use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class BluetoothPairingDialogFragment method createDisplayPasskeyOrPinDialog.
/**
* Creates a dialog that informs users of a pairing request and shows them the passkey/pin
* of the device.
*/
private AlertDialog createDisplayPasskeyOrPinDialog() {
mBuilder.setTitle(getString(R.string.bluetooth_pairing_request, mPairingController.getDeviceName()));
mBuilder.setView(createView());
mBuilder.setNegativeButton(getString(android.R.string.cancel), this);
AlertDialog dialog = mBuilder.create();
// Tell the controller the dialog has been created.
mPairingController.notifyDialogDisplayed();
return dialog;
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class RemoteBugreportActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final int notificationType = getIntent().getIntExtra(DevicePolicyManager.EXTRA_BUGREPORT_NOTIFICATION_TYPE, -1);
if (notificationType == DevicePolicyManager.NOTIFICATION_BUGREPORT_ACCEPTED_NOT_FINISHED) {
AlertDialog dialog = new AlertDialog.Builder(this).setMessage(R.string.sharing_remote_bugreport_dialog_message).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
}).setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
}).create();
dialog.show();
} else if (notificationType == DevicePolicyManager.NOTIFICATION_BUGREPORT_STARTED || notificationType == DevicePolicyManager.NOTIFICATION_BUGREPORT_FINISHED_NOT_ACCEPTED) {
AlertDialog dialog = new AlertDialog.Builder(this).setTitle(R.string.share_remote_bugreport_dialog_title).setMessage(notificationType == DevicePolicyManager.NOTIFICATION_BUGREPORT_STARTED ? R.string.share_remote_bugreport_dialog_message : R.string.share_remote_bugreport_dialog_message_finished).setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
finish();
}
}).setNegativeButton(R.string.decline_remote_bugreport_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(DevicePolicyManager.ACTION_BUGREPORT_SHARING_DECLINED);
RemoteBugreportActivity.this.sendBroadcastAsUser(intent, UserHandle.SYSTEM, android.Manifest.permission.DUMP);
finish();
}
}).setPositiveButton(R.string.share_remote_bugreport_action, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(DevicePolicyManager.ACTION_BUGREPORT_SHARING_ACCEPTED);
RemoteBugreportActivity.this.sendBroadcastAsUser(intent, UserHandle.SYSTEM, android.Manifest.permission.DUMP);
finish();
}
}).create();
dialog.show();
} else {
Log.e(TAG, "Incorrect dialog type, no dialog shown. Received: " + notificationType);
}
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class TextToSpeechSettings method displayNetworkAlert.
private void displayNetworkAlert() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(android.R.string.dialog_alert_title).setMessage(getActivity().getString(R.string.tts_engine_network_required)).setCancelable(false).setPositiveButton(android.R.string.ok, null);
AlertDialog dialog = builder.create();
dialog.show();
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class AppDialogFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Bundle args = getArguments();
final String label = args.getString(ARG_LABEL);
boolean managing = args.getBoolean(ARG_MANAGING);
boolean connected = args.getBoolean(ARG_CONNECTED);
mPackageInfo = args.getParcelable(ARG_PACKAGE);
if (managing) {
return new AppDialog(getActivity(), this, mPackageInfo, label);
} else {
// Build an AlertDialog with an option to disconnect.
AlertDialog.Builder dlog = new AlertDialog.Builder(getActivity()).setTitle(label).setMessage(getActivity().getString(R.string.vpn_disconnect_confirm)).setNegativeButton(getActivity().getString(R.string.vpn_cancel), null);
if (connected && !isUiRestricted()) {
dlog.setPositiveButton(getActivity().getString(R.string.vpn_disconnect), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
onDisconnect(dialog);
}
});
}
return dlog.create();
}
}
use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.
the class TrustedCredentialsDialogBuilder method create.
@Override
public AlertDialog create() {
AlertDialog dialog = super.create();
dialog.setOnShowListener(mDialogEventHandler);
mDialogEventHandler.setDialog(dialog);
return dialog;
}
Aggregations