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();
}
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();
}
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();
}
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();
}
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;
}
Aggregations