List of usage examples for android.app Dialog setOnDismissListener
public void setOnDismissListener(@Nullable OnDismissListener listener)
From source file:com.adithya321.sharesanalysis.fragments.PurchaseShareFragment.java
@Override public void onClick(final View view) { switch (view.getId()) { case R.id.select_date: Dialog dialog = new DatePickerDialog(getActivity(), onDateSetListener, year_start, month_start - 1, day_start);//from w ww . j av a 2 s . c om dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { ((TextView) view).setText(new StringBuilder().append(day_start).append("/").append(month_start) .append("/").append(year_start)); } }); dialog.show(); break; } }
From source file:com.zogamonline.laisiangthou.MaterialPreferenceLib.custom_preferences.DialogPreference.java
protected void showDialog(Bundle state) { Context context = getContext(); mWhichButtonClicked = DialogInterface.BUTTON_NEGATIVE; mBuilder = new AlertDialog.Builder(context).setTitle(mDialogTitle).setIcon(mDialogIcon) .setPositiveButton(mPositiveButtonText, this).setNegativeButton(mNegativeButtonText, this); View contentView = onCreateDialogView(); if (contentView != null) { onBindDialogView(contentView);//from w w w. j a v a 2 s . c o m mBuilder.setView(contentView); } else { mBuilder.setMessage(mDialogMessage); } onPrepareDialogBuilder(mBuilder); PreferenceManagerEx.getInstance().registerOnActivityDestroyListener(getPreferenceManager(), this); // Create the dialog final Dialog dialog = mDialog = mBuilder.create(); if (state != null) { dialog.onRestoreInstanceState(state); } if (needInputMethod()) { requestInputMethod(dialog); } dialog.setOnDismissListener(this); dialog.show(); }
From source file:com.samebits.beacon.locator.ui.activity.MainNavigationActivity.java
@TargetApi(18) private void verifyBluetooth() { try {/*from ww w .ja v a 2 s . c om*/ if (!mBeaconManager.checkAvailability()) { final Dialog bleDialog = DialogBuilder.createSimpleOkErrorDialog(this, getString(R.string.dialog_error_ble_not_enabled), getString(R.string.error_message_please_enable_bluetooth)); bleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { finish(); System.exit(0); } }); bleDialog.show(); } } catch (RuntimeException e) { final Dialog bleDialog = DialogBuilder.createSimpleOkErrorDialog(this, getString(R.string.dialog_error_ble_not_supported), getString(R.string.error_message_bluetooth_le_not_supported)); bleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { finish(); System.exit(0); } }); bleDialog.show(); } }
From source file:com.samebits.beacon.locator.ui.activity.MainNavigationActivity.java
@TargetApi(23) private void checkPermissions() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // Android M Permission check if (this.checkSelfPermission( Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { final Dialog permDialog = DialogBuilder.createSimpleOkErrorDialog(this, getString(R.string.dialog_error_need_location_access), getString(R.string.error_message_location_access_need_tobe_granted)); permDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @TargetApi(23)//from w w w . j a v a2 s.c om @Override public void onDismiss(DialogInterface dialog) { requestPermissions(new String[] { Manifest.permission.ACCESS_COARSE_LOCATION }, PERMISSION_REQUEST_COARSE_LOCATION); } }); permDialog.show(); } } }
From source file:com.samebits.beacon.locator.ui.activity.MainNavigationActivity.java
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], int[] grantResults) { switch (requestCode) { case PERMISSION_REQUEST_COARSE_LOCATION: { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Log.d(Constants.TAG, "coarse location permission granted"); } else {/* w ww . j av a 2 s . c om*/ final Dialog permFailedDialog = DialogBuilder.createSimpleOkErrorDialog(this, getString(R.string.dialog_error_functionality_limited), getString(R.string.error_message_location_access_not_granted)); permFailedDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { //finish(); } }); permFailedDialog.show(); } return; } } }
From source file:net.alchemiestick.katana.winehqappdb.SearchView.java
@Override protected Dialog onCreateDialog(int id) { Dialog diag; switch (id) { case ABOUT_DLG: diag = about_dialog();/*from ww w . j ava2 s. c o m*/ break; case FILTERS_DLG: // TODO: create the real filters dialog and have it modify webData accordingly. diag = new filter_dialog(this, this.webData); break; case WINAPP_DLG: diag = new app_dialog(this); diag.setOnDismissListener(appDismiss); diag.setOnShowListener(appShow); break; default: diag = null; } return diag; }
From source file:com.polyvi.xface.extension.inappbrowser.XInAppBrowser.java
/** * ???// w w w . ja v a2 s. c o m * @param theme * @param animation * @param windowFeature ? * @return dialog */ protected Dialog createDialog(int theme, int animation, int windowFeature) { Dialog dialog = new Dialog(mContext, theme); dialog.getWindow().getAttributes().windowAnimations = animation; dialog.requestWindowFeature(windowFeature); dialog.setCancelable(true); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { public void onDismiss(DialogInterface dialog) { mBrowserListener.onDismiss(mWebContext); } }); return dialog; }
From source file:com.ahao.preferencelibrary.preference.DialogPreference.java
/** * Shows the dialog associated with this Preference. This is normally initiated * automatically on clicking on the preference. Call this method if you need to * show the dialog on some other event./* w w w . j a va 2s . c om*/ * * @param state Optional instance state to restore on the dialog */ protected void showDialog(Bundle state) { Context context = getContext(); mWhichButtonClicked = DialogInterface.BUTTON_NEGATIVE; mBuilder = new AlertDialog.Builder(context).setTitle(mDialogTitle).setIcon(mDialogIcon) .setPositiveButton(mPositiveButtonText, this).setNegativeButton(mNegativeButtonText, this); View contentView = onCreateDialogView(); if (contentView != null) { onBindDialogView(contentView); mBuilder.setView(contentView); } else { mBuilder.setMessage(mDialogMessage); } onPrepareDialogBuilder(mBuilder); PreferenceManagerEx.getInstance().registerOnActivityDestroyListener(getPreferenceManager(), this); // Create the dialog final Dialog dialog = mDialog = mBuilder.create(); if (state != null) { dialog.onRestoreInstanceState(state); } if (needInputMethod()) { requestInputMethod(dialog); } dialog.setOnDismissListener(this); dialog.show(); }
From source file:com.rareventure.gps2.reviewer.SettingsActivity.java
@Override protected Dialog onCreateDialog(int id) { Dialog dialog; if (id == 0 || id == 1) dialog = new PasswordDialog(this, GpsTrailerCrypt.prefs.isNoPassword); else if (id == 2 || id == 3) dialog = new PasswordDialog(this, true); else/*from ww w. ja va2 s . c o m*/ return super.onCreateDialog(id); dialog.setOnDismissListener(this); return dialog; }
From source file:com.xxjwd.sjbg.MainActivity.java
private void doShowDownloadDialog() { Dialog builder = new Dialog(this); //builder.requestWindowFeature(Window.FEATURE_NO_TITLE); builder.setTitle("???"); builder.getWindow().setBackgroundDrawable( new ColorDrawable(android.graphics.Color.TRANSPARENT)); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override/*from w w w. j a v a 2 s .co m*/ public void onDismiss(DialogInterface dialogInterface) { //nothing; } }); ImageView imageView = new ImageView(this); imageView.setImageResource(R.drawable.erweima); imageView.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("http://61.163.45.215:808/sjbg/download.html"); intent.setData(content_url); startActivity(intent); return true; } } ); builder.addContentView(imageView, new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); builder.show(); }