Set default preferences (length 20, .etc) on first use of generator, only save preferences when they've been used to generate i.e. Generate pressed
This commit is contained in:
parent
20da17c2d8
commit
32cf7f7813
1 changed files with 8 additions and 8 deletions
|
@ -55,13 +55,9 @@ public class pwgenDialogFragment extends DialogFragment {
|
|||
TextView textView = (TextView) view.findViewById(R.id.lengthNumber);
|
||||
textView.setText(Integer.toString(prefs.getInt("length", 20)));
|
||||
|
||||
textView = (TextView) view.findViewById(R.id.passwordText);
|
||||
textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
|
||||
|
||||
builder.setPositiveButton(getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
pwgenDialogFragment.this.setPreferences();
|
||||
TextView edit = (TextView) pwgenDialogFragment.this.getActivity().findViewById(R.id.crypto_password_edit);
|
||||
TextView generate = (TextView) pwgenDialogFragment.this.getDialog().findViewById(R.id.passwordText);
|
||||
edit.append(generate.getText());
|
||||
|
@ -81,13 +77,17 @@ public class pwgenDialogFragment extends DialogFragment {
|
|||
ad.setOnShowListener(new DialogInterface.OnShowListener() {
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
setPreferences();
|
||||
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) {
|
||||
pwgenDialogFragment.this.setPreferences();
|
||||
TextView textView1 = (TextView) pwgenDialogFragment.this.getDialog().findViewById(R.id.passwordText);
|
||||
textView1.setText(pwgen.generate(pwgenDialogFragment.this.getActivity().getApplicationContext()).get(0));
|
||||
setPreferences();
|
||||
TextView textView = (TextView) getDialog().findViewById(R.id.passwordText);
|
||||
textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue