List of usage examples for android.app AlertDialog.Builder setCancelable
public void setCancelable(boolean flag)
From source file:com.jaspersoft.android.jaspermobile.dialog.SaveReportOptionDialogFragment.java
@NonNull @Override// w w w .j av a2 s . c o m public Dialog onCreateDialog(Bundle savedInstanceState) { final View customLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_save_report_option, null); reportOptionName = (EditText) customLayout.findViewById(R.id.reportOptionName); nameDuplicationIndicator = (TextView) customLayout.findViewById(R.id.reportOptionDuplication); if (mCurrentlySelected > 0) { String reportOptionName = mReportOptionsTitles.get(mCurrentlySelected); this.reportOptionName.setText(reportOptionName); checkNameDuplication(reportOptionName); } reportOptionName.addTextChangedListener(new RenameTextWatcher()); reportOptionName.setSelection(reportOptionName.getText().length()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(customLayout); builder.setTitle(R.string.ro_save_ro); builder.setCancelable(false); builder.setPositiveButton(R.string.sp_save_btn, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String reportOptionName = SaveReportOptionDialogFragment.this.reportOptionName.getText().toString(); if (mDialogListener != null) { ((SaveReportOptionDialogCallback) mDialogListener).onSaveConfirmed(reportOptionName); } } }); builder.setNegativeButton(R.string.cancel, null); saveReportOptionDialog = builder.create(); saveReportOptionDialog.setOnShowListener(this); return saveReportOptionDialog; }
From source file:com.justplay1.shoppist.features.lists.items.ListItemsFragment.java
@Override public void onNoteClick(String note) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setCancelable(true); builder.setTitle(getString(R.string.note)); builder.setMessage(note);//from www . j av a 2s .c o m AlertDialog dialog = builder.create(); dialog.show(); }
From source file:com.nineducks.hereader.HackfulReaderActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog result = null;// w ww . jav a 2 s .c o m AlertDialog.Builder builder = null; switch (id) { case R.id.open_dialog: builder = new AlertDialog.Builder(this); builder.setTitle(R.string.open_dialog_title); builder.setItems(R.array.open_dialog_options, (OnClickListener) itemsController); builder.setCancelable(true); result = builder.create(); break; case R.id.about_dialog: builder = new AlertDialog.Builder(this); builder.setTitle(R.string.about_dialog_title); ScrollView scroll = new ScrollView(this); TextView msg = new TextView(this); SpannableString s = new SpannableString(getString(R.string.about_dialog_text)); Linkify.addLinks(s, Linkify.WEB_URLS); msg.setText(s); msg.setMovementMethod(LinkMovementMethod.getInstance()); msg.setTextSize(16); msg.setPadding(15, 15, 15, 15); scroll.addView(msg); builder.setView(scroll); builder.setInverseBackgroundForced(true); result = builder.create(); break; } return result; }
From source file:com.renard.ocr.documents.creation.visualisation.LayoutQuestionDialog.java
@NonNull @Override/*from w w w . ja v a2 s. c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { getAnalytics().sendScreenView(SCREEN_NAME); final Context context = getContext(); mLayout = null; Pair<String, String> language = PreferencesUtils.getOCRLanguage(context); final OcrLanguage.InstallStatus installStatus = OcrLanguageDataStore.isLanguageInstalled(language.first, context); if (!installStatus.isInstalled()) { final String defaultLanguage = context.getString(R.string.default_ocr_language); final String defaultLanguageDisplay = context.getString(R.string.default_ocr_display_language); language = Pair.create(defaultLanguage, defaultLanguageDisplay); } mLanguage = language.first; AlertDialog.Builder builder; builder = new AlertDialog.Builder(context); builder.setCancelable(false); View layout = View.inflate(context, R.layout.dialog_layout_question, null); builder.setView(layout); final ViewFlipper titleViewFlipper = (ViewFlipper) layout.findViewById(R.id.layout_title); final ImageView columnLayout = (ImageView) layout.findViewById(R.id.column_layout); final ImageView pageLayout = (ImageView) layout.findViewById(R.id.page_layout); final ImageSwitcher fairy = (ImageSwitcher) layout.findViewById(R.id.fairy_layout); fairy.setFactory(new ViewSwitcher.ViewFactory() { public View makeView() { return new ImageView(context); } }); fairy.setImageResource(R.drawable.fairy_looks_center); fairy.setInAnimation(context, android.R.anim.fade_in); fairy.setOutAnimation(context, android.R.anim.fade_out); final int color = context.getResources().getColor(R.color.progress_color); final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.LIGHTEN); columnLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLayout != LayoutKind.COMPLEX) { fairy.setImageResource(R.drawable.fairy_looks_left); titleViewFlipper.setDisplayedChild(2); columnLayout.setColorFilter(colorFilter); pageLayout.clearColorFilter(); mLayout = LayoutKind.COMPLEX; } } }); pageLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mLayout != LayoutKind.SIMPLE) { mLayout = LayoutKind.SIMPLE; titleViewFlipper.setDisplayedChild(1); fairy.setImageResource(R.drawable.fairy_looks_right); pageLayout.setColorFilter(colorFilter); columnLayout.clearColorFilter(); } } }); final Spinner langButton = (Spinner) layout.findViewById(R.id.button_language); List<OcrLanguage> installedLanguages = OcrLanguageDataStore.getInstalledOCRLanguages(context); // actual values uses by tesseract final ArrayAdapter<OcrLanguage> adapter = new ArrayAdapter<>(context, R.layout.language_spinner_item, installedLanguages); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); langButton.setAdapter(adapter); for (int i = 0; i < installedLanguages.size(); i++) { OcrLanguage lang = installedLanguages.get(i); if (lang.getValue().equals(language.first)) { langButton.setSelection(i, false); break; } } langButton.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { final OcrLanguage item = adapter.getItem(position); mLanguage = item.getValue(); PreferencesUtils.saveOCRLanguage(context, item); getAnalytics().sendOcrLanguageChanged(item); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); builder.setPositiveButton(R.string.start_scan, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (mLayout == null) { mLayout = LayoutKind.SIMPLE; } LayoutChoseListener listener = (LayoutChoseListener) getActivity(); listener.onLayoutChosen(mLayout, mLanguage); getAnalytics().sendOcrStarted(mLanguage, mLayout); dialog.dismiss(); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { getActivity().finish(); dialog.dismiss(); getAnalytics().sendLayoutDialogCancelled(); } }); return builder.create(); }
From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java
public void getTextInputForAction(String title, String hintText, String doButtonText, String dontButtonText, final RunnableWithResults<String> callback) { final EditText textView = new EditText(activity); textView.setHint(hintText);//w w w . j ava 2 s. c om AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setView(textView); builder.setTitle(title); builder.setCancelable(false).setPositiveButton(doButtonText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.callback(textView.getText().toString()); } }).setNegativeButton(dontButtonText, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); builder.show(); }
From source file:ua.naiksoftware.chars.Sender.java
@Override protected void onPreExecute() { Log.d(tag, "onPreExecute begin"); ProgressBar progressBar = new ProgressBar(EngineActivity.CONTEXT); progressBar.setIndeterminate(true);//w w w.java 2 s . c om AlertDialog.Builder builder = new AlertDialog.Builder(EngineActivity.CONTEXT); builder.setCustomTitle(progressBar); builder.setIcon(android.R.drawable.ic_menu_upload); builder.setMessage(R.string.send_record); builder.setCancelable(false); dialog = builder.create(); dialog.show(); Log.d(tag, "onPreExecute end"); }
From source file:com.microblink.blinkid.ScanActivity.java
@Override public void onNotSupported(NotSupportedReason reason) { // this method is called when RecognizerView detects that device is not // supported and describes the not supported reason via enum Log.e(this, "Not supported reason: {}", reason); AlertDialog.Builder ab = new AlertDialog.Builder(this); ab.setCancelable(false).setTitle("Feature not supported") .setMessage("Feature not supported! Reason: " + reason.name()) .setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override/*from w ww . j a v a2s. c o m*/ public void onClick(DialogInterface dialog, int which) { if (dialog != null) dialog.dismiss(); finish(); } }).create().show(); }
From source file:com.microblink.blinkid.ScanActivity.java
@Override public void onStartupError(Throwable exc) { // this method is called when error happens whilst loading RecognizerView // this can be either because camera is busy and cannot be opened // or native library could not be loaded because of unsupported processor architecture Log.e(this, exc, "On startup error!"); AlertDialog.Builder ab = new AlertDialog.Builder(this); ab.setCancelable(false).setTitle("Error") .setMessage("Error while loading camera or library: " + exc.getMessage()) .setNeutralButton("OK", new DialogInterface.OnClickListener() { @Override/*from ww w . ja v a 2 s .c o m*/ public void onClick(DialogInterface dialog, int which) { if (dialog != null) dialog.dismiss(); finish(); } }).create().show(); }
From source file:co.dilaver.quoter.fragments.PopularFragment.java
@Override public void pqInfoClicked() { android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.str_Info)); builder.setMessage(Html.fromHtml(getString(R.string.str_TakenFromReddit))); builder.setCancelable(true); builder.show();// ww w .j a va2s . c o m }
From source file:com.vishnuvalleru.travelweatheralertsystem.MainActivity.java
private void showAlert(String title, String message) { AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this); alert.setTitle(title);/* w w w.j a v a 2 s . co m*/ alert.setCancelable(false); alert.setMessage(message); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert.show(); }