android.content.DialogInterface Java Examples
The following examples show how to use
android.content.DialogInterface.
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 Project: camerakit-android Author: CameraKit File: MainActivity.java License: MIT License | 6 votes |
@Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == R.id.main_menu_about) { AlertDialog dialog = new AlertDialog.Builder(MainActivity.this) .setTitle(R.string.about_dialog_title) .setMessage(R.string.about_dialog_message) .setNeutralButton("Dismiss", null) .show(); dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(Color.parseColor("#91B8CC")); dialog.getButton(DialogInterface.BUTTON_NEUTRAL).setText(Html.fromHtml("<b>Dismiss</b>")); return true; } if (item.getItemId() == R.id.main_menu_gallery) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivity(intent); return true; } return false; }
Example #2
Source Project: budget-watch Author: brarcher File: DatabaseCleanupTask.java License: GNU General Public License v3.0 | 6 votes |
protected void onPreExecute() { progress = new ProgressDialog(activity); progress.setTitle(R.string.cleaning); progress.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { DatabaseCleanupTask.this.cancel(true); } }); progress.show(); }
Example #3
Source Project: xposed-rimet Author: sky-wei File: DialogUtil.java License: Apache License 2.0 | 6 votes |
public static void showDialog(Context context, String title, String message, String positive, DialogInterface.OnClickListener positiveLister, String negative, DialogInterface.OnClickListener negativeLister, boolean cancel) { if (context == null || TextUtils.isEmpty(message) || TextUtils.isEmpty(positive)) { // 不进行处理 return; } AlertDialog dialog = new AlertDialog.Builder(context) .setTitle(title) .setMessage(message) .setCancelable(cancel) .setPositiveButton(positive, positiveLister) .setNegativeButton(negative, negativeLister) .create(); // 显示提示 dialog.show(); }
Example #4
Source Project: RxAndroidBootstrap Author: richardradics File: ChoiceablePickerDialogFragment.java License: Apache License 2.0 | 6 votes |
protected void setupMultiChoiceDialog(AlertDialog.Builder builder) { final List<Choiceable> availableItems = getAvailableItems(); final ItemPrinter<Choiceable> ip = getItemPrinter(); CharSequence[] items = new CharSequence[availableItems.size()]; boolean[] checked = new boolean[availableItems.size()]; for (int i = 0; i < availableItems.size(); ++i) { items[i] = ip.print(getItemAt(i)); if (selectedItems.get(i) != null) { checked[i] = true; } else { checked[i] = false; } } builder.setMultiChoiceItems(items, checked, new DialogInterface.OnMultiChoiceClickListener() { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (isChecked) selectedItems.put(which, getItemAt(which)); else selectedItems.delete(which); } }); }
Example #5
Source Project: FaceRecognitionApp Author: Lauszus File: CameraBridgeViewBase.java License: GNU General Public License v2.0 | 6 votes |
private void onEnterStartedState() { Log.d(TAG, "call onEnterStartedState"); /* Connect camera */ if (!connectCamera(getWidth(), getHeight())) { AlertDialog ad = new AlertDialog.Builder(getContext()).create(); ad.setCancelable(false); // This blocks the 'BACK' button ad.setMessage("It seems that you device does not support camera (or it is locked). Application will be closed."); ad.setButton(DialogInterface.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); ((Activity) getContext()).finish(); } }); ad.show(); } }
Example #6
Source Project: Plumble Author: acomminos File: CertificateExportActivity.java License: GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDatabase = new PlumbleSQLiteDatabase(this); mCertificates = mDatabase.getCertificates(); CharSequence[] labels = new CharSequence[mCertificates.size()]; for (int i = 0; i < labels.length; i++) { labels[i] = mCertificates.get(i).getName(); } AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle(R.string.pref_export_certificate_title); adb.setItems(labels, this); adb.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { finish(); } }); adb.show(); }
Example #7
Source Project: GravityBox Author: WrBug File: WebServiceClient.java License: Apache License 2.0 | 6 votes |
public WebServiceClient(Context context, WebServiceTaskListener<T> listener) { mContext = context; mListener = listener; if (mContext == null || mListener == null) { throw new IllegalArgumentException(); } mProgressDialog = new ProgressDialog(mContext); mProgressDialog.setMessage(mContext.getString(R.string.wsc_please_wait)); mProgressDialog.setIndeterminate(true); mProgressDialog.setCancelable(true); mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dlgInterface) { abortTaskIfRunning(); } }); mHash = getAppSignatureHash(mContext); }
Example #8
Source Project: AcDisplay Author: AChep File: DialogUtils.java License: GNU General Public License v2.0 | 6 votes |
private static void setTypeface(TypefaceHelper helper, AlertDialog alertDialog, String typefaceName, int style) { Button positive = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); Button negative = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); Button neutral = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL); TextView message = (TextView) alertDialog.findViewById(android.R.id.message); if (positive != null) { helper.setTypeface(positive, typefaceName, style); } if (negative != null) { helper.setTypeface(negative, typefaceName, style); } if (neutral != null) { helper.setTypeface(neutral, typefaceName, style); } if (message != null) { helper.setTypeface(message, typefaceName, style); } }
Example #9
Source Project: YImagePicker Author: yangpeixing File: RedBookPresenter.java License: Apache License 2.0 | 6 votes |
/** * 选择超过数量限制提示 * * @param context 上下文 * @param maxCount 最大数量 */ @Override public void overMaxCountTip(Context context, int maxCount) { if (context == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage("最多选择" + maxCount + "个文件"); builder.setPositiveButton(R.string.picker_str_sure, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); AlertDialog dialog = builder.create(); dialog.show(); }
Example #10
Source Project: appcan-android Author: AppCanOpenSource File: EBrowserActivity.java License: GNU Lesser General Public License v3.0 | 6 votes |
private final void loadResError() { AlertDialog.Builder dia = new AlertDialog.Builder(this); ResoureFinder finder = ResoureFinder.getInstance(); dia.setTitle(finder.getString(this, "browser_dialog_error")); dia.setMessage(finder.getString(this, "browser_init_error")); dia.setCancelable(false); dia.setPositiveButton(finder.getString(this, "confirm"), new OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); Process.killProcess(Process.myPid()); } }); dia.create(); dia.show(); }
Example #11
Source Project: media-for-mobile Author: INDExOS File: ActivityWithTimeline.java License: Apache License 2.0 | 6 votes |
public void showMessageBox(String message, DialogInterface.OnClickListener listener) { if (message == null) { message = ""; } if (listener == null) { listener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }; } AlertDialog.Builder b = new AlertDialog.Builder(this); b.setMessage(message); b.setPositiveButton("OK", listener); AlertDialog d = b.show(); ((TextView) d.findViewById(android.R.id.message)).setGravity(Gravity.CENTER); }
Example #12
Source Project: javaide Author: tranleduy2000 File: ColorPickerPreference.java License: GNU General Public License v3.0 | 6 votes |
@Override protected void onClick() { ColorPickerDialogBuilder builder = ColorPickerDialogBuilder .with(getContext()) .setTitle(pickerTitle) .initialColor(selectedColor) .wheelType(wheelType) .density(density) .setPositiveButton(pickerButtonOk, new ColorPickerClickListener() { @Override public void onClick(DialogInterface dialog, int selectedColorFromPicker, Integer[] allColors) { setValue(selectedColorFromPicker); } }) .setNegativeButton(pickerButtonCancel, null); if (!alphaSlider && !lightSlider) builder.noSliders(); else if (!alphaSlider) builder.lightnessSliderOnly(); else if (!lightSlider) builder.alphaSliderOnly(); builder .build() .show(); }
Example #13
Source Project: Dashboard Author: Supremez File: BaseActivity.java License: MIT License | 6 votes |
public void getzooper(View view) { final AlertDialog.Builder menuAleart = new AlertDialog.Builder(this); final String[] menuList = {"AMAZON APP STORE", "GOOGLE PLAY STORE"}; menuAleart.setItems(menuList, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: boolean installed = appInstalledOrNot("com.amazon.venezia"); if (installed) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("amzn://apps/android?p=org.zooper.zwpro"))); } else { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.amazon.com/gp/mas/dl/android?p=org.zooper.zwpro"))); } break; case 1: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=org.zooper.zwpro"))); break; } } }); AlertDialog menuDrop = menuAleart.create(); menuDrop.show(); }
Example #14
Source Project: SystemUITuner2 Author: zacharee File: Exceptions.java License: MIT License | 6 votes |
public void secureSettings(Activity activity, final Context appContext, Exception e, String page) { //exception function for a Secure Settings problem Log.e(page, e.getMessage()); //log the error e.printStackTrace(); if (!activity.isDestroyed()) { new AlertDialog.Builder(activity) //show a dialog with the error and prompt user to set up permissions again .setIcon(alertRed) .setTitle(Html.fromHtml("<font color='#ff0000'>" + activity.getResources().getText(R.string.error) + "</font>")) .setMessage(activity.getResources().getText(R.string.perms_not_set) + "\n\n\"" + e.getMessage() + "\"\n\n" + activity.getResources().getText(R.string.prompt_setup)) .setPositiveButton(activity.getResources().getText(R.string.yes), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(appContext, SetupActivity.class); intent.addFlags(intent.FLAG_ACTIVITY_NEW_TASK); appContext.startActivity(intent); } }) .setNegativeButton(activity.getResources().getText(R.string.no), null) .show(); } }
Example #15
Source Project: endpoints-codelab-android Author: GoogleCloudPlatform File: AddTask.java License: GNU General Public License v3.0 | 6 votes |
private void showProjectContextMenu() { AlertDialog.Builder builder = new AlertDialog.Builder(this); final ArrayList<String> labels = new ArrayList<String>(); labels.addAll(labelsInTaskbagAndText()); if (labels.size() == 0) { onHelpClick(); return; } builder.setItems(labels.toArray(new String[0]), new OnClickListener() { @Override public void onClick(DialogInterface arg0, int which) { replaceTextAtSelection(labels.get(which) + " "); } }); // Create the AlertDialog AlertDialog dialog = builder.create(); dialog.setTitle(R.string.addcontextproject); dialog.show(); }
Example #16
Source Project: Paddle-Lite-Demo Author: PaddlePaddle File: MainActivity.java License: Apache License 2.0 | 6 votes |
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (grantResults[0] != PackageManager.PERMISSION_GRANTED || grantResults[1] != PackageManager.PERMISSION_GRANTED) { new AlertDialog.Builder(MainActivity.this) .setTitle("Permission denied") .setMessage("Click to force quit the app, then open Settings->Apps & notifications->Target " + "App->Permissions to grant all of the permissions.") .setCancelable(false) .setPositiveButton("Exit", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { MainActivity.this.finish(); } }).show(); } }
Example #17
Source Project: imsdk-android Author: qunarcorp File: JzvdStd.java License: MIT License | 6 votes |
@Override public void showWifiDialog() { super.showWifiDialog(); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setMessage(getResources().getString(R.string.tips_not_wifi)); builder.setPositiveButton(getResources().getString(R.string.tips_not_wifi_confirm), (dialog, which) -> { dialog.dismiss(); replayTextView.setVisibility(GONE); startVideo(); WIFI_TIP_DIALOG_SHOWED = true; }); builder.setNegativeButton(getResources().getString(R.string.tips_not_wifi_cancel), (dialog, which) -> { dialog.dismiss(); clearFloatScreen(); }); builder.setOnCancelListener(DialogInterface::dismiss); builder.create().show(); }
Example #18
Source Project: stynico Author: stytooldex File: HCActivity.java License: MIT License | 6 votes |
public void showEditTextDialog(Context context, String title, final int itemPosition) { final EditText edit=new EditText(context); //设置只能输入小数 edit.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); edit.setText(items.get(itemPosition).get("delay") + ""); new AlertDialog.Builder(context) .setTitle(title) .setView(edit) .setPositiveButton("确定", new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface p1, int p2) { // TODO: Implement this method items.get(itemPosition).put("delay", edit.getText().toString()); adapter.notifyDataSetChanged(); } }) .setNegativeButton("取消", null).show(); }
Example #19
Source Project: SimpleAdapterDemo Author: JustinRoom File: AboutFragment.java License: Apache License 2.0 | 6 votes |
private void showNewVersionDialog(String content, final String fileName) { if (getActivity() == null) return; new AlertDialog.Builder(getActivity()) .setTitle("新版本提示") .setMessage(content) .setPositiveButton("更新", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String url = BuildConfig.BASE_URL + BuildConfig.DOWNLOAD_URL; Uri uri = Uri.parse(String.format(Locale.CHINA, url, fileName)); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }) .setNegativeButton("知道了", null) .show(); }
Example #20
Source Project: Klyph Author: jonathangerbaud File: PreferencesActivity.java License: MIT License | 5 votes |
private void handleSetNotifications() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = sharedPreferences.edit(); @SuppressWarnings("deprecation") CheckBoxPreference cpref = (CheckBoxPreference) findPreference("preference_notifications"); pendingAnnounce = false; final Session session = Session.getActiveSession(); List<String> permissions = session.getPermissions(); if (!permissions.containsAll(PERMISSIONS)) { pendingAnnounce = true; editor.putBoolean(KlyphPreferences.PREFERENCE_NOTIFICATIONS, false); editor.commit(); cpref.setChecked(false); AlertUtil.showAlert(this, R.string.preferences_notifications_permissions_title, R.string.preferences_notifications_permissions_message, R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { requestPublishPermissions(session); } }, R.string.cancel, null); return; } editor.putBoolean(KlyphPreferences.PREFERENCE_NOTIFICATIONS, true); editor.commit(); cpref.setChecked(true); startOrStopNotificationsServices(); if (sharedPreferences.getBoolean(KlyphPreferences.PREFERENCE_NOTIFICATIONS_BIRTHDAY, false) == true) KlyphService.startBirthdayService(); }
Example #21
Source Project: social-app-android Author: rozdoum File: BaseActivity.java License: Apache License 2.0 | 5 votes |
@Override public void showWarningDialog(String message, DialogInterface.OnClickListener listener) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(message); builder.setPositiveButton(R.string.button_ok, listener); builder.show(); }
Example #22
Source Project: Lanmitm Author: wg-hub File: RadioDialog.java License: GNU General Public License v2.0 | 5 votes |
public Builder setRadio4(int radioText, boolean checked, DialogInterface.OnClickListener listener) { this.radioText3 = (String) context.getText(radioText); this.radioClickListener3 = listener; this.radioCheck3 = checked; return this; }
Example #23
Source Project: ExpandableButtonMenu Author: lemonlabs File: ExpandableMenuOverlay.java License: Apache License 2.0 | 5 votes |
public void init(AttributeSet attrs) { // We create a fake dialog which dims the screen and we display the expandable menu as content mDialog = new Dialog(getContext(), android.R.style.Theme_Translucent_NoTitleBar); mDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); WindowManager.LayoutParams lp = mDialog.getWindow().getAttributes(); lp.dimAmount = dimAmount; mDialog.getWindow().setAttributes(lp); mButtonMenu = new ExpandableButtonMenu(getContext(), attrs); mButtonMenu.setButtonMenuParentOverlay(this); mDialog.setContentView(mButtonMenu); mDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialogInterface) { setVisibility(View.INVISIBLE); mButtonMenu.toggle(); } }); // Catch events when keyboard button are clicked. Used to dismiss the menu // on 'back' button mDialog.setOnKeyListener(this); // Clicking this view will expand the button menu setOnClickListener(this); }
Example #24
Source Project: TestChat Author: HelloChenJinJun File: CommonSubscriber.java License: Apache License 2.0 | 5 votes |
private void initLoadDialog() { if (mContextSoftReference.get() != null) { mDialog = new ProgressDialog(mContextSoftReference.get()); mDialog.setMessage("正在加载..........请稍候.........."); mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { dialog.cancel(); unsubscribe(); } }); } }
Example #25
Source Project: 10000sentences Author: tkrajina File: WordsAdapter.java License: Apache License 2.0 | 5 votes |
private void removeWord(final WordAnnotation word) { DialogUtils.showYesNoButton( (Activity) this.getContext(), getContext().getString(R.string.remove_word_from_annotation), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int which) { if (which == Dialog.BUTTON_POSITIVE) { annotationService.removeWordToAnnotation(annotation, word); remove(word); notifyDataSetChanged(); } } }); }
Example #26
Source Project: letv Author: JackChan1999 File: MyDownloadActivity.java License: Apache License 2.0 | 5 votes |
public void onDoBatchDelete() { if (isSelectAll()) { DialogUtil.showDialog(this, getBatchDelDialogTitle(), "", "", null, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (MyDownloadActivity.this.getCurrentBatchDelFragment() != null) { MyDownloadActivity.this.getCurrentBatchDelFragment().onDoBatchDelete(); } dialog.dismiss(); } }); } else if (getCurrentBatchDelFragment() != null) { getCurrentBatchDelFragment().onDoBatchDelete(); } }
Example #27
Source Project: ghwatch Author: Daskiworks File: WatchedRepositoriesActivity.java License: Apache License 2.0 | 5 votes |
private void showServerCommunicationErrorAllertDialog(LoadingStatus loadingStatus, boolean showStaledDataWarning) { StringBuilder sb = new StringBuilder(); sb.append(getString(loadingStatus.getResId())); if (showStaledDataWarning) { sb.append("\n").append(getString(R.string.message_staled_data)); } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(sb).setCancelable(true).setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { } }); builder.create().show(); }
Example #28
Source Project: react-native-GPay Author: hellochirag File: DatePickerDialogFragment.java License: MIT License | 5 votes |
@Override public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); if (mOnDismissListener != null) { mOnDismissListener.onDismiss(dialog); } }
Example #29
Source Project: OpenHub Author: ThirtyDegreesRay File: EditLabelDialog.java License: GNU General Public License v3.0 | 5 votes |
public void show() { dialog.show(); dialog.getButton(DialogInterface.BUTTON_POSITIVE) .setOnClickListener(v -> { if(validateLabel()){ updateOrCreateLabel(); dialog.dismiss(); } }); }
Example #30
Source Project: fritz-examples Author: fritzlabs File: CameraConnectionFragment.java License: MIT License | 5 votes |
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Activity activity = getActivity(); return new AlertDialog.Builder(activity) .setMessage(getArguments().getString(ARG_MESSAGE)) .setPositiveButton( android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialogInterface, final int i) { activity.finish(); } }) .create(); }