From 65362beaf9f976d6d6e6da6a4ef41adeec8ca43b Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 7 Jul 2015 22:19:20 +0200 Subject: move queued action handling from prev commit into onActivityCreated --- .../keychain/ui/CreateKeyFinalFragment.java | 58 ++++++++++------------ 1 file changed, 27 insertions(+), 31 deletions(-) (limited to 'OpenKeychain') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java index a997dc545..6e41e97a8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java @@ -225,6 +225,33 @@ public class CreateKeyFinalFragment extends Fragment { } } } + + // handle queued actions + + if (mQueuedFinishResult != null) { + finishWithResult(mQueuedFinishResult); + return; + } + + if (mQueuedDisplayResult != null) { + try { + displayResult(mQueuedDisplayResult); + } finally { + // clear after operation, note that this may drop the operation if it didn't + // work when called from here! + mQueuedDisplayResult = null; + } + } + + if (mQueuedSaveKeyResult != null) { + try { + uploadKey(mQueuedSaveKeyResult); + } finally { + // see above + mQueuedSaveKeyResult = null; + } + } + } private void createKey() { @@ -433,35 +460,4 @@ public class CreateKeyFinalFragment extends Fragment { activity.finish(); } - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - - // there may be queued actions from when we weren't attached to an activity! - - if (mQueuedFinishResult != null) { - finishWithResult(mQueuedFinishResult); - return; - } - - if (mQueuedDisplayResult != null) { - try { - displayResult(mQueuedDisplayResult); - } finally { - // clear after operation, note that this may drop the operation if it didn't - // work when called from here! - mQueuedDisplayResult = null; - } - } - - if (mQueuedSaveKeyResult != null) { - try { - uploadKey(mQueuedSaveKeyResult); - } finally { - // see above - mQueuedSaveKeyResult = null; - } - } - } - } -- cgit v1.2.3