Back to project page KeepMySecret.
The source code is released under:
GNU General Public License
If you think the Android project KeepMySecret listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package keepmysecretapp.app.com.keepmysecretapp.fragments.dialogs; // ww w .j a v a2s . co m import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import android.widget.EditText; import keepmysecretapp.app.com.keepmysecretapp.R; import keepmysecretapp.app.com.keepmysecretapp.fragments.other.SideLogic; public class GeneratePasswordDialog extends DialogFragment { private static EditText fieldToFill; public static GeneratePasswordDialog newInstance(EditText fieldToFill) { GeneratePasswordDialog.fieldToFill = fieldToFill; return new GeneratePasswordDialog(); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle("???????? ???????????").setItems(R.array.password_generation_difficult_strings, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: fieldToFill.setText(SideLogic.generatePassword( SideLogic.PasswordDifficult.EASY)); break; case 1: fieldToFill.setText(SideLogic.generatePassword( SideLogic.PasswordDifficult.MIDDLE)); break; case 2: fieldToFill.setText(SideLogic.generatePassword( SideLogic.PasswordDifficult.HARD)); break; } } }); return builder.create(); } }