move queued action handling from prev commit into onActivityCreated

This commit is contained in:
Vincent Breitmoser
2015-07-07 22:19:20 +02:00
parent 00951bc4c7
commit 65362beaf9

View File

@@ -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;
}
}
}
}