@Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: Editable text = mPunctuationCharacters.getText(); String characters = null; int level; if (text != null) { characters = text.toString(); } if (mNone.isChecked()) { level = SpeechSynthesis.PUNCT_NONE; } else if (characters == null || characters.isEmpty()) { level = mAll.isChecked() ? SpeechSynthesis.PUNCT_ALL : SpeechSynthesis.PUNCT_NONE; } else { level = mAll.isChecked() ? SpeechSynthesis.PUNCT_ALL : SpeechSynthesis.PUNCT_SOME; } onDataChanged(level, characters); if (shouldCommit()) { SharedPreferences.Editor editor = getEditor(); if (editor != null) { editor.putString(VoiceSettings.PREF_PUNCTUATION_CHARACTERS, characters); editor.putString(VoiceSettings.PREF_PUNCTUATION_LEVEL, Integer.toString(level)); editor.commit(); } } break; } super.onClick(dialog, which); }
@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 onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (DialogInterface.BUTTON_POSITIVE == which) { Toast.makeText(mContext, "Send an Email", Toast.LENGTH_SHORT).show(); } }
@Override public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { String value = mEditTextPassword.getText().toString(); callChangeListener(value); } super.onClick(dialog, which); }
@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); }
/** * Called whenever the user clicks on a button. Invokes {@link #onDateChanged(DatePicker, int, * int, int)} and {@link #onDialogClosed(boolean)}. Be sure to call the super when overriding. */ @SuppressWarnings("deprecation") @Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); datePicker.clearFocus(); onDateChanged( datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth()); onDialogClosed(which == DialogInterface.BUTTON1); // OK? }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { // String url = // PreyWebServices.getInstance().getDeviceWebControlPanelUrl(getContext()); String url = PreyConfig.getPreyConfig(getContext()).getPreyUrl(); Intent internetIntent = new Intent(Intent.ACTION_VIEW); internetIntent.setData(Uri.parse(url)); getContext().startActivity(internetIntent); } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); switch (which) { case DialogInterface.BUTTON_POSITIVE: clearAlbumArtDirectory(); break; case DialogInterface.BUTTON_NEGATIVE: // do nothing break; } }
@Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: SharedPrefs.setServerName(mServerName.getText().toString()); connect(mServerName.getText().toString(), null); break; case DialogInterface.BUTTON_NEGATIVE: dialog.cancel(); break; default: super.onClick(dialog, which); } }
@Override public void onClick(DialogInterface dialog, int which) { if (dialog != null && dialog.equals(confirmDlg)) { if (which == Dialog.BUTTON_POSITIVE && selectedPath != null) { ConfigurationManager.instance().setStoragePath(selectedPath); COConfigurationManager.setParameter( "General_sDefaultTorrent_Directory", com.frostwire.android.gui.util.SystemUtils.getTorrentsDirectory().getAbsolutePath()); dismissPreferenceDialog(); uxLogSelection(); } } else { super.onClick(dialog, which); } }
@Override public void onClick(DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: // Clicked connect SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences.Editor editor = prefs.edit(); editor.putString(Defaults.SETTINGS_KEY_BROKER_HOST, host.getText().toString()); editor.putString(Defaults.SETTINGS_KEY_BROKER_PORT, port.getText().toString()); editor.putString( Defaults.SETTINGS_KEY_BROKER_USERNAME, brokerUsername.getText().toString()); editor.putString(Defaults.SETTINGS_KEY_BROKER_PASSWORD, password.getText().toString()); editor.putInt( Defaults.SETTINGS_KEY_BROKER_SECURITY, brokerSecurity.getSelectedItemPosition()); editor.putInt(Defaults.SETTINGS_KEY_BROKER_AUTH, brokerAuth.getSelectedItemPosition()); editor.putString( Defaults.SETTINGS_KEY_BROKER_SECURITY_SSL_CA_PATH, brokerSecuritySSLCaCrtPath.getText().toString()); editor.apply(); Runnable r = new Runnable() { @Override public void run() { ServiceMqtt.getInstance().reconnect(); } }; new Thread(r).start(); break; case DialogInterface.BUTTON_NEGATIVE: Runnable s = new Runnable() { @Override public void run() { ServiceMqtt.getInstance().disconnect(true); } }; new Thread(s).start(); } super.onClick(dialog, which); }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (which == DialogInterface.BUTTON_POSITIVE) { PreyConfig preyConfig = PreyConfig.getPreyConfig(ctx); if (preyConfig.isFroyoOrAbove()) { FroyoSupport fSupport = FroyoSupport.getInstance(ctx); if (fSupport.isAdminActive()) { fSupport.removeAdminPrivileges(); setTitle(R.string.preferences_admin_disabled_title); setSummary(R.string.preferences_admin_disabled_summary); } else { Intent intent = fSupport.getAskForAdminPrivilegesIntent(); ctx.startActivity(intent); } } } }
@Override public void onClick(DialogInterface dialog, int which) { super.onClick(dialog, which); if (getDialog().getCurrentFocus() != null) getDialog().getCurrentFocus().clearFocus(); }