Use string resources
This commit is contained in:
parent
9b61c69913
commit
5c46fea58d
3 changed files with 29 additions and 32 deletions
|
@ -50,46 +50,35 @@ public class pwgenDialogFragment extends DialogFragment {
|
||||||
checkBox.setChecked(!prefs.getBoolean("B", false));
|
checkBox.setChecked(!prefs.getBoolean("B", false));
|
||||||
|
|
||||||
checkBox = (CheckBox) view.findViewById(R.id.pronounceable);
|
checkBox = (CheckBox) view.findViewById(R.id.pronounceable);
|
||||||
checkBox.setChecked(!prefs.getBoolean("s", false));
|
checkBox.setChecked(!prefs.getBoolean("s", true));
|
||||||
|
|
||||||
TextView textView = (TextView) view.findViewById(R.id.lengthNumber);
|
TextView textView = (TextView) view.findViewById(R.id.lengthNumber);
|
||||||
textView.setText(Integer.toString(prefs.getInt("length", 8)));
|
textView.setText(Integer.toString(prefs.getInt("length", 20)));
|
||||||
|
|
||||||
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("OK", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(getResources().getString(R.string.dialog_ok), (dialog, which) -> {
|
||||||
@Override
|
setPreferences();
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
TextView edit = (TextView) getActivity().findViewById(R.id.crypto_password_edit);
|
||||||
TextView edit = (TextView) getActivity().findViewById(R.id.crypto_password_edit);
|
TextView generate = (TextView) getDialog().findViewById(R.id.passwordText);
|
||||||
TextView generate = (TextView) getDialog().findViewById(R.id.passwordText);
|
edit.append(generate.getText());
|
||||||
edit.append(generate.getText());
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
|
builder.setNegativeButton(getResources().getString(R.string.dialog_cancel), (dialog, which) -> {
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.setNeutralButton("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(new DialogInterface.OnShowListener() {
|
ad.setOnShowListener(dialog -> {
|
||||||
@Override
|
Button b = ad.getButton(AlertDialog.BUTTON_NEUTRAL);
|
||||||
public void onShow(DialogInterface dialog) {
|
b.setOnClickListener(v -> {
|
||||||
Button b = ad.getButton(AlertDialog.BUTTON_NEUTRAL);
|
setPreferences();
|
||||||
b.setOnClickListener(new View.OnClickListener() {
|
TextView textView1 = (TextView) getDialog().findViewById(R.id.passwordText);
|
||||||
@Override
|
textView1.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
|
||||||
public void onClick(View v) {
|
});
|
||||||
setPreferences();
|
|
||||||
TextView textView = (TextView) getDialog().findViewById(R.id.passwordText);
|
|
||||||
textView.setText(pwgen.generate(getActivity().getApplicationContext()).get(0));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return ad;
|
return ad;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
android:id="@+id/include"
|
android:id="@+id/include"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Include"
|
android:text="@string/pwgen_include"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:layout_marginBottom="8dp"/>
|
android:layout_marginBottom="8dp"/>
|
||||||
|
|
||||||
|
@ -47,26 +47,26 @@
|
||||||
android:id="@+id/numerals"
|
android:id="@+id/numerals"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Numerals"/>
|
android:text="@string/pwgen_numerals"/>
|
||||||
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/symbols"
|
android:id="@+id/symbols"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Symbols"/>
|
android:text="@string/pwgen_symbols"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/uppercase"
|
android:id="@+id/uppercase"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Uppercase"/>
|
android:text="@string/pwgen_uppercase"/>
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/ambiguous"
|
android:id="@+id/ambiguous"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Ambiguous"/>
|
android:text="@string/pwgen_ambiguous"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,14 @@
|
||||||
<string name="pref_recursive_filter">Recursive filtering</string>
|
<string name="pref_recursive_filter">Recursive filtering</string>
|
||||||
<string name="pref_recursive_filter_hint">Recursively find passwords of the current directory.</string>
|
<string name="pref_recursive_filter_hint">Recursively find passwords of the current directory.</string>
|
||||||
|
|
||||||
|
<!-- pwgen fragment -->
|
||||||
|
<string name="pwgen_generate">Generate</string>
|
||||||
|
<string name="pwgen_include">Include</string>
|
||||||
|
<string name="pwgen_numerals">Numerals</string>
|
||||||
|
<string name="pwgen_symbols">Symbols</string>
|
||||||
|
<string name="pwgen_uppercase">Uppercase</string>
|
||||||
|
<string name="pwgen_ambiguous">Ambiguous</string>
|
||||||
|
|
||||||
<!-- Misc -->
|
<!-- Misc -->
|
||||||
<string name="dialog_ok">OK</string>
|
<string name="dialog_ok">OK</string>
|
||||||
<string name="dialog_yes">Yes</string>
|
<string name="dialog_yes">Yes</string>
|
||||||
|
|
Loading…
Reference in a new issue