@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { System.exit(0); } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { PreferenceManager.getDefaultSharedPreferences(getContext()).edit() .putStringSet("excluded-apps-from-history", new HashSet<String>()).apply(); Toast.makeText(getContext(), R.string.excluded_app_list_erased, Toast.LENGTH_LONG).show(); } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { // get context (in order to avoid multiple get() calls) Context context = getContext(); // get packet manager PackageManager packageManager = context.getPackageManager(); // get dummyActivity ComponentName componentName = new ComponentName(context, DummyActivity.class); // enable dummyActivity (it starts disabled in the manifest.xml) packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); // create a new (implicit) intent with MAIN action Intent intent = new Intent(Intent.ACTION_MAIN); // add HOME category to it intent.addCategory(Intent.CATEGORY_HOME); // launch intent context.startActivity(intent); // disable dummyActivity once again packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { KissApplication.getApplication(getContext()).getDataHandler().clearHistory(); // We'll have to redraw the list, so add a flag for MainActivity to restart SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(getContext()).edit(); // SettingsActivity will have to restart (hides the summary with history count after reset) // Nothing to do for MainActivity, since updateSearchRecords() is called onResume(). editor.putBoolean("require-settings-update", true); editor.apply(); Toast.makeText(getContext(), R.string.history_erased, Toast.LENGTH_LONG).show(); } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { PreferenceManager.getDefaultSharedPreferences(getContext()).edit() .putString("favorite-apps-list", "").apply(); KissApplication.getApplication(getContext()).getDataHandler().getAppProvider().reload(); Toast.makeText(getContext(), R.string.favorites_erased, Toast.LENGTH_LONG).show(); } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { PreferenceManager.getDefaultSharedPreferences(getContext()).edit() .putStringSet("excluded-apps", new HashSet<String>()).apply(); KissApplication.getApplication(getContext()).getDataHandler().getAppProvider().reload(); Toast.makeText(getContext(), R.string.excluded_app_list_erased, Toast.LENGTH_LONG).show(); } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { PreferenceManager.getDefaultSharedPreferences(getContext()).edit() .remove("available-search-providers").apply(); Toast.makeText(getContext(), R.string.search_provider_reset_done_desc, Toast.LENGTH_LONG).show(); SearchProvider searchProvider = KissApplication.getApplication(getContext()).getDataHandler().getSearchProvider(); if (searchProvider != null) { searchProvider.reload(); } } } }
@VisibleForTesting @Override public void onClick() { super.onClick(); }
@Override public void onClick(DialogInterface dialog, int which) { if(LOGV) Log.v(TAG, getKey() + ": onClick: which=" + which); if(USE_NEW_DISMISS_LOGIC) mLastButtonId = which; else { super.onClick(dialog, which); //onDialogClosed(which == Dialog.BUTTON_POSITIVE); } }
@Override protected void onClick() { super.onClick(); // this seems to work to pop the keyboard when the dialog appears // i hope this isn't a race condition getDialog().getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); }
@Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: getSharedPreferences().edit().putString("ZH_SPACE_TEXT", zhEditText.getText().toString()).commit(); getSharedPreferences().edit().putString("EN_SPACE_TEXT", enEditText.getText().toString()).commit(); break; } super.onClick(dialog, which); }
@Override public void onClick(final DialogInterface dialog, final int which) { super.onClick(dialog, which); final String key = getKey(); if (which == DialogInterface.BUTTON_POSITIVE) { super.onClick(dialog, which); final int value = Color.rgb( mSeekBarRed.getProgress(), mSeekBarGreen.getProgress(), mSeekBarBlue.getProgress()); mValueProxy.writeValue(value, key); return; } if (which == DialogInterface.BUTTON_NEUTRAL) { super.onClick(dialog, which); mValueProxy.writeDefaultValue(key); return; } }
@Override public void onClick(final DialogInterface dialog, final int which) { super.onClick(dialog, which); final String key = getKey(); if (which == DialogInterface.BUTTON_NEUTRAL) { final int value = mValueProxy.readDefaultValue(key); setSummary(mValueProxy.getValueText(value)); mValueProxy.writeDefaultValue(key); return; } if (which == DialogInterface.BUTTON_POSITIVE) { final int value = getClippedValueFromProgress(mSeekBar.getProgress()); setSummary(mValueProxy.getValueText(value)); mValueProxy.writeValue(value, key); return; } }
@Override public void onClick(final DialogInterface dialog, final int which) { super.onClick(dialog, which); final String key = getKey(); if (which == DialogInterface.BUTTON_NEUTRAL) { final int value = mValueProxy.readDefaultValue(key); setSummary(mValueProxy.getValueText(value)); mValueProxy.writeDefaultValue(key); return; } if (which == DialogInterface.BUTTON_POSITIVE) { final int value = getClippedValueFromProgress(mSeekBar.getProgress()); setSummary(mValueProxy.getValueText(value)); mValueProxy.writeValue(value, key); return; } }
@Override public void onClick(final DialogInterface dialog, final 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 = AdditionalSubtypeUtils.createAsciiEmojiCapableAdditionalSubtype( locale.mLocaleString, layout.mLayoutName); setSubtype(subtype); notifyChanged(); if (isEditing) { mProxy.onSaveCustomInputStyle(this); } else { mProxy.onAddCustomInputStyle(this); } break; case DialogInterface.BUTTON_NEUTRAL: // Nothing to do break; case DialogInterface.BUTTON_NEGATIVE: mProxy.onRemoveCustomInputStyle(this); break; } }