Cancel SubtypePreference dialog properly
Bug: 6384416 Bug: 6387408 Change-Id: Ia7b0653a09410b42a55915815c887bf0ad56c856
This commit is contained in:
parent
9f0a137f82
commit
cbaf6d85f1
1 changed files with 10 additions and 1 deletions
|
@ -141,7 +141,8 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||||
public KeyboardLayoutSetAdapter getKeyboardLayoutSetAdapter();
|
public KeyboardLayoutSetAdapter getKeyboardLayoutSetAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
static class SubtypePreference extends DialogPreference {
|
static class SubtypePreference extends DialogPreference
|
||||||
|
implements DialogInterface.OnCancelListener {
|
||||||
private static final String KEY_PREFIX = "subtype_pref_";
|
private static final String KEY_PREFIX = "subtype_pref_";
|
||||||
private static final String KEY_NEW_SUBTYPE = KEY_PREFIX + "new";
|
private static final String KEY_NEW_SUBTYPE = KEY_PREFIX + "new";
|
||||||
|
|
||||||
|
@ -205,6 +206,7 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||||
@Override
|
@Override
|
||||||
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
|
||||||
final Context context = builder.getContext();
|
final Context context = builder.getContext();
|
||||||
|
builder.setCancelable(true).setOnCancelListener(this);
|
||||||
if (isIncomplete()) {
|
if (isIncomplete()) {
|
||||||
builder.setPositiveButton(R.string.add, this)
|
builder.setPositiveButton(R.string.add, this)
|
||||||
.setNegativeButton(android.R.string.cancel, this);
|
.setNegativeButton(android.R.string.cancel, this);
|
||||||
|
@ -232,6 +234,13 @@ public class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(DialogInterface dialog) {
|
||||||
|
if (isIncomplete()) {
|
||||||
|
mProxy.onRemovePressed(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
super.onClick(dialog, which);
|
super.onClick(dialog, which);
|
||||||
|
|
Loading…
Reference in a new issue