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