aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java1
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java21
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml1
3 files changed, 23 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
index 1398e2d29..7747ecb43 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/Constants.java
@@ -149,6 +149,7 @@ public final class Constants {
public static final class key {
public static final int none = 0;
public static final int symmetric = -1;
+ public static final int backup_code = -2;
}
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java
index e71349880..a44acc926 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/PassphraseDialogActivity.java
@@ -117,6 +117,10 @@ public class PassphraseDialogActivity extends FragmentActivity {
mSubKeyId = Constants.key.symmetric;
break;
}
+ case BACKUP_CODE: {
+ mSubKeyId = Constants.key.backup_code;
+ break;
+ }
case PASSPHRASE: {
// handle empty passphrases by directly returning an empty crypto input parcel
@@ -208,6 +212,17 @@ public class PassphraseDialogActivity extends FragmentActivity {
// No title, see http://www.google.com/design/spec/components/dialogs.html#dialogs-alerts
//alert.setTitle()
+ if (mSubKeyId == Constants.key.backup_code) {
+ LayoutInflater inflater = LayoutInflater.from(theme);
+ View view = inflater.inflate(R.layout.passphrase_dialog_backup_code, null);
+ alert.setView(view);
+
+ AlertDialog dialog = alert.create();
+ dialog.setButton(DialogInterface.BUTTON_POSITIVE,
+ activity.getString(R.string.btn_unlock), (DialogInterface.OnClickListener) null);
+ return dialog;
+ }
+
LayoutInflater inflater = LayoutInflater.from(theme);
View view = inflater.inflate(R.layout.passphrase_dialog, null);
alert.setView(view);
@@ -229,8 +244,10 @@ public class PassphraseDialogActivity extends FragmentActivity {
CanonicalizedSecretKey.SecretKeyType keyType = CanonicalizedSecretKey.SecretKeyType.PASSPHRASE;
String message;
+ String hint;
if (mSubKeyId == Constants.key.symmetric || mSubKeyId == Constants.key.none) {
message = getString(R.string.passphrase_for_symmetric_encryption);
+ hint = getString(R.string.label_passphrase);
} else {
try {
ProviderHelper helper = new ProviderHelper(activity);
@@ -255,12 +272,15 @@ public class PassphraseDialogActivity extends FragmentActivity {
switch (keyType) {
case PASSPHRASE:
message = getString(R.string.passphrase_for, userId);
+ hint = getString(R.string.label_passphrase);
break;
case PIN:
message = getString(R.string.pin_for, userId);
+ hint = getString(R.string.label_pin);
break;
case DIVERT_TO_CARD:
message = getString(R.string.yubikey_pin_for, userId);
+ hint = getString(R.string.label_pin);
break;
// special case: empty passphrase just returns the empty passphrase
case PASSPHRASE_EMPTY:
@@ -283,6 +303,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
}
mPassphraseText.setText(message);
+ mPassphraseEditText.setHint(hint);
// Hack to open keyboard.
// This is the only method that I found to work across all Android versions
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index be8eb1706..7c63a2a96 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -132,6 +132,7 @@
<string name="label_file_colon">"File:"</string>
<string name="label_no_passphrase">"No Password"</string>
<string name="label_passphrase">"Password"</string>
+ <string name="label_pin">"PIN"</string>
<string name="label_unlock">"Unlocking…"</string>
<string name="label_passphrase_again">"Repeat Password"</string>
<string name="label_show_passphrase">"Show Password"</string>