From 17301be2cae4742f6ff508f984730a4d44e0a66a Mon Sep 17 00:00:00 2001 From: danielnelz Date: Mon, 9 Mar 2015 20:09:05 +0100 Subject: Created enum MessageStatus in KeychainIntentServiceHandler and enum IOType in KeychainIntentService and replaced int constants with them. Fixed some typos. --- .../java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java') 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..56c60506a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -72,6 +72,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; @@ -429,7 +430,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 +487,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 +596,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(); -- cgit v1.2.3 From 471f92a9677acdd235b0a3627dc2413b58973557 Mon Sep 17 00:00:00 2001 From: Raoul Date: Tue, 10 Mar 2015 22:06:17 -0400 Subject: Check if NFC is available on device --- .../java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java') 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..637496c61 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; @@ -373,6 +374,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)) { + Toast.makeText(this, R.string.no_nfc_support, Toast.LENGTH_SHORT).show(); + return; + } // Check for available NFC Adapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null || !mNfcAdapter.isEnabled()) { -- cgit v1.2.3 From 27027b8ee55dd0245632bca6b647477d810ce077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 12 Mar 2015 13:39:20 +0100 Subject: Use notify instead of Toast for NFC check --- .../main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java') 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 5ba9a95c6..b25f6bbf2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -375,9 +375,9 @@ public class ViewKeyActivity extends BaseActivity implements @TargetApi(Build.VERSION_CODES.LOLLIPOP) private void invokeNfcBeam() { - //Check if device supports NFC + // Check if device supports NFC if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC)) { - Toast.makeText(this, R.string.no_nfc_support, Toast.LENGTH_SHORT).show(); + Notify.createNotify(this, R.string.no_nfc_support, Notify.LENGTH_LONG, Notify.Style.ERROR).show(); return; } // Check for available NFC Adapter -- cgit v1.2.3