diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-03-23 01:09:39 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-03-23 01:09:39 +0100 |
commit | 3bb194fc080e5945dc8bdbeea9b91cf801406c32 (patch) | |
tree | 65a42f883267c23171855db9a2875a248b47c6b7 | |
parent | 5227b45af8e86484f6cedb0fd67c591d065d2361 (diff) | |
download | open-keychain-3bb194fc080e5945dc8bdbeea9b91cf801406c32.tar.gz open-keychain-3bb194fc080e5945dc8bdbeea9b91cf801406c32.tar.bz2 open-keychain-3bb194fc080e5945dc8bdbeea9b91cf801406c32.zip |
nicer handling of nfc errors
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java | 13 | ||||
-rw-r--r-- | OpenKeychain/src/main/res/values/strings.xml | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java index 2c2cb6067..365d32918 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java @@ -28,7 +28,6 @@ import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity; import org.sufficientlysecure.keychain.ui.ViewKeyActivity; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.Notify; -import org.sufficientlysecure.keychain.ui.util.Notify.ActionListener; import org.sufficientlysecure.keychain.ui.util.Notify.Style; import org.sufficientlysecure.keychain.util.Iso7816TLV; import org.sufficientlysecure.keychain.util.Log; @@ -68,14 +67,18 @@ public abstract class BaseNfcActivity extends BaseActivity { try { handleNdefDiscoveredIntent(intent); } catch (IOException e) { - Log.e(Constants.TAG, "Connection error!", e); - toast("Connection Error: " + e.getMessage()); - setResult(RESULT_CANCELED); - finish(); + handleNfcError(e); } } } + public void handleNfcError(IOException e) { + + Log.e(Constants.TAG, "nfc error", e); + Notify.create(this, getString(R.string.error_nfc, e.getMessage()), Style.WARN).show(); + + } + /** * Called when the system is about to start resuming a previous activity, * disables NFC Foreground Dispatch diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 6aefbc7f5..402dcdf7c 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -1278,5 +1278,6 @@ <string name="yubikey_status_partly">"Yubikey matches, partly bound to key"</string> <string name="btn_import">"Import"</string> <string name="snack_yubi_other">Different key stored on Yubikey!</string> + <string name="error_nfc">"NFC Error: %s"</string> </resources> |