List of usage examples for android.app Dialog setCanceledOnTouchOutside
public void setCanceledOnTouchOutside(boolean cancel)
From source file:Main.java
public static void showDialogAlert(Context ctx, String title, String body) { AlertDialog.Builder builder = new AlertDialog.Builder(ctx); builder.setTitle(title);// www . ja v a2s.c o m builder.setMessage(body); Dialog dialogDetails = builder.create(); dialogDetails.setCanceledOnTouchOutside(true); dialogDetails.show(); }
From source file:org.wahtod.wififixer.ui.BaseDialogFragment.java
protected static void setDialog(DialogFragment f) { Dialog d = f.getDialog(); if (d != null) { d.setCanceledOnTouchOutside(true); d.getWindow().getAttributes().softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN; }// w ww.jav a 2 s . c om }
From source file:it.mb.whatshare.Dialogs.java
/** * Shows a dialog informing the user that the action she's trying to perform * requires an Internet connection which is not available at the moment. * //from w w w.j a v a 2 s . co m * @param activity * the caller activity * @param whyItsNeeded * the resource ID within <tt>strings.xml</tt> that explains to * the user why an Internet connection is needed by the operation * @param finishActivityOnOk * whether the caller activity must be {@link Activity#finish()} * 'ed after the user hides the dialog */ public static void noInternetConnection(final FragmentActivity activity, final int whyItsNeeded, final boolean finishActivityOnOk) { new PatchedDialogFragment() { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder; if (finishActivityOnOk) { builder = getNoUiBuilder(activity); } else { builder = getBuilder(activity); } builder.setMessage(getString(R.string.no_internet_connection, getString(whyItsNeeded))); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(!finishActivityOnOk); return dialog; } }.show(activity.getSupportFragmentManager(), "no_internet"); }
From source file:com.judepereira.android.co.uncyclopedia.BookmarksDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); Dao dao = new Dao(context); bookmarkList = dao.getBookmarkList(); dao.close();//w w w . j a va2 s.c om ArrayList<String> titleList = new ArrayList<String>(); Collections.reverse(bookmarkList); for (Bookmark b : bookmarkList) { titleList.add(b.getTitle()); } String[] titleArray = titleList.toArray(new String[bookmarkList.size()]); builder.setTitle("Bookmarks").setItems(titleArray, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int index) { Bookmark b = bookmarkList.get(index); client.setUniqueId(Math.random()); wikiView.loadUrl(b.getUrl()); } }); Dialog d = builder.create(); d.setCanceledOnTouchOutside(false); return d; }
From source file:com.snippet.widget.AlertDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { Bundle args = getArguments();//from ww w .ja va 2s.c o m int icon = args.getInt(ARG_ICON); String title = args.getString(ARG_TITLE); String message = args.getString(ARG_MESSAGE); boolean cancelable = args.getBoolean(ARG_CANCELABLE, true); setCancelable(cancelable); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); if (icon != 0) { builder.setIcon(android.R.drawable.ic_dialog_info); } if (!TextUtils.isEmpty(title)) { builder.setTitle(title); } builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, null); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(cancelable); return dialog; }
From source file:com.jaspersoft.android.jaspermobile.dialog.AboutDialogFragment.java
@NonNull @Override// ww w. j a v a 2s . com public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.sa_show_about); String message = getString(R.string.sa_about_info, BuildConfig.VERSION_NAME); builder.setMessage(Html.fromHtml(message)); builder.setNeutralButton(R.string.ok, null); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(true); dialog.setOnShowListener(this); return dialog; }
From source file:com.frostwire.android.gui.dialogs.TermsUseDialog.java
@Override protected void initComponents(Dialog dlg, Bundle savedInstanceState) { dlg.setCanceledOnTouchOutside(true); }
From source file:com.dspot.declex.example.expenses.fragment.NewAccountFragment.java
@Click void btnSignUp() { Dialog progressDialog = $ProgressDialog().message("Creating Account...").dialog(); progressDialog.setCanceledOnTouchOutside(false); $PutModel(signUp);/* w ww .j a v a 2s . c o m*/ if ($PutModel.Failed) { progressDialog.dismiss(); $Toast("An error occurred"); } progressDialog.dismiss(); if (signUp.getSuccess() == 1) { $MainActivity(); getActivity().finish(); } else { $Toast(signUp.getMessage()); } }
From source file:cn.stj.fphealth.views.dialog.QrcodeDialog.java
/** * Set the dialog edit text and other attribute *//*from w w w .ja va 2 s .c o m*/ @Override public void onResume() { super.onResume(); Dialog dialog = getDialog(); dialog.setCanceledOnTouchOutside(false); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); dialog.setCancelable(false); dialog.setOnKeyListener(new QrcodeDialogKeyListener()); }
From source file:com.jaspersoft.android.jaspermobile.dialog.RateAppDialog.java
@NonNull @Override//from w w w . j a va2 s . com public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setMessage(R.string.h_rd_description) .setPositiveButton(R.string.h_rd_rate, rateClickListener) .setNegativeButton(R.string.h_rd_never, neverShowAgainClickListener) .setNeutralButton(R.string.h_rd_later, showLaterClickListener); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(true); return dialog; }