Search in sources :

Example 96 with Builder

use of android.app.AlertDialog.Builder in project Pix-Art-Messenger by kriztan.

the class EditAccountActivity method showWipePepDialog.

public void showWipePepDialog() {
    Builder builder = new Builder(this);
    builder.setTitle(getString(R.string.clear_other_devices));
    builder.setIconAttribute(android.R.attr.alertDialogIcon);
    builder.setMessage(getString(R.string.clear_other_devices_desc));
    builder.setNegativeButton(getString(R.string.cancel), null);
    builder.setPositiveButton(getString(R.string.accept), (dialog, which) -> mAccount.getAxolotlService().wipeOtherPepDevices());
    builder.create().show();
}
Also used : Builder(android.app.AlertDialog.Builder)

Example 97 with Builder

use of android.app.AlertDialog.Builder in project socialauth-android by 3pillarlabs.

the class Util method showAlert.

/**
 * Display a simple alert dialog with the given text and title.
 *
 * @param context
 *            Android context in which the dialog should be displayed
 * @param title
 *            Alert dialog title
 * @param text
 *            Alert dialog message
 */
public static void showAlert(Context context, String title, String text) {
    Builder alertBuilder = new Builder(context);
    alertBuilder.setTitle(title);
    alertBuilder.setMessage(text);
    alertBuilder.create().show();
}
Also used : Builder(android.app.AlertDialog.Builder)

Example 98 with Builder

use of android.app.AlertDialog.Builder in project android_packages_apps_CMParts by LineageOS.

the class NFCProfileSelect method showProfileSelectionDialog.

void showProfileSelectionDialog() {
    final Profile[] profiles = mProfileManager.getProfiles();
    final String[] profileNames = new String[profiles.length];
    for (int i = 0; i < profiles.length; i++) {
        profileNames[i] = profiles[i].getName();
    }
    Builder builder = new Builder(this);
    builder.setTitle(R.string.profile_settings_title);
    builder.setSingleChoiceItems(profileNames, currentChoice, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            currentChoice = which;
        }
    });
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (currentChoice != defaultChoice) {
                Profile profile = profiles[currentChoice];
                profile.addSecondaryUuid(mProfileUuid);
                mProfileManager.updateProfile(profile);
                Toast.makeText(NFCProfileSelect.this, R.string.profile_write_success, Toast.LENGTH_LONG).show();
            }
            finish();
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    builder.show();
}
Also used : DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Profile(cyanogenmod.app.Profile)

Example 99 with Builder

use of android.app.AlertDialog.Builder in project jmulticard by ctt-gob-es.

the class PinDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Builder alertDialogBuilder = new AlertDialog.Builder(this.activity);
    final LayoutInflater layoutInflater = LayoutInflater.from(this.activity);
    final View view;
    if (this.isCan) {
        alertDialogBuilder.setTitle(R.string.can_intro);
        view = layoutInflater.inflate(R.layout.dialog_can, null);
        final TextView textV = (TextView) view.findViewById(R.id.tvPin);
    } else {
        alertDialogBuilder.setTitle(R.string.pin_intro);
        view = layoutInflater.inflate(R.layout.dialog_pin, null);
        final TextView textV = (TextView) view.findViewById(R.id.tvPin);
        textV.setText(this.title);
    }
    final EditText editTextPin = (EditText) view.findViewById(R.id.etPin);
    alertDialogBuilder.setView(view);
    alertDialogBuilder.setNegativeButton(this.activity.getString(R.string.cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int id) {
            dialog.dismiss();
            synchronized (PinDialog.this.dialogDone) {
                PinDialog.this.dialogDone.notify();
            }
        }
    });
    alertDialogBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            if (editTextPin.getText() != null && !"".equals(editTextPin.getText().toString())) {
                // $NON-NLS-1$
                dialog.dismiss();
                setPassword(editTextPin.getText().toString());
                if (callback instanceof PasswordCallback) {
                    final PasswordCallback pc = (PasswordCallback) callback;
                    pc.setPassword(editTextPin.getText().toString().toCharArray());
                } else if (callback instanceof CustomTextInputCallback) {
                    final CustomTextInputCallback pc = (CustomTextInputCallback) callback;
                    pc.setText(editTextPin.getText().toString());
                }
                synchronized (PinDialog.this.dialogDone) {
                    PinDialog.this.dialogDone.notify();
                }
            } else {
                // TODO: Gestionar este caso
                // $NON-NLS-1$ //$NON-NLS-2$
                Log.e("es.gob.jmulticard", "El pin no puede ser vacio o nulo");
                synchronized (PinDialog.this.dialogDone) {
                    PinDialog.this.dialogDone.notify();
                }
            }
        }
    });
    alertDialogBuilder.setOnKeyListener(new DialogInterface.OnKeyListener() {

        @Override
        public boolean onKey(final DialogInterface dialog, final int keyCode, final KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK) {
                dialog.dismiss();
                return true;
            }
            return false;
        }
    });
    return alertDialogBuilder.create();
}
Also used : EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) TextView(android.widget.TextView) View(android.view.View) KeyEvent(android.view.KeyEvent) LayoutInflater(android.view.LayoutInflater) PasswordCallback(javax.security.auth.callback.PasswordCallback) TextView(android.widget.TextView) CustomTextInputCallback(es.gob.jmulticard.card.dnie.CustomTextInputCallback)

Example 100 with Builder

use of android.app.AlertDialog.Builder in project android_packages_apps_Settings by SudaMod.

the class ChooseLockTypeDialogFragment method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Context context = getContext();
    Builder builder = new Builder(context);
    List<ScreenLockType> locks = mController.getVisibleScreenLockTypes(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, false);
    mAdapter = new ScreenLockAdapter(context, locks, mController);
    builder.setAdapter(mAdapter, this);
    builder.setTitle(R.string.setup_lock_settings_options_dialog_title);
    AlertDialog alertDialog = builder.create();
    return alertDialog;
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) Builder(android.app.AlertDialog.Builder)

Aggregations

Builder (android.app.AlertDialog.Builder)112 DialogInterface (android.content.DialogInterface)64 AlertDialog (android.app.AlertDialog)42 Intent (android.content.Intent)29 View (android.view.View)28 TextView (android.widget.TextView)25 OnClickListener (android.content.DialogInterface.OnClickListener)21 SuppressLint (android.annotation.SuppressLint)16 ArrayList (java.util.ArrayList)15 OnClickListener (android.view.View.OnClickListener)13 ImageView (android.widget.ImageView)13 Context (android.content.Context)12 AlertDialog (android.support.v7.app.AlertDialog)12 List (java.util.List)12 Bundle (android.os.Bundle)11 RelativeLayout (android.widget.RelativeLayout)10 Point (android.graphics.Point)9 ExpandableListView (android.widget.ExpandableListView)9 ImageButton (android.widget.ImageButton)7 EditText (android.widget.EditText)6