summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorMatthew Wong <wongma7@outlook.com>2015-08-25 13:47:13 -0400
committerMatthew Wong <wongma7@outlook.com>2015-08-25 13:47:13 -0400
commitdc732cb573288a136a66fd74c0b8a48718907e52 (patch)
treec492d20f24a10e598ee0099de5162d5bfa7743d9 /app/src/main/java
parent327945f3b8aa56f77559a25bc9160dae0a0cc6d2 (diff)
Generated password EditText to TextView + fix generation bug
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgen/pw_rand.java3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java12
2 files changed, 8 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgen/pw_rand.java b/app/src/main/java/com/zeapo/pwdstore/pwgen/pw_rand.java
index 1f4acdec..945aaf71 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgen/pw_rand.java
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgen/pw_rand.java
@@ -19,7 +19,7 @@ public class pw_rand {
* @return the generated password
*/
public static String rand(int size, int pwFlags) {
- String password = "";
+ String password;
char cha;
int i, featureFlags, num;
String val;
@@ -36,6 +36,7 @@ public class pw_rand {
bank += pwgen.SYMBOLS_STR;
}
do {
+ password = "";
featureFlags = pwFlags;
i = 0;
while (i < size) {
diff --git a/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java b/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
index 019396db..7d798a81 100644
--- a/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
+++ b/app/src/main/java/com/zeapo/pwdstore/pwgenDialogFragment.java
@@ -61,13 +61,13 @@ public class pwgenDialogFragment extends DialogFragment {
TextView textView = (TextView) view.findViewById(R.id.lengthNumber);
textView.setText(Integer.toString(prefs.getInt("length", 20)));
- ((EditText) view.findViewById(R.id.passwordText)).setTypeface(monoTypeface);
+ ((TextView) view.findViewById(R.id.passwordText)).setTypeface(monoTypeface);
builder.setPositiveButton(getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
EditText edit = (EditText) callingActivity.findViewById(R.id.crypto_password_edit);
- EditText generate = (EditText) view.findViewById(R.id.passwordText);
+ TextView generate = (TextView) view.findViewById(R.id.passwordText);
edit.append(generate.getText());
}
});
@@ -86,16 +86,16 @@ public class pwgenDialogFragment extends DialogFragment {
@Override
public void onShow(DialogInterface dialog) {
setPreferences();
- EditText editText = (EditText) view.findViewById(R.id.passwordText);
- editText.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
+ TextView textView = (TextView) view.findViewById(R.id.passwordText);
+ textView.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 editText = (EditText) view.findViewById(R.id.passwordText);
- editText.setText(pwgen.generate(callingActivity.getApplicationContext()).get(0));
+ TextView textView = (TextView) view.findViewById(R.id.passwordText);
+ textView.setText(pwgen.generate(callingActivity.getApplicationContext()).get(0));
}
});
}