Generated password EditText to TextView + fix generation bug
This commit is contained in:
parent
327945f3b8
commit
dc732cb573
3 changed files with 11 additions and 11 deletions
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,14 +14,13 @@
|
|||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context=".MainActivityFragment">
|
||||
|
||||
<EditText
|
||||
<TextView
|
||||
android:id="@+id/passwordText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:editable="false"
|
||||
android:textIsSelectable="true"
|
||||
android:inputType="textVisiblePassword"/>
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue