Undo lambda-ing

This commit is contained in:
Matthew Wong 2015-07-11 12:31:09 -04:00
parent 5c46fea58d
commit 20da17c2d8

View file

@ -58,27 +58,39 @@ public class pwgenDialogFragment extends DialogFragment {
textView = (TextView) view.findViewById(R.id.passwordText); textView = (TextView) view.findViewById(R.id.passwordText);
textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0)); textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
builder.setPositiveButton(getResources().getString(R.string.dialog_ok), (dialog, which) -> { builder.setPositiveButton(getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
setPreferences(); @Override
TextView edit = (TextView) getActivity().findViewById(R.id.crypto_password_edit); public void onClick(DialogInterface dialog, int which) {
TextView generate = (TextView) getDialog().findViewById(R.id.passwordText); pwgenDialogFragment.this.setPreferences();
edit.append(generate.getText()); 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());
}
}); });
builder.setNegativeButton(getResources().getString(R.string.dialog_cancel), (dialog, which) -> { builder.setNegativeButton(getResources().getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}); });
builder.setNeutralButton(getResources().getString(R.string.pwgen_generate), null); builder.setNeutralButton(getResources().getString(R.string.pwgen_generate), null);
final AlertDialog ad = builder.setTitle("Generate Password").create(); final AlertDialog ad = builder.setTitle("Generate Password").create();
ad.setOnShowListener(dialog -> { ad.setOnShowListener(new DialogInterface.OnShowListener() {
Button b = ad.getButton(AlertDialog.BUTTON_NEUTRAL); @Override
b.setOnClickListener(v -> { public void onShow(DialogInterface dialog) {
setPreferences(); Button b = ad.getButton(AlertDialog.BUTTON_NEUTRAL);
TextView textView1 = (TextView) getDialog().findViewById(R.id.passwordText); b.setOnClickListener(new View.OnClickListener() {
textView1.setText(pwgen.generate(getActivity().getApplicationContext()).get(0)); @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));
}
});
}
}); });
return ad; return ad;
} }