List of usage examples for android.app AlertDialog.Builder setCancelable
public void setCancelable(boolean flag)
From source file:com.github.kanata3249.ffxieq.android.EquipmentSetEditActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog dialog;//www . ja v a2s . com AlertDialog.Builder builder; switch (id) { case R.string.EquipmentNotFound: builder = new AlertDialog.Builder(this); builder.setCancelable(true); builder.setMessage(getString(R.string.EquipmentNotFound)); builder.setTitle(getString(R.string.app_name)); builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dismissDialog(R.string.EquipmentNotFound); FragmentManager fm = getSupportFragmentManager(); EquipmentSetEditFragment fragment = (EquipmentSetEditFragment) fm .findFragmentById(R.id.CharacterEdit); if (fragment != null) fragment.startReselect(); } }); builder.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dismissDialog(R.string.EquipmentNotFound); FragmentManager fm = getSupportFragmentManager(); EquipmentSetEditFragment fragment = (EquipmentSetEditFragment) fm .findFragmentById(R.id.CharacterEdit); if (fragment != null) fragment.cancelReselect(); } }); dialog = builder.create(); return dialog; } return super.onCreateDialog(id); }
From source file:com.ntsync.android.sync.activities.ShowLicensesActivity.java
private void showPageOfText(String text) { // Create an AlertDialog to display the WebView in. AlertDialog.Builder builder = new AlertDialog.Builder(ShowLicensesActivity.this); builder.setCancelable(true).setView(mWebView).setTitle(R.string.license_activity_title); mTextDlg = builder.create();/*from w w w. j a v a 2 s. c o m*/ mTextDlg.setOnDismissListener(new OnDismissListener() { public void onDismiss(DialogInterface dlgi) { ShowLicensesActivity.this.finish(); } }); // Begin the loading. This will be done in a separate thread in WebView. mWebView.loadDataWithBaseURL(null, text, "text/html", "utf-8", null); mWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { if (mSpinnerDlg != null) { mSpinnerDlg.dismiss(); } if (!ShowLicensesActivity.this.isFinishing()) { mTextDlg.show(); } } }); mWebView = null; }
From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java
public void displayAlert(String arg0) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCancelable(false).setPositiveButton(OK_BUTTON_TEXT, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss();/*from w w w . ja v a 2s . c o m*/ } }).setMessage(arg0); builder.show(); }
From source file:com.outsystemscloud.andrevieira.secureDevice.java
/** * Builds and shows a native Android alert with given Strings * @param message The message the alert should display * @param buttonLabel The label of the button * @param callbackContext The callback context *//*w w w . j ava 2s. c o m*/ private synchronized void alert(final String message, final String buttonLabel) { final CordovaInterface cordova = this.cordova; final Activity activity = cordova.getActivity(); Runnable runnable = new Runnable() { public void run() { AlertDialog.Builder dlg = createDialog(cordova); dlg.setMessage(message); dlg.setCancelable(true); dlg.setPositiveButton(buttonLabel, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); System.exit(0); } }); dlg.setOnDismissListener(new DialogInterface.OnDismissListener() { public void onDismiss(final DialogInterface dialog) { System.exit(0); } }); changeTextDirection(dlg); }; }; this.cordova.getActivity().runOnUiThread(runnable); }
From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java
public void displayYesNoConfirmation(String title, String msg, final Runnable yesAction, final Runnable noAction) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { yesAction.run();/*from ww w .j av a 2 s . c o m*/ } }).setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { noAction.run(); } }).setMessage(msg).setTitle(title); builder.show(); }
From source file:com.jaspersoft.android.jaspermobile.dialog.ValueInputDialogFragment.java
@NonNull @Override/*from w w w .j a v a 2s . c om*/ public Dialog onCreateDialog(Bundle savedInstanceState) { final View customLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_ic_value, null); icValue = (EditText) customLayout.findViewById(R.id.icValue); icValue.setText(""); icValue.append(mValue); icValue.addTextChangedListener(new SimpleTextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { super.onTextChanged(s, start, before, count); icValue.setError(null); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(customLayout); builder.setTitle(mLabel); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, null); builder.setNegativeButton(R.string.cancel, null); mValueDialog = builder.create(); mValueDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); mValueDialog.setOnShowListener(this); return mValueDialog; }
From source file:com.jaspersoft.android.jaspermobile.dialog.TextInputControlDialogFragment.java
@NonNull @Override//from w w w . ja v a 2 s .c o m public Dialog onCreateDialog(Bundle savedInstanceState) { final View customLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_ic_value, null); icValue = (EditText) customLayout.findViewById(R.id.icValue); // allow only numbers if data type is numeric if (mInputControl.getType() == InputControl.Type.singleValueNumber) { icValue.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL); } String icName = mInputControl.getState().getValue(); icValue.setText(icName); icValue.setSelection(icName.length()); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(customLayout); builder.setTitle(mInputControl.getLabel()); builder.setCancelable(false); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String newIcValue = TextInputControlDialogFragment.this.icValue.getText().toString(); if (mDialogListener != null) { ((InputControlValueDialogCallback) mDialogListener).onTextValueEntered(mInputControl, newIcValue); } } }); builder.setNegativeButton(R.string.cancel, null); icValueDialog = builder.create(); icValueDialog.setOnShowListener(this); return icValueDialog; }
From source file:com.jdom.get.stuff.done.android.AndroidApplicationContextFactory.java
public void displayCollectionOfItemsAsCheckBoxes(final Collection<String> collection, final Collection<String> initialSelections, final RunnableWithResults<Collection<String>> callback) { final String[] array = collection.toArray(new String[collection.size()]); boolean[] checked = new boolean[collection.size()]; for (int i = 0; i < array.length; i++) { String value = array[i];// ww w . j a v a 2 s .c o m checked[i] = initialSelections.contains(value); } final List<String> selectedItems = new ArrayList<String>(); for (String initialSelection : initialSelections) { selectedItems.add(initialSelection); } AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setCancelable(false).setPositiveButton(OK_BUTTON_TEXT, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { callback.callback(selectedItems); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }).setMultiChoiceItems(array, checked, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { String value = array[which]; if (isChecked && !selectedItems.contains(value)) { selectedItems.add(value); } else { selectedItems.remove(value); } } }); builder.show(); }
From source file:com.christopher83.pkfmanager.PkfActivity.java
/** * Shows an alert dialog for the kernel that doesn't support the Phantom Key Presses Filter module *//*from ww w . j ava 2 s.co m*/ private void showPkfNotSupportedAlert() { // Create and set the alert dialog AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setMessage("Sorry, but your kernel doesn't include the Phantom Key Presses Filter module."); alert.setCancelable(false); alert.setPositiveButton("Close", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { PkfActivity.this.finish(); } }); // Show the dialog alert.show(); }