From b9dc21969faa7c4cd7b10638a629690d0df20cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 3 Oct 2014 02:17:51 +0200 Subject: Fix nullpointer with clipboard --- .../org/sufficientlysecure/keychain/ui/DecryptActivity.java | 13 ++++++------- .../sufficientlysecure/keychain/ui/DecryptTextActivity.java | 6 +++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index ac58c63dc..5e23a24ae 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -76,20 +76,19 @@ public class DecryptActivity extends DrawerActivity { if (Build.VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) { // get text from clipboard - final String clipboardText = - ClipboardReflection.getClipboardText(DecryptActivity.this).toString(); + final CharSequence clipboardText = ClipboardReflection.getClipboardText(DecryptActivity.this); - AsyncTask tadaTask = new AsyncTask() { + AsyncTask tadaTask = new AsyncTask() { @Override - protected Boolean doInBackground(Void... params) { + protected Boolean doInBackground(String... clipboardText) { // see if it looks like a pgp thing - Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(clipboardText); + Matcher matcher = PgpHelper.PGP_MESSAGE.matcher(clipboardText[0]); boolean animate = matcher.matches(); // see if it looks like another pgp thing if (!animate) { - matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(clipboardText); + matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(clipboardText[0]); animate = matcher.matches(); } return animate; @@ -107,7 +106,7 @@ public class DecryptActivity extends DrawerActivity { }; if (clipboardText != null) { - tadaTask.execute(); + tadaTask.execute(clipboardText.toString()); } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java index 8d489b3d4..73163eabd 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java @@ -156,11 +156,11 @@ public class DecryptTextActivity extends ActionBarActivity { } else if (ACTION_DECRYPT_FROM_CLIPBOARD.equals(action)) { Log.d(Constants.TAG, "ACTION_DECRYPT_FROM_CLIPBOARD"); - String clipboardText = ClipboardReflection.getClipboardText(this).toString(); - clipboardText = getPgpContent(clipboardText); + CharSequence clipboardText = ClipboardReflection.getClipboardText(this); if (clipboardText != null) { - loadFragment(savedInstanceState, clipboardText); + String text = getPgpContent(clipboardText.toString()); + loadFragment(savedInstanceState, text); } else { returnInvalidResult(); } -- cgit v1.2.3 From 2c22a4c2f6d172d6f81f7305d475d3079c350c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 3 Oct 2014 02:28:01 +0200 Subject: Update safeslinger lib --- extern/safeslinger-exchange | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/safeslinger-exchange b/extern/safeslinger-exchange index d58461492..5c48b928d 160000 --- a/extern/safeslinger-exchange +++ b/extern/safeslinger-exchange @@ -1 +1 @@ -Subproject commit d584614921600fabe2043d16acfefd55d4c00c8a +Subproject commit 5c48b928d0f250a9121a74690da86162467cc956 -- cgit v1.2.3 From 4cfc7feb430c984e5341d1bed7cd2fba499ebfa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 3 Oct 2014 03:16:34 +0200 Subject: More beautifyKeyIdWithPrefix --- .../main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java | 3 +-- .../sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java index 31a307194..6f521efa2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFragment.java @@ -122,8 +122,7 @@ public abstract class DecryptFragment extends Fragment { if (userIdSplit[1] != null) { mUserIdRest.setText(userIdSplit[1]); } else { - mUserIdRest.setText(getString(R.string.label_key_id) + ": " - + KeyFormattingUtils.convertKeyIdToHex(mSignatureKeyId)); + mUserIdRest.setText(KeyFormattingUtils.beautifyKeyIdWithPrefix(getActivity(), mSignatureKeyId)); } switch (signatureResult.getStatus()) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index 53e4e0fd6..6947fc1ff 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -128,7 +128,7 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { } long masterKeyId = cursor.getLong(mIndexMasterKeyId); - h.keyId.setText(KeyFormattingUtils.convertKeyIdToHex(masterKeyId)); + h.keyId.setText(KeyFormattingUtils.beautifyKeyIdWithPrefix(mContext, masterKeyId)); boolean enabled = true; if (cursor.getInt(mIndexRevoked) != 0) { -- cgit v1.2.3