List of usage examples for android.view Window getAttributes
public final WindowManager.LayoutParams getAttributes()
From source file:com.daxstudio.sa.base.android.BaseDialogFragment.java
@Override public void onStart() { super.onStart(); // Less dimmed background; see http://stackoverflow.com/q/13822842/56285 final Window window = getDialog().getWindow(); final WindowManager.LayoutParams params = window.getAttributes(); params.dimAmount = getDimAmount(); // dim only a little bit window.setAttributes(params);// w w w .j a va2 s. c om window.setLayout(getWidth(), getHeight()); window.setGravity(getGravity()); // Transparent background; see http://stackoverflow.com/q/15007272/56285 // (Needed to make dialog's alpha shadow look good) window.setBackgroundDrawableResource(android.R.color.transparent); final Resources res = getResources(); final int titleDividerId = res.getIdentifier("titleDivider", "id", "android"); if (titleDividerId > 0) { final View titleDivider = getDialog().findViewById(titleDividerId); if (titleDivider != null) { titleDivider.setBackgroundColor(res.getColor(android.R.color.transparent)); } } }
From source file:com.hellofyc.base.app.AppSupportDelegate.java
private void setAttributesFlag(int flags, boolean trueOrFalse) { Window win = mActivity.getWindow(); LayoutParams params = win.getAttributes(); if (trueOrFalse) { params.flags |= flags;/*from www .j av a 2 s . co m*/ } else { params.flags &= ~flags; } win.setAttributes(params); }
From source file:com.sbgapps.scoreit.numberpicker.NumberPickerDialogFragment.java
@Override public void onResume() { super.onResume(); Window window = getDialog().getWindow(); DisplayMetrics dm = getResources().getDisplayMetrics(); int width = Math.min(getActivity().getResources().getDimensionPixelSize(R.dimen.dialog_width), dm.widthPixels * 3 / 4);/*from ww w.j av a 2 s. c o m*/ int height = window.getAttributes().height; window.setLayout(width, height); }
From source file:com.github.piasy.bootstrap.base.android.BaseDialogFragment.java
@Override public void onStart() { super.onStart(); // Less dimmed background; see http://stackoverflow.com/q/13822842/56285 final Window window = getDialog().getWindow(); if (window != null) { final WindowManager.LayoutParams params = window.getAttributes(); params.dimAmount = getDimAmount(); // dim only a little bit window.setAttributes(params);//ww w . ja va 2s . c o m window.setLayout(getWidth(), getHeight()); window.setGravity(getGravity()); // Transparent background; see http://stackoverflow.com/q/15007272/56285 // (Needed to make dialog's alpha shadow look good) window.setBackgroundDrawableResource(android.R.color.transparent); } final Resources res = getResources(); final int titleDividerId = res.getIdentifier("titleDivider", "id", "android"); if (titleDividerId > 0) { final View titleDivider = getDialog().findViewById(titleDividerId); if (titleDivider != null) { titleDivider.setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); } } }
From source file:com.hacktx.android.activities.CheckInActivity.java
private void setTranslucentStatusFlag(boolean on) { if (Build.VERSION.SDK_INT >= 19) { Window win = getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) { winParams.flags |= bits;/*from ww w . j av a 2s. com*/ } else { winParams.flags &= ~bits; } win.setAttributes(winParams); } }
From source file:com.kccomy.orgar.ui.note.NoteFragment.java
private void setWindowAlpha(float f) { Window window = getActivity().getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.alpha = f;/*from w w w . j a v a 2s.co m*/ window.setAttributes(lp); }
From source file:com.qiangxi.checkupdatelibrary.dialog.CheckUpdateDialog.java
private void resizeWidthAndHeight() { Window window = getWindow(); if (window == null) return;/*from w w w . j ava 2 s .c o m*/ WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.CENTER; lp.width = dp2px(260);//260dp lp.height = ViewGroup.LayoutParams.WRAP_CONTENT; window.setAttributes(lp); }
From source file:com.github.piasy.dialogfragmentanywhere.BaseDialogFragment.java
void anchorDialog() { final Bundle args = getArguments(); if (args == null || getDialog() == null) { return;//from www. ja v a 2 s . c om } final Window window = getDialog().getWindow(); final WindowManager.LayoutParams params = window.getAttributes(); int anchorX = args.getInt(ANCHOR_VIEW_X); int anchorY = args.getInt(ANCHOR_VIEW_Y); int anchorWidth = args.getInt(ANCHOR_VIEW_WIDTH); int anchorHeight = args.getInt(ANCHOR_VIEW_HEIGHT); int dialogWidth = window.getDecorView().getWidth(); int dialogHeight = window.getDecorView().getHeight(); int locate = args.getInt(LOCATE_TO_ANCHOR); int offsetX = args.getInt(OFFSET_X); int offsetY = args.getInt(OFFSET_Y); switch (locate) { case LOCATE_LEFT: params.x = anchorX - dialogWidth + offsetX; params.y = anchorY - Math.abs(dialogHeight - anchorHeight) / 2 - getStatusBarHeight() + offsetY; break; case LOCATE_RIGHT: params.x = anchorX + anchorWidth + offsetX; params.y = anchorY - Math.abs(dialogHeight - anchorHeight) / 2 - getStatusBarHeight() + offsetY; break; case LOCATE_BELOW: params.x = anchorX - Math.abs(dialogWidth - anchorWidth) / 2 + offsetX; params.y = anchorY + anchorHeight - getStatusBarHeight() + offsetY; break; case LOCATE_ABOVE: params.x = anchorX - Math.abs(dialogWidth - anchorWidth) / 2 + offsetX; params.y = anchorY - dialogHeight - getStatusBarHeight() + offsetY; default: break; } window.setAttributes(params); }
From source file:com.king.base.BaseActivity.java
private void setDialogWindow(Dialog dialog, float widthRatio) { Window window = dialog.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); int width = Math.min(getWidthPixels(), getHeightPixels()); lp.width = (int) (width * widthRatio); window.setAttributes(lp);// ww w .j av a 2 s .com }
From source file:com.timothy.android.api.fragment.PageFragment.java
public void openDialog(String content) { // Log.i(LOG_TAG, "openDialog()..."); CustomDialog cusDialog = new CustomDialog(activity, R.style.custom_dialog_style, content); Window wd = cusDialog.getWindow(); WindowManager.LayoutParams lp = wd.getAttributes(); lp.alpha = 1.0f;//from w w w .ja v a 2s . co m wd.setAttributes(lp); cusDialog.show(); }