aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-01-31 18:16:06 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2014-01-31 18:16:06 +0100
commit34d791c9bdddd189e61bdf7e71773fe5c68832cc (patch)
treef4ac6343f21b23d810abd51fc685732cbe3f5a5f /OpenPGP-Keychain
parentd8a91f15df2b00a4fa175b0e5444daad06ad66c7 (diff)
downloadopen-keychain-34d791c9bdddd189e61bdf7e71773fe5c68832cc.tar.gz
open-keychain-34d791c9bdddd189e61bdf7e71773fe5c68832cc.tar.bz2
open-keychain-34d791c9bdddd189e61bdf7e71773fe5c68832cc.zip
Allow state loss on dismissal of progress dialogs, fixes #217
Diffstat (limited to 'OpenPGP-Keychain')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java4
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java48
2 files changed, 28 insertions, 24 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java
index 170b946d2..5a338c757 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java
@@ -69,12 +69,12 @@ public class KeychainIntentServiceHandler extends Handler {
switch (message.arg1) {
case MESSAGE_OKAY:
- mProgressDialogFragment.dismiss();
+ mProgressDialogFragment.dismissAllowingStateLoss();
break;
case MESSAGE_EXCEPTION:
- mProgressDialogFragment.dismiss();
+ mProgressDialogFragment.dismissAllowingStateLoss();
// show error from service
if (data.containsKey(DATA_ERROR)) {
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
index 1f9605fb1..3175d79a4 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
@@ -326,28 +326,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
.BytesToPGPKeyRing(data
.getByteArray(KeychainIntentService.RESULT_NEW_KEY));
- boolean isMasterKey = (mEditors.getChildCount() == 0);
-
- // take only the key from this ring
- PGPSecretKey newKey = null;
- @SuppressWarnings("unchecked")
- Iterator<PGPSecretKey> it = newKeyRing.getSecretKeys();
-
- if (isMasterKey) {
- newKey = it.next();
- } else {
- // first one is the master key
- it.next();
- newKey = it.next();
- }
-
- // add view with new key
- KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
- mEditors, false);
- view.setEditorListener(SectionView.this);
- view.setValue(newKey, isMasterKey, -1);
- mEditors.addView(view);
- SectionView.this.updateEditorsVisible();
+ addGeneratedKeyToView(newKeyRing);
}
};
};
@@ -361,4 +340,29 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
// start service with intent
mActivity.startService(intent);
}
+
+ private void addGeneratedKeyToView(PGPSecretKeyRing newKeyRing) {
+ boolean isMasterKey = (mEditors.getChildCount() == 0);
+
+ // take only the key from this ring
+ PGPSecretKey newKey = null;
+ @SuppressWarnings("unchecked")
+ Iterator<PGPSecretKey> it = newKeyRing.getSecretKeys();
+
+ if (isMasterKey) {
+ newKey = it.next();
+ } else {
+ // first one is the master key
+ it.next();
+ newKey = it.next();
+ }
+
+ // add view with new key
+ KeyEditor view = (KeyEditor) mInflater.inflate(R.layout.edit_key_key_item,
+ mEditors, false);
+ view.setEditorListener(SectionView.this);
+ view.setValue(newKey, isMasterKey, -1);
+ mEditors.addView(view);
+ SectionView.this.updateEditorsVisible();
+ }
}