@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); switch (which) { case DialogInterface.BUTTON_POSITIVE: final boolean isEditing = !isIncomplete(); final SubtypeLocaleItem locale = (SubtypeLocaleItem) mSubtypeLocaleSpinner.getSelectedItem(); final KeyboardLayoutSetItem layout = (KeyboardLayoutSetItem) mKeyboardLayoutSetSpinner.getSelectedItem(); final InputMethodSubtype subtype = AdditionalSubtype.createAdditionalSubtype(locale.first, layout.first, ASCII_CAPABLE); setSubtype(subtype); notifyChanged(); if (isEditing) { mProxy.onSavePressed(this); } else { mProxy.onAddPressed(this); } break; case DialogInterface.BUTTON_NEUTRAL: // Nothing to do break; case DialogInterface.BUTTON_NEGATIVE: mProxy.onRemovePressed(this); break; } }
@Override public void onCancel(DialogInterface dialog) { if (isIncomplete()) { mProxy.onRemovePressed(this); } }