diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java | 28 | ||||
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/BaseNfcActivity.java | 4 |
2 files changed, 26 insertions, 6 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java index fbe7b4066..505638c7c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui; import android.content.Intent; +import android.nfc.NfcAdapter; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; @@ -62,6 +63,23 @@ public class CreateKeyActivity extends BaseNfcActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // React on NDEF_DISCOVERED from Manifest + // NOTE: ACTION_NDEF_DISCOVERED and not ACTION_TAG_DISCOVERED like in BaseNfcActivity + if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { + try { + handleTagDiscoveredIntent(getIntent()); + } catch (CardException e) { + handleNfcError(e); + } catch (IOException e) { + handleNfcError(e); + } + + setTitle(R.string.title_manage_my_keys); + + // done + return; + } + // Check whether we're recreating a previously destroyed instance if (savedInstanceState != null) { // Restore value of members from saved state @@ -96,14 +114,16 @@ public class CreateKeyActivity extends BaseNfcActivity { } else { Fragment frag = CreateKeyYubiKeyBlankFragment.newInstance(); loadFragment(frag, FragAction.START); + setTitle(R.string.title_manage_my_keys); } + + // done return; - } else { - // normal key creation - CreateKeyStartFragment frag = CreateKeyStartFragment.newInstance(); - loadFragment(frag, FragAction.START); } + // normal key creation + CreateKeyStartFragment frag = CreateKeyStartFragment.newInstance(); + loadFragment(frag, FragAction.START); } if (mFirstTime) { 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 cb250d28c..bede16b2a 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 @@ -94,7 +94,7 @@ public abstract class BaseNfcActivity extends BaseActivity { public void onNewIntent(Intent intent) { if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { try { - handleNdefDiscoveredIntent(intent); + handleTagDiscoveredIntent(intent); } catch (CardException e) { handleNfcError(e); } catch (IOException e) { @@ -278,7 +278,7 @@ public abstract class BaseNfcActivity extends BaseActivity { * on ISO SmartCard Systems specification. * */ - protected void handleNdefDiscoveredIntent(Intent intent) throws IOException { + protected void handleTagDiscoveredIntent(Intent intent) throws IOException { Tag detectedTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); |