Java Code Examples for android.content.DialogInterface#cancel()
The following examples show how to use
android.content.DialogInterface#cancel() .
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: TaskListFragment.java From mvp-helpers with MIT License | 6 votes |
public void onClick(@NonNull DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: if (isPresenterAvailable()) { getPresenter().removeAllTasks(); } dialog.dismiss(); break; case DialogInterface.BUTTON_NEGATIVE: dialog.cancel(); break; } }
Example 2
Source File: AddTaskFragment.java From mvp-helpers with MIT License | 6 votes |
public void onClick(@NonNull DialogInterface dialog, int which) { switch (which) { case DialogInterface.BUTTON_POSITIVE: if (isPresenterAvailable()) { getPresenter().removeTask(); } dialog.dismiss(); break; case DialogInterface.BUTTON_NEGATIVE: dialog.cancel(); break; } }
Example 3
Source File: TeamDetails.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected DialogInterface.OnClickListener cancelListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }; }
Example 4
Source File: MeetingDetails.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected DialogInterface.OnClickListener cancelListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }; }
Example 5
Source File: ImageViewer.java From photo-viewer with Apache License 2.0 | 5 votes |
/** * Resets image on {@literal KeyEvent.KEYCODE_BACK} to normal scale if needed, otherwise - hide the viewer. */ @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) { if (viewer.isScaled()) { viewer.resetScale(); } else { dialog.cancel(); } } return true; }
Example 6
Source File: TeamList.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected DialogInterface.OnClickListener cancelListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }; }
Example 7
Source File: TeamDetails.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected DialogInterface.OnClickListener cancelListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }; }
Example 8
Source File: MeetingDetails.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected DialogInterface.OnClickListener cancelListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }; }
Example 9
Source File: TeamList.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected DialogInterface.OnClickListener cancelListener() { return new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }; }
Example 10
Source File: SelectPreferredLocationFragment.java From barterli_android with Apache License 2.0 | 5 votes |
/** * Handle the click for the dialog. The fragment will receive this call, only if {@link * #willHandleDialog(DialogInterface)} returns <code>true</code> * * @param dialog The dialog that was interacted with * @param which The button that was clicked */ public void onDialogClick(final DialogInterface dialog, final int which) { if ((mAddLocationDialogFragment != null) && mAddLocationDialogFragment.getDialog() .equals(dialog)) { if (which == DialogInterface.BUTTON_POSITIVE) { final String locationName = mAddLocationDialogFragment .getName(); final double latitude = DeviceInfo.INSTANCE.getLatestLocation() .getLatitude(); final double longitude = DeviceInfo.INSTANCE .getLatestLocation().getLongitude(); if (!TextUtils.isEmpty(locationName)) { setUserPreferredLocation(locationName, "", latitude, longitude, "", "", "", ""); } } } else if ((mEnableLocationDialogFragment != null) && mEnableLocationDialogFragment.getDialog() .equals(dialog)) { if (which == DialogInterface.BUTTON_POSITIVE) { // enable location Intent locationOptionsIntent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivity(locationOptionsIntent); } else if (which == DialogInterface.BUTTON_NEGATIVE) { // cancel dialog.cancel(); } } }
Example 11
Source File: RingerModeAndScreenMonitor.java From talkback with Apache License 2.0 | 4 votes |
/** * Handles when the screen is turned off. Announces "screen off" and suspends the proximity * sensor. */ @SuppressWarnings("deprecation") private void handleScreenOff(EventId eventId) { proximitySensorListener.setScreenIsOn(false); menuManager.dismissAll(); // Iterate over a copy because dialog dismiss handlers might try to unregister dialogs. List<DialogInterface> openDialogsCopy = new ArrayList<>(openDialogs); for (DialogInterface dialog : openDialogsCopy) { dialog.cancel(); } openDialogs.clear(); final SpannableStringBuilder ttsText = new SpannableStringBuilder(service.getString(R.string.value_screen_off)); // Only announce ringer state if we're not in a call. if (isIdle()) { appendRingerStateAnnouncement(ttsText); } // Always reset the television remote mode to the standard (navigate) mode on screen off. if (televisionNavigationController != null) { televisionNavigationController.resetToNavigateMode(); } // Stop queued speech and events. AccessibilityEventProcessor will block new events. service.clearQueues(); // Speak "screen off". // : Do not have any screen off message and any chime for Android Wear. if (!isWatch) { SpeakOptions speakOptions = SpeakOptions.create() .setQueueMode(SpeechController.QUEUE_MODE_INTERRUPT) .setFlags(FeedbackItem.FLAG_NO_HISTORY); final float volume; if (ringerMode == AudioManager.RINGER_MODE_NORMAL) { // Gets TalkBack's default earcon volume from FeedbackController. final float talkbackVolume = getStreamVolume(FeedbackController.DEFAULT_STREAM); if ((talkbackVolume > 0) && (audioManager.isWiredHeadsetOn() || audioManager.isBluetoothA2dpOn())) { // TODO: refactor the following lines. // Play the ringer beep on the default (music) stream to avoid // issues with ringer audio (e.g. no speech on ICS and // interruption of music on JB). Adjust playback volume to // compensate for music volume. final float ringVolume = getStreamVolume(AudioManager.STREAM_RING); volume = Math.min(1.0f, (ringVolume / talkbackVolume)); } else { volume = 1.0f; } // Normally we'll play the volume beep on the ring stream. pipeline.returnFeedback( eventId, Feedback.sound(R.raw.volume_beep, 1.0f, volume).speech(ttsText, speakOptions)); } else { pipeline.returnFeedback(eventId, Feedback.speech(ttsText, speakOptions)); } } for (ScreenChangedListener screenChangedListener : screenChangedListeners) { screenChangedListener.onScreenChanged(isScreenOn, eventId); } }
Example 12
Source File: Tools.java From Beats with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void onClick(DialogInterface dialog, int id) { dialog.cancel(); }
Example 13
Source File: WifiapActivity.java From WifiChat with GNU General Public License v2.0 | 4 votes |
@Override public void onClick(DialogInterface hintDialog, int which) { switch (which) { // 确定 case 0: hintDialog.dismiss(); if (WifiUtils.isWifiApEnabled()) { // 执行关闭热点事件 WifiUtils.closeWifiAp(); WifiUtils.OpenWifi(); showShortToast(R.string.wifiap_text_ap_0); mTvStatusInfo.setText(getString(R.string.wifiap_text_wifi_1_0)); mBtnCreateAp.setText(getString(R.string.wifiap_btn_createap)); mLlApInfo.setVisibility(View.GONE); mLvWifiList.setVisibility(View.VISIBLE); localIPaddress = null; serverIPaddres = null; mSearchWifiThread.start(); } else { // 创建热点 mTvStatusInfo.setText(getString(R.string.wifiap_text_createap_creating)); mBtnBack.setClickable(false); mBtnCreateAp.setClickable(false); mBtnNext.setClickable(false); WifiUtils.startWifiAp(WifiApConst.WIFI_AP_HEADER + getLocalHostName(), WifiApConst.WIFI_AP_PASSWORD, mHandler); } break; // 取消 case 1: hintDialog.cancel(); break; } }
Example 14
Source File: NumericOptionItem.java From msdkui-android with Apache License 2.0 | 4 votes |
@Override public void onClick(final DialogInterface dialog, final int which) { dialog.cancel(); }
Example 15
Source File: TalkBackKeyboardShortcutPreferencesActivity.java From talkback with Apache License 2.0 | 4 votes |
@Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); }
Example 16
Source File: MessageListsActivity.java From medic-gateway with GNU Affero General Public License v3.0 | 4 votes |
public void onClick(DialogInterface dialog, int which) { dialog.cancel(); }
Example 17
Source File: DialogLPV.java From LockPattern with MIT License | 4 votes |
@Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); }
Example 18
Source File: DialogHelper.java From Onosendai with Apache License 2.0 | 4 votes |
@Override public void onClick (final DialogInterface dialog, final int whichButton) { dialog.cancel(); }
Example 19
Source File: MainActivity.java From GoFIT_SDK_Android with Apache License 2.0 | 4 votes |
@Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); }
Example 20
Source File: ActivityEditTransaction.java From fingen with Apache License 2.0 | 4 votes |
@Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); mActivity.finish(); }