Java Code Examples for android.content.DialogInterface#dismiss()

The following examples show how to use android.content.DialogInterface#dismiss() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemorizingActivity.java    From Zom-Android-XMPP with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: UpdateActivity.java    From Cornowser with MIT License 5 votes vote down vote up
@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();
    }
}
 
Example 3
Source File: ChoiceablePickerDialogFragment.java    From MVPAndroidBootstrap with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == DialogInterface.BUTTON_POSITIVE) {
        notifyItemsSelected();
    } else {
        notifyDialogCancelled();
    }
    dialog.dismiss();
}
 
Example 4
Source File: AppRater.java    From listmyaps with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 5
Source File: LatinIME.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: SettingFragment.java    From NewsMe with Apache License 2.0 5 votes vote down vote up
/**
 * 取消升级,如果当前版本与最新版本相隔一个版本的话,则强制升级
 * 取消则关闭应用
 * @return
 */
private DialogInterface.OnClickListener cancelClick(final Version version) {
    return new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    };
}
 
Example 7
Source File: Filter.java    From WiFiAnalyzer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    dialog.dismiss();
    MainContext mainContext = MainContext.INSTANCE;
    mainContext.getFilterAdapter().save();
    mainContext.getMainActivity().update();
}
 
Example 8
Source File: AppSelectionPreferenceDialog.java    From HgLauncher with GNU General Public License v3.0 5 votes vote down vote up
@Override public void onClick(DialogInterface dialog, int which) {
    if (mClickedDialogEntryIndex != which) {
        mClickedDialogEntryIndex = which;
        mValue = mEntryValues[mClickedDialogEntryIndex].toString();
        PreferenceHelper.update(preference, mValue);
    }
    dialog.dismiss();
}
 
Example 9
Source File: UpdateChecker.java    From screenstandby with GNU General Public License v2.0 5 votes vote down vote up
@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;
	}
}
 
Example 10
Source File: DNSProxyActivity.java    From personaldnsfilter with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example 11
Source File: Pop.java    From pop with Apache License 2.0 4 votes vote down vote up
@Override
public void clicked(DialogInterface dialog, @Nullable android.view.View view) {
    if (dialog != null) {
        dialog.dismiss();
    }
}
 
Example 12
Source File: SettingFragment.java    From SmartOrnament with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
}
 
Example 13
Source File: UpdateManager.java    From cordova-plugin-app-update-demo with MIT License 4 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    dialog.dismiss();
    // 设置取消状态
    //downloadApkThread.cancelBuildUpdate();
}
 
Example 14
Source File: UpdateManager.java    From cordova-plugin-app-update-demo with MIT License 4 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    dialog.dismiss();
    // 设置取消状态
    //downloadApkThread.cancelBuildUpdate();
}
 
Example 15
Source File: ConversationActivity.java    From Silence with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
  addAttachment(attachmentAdapter.buttonToCommand(which));
  dialog.dismiss();
}
 
Example 16
Source File: KillAppMessageDialogButton.java    From Cornowser with MIT License 4 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int id) {
	dialog.dismiss();
	android.os.Process.killProcess(android.os.Process.myPid());
	System.exit(0);
}
 
Example 17
Source File: MainActivity.java    From MalwareBuster with Apache License 2.0 4 votes vote down vote up
@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)));
}
 
Example 18
Source File: KeyComboPreference.java    From talkback with Apache License 2.0 4 votes vote down vote up
/**
 * 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;
}
 
Example 19
Source File: bJ.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public void onClick(DialogInterface dialoginterface, int i)
{
    BraceletBtInfo braceletbtinfo = Keeper.readBraceletBtInfo();
    SettingFirmwareActivity.SettingFirmwareFragment.a(b, braceletbtinfo.address, a);
    dialoginterface.dismiss();
}
 
Example 20
Source File: N.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public void onClick(DialogInterface dialoginterface, int i)
{
    BraceletBtInfo braceletbtinfo = Keeper.readBraceletBtInfo();
    BraceletSettingsFragment.a(b, braceletbtinfo.address, a);
    dialoginterface.dismiss();
}