show more generic "Enter password" if asking for multiple

This commit is contained in:
Vincent Breitmoser
2017-11-23 22:23:43 +01:00
parent 04efa9e66d
commit 3bfb04f990
2 changed files with 37 additions and 31 deletions

View File

@@ -232,7 +232,12 @@ public class PassphraseDialogActivity extends FragmentActivity {
hint = getString(R.string.label_passphrase); hint = getString(R.string.label_passphrase);
} else { } else {
try { try {
long subKeyId = mRequiredInput.getSubKeyId(); long[] subKeyIds = mRequiredInput.getSubKeyIds();
if (subKeyIds.length > 1) {
message = getString(R.string.passphrase_for_any);
hint = getString(R.string.label_passphrase);
} else {
long subKeyId = subKeyIds[0];
KeyRepository helper = KeyRepository helper =
KeyRepository.create(getContext()); KeyRepository.create(getContext());
@@ -265,7 +270,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
default: default:
throw new AssertionError("Unhandled SecretKeyType (should not happen)"); throw new AssertionError("Unhandled SecretKeyType (should not happen)");
} }
}
} catch (PgpKeyNotFoundException | KeyRepository.NotFoundException e) { } catch (PgpKeyNotFoundException | KeyRepository.NotFoundException e) {
alert.setTitle(R.string.title_key_not_found); alert.setTitle(R.string.title_key_not_found);
alert.setMessage(getString(R.string.key_not_found, mRequiredInput.getSubKeyId())); alert.setMessage(getString(R.string.key_not_found, mRequiredInput.getSubKeyId()));

View File

@@ -332,6 +332,7 @@
<string name="passphrase_for_symmetric_encryption">"Enter password"</string> <string name="passphrase_for_symmetric_encryption">"Enter password"</string>
<string name="passphrase_for_backup">"Enter backup code"</string> <string name="passphrase_for_backup">"Enter backup code"</string>
<string name="passphrase_for">"Enter password for '%s'"</string> <string name="passphrase_for">"Enter password for '%s'"</string>
<string name="passphrase_for_any">"Enter password"</string>
<string name="passphrase_keyboard_hint_alpha">"Switch to alphabetic keyboard"</string> <string name="passphrase_keyboard_hint_alpha">"Switch to alphabetic keyboard"</string>
<string name="passphrase_keyboard_hint_numeric">"Switch to numeric keyboard"</string> <string name="passphrase_keyboard_hint_numeric">"Switch to numeric keyboard"</string>
<string name="pin_for">"Enter PIN for '%s'"</string> <string name="pin_for">"Enter PIN for '%s'"</string>