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:org.ecmdroid.activity.EEPROMActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.fetch:
        new FetchTask(this) {
            @Override//from w  w w.j  a  v  a  2 s. co m
            protected void onPostExecute(Exception result) {
                super.onPostExecute(result);
                GridView gridview = (GridView) findViewById(R.id.eepromGrid);
                adapter = new EEPROMAdapter(EEPROMActivity.this, ecm.getEEPROM(), COLS);
                gridview.setAdapter(adapter);
            }
        }.start();
        break;
    case R.id.burn:
        new BurnTask(this).start();
        break;
    case R.id.save:
        new SaveTask(this, ecm.getEEPROM()).start();
        break;
    case R.id.load:
        final StringBuilder result = new StringBuilder();
        Dialog dlg = createLoadDialog(result);
        dlg.setOnDismissListener(new OnDismissListener() {
            public void onDismiss(DialogInterface dialog) {
                if (result.length() > 0) {
                    if (ecm.isEepromRead() && ecm.getEEPROM().isTouched()) {
                        AlertDialog.Builder builder = new AlertDialog.Builder(EEPROMActivity.this);
                        builder.setTitle(R.string.load_eeprom).setMessage(R.string.overwrite_changes)
                                .setCancelable(true).setNegativeButton(android.R.string.cancel, null)
                                .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        loadEEPROM(new File(result.toString()));
                                    }
                                }).show();
                    } else {
                        loadEEPROM(new File(result.toString()));
                    }
                }
            }
        });
        dlg.show();
        break;
    }
    return true;
}

From source file:org.mythdroid.activities.MDActivity.java

@Override
public Dialog onCreateDialog(int id) {

    switch (id) {

    case FRONTEND_CHOOSER:
        final Dialog d = createFrontendDialog();
        d.setOnDismissListener(dismissListener);
        d.setOnCancelListener(cancelListener);
        return d;

    case DIALOG_LOAD:
        final ProgressDialog prog = new ProgressDialog(this);
        prog.setIndeterminate(true);/*www  .  ja  v  a 2 s  .  c om*/
        prog.setMessage(getResources().getText(R.string.loading));
        prog.setCanceledOnTouchOutside(false);
        prog.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface arg0) {
                finish();
            }
        });
        return prog;

    }

    return null;

}

From source file:org.developfreedom.logmein.ui.MainActivity.java

public void dialogDismissUpdater(Dialog dialog, final int pos) {
    dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override/*from   ww w .jav a 2s  .  co m*/
        public void onDismiss(DialogInterface dialogInterface) {
            spinnerUpdateFlag = false;
            updateHomescreenData();
            if (spinner_user_list.getCount() > pos) {
                spinner_user_list.setSelection(pos);
            }
        }
    });
}

From source file:com.gaba.alex.trafficincidents.MainActivity.java

private boolean checkGooglePlayServices() {
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    final int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            Dialog dialog = apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST);
            if (dialog != null) {
                dialog.show();/*from  w  w w.j  a  v a 2  s  .  co m*/
                dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    public void onDismiss(DialogInterface dialog) {
                        if (ConnectionResult.SERVICE_INVALID == resultCode) {
                            finish();
                        }
                    }
                });
            }
        }
        return false;
    }
    return true;
}

From source file:ca.rmen.android.poetassistant.main.WarningNoSpaceDialogFragment.java

/**
 * @return a Dialog with a title, message and ok button.
 *//*from w ww  .  j  a v  a 2s  . co m*/
@Override
@NonNull
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Log.v(TAG, "onCreateDialog: savedInstanceState = " + savedInstanceState);
    Context context = getActivity();

    OnClickListener positiveListener = (dialog, which) -> notifyListener();

    DialogInterface.OnDismissListener dismissListener = dialog -> notifyListener();

    Dialog dialog = new AlertDialog.Builder(context)
            .setTitle(context.getString(R.string.warning_no_space_title))
            .setMessage(context.getString(R.string.warning_no_space_message))
            .setPositiveButton(android.R.string.ok, positiveListener).setOnDismissListener(dismissListener)
            .create();
    dialog.setOnDismissListener(dismissListener);
    return dialog;
}

From source file:org.droid2droid.install.DownloadApkActivity.java

@Override // FIXME: utiliser les Fragments  la place
protected Dialog onCreateDialog(int id) {
    Dialog dlg = new AlertDialog.Builder(this).setView(mView)
            .setPositiveButton(R.string.download_apk_hide, this)
            .setNegativeButton(R.string.download_apk_cancel, this).create();
    dlg.setOnDismissListener(this);
    return dlg;// ww  w .j av  a2 s.c o  m
}

From source file:org.neotree.ui.activity.MainActivity.java

private boolean checkPlayServices() {
    Log.d(logTag(), "Checking Google Play Services availability");
    GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
    int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (apiAvailability.isUserResolvableError(resultCode)) {
            Dialog dialog = apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_REQUEST);
            dialog.setOnDismissListener(dialog1 -> finish());
            dialog.show();/*from  www.ja v a  2  s.c  o m*/
        } else {
            AlertDialog dialog = new AlertDialog.Builder(this).setMessage("This device is not supported")
                    .setPositiveButton(R.string.label_action_close, (d, i) -> {
                        finish();
                    }).create();
            dialog.show();
        }
        return false;
    }
    return true;
}

From source file:at.wada811.android.dialogfragments.AbstractDialogFragment.java

protected void setOnDismissListener(Dialog dialog) {
    useOnDismissListener = true;/*  w w w.  j a  v a  2s .  c o m*/
    dialog.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            bindDismissListener();
        }
    });
}

From source file:jp.co.noxi.app.NXDialog.java

void setOnDismissListenerInternal(final OnDismissListener listener) {
    final Dialog dialog = getDialog();
    if ((listener == null) || (dialog == null)) {
        return;//from   w  ww  . j ava  2s  . c  om
    }

    dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            listener.onDismiss(NXDialog.this);
        }
    });
}

From source file:net.evendanan.android.thumbremote.ui.FragmentAlertDialogSupport.java

private Dialog createMediaTimeSeekDialog() {
    final Dialog seeker = new Dialog(getActivity(), R.style.Popup);
    seeker.setContentView(R.layout.custom_time_selection);
    seeker.findViewById(R.id.seeker_close_button).setOnClickListener(new OnClickListener() {
        @Override//from   w ww. j a v  a 2s . c  om
        public void onClick(View v) {
            seeker.dismiss();
        }
    });
    seeker.setOnDismissListener(new OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            ((RemoteUiActivity) getActivity()).mMediaSeekBar = null;
        }
    });

    SeekBar seekBar = (SeekBar) seeker.findViewById(R.id.time_seek_bar);
    seekBar.setOnSeekBarChangeListener((RemoteUiActivity) getActivity());

    return seeker;
}