Search in sources :

Example 81 with AlertDialog

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;
}
Also used : AlertDialog(android.app.AlertDialog)

Example 82 with AlertDialog

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);
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Intent(android.content.Intent)

Example 83 with AlertDialog

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();
}
Also used : AlertDialog(android.app.AlertDialog)

Example 84 with AlertDialog

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();
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Bundle(android.os.Bundle)

Example 85 with AlertDialog

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;
}
Also used : AlertDialog(android.app.AlertDialog)

Aggregations

AlertDialog (android.app.AlertDialog)1029 DialogInterface (android.content.DialogInterface)573 View (android.view.View)278 TextView (android.widget.TextView)213 Intent (android.content.Intent)172 EditText (android.widget.EditText)160 Test (org.junit.Test)148 ShadowAlertDialog (org.robolectric.shadows.ShadowAlertDialog)111 Context (android.content.Context)96 ListView (android.widget.ListView)87 ImageView (android.widget.ImageView)86 LayoutInflater (android.view.LayoutInflater)80 Button (android.widget.Button)78 AdapterView (android.widget.AdapterView)72 Activity (android.app.Activity)66 SuppressLint (android.annotation.SuppressLint)61 Bundle (android.os.Bundle)56 OnClickListener (android.content.DialogInterface.OnClickListener)54 ArrayList (java.util.ArrayList)50 Dialog (android.app.Dialog)46