aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-10-21 22:30:21 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-10-21 22:30:21 +0200
commit7eb9f5d5cfb3e735076ea019013f89ca60ed5804 (patch)
treed29c754eb71599327ce28caec53d7bae26cb9d57 /OpenKeychain/src/main/java/org
parent4e60f1bc75a7727ebc31db4921e5f5f36fe9d184 (diff)
downloadopen-keychain-7eb9f5d5cfb3e735076ea019013f89ca60ed5804.tar.gz
open-keychain-7eb9f5d5cfb3e735076ea019013f89ca60ed5804.tar.bz2
open-keychain-7eb9f5d5cfb3e735076ea019013f89ca60ed5804.zip
decrypt: special case single encrypted text -> directly display text, if not too large
Diffstat (limited to 'OpenKeychain/src/main/java/org')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
index a5f9dc885..c7ad4bd65 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
@@ -322,6 +322,29 @@ public class DecryptListFragment
Uri uri = mCurrentInputUri;
mCurrentInputUri = null;
+ Activity activity = getActivity();
+
+ boolean isSingleInput = mInputDataResults.isEmpty() && mPendingInputUris.isEmpty();
+ if (isSingleInput) {
+
+ // there is always at least one mMetadata object, so we know this is >= 1 already
+ boolean isSingleMetadata = result.mMetadata.size() == 1;
+ OpenPgpMetadata metadata = result.mMetadata.get(0);
+ boolean isText = "text/plain".equals(metadata.getMimeType());
+ boolean isOverSized = metadata.getOriginalSize() > Constants.TEXT_LENGTH_LIMIT;
+
+ if (isSingleMetadata && isText && !isOverSized) {
+ Intent displayTextIntent = new Intent(activity, DisplayTextActivity.class)
+ .setDataAndType(result.mOutputUris.get(0), "text/plain")
+ .putExtra(DisplayTextActivity.EXTRA_RESULT, result.mDecryptVerifyResult)
+ .putExtra(DisplayTextActivity.EXTRA_METADATA, metadata);
+ activity.startActivity(displayTextIntent);
+ activity.finish();
+ return;
+ }
+
+ }
+
mInputDataResults.put(uri, result);
processResult(uri);