Example usage for android.app Dialog setOnDismissListener

List of usage examples for android.app Dialog setOnDismissListener

Introduction

In this page you can find the example usage for android.app Dialog setOnDismissListener.

Prototype

public void setOnDismissListener(@Nullable OnDismissListener listener) 

Source Link

Document

Set a listener to be invoked when the dialog is dismissed.

Usage

From source file:com.oliversride.wordryo.Utils.java

public static void setRemoveOnDismiss(final Activity activity, Dialog dialog, final int id) {
    dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        public void onDismiss(DialogInterface di) {
            activity.removeDialog(id);/*from   w  w w  .j a v  a2s. c  o m*/
        }
    });
}

From source file:com.robwilliamson.healthyesther.fragment.dialog.FixedDialogFragment.java

@Override
public void onDestroyView() {
    Dialog dialog = getDialog();
    if (dialog != null && getRetainInstance()) {
        dialog.setOnDismissListener(null);
    }//w w  w  .j a  v a  2  s .com

    super.onDestroyView();
}

From source file:org.dash.wallet.integration.uphold.ui.UpholdSplashActivity.java

private void showLoadingErrorAlert() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(false);//w  ww.  j a  v  a2 s  . c  o  m
    builder.setMessage(R.string.loading_error);
    builder.setPositiveButton(android.R.string.ok, null);
    Dialog dialog = builder.show();
    dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            finish();
        }
    });
}

From source file:com.deange.githubstatus.push.PushBaseActivity.java

private boolean performPlayServicesCheck() {

    mNeedToCheckPlayServices = false;//from   www.j a v a2s .  c  o  m
    final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode == ConnectionResult.SUCCESS) {
        return true;

    } else {
        Log.d(TAG, "isGooglePlayServicesAvailable = " + resultCode);

        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            final Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 0);
            dialog.setCancelable(false);
            dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    mNeedToCheckPlayServices = true;
                }
            });
            dialog.show();

        } else {
            Log.e(TAG, "Unrecoverable error checking Google Play Services.");
            finish();
        }

        return false;
    }
}

From source file:de.j4velin.wifiAutoOff.Map.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map);//from  ww  w .j av a 2 s .  c  om

    location = getIntent().getParcelableExtra("location");

    mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();

    if (mMap == null) {
        if (BuildConfig.DEBUG)
            Logger.log("Map = null - play services available: "
                    + GooglePlayServicesUtil.isGooglePlayServicesAvailable(this));
        Dialog d = GooglePlayServicesUtil
                .getErrorDialog(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this), this, 0);
        d.setOnDismissListener(new OnDismissListener() {
            @Override
            public void onDismiss(final DialogInterface dialog) {
                finish();
            }
        });
        d.show();
        return;
    }

    if (location == null) {
        mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API)
                .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
                    @Override
                    public void onConnected(final Bundle bundle) {
                        Location l = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
                        if (l != null && mMap.getCameraPosition().zoom <= 2) {
                            mMap.moveCamera(CameraUpdateFactory
                                    .newLatLngZoom(new LatLng(l.getLatitude(), l.getLongitude()), 16));
                        }
                        mGoogleApiClient.disconnect();
                    }

                    @Override
                    public void onConnectionSuspended(int cause) {
                        if (BuildConfig.DEBUG)
                            Logger.log("connection suspended: " + cause);
                    }
                }).build();

        mGoogleApiClient.connect();

        mMap.setOnMapClickListener(new OnMapClickListener() {
            @Override
            public void onMapClick(final LatLng center) {
                getIntent().putExtra("location", center);
                setResult(RESULT_OK, getIntent());
                finish();
            }
        });
    } else {
        mMap.addCircle(new CircleOptions().center(location).radius(100).strokeColor(Color.RED)
                .fillColor(Color.argb(64, 255, 0, 0)));
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 16));
    }

    mMap.setMyLocationEnabled(true);
}

From source file:org.chromium.chrome.browser.media.router.ChromeMediaRouterDialogController.java

/**
 * Shows the {@link MediaRouteChooserDialogFragment} dialog if it's not shown yet.
 * @param sourceUrn the URN identifying the media source to filter the devices with.
 *///from   www . j av a  2s . co m
@CalledByNative
public void createDialog(String sourceUrn) {
    if (isShowingDialog())
        return;

    MediaSource mediaSource = MediaSource.from(sourceUrn);
    if (mediaSource == null)
        return;

    FragmentActivity currentActivity = (FragmentActivity) ApplicationStatus.getLastTrackedFocusedActivity();
    if (currentActivity == null)
        return;

    FragmentManager fm = currentActivity.getSupportFragmentManager();
    if (fm == null)
        return;

    if (fm.findFragmentByTag(MEDIA_ROUTE_CHOOSER_DIALOG_FRAGMENT) != null)
        return;

    MediaRouteSelector selector = mediaSource.buildRouteSelector();
    mAndroidMediaRouter.addCallback(selector, this);

    MediaRouteDialogFactory factory = new ChromeMediaRouteDialogFactory();
    mChooserDialogFragment = factory.onCreateChooserDialogFragment();
    mChooserDialogFragment.setRouteSelector(selector);
    mChooserDialogFragment.show(fm, MEDIA_ROUTE_CHOOSER_DIALOG_FRAGMENT);
    fm.executePendingTransactions();

    Dialog dialog = mChooserDialogFragment.getDialog();
    if (dialog == null) {
        closeDialog();
        return;
    }

    dialog.setOnDismissListener(this);
}

From source file:com.cerema.cloud2.ui.dialog.SamlWebViewDialog.java

@Override
public void onDestroyView() {
    Log_OC.v(TAG, "onDestroyView");

    if ((ViewGroup) mSsoWebView.getParent() != null) {
        ((ViewGroup) mSsoWebView.getParent()).removeView(mSsoWebView);
    }//from   w  ww .  j  a  va2s  .c  o  m

    mSsoWebView.setWebViewClient(null);

    // Work around bug: http://code.google.com/p/android/issues/detail?id=17423
    Dialog dialog = getDialog();
    if ((dialog != null)) {
        dialog.setOnDismissListener(null);
    }

    super.onDestroyView();
}

From source file:com.synox.android.ui.dialog.SamlWebViewDialog.java

@Override
public void onDestroyView() {
    Log_OC.v(TAG, "onDestroyView");

    if (mSsoWebView.getParent() != null) {
        ((ViewGroup) mSsoWebView.getParent()).removeView(mSsoWebView);
    }//  www.j  a v a2  s .c  o  m

    mSsoWebView.setWebViewClient(null);

    // Work around bug: http://code.google.com/p/android/issues/detail?id=17423
    Dialog dialog = getDialog();
    if ((dialog != null)) {
        dialog.setOnDismissListener(null);
    }

    super.onDestroyView();
}

From source file:com.digitalarx.android.ui.dialog.SamlWebViewDialog.java

@Override
public void onDestroyView() {
    Log_OC.d(TAG, "onDestroyView");

    if ((ViewGroup) mSsoWebView.getParent() != null) {
        ((ViewGroup) mSsoWebView.getParent()).removeView(mSsoWebView);
    }/*  w  w  w .  j  a v a2 s.  co  m*/

    mSsoWebView.setWebViewClient(null);

    // Work around bug: http://code.google.com/p/android/issues/detail?id=17423
    Dialog dialog = getDialog();
    if ((dialog != null)) {
        dialog.setOnDismissListener(null);
        //dialog.dismiss();
        //dialog.setDismissMessage(null);
    }

    super.onDestroyView();
}

From source file:com.owncloud.android.ui.dialog.LoginWebViewDialog.java

@Override
public void onDestroyView() {
    Log_OC.v(TAG, "onDestroyView");

    if (mWebView.getParent() != null) {
        ((ViewGroup) mWebView.getParent()).removeView(mWebView);
    }/*  w w w.  j  av a2 s .  c  om*/

    mWebView.setWebViewClient(null);

    // Work around bug: http://code.google.com/p/android/issues/detail?id=17423
    Dialog dialog = getDialog();
    if ((dialog != null)) {
        dialog.setOnDismissListener(null);
    }

    super.onDestroyView();
}