List of usage examples for android.app Dialog setCanceledOnTouchOutside
public void setCanceledOnTouchOutside(boolean cancel)
From source file:com.jaspersoft.android.jaspermobile.dialog.ReportOptionsFragmentDialog.java
@NonNull @Override//w w w .ja v a 2 s .c o m public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final View reportOptionLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_report_options, null); loadingBar = (ProgressBar) reportOptionLayout.findViewById(R.id.reportOptionsProgress); reportOptionsList = (ListView) reportOptionLayout.findViewById(R.id.reportOptionsList); builder.setTitle(R.string.ro_show); builder.setView(reportOptionLayout); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(canceledOnTouchOutside); dialog.setOnShowListener(this); return dialog; }
From source file:eu.power_switch.gui.dialog.DeveloperOptionsDialog.java
@NonNull @Override// ww w .ja v a 2 s . c om public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = getActivity().getLayoutInflater(); rootView = inflater.inflate(R.layout.dialog_developer_options, null); geofenceApiHandler = new GeofenceApiHandler(getActivity()); CheckBox checkBox_playStoreMode = (CheckBox) rootView.findViewById(R.id.checkBox_playStoreMode); checkBox_playStoreMode.setChecked(DeveloperPreferencesHandler.getPlayStoreMode()); checkBox_playStoreMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { DeveloperPreferencesHandler.setPlayStoreMode(isChecked); } }); Button resetShowcasesButton = (Button) rootView.findViewById(R.id.button_resetShowcases); resetShowcasesButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MaterialShowcaseView.resetAll(getContext()); } }); Button removeAllGeofences = (Button) rootView.findViewById(R.id.button_removeAllGeofences); removeAllGeofences.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { geofenceApiHandler.removeAllGeofences(); } }); Button forceUnknownExceptionDialog = (Button) rootView .findViewById(R.id.button_forceUnknownExceptionDialog); forceUnknownExceptionDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { StatusMessageHandler.showErrorDialog(getContext(), new Exception("Unknown error during runtime!")); } }); Button forceUnhandledException = (Button) rootView.findViewById(R.id.button_forceUnhandledException); forceUnhandledException.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { throw new RuntimeException("Unhandled Exception"); } }); final Spinner spinnerLanguage = (Spinner) rootView.findViewById(R.id.spinner_language); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(), R.array.locales, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerLanguage.setAdapter(adapter); spinnerLanguage.setSelection(getIndex(spinnerLanguage, DeveloperPreferencesHandler.getLocale().toString())); spinnerLanguage.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String localeString = spinnerLanguage.getItemAtPosition(position).toString(); DeveloperPreferencesHandler.setLocale(new Locale(localeString)); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); CheckBox checkBoxForceLanguage = (CheckBox) rootView.findViewById(R.id.checkBox_forceLanguage); checkBoxForceLanguage.setChecked(DeveloperPreferencesHandler.getForceLanguage()); checkBoxForceLanguage.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { DeveloperPreferencesHandler.setForceLanguage(isChecked); } }); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(rootView); builder.setTitle("Developer Options"); builder.setNeutralButton(android.R.string.ok, null); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); // prevent close dialog on touch outside window dialog.show(); return dialog; }
From source file:com.jaspersoft.android.jaspermobile.dialog.ProgressDialogFragment.java
@NonNull @Override//from ww w . j ava 2s. c o m public Dialog onCreateDialog(Bundle savedInstanceState) { View customLayout = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_progress, null); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); TextView message = (TextView) customLayout.findViewById(R.id.progressMessage); message.setText(getString(loadingMessage)); builder.setView(customLayout); Dialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.setOnShowListener(new OnShowListener() { @Override public void onShow(DialogInterface dialog) { if (!isPreparing) { dialog.dismiss(); return; } if (onShowListener != null) { onShowListener.onShow(dialog); } isPreparing = false; } }); return dialog; }
From source file:net.bither.ui.base.DialogFragmentHDMSingularColdSeed.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.setCanceledOnTouchOutside(false); dialog.setCancelable(false);//from w w w . j a va 2s.c o m setCancelable(false); return dialog; }
From source file:de.awisus.refugeeaidleipzig.views.login.FragmentAnmelden.java
/** * Called when this dialogue is created; Android-specific * Inflates the layout, initialises text field and spinner, initialises the spinner adapter to * show up accommodations and sets the dialogue buttons * * @param savedInstanceState Bundle of saved instance state * @return dialogue created by the AlertDialog.Builder *///from ww w . j a va 2s.co m @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Button btAnmelden, btNeu; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_anmelden, null); warnungID = R.string.warnung_anmelden; etName = (EditText) view.findViewById(R.id.etName); etPasswort = (EditText) view.findViewById(R.id.etPassword); btAnmelden = (Button) view.findViewById(R.id.btAnmelden); btNeu = (Button) view.findViewById(R.id.btNeu); btAnmelden.setOnClickListener(this); btNeu.setOnClickListener(this); builder.setView(view); Dialog dialog = builder.create(); dialog.setTitle(R.string.titel_login); dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); return dialog; }
From source file:com.tutor.activity.SlidingActivity.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (isShowLeft) { this.isShowLeft = mSlidingMenu.showLeftView(); return false; }/* w w w .j av a2 s . c o m*/ final Dialog dialog = new Dialog(this, R.style.Theme_dialog); dialog.setCanceledOnTouchOutside(true); View view = LayoutInflater.from(this).inflate(R.layout.dialog_yesno_layout, null); dialog.setContentView(view); TextView tvMessage = (TextView) dialog.findViewById(R.id.tvMessage); tvMessage.setText(""); Button confirmButton = (Button) dialog.findViewById(R.id.btnConfirm); confirmButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); android.os.Process.killProcess(android.os.Process.myPid()); } }); Button cancelButton = (Button) dialog.findViewById(R.id.btnCancel); cancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } return false; }
From source file:com.doodle.android.chips.dialog.ChipsEmailDialogFragment.java
@NonNull @Override/*www . j a v a 2 s . c o m*/ public Dialog onCreateDialog(Bundle savedInstanceState) { View view = View.inflate(getContext(), R.layout.dialog_chips_email, null); Dialog dialog = new AlertDialog.Builder(getActivity()).setCancelable(true).setView(view).create(); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); setCancelable(true); mEditText = (MaterialEditText) view.findViewById(R.id.et_ch_email); mConfirm = (Button) view.findViewById(R.id.bu_ch_confirm); mCancel = (Button) view.findViewById(R.id.bu_ch_cancel); TextView titleView = (TextView) view.findViewById(R.id.tv_ch_title); mErrorMsg = getString(R.string.please_enter_a_valid_email_address); Bundle bundle = getArguments(); if (bundle != null) { if (bundle.containsKey(EXTRA_STRING_TEXT)) { mInitialText = bundle.getString(EXTRA_STRING_TEXT); mEditText.setText(mInitialText); } if (bundle.containsKey(EXTRA_STRING_TITLE)) titleView.setText(bundle.getString(EXTRA_STRING_TITLE)); if (bundle.containsKey(EXTRA_STRING_PLACEHOLDER)) { mEditText.setHint(bundle.getString(EXTRA_STRING_PLACEHOLDER)); mEditText.setFloatingLabelText(bundle.getString(EXTRA_STRING_PLACEHOLDER)); } if (bundle.containsKey(EXTRA_STRING_CONFIRM)) mConfirm.setText(bundle.getString(EXTRA_STRING_CONFIRM)); if (bundle.containsKey(EXTRA_STRING_CANCEL)) mCancel.setText(bundle.getString(EXTRA_STRING_CANCEL)); if (bundle.containsKey(EXTRA_STRING_ERROR_MSG)) mErrorMsg = bundle.getString(EXTRA_STRING_ERROR_MSG); } mConfirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { positiveClick(); } }); mCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { negativeClick(); } }); mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { positiveClick(); return true; } }); return dialog; }
From source file:cn.apputest.ctria.section2.Dialog_DriverLicenseCard.java
public void alert_DriverLicenseCardDialog(Context context, EditText carnum) { // TODO Auto-generated method stub contextAlawys = context;//from w w w . j ava2s .c o m preferencesuser = context.getSharedPreferences(Login.FILE_USER, Context.MODE_PRIVATE); String DBName = preferencesuser.getString(Login.KEY_NAME, "1"); helper = new DBHelper(context, DBName + "_DB"); mgr = new DBManager(helper); final Dialog dialog = new Dialog(context, R.style.add_dialog); View vv = LayoutInflater.from(context) .inflate(R.layout.section2activity_lucha2_alert_driverlicensecard_dialog, null); dialog.setCanceledOnTouchOutside(true); dialog.setContentView(vv); // dialog.getWindow().setLayout(480, 524); // dialog.getWindow().setLayout(720, 1050); Resources r = context.getResources(); int x = (int) r.getDimension(R.dimen.x320); int y = (int) r.getDimension(R.dimen.y350); dialog.getWindow().setLayout(x, y); dialog.getWindow().setGravity(Gravity.BOTTOM); Information = (TextView) vv.findViewById(R.id.DriverLicensecard); Information.setClickable(false); Information.setLongClickable(false); Information.setMovementMethod(ScrollingMovementMethod.getInstance()); getDriverLicense(carnum); ImageButton backButton = (ImageButton) vv.findViewById(R.id.backImageButton); backButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); }
From source file:org.hopestarter.wallet.util.BitmapFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { final Bundle args = getArguments(); final Bitmap bitmap = (Bitmap) args.getParcelable(KEY_BITMAP); final CharSequence label = args.getCharSequence(KEY_LABEL); final CharSequence address = args.getCharSequence(KEY_ADDRESS); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.bitmap_dialog); dialog.setCanceledOnTouchOutside(true); final ImageView imageView = (ImageView) dialog.findViewById(R.id.bitmap_dialog_image); imageView.setImageBitmap(bitmap);/*w w w . ja va 2 s . c o m*/ final View labelButtonView = dialog.findViewById(R.id.bitmap_dialog_label_button); final TextView labelView = (TextView) dialog.findViewById(R.id.bitmap_dialog_label); if (getResources().getBoolean(R.bool.show_bitmap_dialog_label) && label != null) { labelView.setText(Html.fromHtml(Formats.maybeRemoveOuterHtmlParagraph(label))); labelButtonView.setVisibility(View.VISIBLE); if (address != null) { labelButtonView.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { final Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, address); startActivity(Intent.createChooser(intent, getString(R.string.bitmap_fragment_share))); } }); } else { labelButtonView.setEnabled(false); } } else { labelButtonView.setVisibility(View.GONE); } final View dialogView = dialog.findViewById(R.id.bitmap_dialog_group); dialogView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { dismiss(); } }); return dialog; }
From source file:com.hivewallet.androidclient.wallet.ui.WalletAddressDialogFragment.java
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { address = getArguments().getString(KEY_ADDRESS); final Bitmap qrCode = (Bitmap) getArguments().getParcelable(KEY_QR_CODE); final Dialog dialog = new Dialog(activity); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.wallet_address_dialog); dialog.setCanceledOnTouchOutside(true); final ImageView imageView = (ImageView) dialog.findViewById(R.id.iv_qr_code); imageView.setImageBitmap(qrCode);/*from w ww. j a v a 2 s . co m*/ imageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { dismiss(); } }); final TextView textView = (TextView) dialog.findViewById(R.id.tv_bitcoin_address); textView.setText(address); final ImageButton copyButton = (ImageButton) dialog.findViewById(R.id.ib_copy_wallet_address); copyButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleCopy(); } }); final ImageButton shareButton = (ImageButton) dialog.findViewById(R.id.ib_share_wallet_address); shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { handleShare(); } }); return dialog; }