aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-09-16 01:49:42 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-09-16 01:49:42 +0200
commit258e2e9a883c4bf317cda55099efce92b7c1bf08 (patch)
treebee1d965153d6622a920cd58f4de9364e75f75e4 /OpenKeychain
parent0ed0ba88f9ce4647f77a823fdf218ce53b175c48 (diff)
downloadopen-keychain-258e2e9a883c4bf317cda55099efce92b7c1bf08.tar.gz
open-keychain-258e2e9a883c4bf317cda55099efce92b7c1bf08.tar.bz2
open-keychain-258e2e9a883c4bf317cda55099efce92b7c1bf08.zip
multidecrypt: change some method params, prepare for open/share of other outputs
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java45
1 files changed, 16 insertions, 29 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 9cc8a0887..99a38ed16 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptListFragment.java
@@ -57,19 +57,16 @@ import org.openintents.openpgp.OpenPgpMetadata;
import org.openintents.openpgp.OpenPgpSignatureResult;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
-import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
import org.sufficientlysecure.keychain.operations.results.InputDataResult;
import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyInputParcel;
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
-import org.sufficientlysecure.keychain.provider.TemporaryStorageProvider;
-// this import NEEDS to be above the ViewModel one, or it won't compile! (as of 06/06/15)
import org.sufficientlysecure.keychain.service.InputDataParcel;
-import org.sufficientlysecure.keychain.ui.base.QueueingCryptoOperationFragment;
-import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.StatusHolder;
import org.sufficientlysecure.keychain.ui.DecryptListFragment.DecryptFilesAdapter.ViewModel;
import org.sufficientlysecure.keychain.ui.adapter.SpacesItemDecoration;
+import org.sufficientlysecure.keychain.ui.base.QueueingCryptoOperationFragment;
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
+import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils.StatusHolder;
import org.sufficientlysecure.keychain.ui.util.Notify;
import org.sufficientlysecure.keychain.ui.util.Notify.Style;
import org.sufficientlysecure.keychain.util.FileHelper;
@@ -306,17 +303,13 @@ public class DecryptListFragment
InputDataResult result = mInputDataResults.get(uri);
Context context = getActivity();
- if (result.mDecryptVerifyResult.getDecryptionMetadata() == null || context == null) {
- return null;
- }
-
- String type = result.mDecryptVerifyResult.getDecryptionMetadata().getMimeType();
+ OpenPgpMetadata metadata = result.mMetadata.get(0);
Uri outputUri = result.getOutputUris().get(0);
- if (type == null || outputUri == null) {
+ if (metadata == null || context == null || outputUri == null) {
return null;
}
- TemporaryStorageProvider.setMimeType(context, outputUri, type);
+ String type = metadata.getMimeType();
if (ClipDescription.compareMimeTypes(type, "image/*")) {
int px = FormattingUtils.dpToPx(context, 48);
@@ -369,19 +362,14 @@ public class DecryptListFragment
}
- public void displayWithViewIntent(final Uri uri, boolean share) {
+ public void displayWithViewIntent(InputDataResult result, int index, boolean share) {
Activity activity = getActivity();
- if (activity == null || mCurrentInputUri != null) {
- return;
- }
-
- final Uri outputUri = mInputDataResults.get(uri).getOutputUris().get(0);
- final DecryptVerifyResult result = mAdapter.getItemResult(uri).mDecryptVerifyResult;
- if (outputUri == null || result == null) {
+ if (activity == null) {
return;
}
- final OpenPgpMetadata metadata = result.getDecryptionMetadata();
+ Uri outputUri = result.getOutputUris().get(index);
+ OpenPgpMetadata metadata = result.mMetadata.get(index);
// text/plain is a special case where we extract the uri content into
// the EXTRA_TEXT extra ourselves, and display a chooser which includes
@@ -390,7 +378,7 @@ public class DecryptListFragment
if (share) {
try {
- String plaintext = FileHelper.readTextFromUri(activity, outputUri, result.getCharset());
+ String plaintext = FileHelper.readTextFromUri(activity, outputUri, null);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(metadata.getMimeType());
@@ -468,18 +456,17 @@ public class DecryptListFragment
}
ViewModel model = mAdapter.mMenuClickedModel;
- DecryptVerifyResult result = model.mResult.mDecryptVerifyResult;
switch (menuItem.getItemId()) {
case R.id.view_log:
Intent intent = new Intent(activity, LogDisplayActivity.class);
- intent.putExtra(LogDisplayFragment.EXTRA_RESULT, result);
+ intent.putExtra(LogDisplayFragment.EXTRA_RESULT, model.mResult);
activity.startActivity(intent);
return true;
case R.id.decrypt_share:
- displayWithViewIntent(model.mInputUri, true);
+ displayWithViewIntent(model.mResult, 0, true);
return true;
case R.id.decrypt_save:
- OpenPgpMetadata metadata = result.getDecryptionMetadata();
+ OpenPgpMetadata metadata = model.mResult.mDecryptVerifyResult.getDecryptionMetadata();
if (metadata == null) {
return true;
}
@@ -663,7 +650,7 @@ public class DecryptListFragment
KeyFormattingUtils.setStatus(getResources(), holder, model.mResult.mDecryptVerifyResult);
- final OpenPgpMetadata metadata = model.mResult.mDecryptVerifyResult.getDecryptionMetadata();
+ final OpenPgpMetadata metadata = model.mResult.mMetadata.get(0);
String filename;
if (metadata == null) {
@@ -692,8 +679,8 @@ public class DecryptListFragment
holder.vFile.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
- if (model.mResult.success() && model.mResult.mDecryptVerifyResult.getDecryptionMetadata() != null) {
- displayWithViewIntent(model.mInputUri, false);
+ if (model.mResult.success()) {
+ displayWithViewIntent(model.mResult, 0, false);
}
}
});