diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-06 23:39:26 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-06-06 23:40:22 +0200 |
commit | b779211f55a126d54c643fb9f13a0a17b46c37bf (patch) | |
tree | a526af2e5d385691c20393560443e17f9a61201a /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java | |
parent | fa614383065a22269c5ca249819c46b82e20a194 (diff) | |
parent | 7cfc0d80d0b4318ce1ae027536d70c2cda4c8605 (diff) | |
download | open-keychain-b779211f55a126d54c643fb9f13a0a17b46c37bf.tar.gz open-keychain-b779211f55a126d54c643fb9f13a0a17b46c37bf.tar.bz2 open-keychain-b779211f55a126d54c643fb9f13a0a17b46c37bf.zip |
Merge branch 'master' into v/multi-decrypt
this also fixes weird-bug
Conflicts:
OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java
OpenKeychain/src/main/res/values/strings.xml
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java | 80 |
1 files changed, 29 insertions, 51 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index d02030cbf..5251f5949 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -35,11 +35,9 @@ import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; import org.sufficientlysecure.keychain.operations.results.OperationResult; -import org.sufficientlysecure.keychain.service.KeychainIntentService; +import org.sufficientlysecure.keychain.service.KeychainService; import org.sufficientlysecure.keychain.ui.base.BaseNfcActivity; -import org.sufficientlysecure.keychain.service.CloudImportService; import org.sufficientlysecure.keychain.service.ServiceProgressHandler; -import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.util.Log; @@ -383,7 +381,6 @@ public class ImportKeysActivity extends BaseNfcActivity { * Import keys with mImportData */ public void importKeys() { - ImportKeysListFragment.LoaderState ls = mListFragment.getLoaderState(); if (mListFragment.getSelectedEntries().size() == 0) { Notify.create(this, R.string.error_nothing_import_selected, Notify.Style.ERROR) @@ -391,31 +388,32 @@ public class ImportKeysActivity extends BaseNfcActivity { return; } - if (ls instanceof ImportKeysListFragment.BytesLoaderState) { - Log.d(Constants.TAG, "importKeys started"); + ServiceProgressHandler serviceHandler = new ServiceProgressHandler( + this, + getString(R.string.progress_importing), + ProgressDialog.STYLE_HORIZONTAL, + true + ) { + @Override + public void handleMessage(Message message) { + // handle messages by standard KeychainIntentServiceHandler first + super.handleMessage(message); - ServiceProgressHandler serviceHandler = new ServiceProgressHandler( - this, - getString(R.string.progress_importing), - ProgressDialog.STYLE_HORIZONTAL, - true, - ProgressDialogFragment.ServiceType.KEYCHAIN_INTENT) { - public void handleMessage(Message message) { - // handle messages by standard KeychainIntentServiceHandler first - super.handleMessage(message); - - ImportKeysActivity.this.handleMessage(message); - } - }; + ImportKeysActivity.this.handleMessage(message); + } + }; + + // Send all information needed to service to import key in other thread + Intent intent = new Intent(this, KeychainService.class); - // TODO: Currently not using CloudImport here due to https://github.com/open-keychain/open-keychain/issues/1221 - // Send all information needed to service to import key in other thread - Intent intent = new Intent(this, KeychainIntentService.class); + intent.setAction(KeychainService.ACTION_IMPORT_KEYRING); - intent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING); + // fill values for this action + Bundle data = new Bundle(); - // fill values for this action - Bundle data = new Bundle(); + ImportKeysListFragment.LoaderState ls = mListFragment.getLoaderState(); + if (ls instanceof ImportKeysListFragment.BytesLoaderState) { + Log.d(Constants.TAG, "importKeys started"); // get DATA from selected key entries IteratorWithSize<ParcelableKeyRing> selectedEntries = mListFragment.getSelectedData(); @@ -430,11 +428,11 @@ public class ImportKeysActivity extends BaseNfcActivity { new ParcelableFileCache<>(this, "key_import.pcl"); cache.writeCache(selectedEntries); - intent.putExtra(KeychainIntentService.EXTRA_DATA, data); + intent.putExtra(KeychainService.EXTRA_DATA, data); // Create a new Messenger for the communication back Messenger messenger = new Messenger(serviceHandler); - intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger); + intent.putExtra(KeychainService.EXTRA_MESSENGER, messenger); // show progress dialog serviceHandler.showProgressDialog(this); @@ -449,27 +447,7 @@ public class ImportKeysActivity extends BaseNfcActivity { } else if (ls instanceof ImportKeysListFragment.CloudLoaderState) { ImportKeysListFragment.CloudLoaderState sls = (ImportKeysListFragment.CloudLoaderState) ls; - ServiceProgressHandler serviceHandler = new ServiceProgressHandler( - this, - getString(R.string.progress_importing), - ProgressDialog.STYLE_HORIZONTAL, - true, - ProgressDialogFragment.ServiceType.CLOUD_IMPORT) { - public void handleMessage(Message message) { - // handle messages by standard KeychainIntentServiceHandler first - super.handleMessage(message); - - ImportKeysActivity.this.handleMessage(message); - } - }; - - // Send all information needed to service to query keys in other thread - Intent intent = new Intent(this, CloudImportService.class); - - // fill values for this action - Bundle data = new Bundle(); - - data.putString(CloudImportService.IMPORT_KEY_SERVER, sls.mCloudPrefs.keyserver); + data.putString(KeychainService.IMPORT_KEY_SERVER, sls.mCloudPrefs.keyserver); // get selected key entries ArrayList<ParcelableKeyRing> keys = new ArrayList<>(); @@ -482,13 +460,13 @@ public class ImportKeysActivity extends BaseNfcActivity { ); } } - data.putParcelableArrayList(CloudImportService.IMPORT_KEY_LIST, keys); + data.putParcelableArrayList(KeychainService.IMPORT_KEY_LIST, keys); - intent.putExtra(CloudImportService.EXTRA_DATA, data); + intent.putExtra(KeychainService.EXTRA_DATA, data); // Create a new Messenger for the communication back Messenger messenger = new Messenger(serviceHandler); - intent.putExtra(CloudImportService.EXTRA_MESSENGER, messenger); + intent.putExtra(KeychainService.EXTRA_MESSENGER, messenger); // show progress dialog serviceHandler.showProgressDialog(this); |