Java Code Examples for android.app.AlertDialog#getWindow()
The following examples show how to use
android.app.AlertDialog#getWindow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LatinIME.java From openboard with GNU General Public License v3.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example 2
Source File: LatinIME.java From Android-Keyboard with Apache License 2.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = KeyboardSwitcher.getInstance().getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example 3
Source File: LatinIME.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example 4
Source File: LatinIME.java From simple-keyboard with Apache License 2.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example 5
Source File: LatinIME.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example 6
Source File: LatinIME.java From Indic-Keyboard with Apache License 2.0 | 6 votes |
private void showOptionDialog(final AlertDialog dialog) { final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken(); if (windowToken == null) { return; } final Window window = dialog.getWindow(); final WindowManager.LayoutParams lp = window.getAttributes(); lp.token = windowToken; lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG; window.setAttributes(lp); window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); mOptionsDialog = dialog; dialog.show(); }
Example 7
Source File: LeaveRoomDialog.java From justaline-android with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).setMessage(R.string.pair_disconnect); // Set up the buttons builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (mListener != null) { mListener.onExitRoomSelected(); } } }); builder.setNeutralButton(R.string.cancel, null); AlertDialog dialog = builder.show(); if (dialog.getWindow() != null) { dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); } setCancelable(false); return dialog; }
Example 8
Source File: ErrorDialog.java From justaline-android with Apache License 2.0 | 5 votes |
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { int titleRes = getArguments().getInt(ARG_TITLE); int messageRes = getArguments().getInt(ARG_MESSAGE); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()).setMessage(messageRes); if (titleRes > -1) builder.setTitle(titleRes); // Set up the buttons builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (getArguments().getBoolean(ARG_EXIT_ON_OK) && mListener != null) { mListener.exitApp(); } } }); AlertDialog dialog = builder.show(); if (dialog.getWindow() != null) { dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); } setCancelable(false); return dialog; }
Example 9
Source File: SettingsDialogFragment.java From nano-wallet-android with BSD 2-Clause "Simplified" License | 5 votes |
private void showCopySeedAlert() { // show the copy seed dialog AlertDialog.Builder builder; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder = new AlertDialog.Builder(getContext(), android.R.style.Theme_Material_Light_Dialog_Alert); } else { builder = new AlertDialog.Builder(getContext()); } Credentials credentials = realm.where(Credentials.class).findFirst(); if (credentials != null) { AlertDialog dialog = builder.setTitle(R.string.settings_seed_alert_title) .setMessage(clickedNewSeed ? credentials.getNewlyGeneratedSeed().replaceAll("(.{4})", "$1 ") : credentials.getSeed().replaceAll("(.{4})", "$1 ")) .setPositiveButton(R.string.settings_seed_alert_confirm_cta, (d, which) -> { analyticsService.track(AnalyticsEvents.SEED_COPIED); }) .setIcon(R.drawable.ic_warning) .create(); dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); dialog.show(); if (dialog.getWindow() != null) { dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); } } KeyboardUtil.hideKeyboard(getActivity()); }
Example 10
Source File: DialogUtils.java From letv with Apache License 2.0 | 5 votes |
public static AlertDialog buildBottomDialog(Activity activity, View contentView) { AlertDialog dialog = new Builder(activity).create(); dialog.setCanceledOnTouchOutside(true); dialog.show(); dialog.setContentView(contentView); Window dialogWindow = dialog.getWindow(); Display d = activity.getWindowManager().getDefaultDisplay(); LayoutParams p = dialogWindow.getAttributes(); p.width = d.getWidth(); dialogWindow.setAttributes(p); dialogWindow.setGravity(80); return dialog; }
Example 11
Source File: LocationDialogFragment.java From BetterWay with Apache License 2.0 | 5 votes |
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { View view = LayoutInflater.from(getContext()) .inflate(R.layout.location_dialog_fragment, mViewGroup, false); initView(view); AlertDialog.Builder builder = new AlertDialog.Builder(getContext()) .setIcon(R.drawable.ic_action_item_dialog) .setView(view) .setTitle("请输入信息") .setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (TextUtils.isEmpty(mEditLocation.getText())) { ToastUtil.show(getContext(), "未选择地点"); } else { getLocationPlanData(); postSureCode(MapMarker.ADD); } } }) .setNegativeButton("取消", null); AlertDialog alertDialog = builder.create(); alertDialog.setOnCancelListener(null); if (alertDialog.getWindow() != null) { Window window = alertDialog.getWindow(); window.setWindowAnimations(R.style.dialogAnim); } return alertDialog; }
Example 12
Source File: LocationServicesDialogBoxModule.java From react-native-android-location-services-dialog-box with MIT License | 5 votes |
private void colorAdjustment(AlertDialog dialog, ReadableMap colorMap) { Window window = dialog.getWindow(); if (window != null) { Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE); Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE); if (colorMap.hasKey("backgroundColor")) { window.setBackgroundDrawable(new ColorDrawable(Color.parseColor(colorMap.getString("backgroundColor")))); } if (colorMap.hasKey("positiveButtonTextColor")) { positiveButton.setTextColor(Color.parseColor(colorMap.getString("positiveButtonTextColor"))); } if (colorMap.hasKey("positiveButtonBackgroundColor")) { positiveButton.setBackgroundColor(Color.parseColor(colorMap.getString("positiveButtonBackgroundColor"))); } if (colorMap.hasKey("negativeButtonTextColor")) { negativeButton.setTextColor(Color.parseColor(colorMap.getString("negativeButtonTextColor"))); } if (colorMap.hasKey("negativeButtonBackgroundColor")) { negativeButton.setBackgroundColor(Color.parseColor(colorMap.getString("negativeButtonBackgroundColor"))); } } }
Example 13
Source File: CompatibleAlertDialogBuilder.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 5 votes |
@Override public AlertDialog create() { AlertDialog dialog = super.create(); try { if (dialog.getWindow() != null) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { int type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; dialog.getWindow().setType(type); } } } catch (Exception e) { e.printStackTrace(); } return dialog; }
Example 14
Source File: A2dpDlg.java From misound with Apache License 2.0 | 5 votes |
private void caculatePos(AlertDialog dlg){ Window w = dlg.getWindow(); WindowManager.LayoutParams lp =w.getAttributes(); DisplayMetrics display = mMainActivity.getResources().getDisplayMetrics(); int dpi = display.densityDpi; lp.width = 200*dpi/160; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; lp.y = -100; w.setAttributes(lp); }