Search in sources :

Example 86 with AlertDialog

use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.

the class WifiCallingSettings method showAlert.

private void showAlert(Intent intent) {
    Context context = getActivity();
    CharSequence title = intent.getCharSequenceExtra(Phone.EXTRA_KEY_ALERT_TITLE);
    CharSequence message = intent.getCharSequenceExtra(Phone.EXTRA_KEY_ALERT_MESSAGE);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage(message).setTitle(title).setIcon(android.R.drawable.ic_dialog_alert).setPositiveButton(android.R.string.ok, null);
    AlertDialog dialog = builder.create();
    dialog.show();
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog)

Example 87 with AlertDialog

use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.

the class AccessibilityServiceWarning method createCapabilitiesDialog.

public static Dialog createCapabilitiesDialog(Activity parentActivity, AccessibilityServiceInfo info, DialogInterface.OnClickListener listener) {
    final AlertDialog ad = new AlertDialog.Builder(parentActivity).setTitle(parentActivity.getString(R.string.enable_service_title, getServiceName(parentActivity, info))).setView(createEnableDialogContentView(parentActivity, info)).setPositiveButton(android.R.string.ok, listener).setNegativeButton(android.R.string.cancel, listener).create();
    final View.OnTouchListener filterTouchListener = (View v, MotionEvent event) -> {
        // Filter obscured touches by consuming them.
        if (((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_OBSCURED) != 0) || ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_PARTIALLY_OBSCURED) != 0)) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                Toast.makeText(v.getContext(), R.string.touch_filtered_warning, Toast.LENGTH_SHORT).show();
            }
            return true;
        }
        return false;
    };
    Window window = ad.getWindow();
    WindowManager.LayoutParams params = window.getAttributes();
    params.privateFlags |= PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
    window.setAttributes(params);
    ad.create();
    ad.getButton(AlertDialog.BUTTON_POSITIVE).setOnTouchListener(filterTouchListener);
    ad.setCanceledOnTouchOutside(true);
    return ad;
}
Also used : AlertDialog(android.app.AlertDialog) Window(android.view.Window) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) MotionEvent(android.view.MotionEvent) WindowManager(android.view.WindowManager)

Example 88 with AlertDialog

use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.

the class KeyboardLayoutDialogFragment method updateSwitchHintVisibility.

private void updateSwitchHintVisibility() {
    AlertDialog dialog = (AlertDialog) getDialog();
    if (dialog != null) {
        View customPanel = dialog.findViewById(com.android.internal.R.id.customPanel);
        customPanel.setVisibility(mAdapter.getCount() > 1 ? View.VISIBLE : View.GONE);
    }
}
Also used : AlertDialog(android.app.AlertDialog) View(android.view.View) TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView)

Example 89 with AlertDialog

use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.

the class NotificationLockscreenPreference method onDialogStateRestored.

@Override
protected void onDialogStateRestored(Dialog dialog, Bundle savedInstanceState) {
    super.onDialogStateRestored(dialog, savedInstanceState);
    ListView listView = ((AlertDialog) dialog).getListView();
    int selectedPosition = listView.getCheckedItemPosition();
    View panel = dialog.findViewById(com.android.internal.R.id.customPanel);
    panel.setVisibility(checkboxVisibilityForSelectedIndex(selectedPosition, mShowRemoteInput));
    mListener.setView(panel);
}
Also used : AlertDialog(android.app.AlertDialog) ListView(android.widget.ListView) ImageView(android.widget.ImageView) View(android.view.View) ListView(android.widget.ListView)

Example 90 with AlertDialog

use of android.app.AlertDialog in project android_packages_apps_Settings by LineageOS.

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

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