diff options
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index c94b29bac..b25f6bbf2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -25,6 +25,7 @@ import android.annotation.TargetApi; import android.app.Activity; import android.app.ActivityOptions; import android.content.Intent; +import android.content.pm.PackageManager; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; @@ -72,6 +73,7 @@ import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; +import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler.MessageStatus; import org.sufficientlysecure.keychain.ui.util.FormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.State; @@ -373,6 +375,11 @@ public class ViewKeyActivity extends BaseActivity implements @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void invokeNfcBeam() { + // Check if device supports NFC + if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) { + Notify.createNotify(this, R.string.no_nfc_support, Notify.LENGTH_LONG, Notify.Style.ERROR).show(); + return; + } // Check for available NFC Adapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null || !mNfcAdapter.isEnabled()) { @@ -429,7 +436,7 @@ public class ViewKeyActivity extends BaseActivity implements // handle messages by standard KeychainIntentServiceHandler first super.handleMessage(message); - if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { + if (message.arg1 == MessageStatus.OKAY.ordinal()) { Bundle data = message.getData(); CertifyResult result = data.getParcelable(CertifyResult.EXTRA_RESULT); @@ -486,7 +493,7 @@ public class ViewKeyActivity extends BaseActivity implements Handler returnHandler = new Handler() { @Override public void handleMessage(Message message) { - if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { + if (message.arg1 == MessageStatus.OKAY.ordinal()) { setResult(RESULT_CANCELED); finish(); } @@ -595,7 +602,7 @@ public class ViewKeyActivity extends BaseActivity implements // handle messages by standard KeychainIntentServiceHandler first super.handleMessage(message); - if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { + if (message.arg1 == MessageStatus.OKAY.ordinal()) { // get returned data bundle Bundle returnData = message.getData(); |