android.content.DialogInterface#dismiss ( )源码实例Demo

下面列出了android.content.DialogInterface#dismiss ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Zom-Android-XMPP   文件: MemorizingActivity.java
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);
}
 
源代码2 项目: Cornowser   文件: UpdateActivity.java
@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();
}
 
源代码4 项目: listmyaps   文件: AppRater.java
@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();
}
 
源代码5 项目: openboard   文件: LatinIME.java
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);
}
 
源代码6 项目: NewsMe   文件: SettingFragment.java
/**
 * 取消升级,如果当前版本与最新版本相隔一个版本的话,则强制升级
 * 取消则关闭应用
 * @return
 */
private DialogInterface.OnClickListener cancelClick(final Version version) {
    return new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    };
}
 
源代码7 项目: HgLauncher   文件: AppSelectionPreferenceDialog.java
@Override public void onClick(DialogInterface dialog, int which) {
    if (mClickedDialogEntryIndex != which) {
        mClickedDialogEntryIndex = which;
        mValue = mEntryValues[mClickedDialogEntryIndex].toString();
        PreferenceHelper.update(preference, mValue);
    }
    dialog.dismiss();
}
 
源代码8 项目: screenstandby   文件: UpdateChecker.java
@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;
	}
}
 
源代码9 项目: personaldnsfilter   文件: DNSProxyActivity.java
@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;
}
 
源代码10 项目: WiFiAnalyzer   文件: Filter.java
@Override
public void onClick(DialogInterface dialog, int which) {
    dialog.dismiss();
    MainContext mainContext = MainContext.INSTANCE;
    mainContext.getFilterAdapter().save();
    mainContext.getMainActivity().update();
}
 
源代码11 项目: SmartOrnament   文件: SettingFragment.java
@Override
public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
}
 
源代码12 项目: MiBandDecompiled   文件: N.java
public void onClick(DialogInterface dialoginterface, int i)
{
    BraceletBtInfo braceletbtinfo = Keeper.readBraceletBtInfo();
    BraceletSettingsFragment.a(b, braceletbtinfo.address, a);
    dialoginterface.dismiss();
}
 
源代码13 项目: MiBandDecompiled   文件: bJ.java
public void onClick(DialogInterface dialoginterface, int i)
{
    BraceletBtInfo braceletbtinfo = Keeper.readBraceletBtInfo();
    SettingFirmwareActivity.SettingFirmwareFragment.a(b, braceletbtinfo.address, a);
    dialoginterface.dismiss();
}
 
源代码14 项目: talkback   文件: KeyComboPreference.java
/**
 * 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;
}
 
源代码15 项目: MalwareBuster   文件: MainActivity.java
@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)));
}
 
源代码16 项目: Cornowser   文件: KillAppMessageDialogButton.java
@Override
public void onClick(DialogInterface dialog, int id) {
	dialog.dismiss();
	android.os.Process.killProcess(android.os.Process.myPid());
	System.exit(0);
}
 
源代码17 项目: Silence   文件: ConversationActivity.java
@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();
}
 
源代码20 项目: pop   文件: Pop.java
@Override
public void clicked(DialogInterface dialog, @Nullable android.view.View view) {
    if (dialog != null) {
        dialog.dismiss();
    }
}