diff options
author | Matthew Wong <wongma@protonmail.ch> | 2015-07-18 16:04:23 -0400 |
---|---|---|
committer | Matthew Wong <wongma@protonmail.ch> | 2015-07-18 16:04:23 -0400 |
commit | dcf66672fe26c2b5103c4c1bc38ca0a1b84bc7e0 (patch) | |
tree | 6fc9ba93543be9850e9bd7a2982713553462b022 | |
parent | 01b7b2102dd40ed2bdbad3eefd91a4ed03d10a73 (diff) |
v.find vs getDialog.find consistency and fix more textview/edittext
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java | 2 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java index 000e08e7..c12b2298 100644 --- a/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java +++ b/app/src/main/java/com/zeapo/pwdstore/SshKeyGen.java @@ -123,7 +123,7 @@ public class SshKeyGen extends AppCompatActivity { b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - TextView textView = (TextView) getDialog().findViewById(R.id.public_key); + TextView textView = (TextView) v.findViewById(R.id.public_key); ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("public key", textView.getText().toString()); clipboard.setPrimaryClip(clip); diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java b/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java index 1a42e2ba..019396db 100644 --- a/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java +++ b/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java @@ -86,16 +86,16 @@ public class pwgenDialogFragment extends DialogFragment { @Override public void onShow(DialogInterface dialog) { setPreferences(); - EditText textView = (EditText) view.findViewById(R.id.passwordText); - textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0)); + EditText editText = (EditText) view.findViewById(R.id.passwordText); + editText.setText(pwgen.generate(getActivity().getApplicationContext()).get(0)); Button b = ad.getButton(AlertDialog.BUTTON_NEUTRAL); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { setPreferences(); - EditText textView = (EditText) getDialog().findViewById(R.id.passwordText); - textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0)); + EditText editText = (EditText) view.findViewById(R.id.passwordText); + editText.setText(pwgen.generate(callingActivity.getApplicationContext()).get(0)); } }); } @@ -120,9 +120,9 @@ public class pwgenDialogFragment extends DialogFragment { if (!((CheckBox) getDialog().findViewById(R.id.pronounceable)).isChecked()) { preferences.add("s"); } - EditText textView = (EditText) getDialog().findViewById(R.id.lengthNumber); + EditText editText = (EditText) getDialog().findViewById(R.id.lengthNumber); try { - int length = Integer.valueOf(textView.getText().toString()); + int length = Integer.valueOf(editText.getText().toString()); return pwgen.setPrefs(getActivity().getApplicationContext(), preferences, length); } catch(NumberFormatException e) { return pwgen.setPrefs(getActivity().getApplicationContext(), preferences); |