Merge change 4532 into donut
* changes: Fixes #1924909. When restoring managed dialogs, do exactly the same thing as when showing a dialog.
This commit is contained in:
@@ -864,13 +864,24 @@ public class Activity extends ContextThemeWrapper
|
|||||||
final Integer dialogId = ids[i];
|
final Integer dialogId = ids[i];
|
||||||
Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
|
Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId));
|
||||||
if (dialogState != null) {
|
if (dialogState != null) {
|
||||||
final Dialog dialog = onCreateDialog(dialogId);
|
final Dialog dialog = createDialog(dialogId);
|
||||||
dialog.onRestoreInstanceState(dialogState);
|
|
||||||
mManagedDialogs.put(dialogId, dialog);
|
mManagedDialogs.put(dialogId, dialog);
|
||||||
|
onPrepareDialog(dialogId, dialog);
|
||||||
|
dialog.onRestoreInstanceState(dialogState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dialog createDialog(Integer dialogId) {
|
||||||
|
final Dialog dialog = onCreateDialog(dialogId);
|
||||||
|
if (dialog == null) {
|
||||||
|
throw new IllegalArgumentException("Activity#onCreateDialog did "
|
||||||
|
+ "not create a dialog for id " + dialogId);
|
||||||
|
}
|
||||||
|
dialog.dispatchOnCreate(null);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
private String savedDialogKeyFor(int key) {
|
private String savedDialogKeyFor(int key) {
|
||||||
return SAVED_DIALOG_KEY_PREFIX + key;
|
return SAVED_DIALOG_KEY_PREFIX + key;
|
||||||
}
|
}
|
||||||
@@ -2419,12 +2430,7 @@ public class Activity extends ContextThemeWrapper
|
|||||||
}
|
}
|
||||||
Dialog dialog = mManagedDialogs.get(id);
|
Dialog dialog = mManagedDialogs.get(id);
|
||||||
if (dialog == null) {
|
if (dialog == null) {
|
||||||
dialog = onCreateDialog(id);
|
dialog = createDialog(id);
|
||||||
if (dialog == null) {
|
|
||||||
throw new IllegalArgumentException("Activity#onCreateDialog did "
|
|
||||||
+ "not create a dialog for id " + id);
|
|
||||||
}
|
|
||||||
dialog.dispatchOnCreate(null);
|
|
||||||
mManagedDialogs.put(id, dialog);
|
mManagedDialogs.put(id, dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user