Example usage for android.app Activity removeDialog

List of usage examples for android.app Activity removeDialog

Introduction

In this page you can find the example usage for android.app Activity removeDialog.

Prototype

@Deprecated
public final void removeDialog(int id) 

Source Link

Document

Removes any internal references to a dialog managed by this Activity.

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.  jav a  2s. c  o  m*/
    });
}

From source file:es.farfuteam.vncpp.controller.ActivityTabs.java

/**
 * @return The new dialog/*from  ww  w. j  a  va 2 s  . c  o m*/
 * @brief Shows the dialog with the exit question
 * @details Shows the dialog with the exit question
 */
private Dialog createExitDialog() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    View checkBoxOut = View.inflate(this, R.layout.checkbox_out, null);
    final CheckBox checkBox = (CheckBox) checkBoxOut.findViewById(R.id.checkboxOut);

    final String decision = getString(R.string.RememberCheckBox);

    checkBox.setText(decision);

    final String titleExit = getString(R.string.DialogTitleExit);
    final String question = getString(R.string.DialogQuestion);
    final Activity actThis = this;
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.setTitle(titleExit);
    builder.setMessage(question);
    builder.setView(checkBoxOut);
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            actThis.removeDialog(InfoDialogs.exitDialog.ordinal());

        }
    });
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {//un listener que al pulsar, cierre la aplicacion
        @Override
        public void onClick(DialogInterface dialog, int which) {
            //Salir
            (Configuration.getInstance()).setRememberExit(checkBox.isChecked());
            finish();
        }
    });
    return builder.create();
}

From source file:es.farfuteam.vncpp.controller.ActivityTabs.java

/**
 * @return The new dialog/*from   ww w  .  ja v  a 2s  . com*/
 * @brief Shows the dialog to indicate the connection info
 * @details Shows the dialog to indicate the connection info
 */
private Dialog infoDialog() {

    final Activity actThis = this;

    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    final String portText = getString(R.string.port);
    final String qualityText = getString(R.string.Quality);
    final String connectionText = getString(R.string.connection);

    String name = ((Connection) getO()).getName();
    String ip = ((Connection) getO()).getIP();
    String port = ((Connection) getO()).getPORT();
    QualityArray color = ((Connection) getO()).getColorFormat();

    String quality = messageQuality(color);

    builder.setMessage("IP: " + ip + "\n" + portText + ": " + port + "\n" + qualityText + ": " + quality);

    builder.setTitle(connectionText + " " + name);
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            actThis.removeDialog(InfoDialogs.infoDialog.ordinal());
        }

    });

    return builder.create();

}

From source file:es.farfuteam.vncpp.controller.CanvasActivity.java

/**
 * @return The new dialog//from  w ww .ja v a2s .  c om
 * @brief Show the dialog with the function keys
 * @details Show the dialog with the function keys
 */
private Dialog functionKeysDialog() {

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    if (keys == null)
        keys = new Vector<Integer>(); // Where we track the selected items

    final Activity actThis = this;
    // Set the dialog title
    builder.setCancelable(false);
    builder.setTitle(R.string.function_keys_title).setMultiChoiceItems(R.array.function_keys_array, null,
            new DialogInterface.OnMultiChoiceClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                    if (isChecked) {
                        // If the user checked the item, add it to the selected items
                        keys.add(which);
                    } else if (keys.contains(Integer.valueOf(which))) {
                        // Else, if the item is already in the array, remove it
                        keys.remove(Integer.valueOf(which));
                    }
                }
            })
            // Set the action buttons
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    showDialog(EnumDialogs.comboEventsDialog.ordinal());
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    showDialog(EnumDialogs.comboEventsDialog.ordinal());
                    actThis.removeDialog(EnumDialogs.functionKeysDialog.ordinal());

                }
            });

    return builder.create();

}

From source file:es.farfuteam.vncpp.controller.CanvasActivity.java

/**
 * @return The new dialog//ww  w  .j a v a 2s.  com
 * @brief Show the dialog with the combo event
 * @details Show the dialog with the combo event
 */
private Dialog comboEventsDialog() {

    specialKeys = new Vector<EnumSpecialKey>(); // Where we track the selected items
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    // Set the dialog title
    final Activity actThis = this;
    builder.setCancelable(false);
    builder.setTitle(R.string.combo_keys_title)
            // Specify the list array, the items to be selected by default (null for none),
            // and the listener through which to receive callbacks when items are selected
            .setMultiChoiceItems(R.array.keys_array, null, new DialogInterface.OnMultiChoiceClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                    EnumSpecialKey aux = EnumSpecialKey.values()[which];
                    ;
                    if (isChecked) {
                        // If the user checked the item, add it to the selected items
                        if (aux == EnumSpecialKey.ctrl || aux == EnumSpecialKey.alt) {
                            specialKeys.add(0, aux);
                        } else {
                            specialKeys.add(aux);
                        }
                    } else if (specialKeys.contains(which)) {
                        // Else, if the item is already in the array, remove it
                        specialKeys.remove(aux);
                    }
                }
            }).setNeutralButton(R.string.function_keys_title, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    //muestra function keys
                    showDialog(EnumDialogs.functionKeysDialog.ordinal());
                }
            })
            // Set the action buttons
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    sendSpecialKeys(true);
                    sendKeys(true);
                    Collections.reverse(specialKeys);
                    if (keys != null)
                        Collections.reverse(keys);
                    sendKeys(false);
                    sendSpecialKeys(false);

                    actThis.removeDialog(EnumDialogs.comboEventsDialog.ordinal());
                    actThis.removeDialog(EnumDialogs.functionKeysDialog.ordinal());
                    specialKeys = null;
                    keys = null;
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    //se vacia el vector
                    actThis.removeDialog(EnumDialogs.comboEventsDialog.ordinal());
                    actThis.removeDialog(EnumDialogs.functionKeysDialog.ordinal());
                    specialKeys = null;
                    keys = null;
                }
            });

    return builder.create();

}