Allow OnCancelListener and OnDismissListener in Settings app
for the framework-managed dialogs. DialogFragment acts as both listeners so the application cannot set both listeners in the embedded dialog. New hooks are added in SettingsDialogFragment so that settings apps can do so for the framework-managed dialogs. Bug: 3386670 Change-Id: I144e7c4ccf7f86c61f6079fa86d830c709335af1
This commit is contained in:
@@ -311,19 +311,29 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
|
||||
}})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.setMessage(R.string.dlg_confirm_unmount_text)
|
||||
.setOnCancelListener(this)
|
||||
.create();
|
||||
case DLG_ERROR_UNMOUNT:
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.dlg_error_unmount_title)
|
||||
.setNeutralButton(R.string.dlg_ok, null)
|
||||
.setMessage(R.string.dlg_error_unmount_text)
|
||||
.setOnCancelListener(this)
|
||||
.create();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showDialog(int id) {
|
||||
super.showDialog(id);
|
||||
|
||||
switch (id) {
|
||||
case DLG_CONFIRM_UNMOUNT:
|
||||
case DLG_ERROR_UNMOUNT:
|
||||
setOnCancelListener(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void doUnmount(boolean force) {
|
||||
// Present a toast here
|
||||
Toast.makeText(getActivity(), R.string.unmount_inform_text, Toast.LENGTH_SHORT).show();
|
||||
|
Reference in New Issue
Block a user