下面列出了android.content.DialogInterface#dismiss ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void onClick(DialogInterface dialog, int btnId) {
int decision;
dialog.dismiss();
switch (btnId) {
case DialogInterface.BUTTON_POSITIVE:
decision = MTMDecision.DECISION_ALWAYS;
break;
case DialogInterface.BUTTON_NEUTRAL:
decision = MTMDecision.DECISION_ONCE;
break;
default:
decision = MTMDecision.DECISION_ABORT;
}
sendDecision(decision);
}
@Override
public void onClick(DialogInterface d, int id) {
if (RootController.requestRoot()) {
enableRoot = true;
rootCheckBox.setChecked(true);
d.dismiss();
} else {
MessageDialog.showDialog(
getString(R.string.rootutils_root_access_failed_title),
getString(R.string.rootutils_root_access_failed), staticContext);
rootCheckBox.setChecked(false);
d.dismiss();
}
}
@Override
public void onClick(DialogInterface dialog, int which) {
if (which == DialogInterface.BUTTON_POSITIVE) {
notifyItemsSelected();
} else {
notifyDialogCancelled();
}
dialog.dismiss();
}
@Override
public void onClick(DialogInterface di, int id) {
SharedPreferences.Editor editor = context
.getSharedPreferences(PREFSFILE, 0).edit();
switch (id) {
case DialogInterface.BUTTON_POSITIVE: {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri
.parse("market://details?id=" + context.getPackageName())));
}
catch (ActivityNotFoundException exp) {
}
// Fall through intended!
}
case DialogInterface.BUTTON_NEGATIVE: {
editor.putBoolean("dontshowagain", true);
break;
}
case DialogInterface.BUTTON_NEUTRAL:
default: {
// Did the user select "Later" because s/he does not have network access
// right now or because s/he wants to extend the trial period? Let's
// assume the later and reset the launch counter, as it is the less
// pesky option.
editor.putLong("launch_count", 0);
}
}
editor.commit();
di.dismiss();
}
private void showSubtypeSelectorAndSettings() {
final CharSequence title = getString(R.string.english_ime_input_options);
// TODO: Should use new string "Select active input modes".
final CharSequence languageSelectionTitle = getString(R.string.language_selection_title);
final CharSequence[] items = new CharSequence[] {
languageSelectionTitle,
getString(ApplicationUtils.getActivityTitleResId(this, SettingsActivity.class))
};
final String imeId = mRichImm.getInputMethodIdOfThisIme();
final OnClickListener listener = new OnClickListener() {
@Override
public void onClick(DialogInterface di, int position) {
di.dismiss();
switch (position) {
case 0:
final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
imeId,
Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(Intent.EXTRA_TITLE, languageSelectionTitle);
startActivity(intent);
break;
case 1:
launchSettings();
break;
}
}
};
final AlertDialog.Builder builder = new AlertDialog.Builder(
DialogUtils.getPlatformDialogThemeContext(this));
builder.setItems(items, listener).setTitle(title);
final AlertDialog dialog = builder.create();
dialog.setCancelable(true /* cancelable */);
dialog.setCanceledOnTouchOutside(true /* cancelable */);
showOptionDialog(dialog);
}
/**
* 取消升级,如果当前版本与最新版本相隔一个版本的话,则强制升级
* 取消则关闭应用
* @return
*/
private DialogInterface.OnClickListener cancelClick(final Version version) {
return new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
};
}
@Override public void onClick(DialogInterface dialog, int which) {
if (mClickedDialogEntryIndex != which) {
mClickedDialogEntryIndex = which;
mValue = mEntryValues[mClickedDialogEntryIndex].toString();
PreferenceHelper.update(preference, mValue);
}
dialog.dismiss();
}
@Override
public void onClick(DialogInterface dialog, int which) {
switch(which)
{
case DialogInterface.BUTTON_NEGATIVE:
dialog.dismiss();break;
case DialogInterface.BUTTON_POSITIVE:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
context.startActivity(i);
dialog.dismiss();break;
}
}
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME) {
dialog.dismiss();
advDNSConfigDia_open = false;
persistConfig();
}
return false;
}
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
MainContext mainContext = MainContext.INSTANCE;
mainContext.getFilterAdapter().save();
mainContext.getMainActivity().update();
}
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
public void onClick(DialogInterface dialoginterface, int i)
{
BraceletBtInfo braceletbtinfo = Keeper.readBraceletBtInfo();
BraceletSettingsFragment.a(b, braceletbtinfo.address, a);
dialoginterface.dismiss();
}
public void onClick(DialogInterface dialoginterface, int i)
{
BraceletBtInfo braceletbtinfo = Keeper.readBraceletBtInfo();
SettingFirmwareActivity.SettingFirmwareFragment.a(b, braceletbtinfo.address, a);
dialoginterface.dismiss();
}
/**
* Accepts and handles key event from parent. KeyAssignmentUtils updates the keycombo list and
* view. Displays a message if the key is assigned elsewhere, and indicates if the press was
* consumed or not.
*
* @param dialog The Dialog on which the key press occurred
* @param keyCode The key code of the key that was pressed
* @param event The {@link KeyEvent} to process
* @return {@code true} if event was consumed, {@code false} otherwise
*/
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
// Process on ACTION_UP since ACTION_DOWN can be sent multiple times if the switch is
// pressed and held or not at all in other cases (e.g. the first time the switch is pressed
// when no keys are assigned).
if (event.getAction() == KeyEvent.ACTION_UP) {
// If the key press is from the back button when using a virtual hard key, close the dialog.
// Otherwise, allow the back button to be assigned as usual. This is because the back button
// is unable to be used as a switch when it's a virtual hard key, so it shouldn't be
// assignable.
if (keyCode == KeyEvent.KEYCODE_BACK
&& ((event.getFlags() & KeyEvent.FLAG_VIRTUAL_HARD_KEY)
== KeyEvent.FLAG_VIRTUAL_HARD_KEY)) {
dialog.dismiss();
return true;
}
long keyCombo = KeyAssignmentUtils.keyEventToExtendedKeyCode(event);
int keyPressResult =
KeyAssignmentUtils.processKeyAssignment(
getContext(), event, keyCombos, getKey(), keyListAdapter);
CharSequence titleOfOtherPrefForKey = getTitleOfOtherActionAssociatedWith(keyCombo);
if ((keyPressResult == KeyAssignmentUtils.KEYCOMBO_ALREADY_ASSIGNED)
&& (titleOfOtherPrefForKey != null)) {
CharSequence toastText =
getContext()
.getString(
R.string.toast_msg_key_already_assigned,
KeyAssignmentUtils.describeExtendedKeyCode(keyCombo, getContext()),
titleOfOtherPrefForKey);
Toast.makeText(getContext(), toastText, Toast.LENGTH_SHORT).show();
} else {
resetButton.setEnabled(hasSwitchesAdded());
if ((keyPressResult == KeyAssignmentUtils.CONSUME_EVENT) && (callback != null)) {
callback.onKeyEventConsumed();
}
/* If the event was ignored, return that the event was not consumed. */
return keyPressResult != KeyAssignmentUtils.IGNORE_EVENT;
}
}
resetButton.setEnabled(hasSwitchesAdded());
return true;
}
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + Common.XPOSEDINSTALLER_PACKAGE_NAME)));
}
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
@Override
public void onClick(DialogInterface dialog, int which) {
addAttachment(attachmentAdapter.buttonToCommand(which));
dialog.dismiss();
}
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// 设置取消状态
//downloadApkThread.cancelBuildUpdate();
}
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
// 设置取消状态
//downloadApkThread.cancelBuildUpdate();
}