diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-11-19 14:00:13 +0100 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2015-11-19 14:00:13 +0100 |
commit | 62918c571899855bc4a16a77c9f423ff24c7d036 (patch) | |
tree | cb3e59980f5c63f6c08182c9f23f537e745d19e2 /OpenKeychain/src/main/java/org | |
parent | 4b594e4e753b4dab82dcb151502d4a0ff156e661 (diff) | |
download | open-keychain-62918c571899855bc4a16a77c9f423ff24c7d036.tar.gz open-keychain-62918c571899855bc4a16a77c9f423ff24c7d036.tar.bz2 open-keychain-62918c571899855bc4a16a77c9f423ff24c7d036.zip |
Check if NFC is available before displaying button
Diffstat (limited to 'OpenKeychain/src/main/java/org')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 8 |
1 files changed, 5 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 0184527b7..7b761a52f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -31,6 +31,7 @@ import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.net.Uri; +import android.nfc.NfcAdapter; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -923,10 +924,11 @@ public class ViewKeyActivity extends BaseNfcActivity implements mActionEncryptText.setVisibility(View.VISIBLE); // invokeBeam is available from API 21 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP + && NfcAdapter.getDefaultAdapter(this) != null) { mActionNfc.setVisibility(View.VISIBLE); } else { - mActionNfc.setVisibility(View.GONE); + mActionNfc.setVisibility(View.INVISIBLE); } showFab(); // noinspection deprecation (no getDrawable with theme at current minApi level 15!) @@ -935,7 +937,7 @@ public class ViewKeyActivity extends BaseNfcActivity implements mActionEncryptFile.setVisibility(View.VISIBLE); mActionEncryptText.setVisibility(View.VISIBLE); mQrCodeLayout.setVisibility(View.GONE); - mActionNfc.setVisibility(View.GONE); + mActionNfc.setVisibility(View.INVISIBLE); if (mIsVerified) { mStatusText.setText(R.string.view_key_verified); |