List of usage examples for android.view Window setAttributes
public void setAttributes(WindowManager.LayoutParams a)
From source file:Main.java
public static void BrightnessSetValue(Window window, int value) { WindowManager.LayoutParams lp = window.getAttributes(); if (Build.MODEL != null && Build.MODEL.indexOf("MEIZU MX") > -1) { lp.screenBrightness = 0.6f + value * 3 / 100f; window.setAttributes(lp); } else {/*from w w w . j ava 2 s . com*/ if (value > 10) value = 10; if (value < 0) value = 0; float bright = value; bright /= 10.0f; lp.screenBrightness = bright; window.setAttributes(lp); } }
From source file:Main.java
public static void setTranslucentStatus(Activity activity, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); if (on)// w ww . j a v a 2 s. c o m winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; else winParams.flags &= ~WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; win.setAttributes(winParams); }
From source file:Main.java
@TargetApi(19) public static void setTranslucentStatus(Activity activity, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) {/*from w w w. j ava 2 s. c o m*/ winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); }
From source file:Main.java
public static void toggleFullScreen(Activity activity, boolean isFull) { Window window = activity.getWindow(); WindowManager.LayoutParams winParams = window.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_FULLSCREEN; if (isFull) { winParams.flags |= bits;//w w w. ja v a2 s .c o m } else { winParams.flags &= ~bits; } window.setAttributes(winParams); }
From source file:Main.java
@TargetApi(19) public static void setTranslucentNavigation(Activity activity, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION; if (on) {//from w w w . j a v a 2 s. co m winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); }
From source file:Main.java
/** * set status bar translucency//from w w w .ja v a2s .co m */ public static void setTranslucentStatus(Activity activity, boolean on) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); } }
From source file:Main.java
/** * Sets the screen brightness for this activity. The screen brightness will * change immediately. As soon as the activity terminates, the brightness will * return to the system brightness. Valid brightnesses range from 0 to 255. * /*from www . jav a 2 s. c o m*/ * @param window * The activity window. * @param brightnessUnits * An integer between 0 and 255. */ static void setActivityBrightness(Window window, int brightnessUnits) { // Set the brightness of the current window. This takes effect immediately. // When the window is closed, the new system brightness is used. // (Scale 0.0 - 1.0). WindowManager.LayoutParams lp = window.getAttributes(); lp.screenBrightness = brightnessUnits / 255.0f; window.setAttributes(lp); }
From source file:Main.java
public static void initializeScreenBrightness(Window win, ContentResolver resolver) { // Overright the brightness settings if it is automatic int mode = Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); if (mode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { WindowManager.LayoutParams winParams = win.getAttributes(); winParams.screenBrightness = DEFAULT_CAMERA_BRIGHTNESS; win.setAttributes(winParams); }//from ww w . j ava2s .c om }
From source file:Main.java
public static void dimBackground(final float from, final float to, Activity context) { final Window window = context.getWindow(); ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to); valueAnimator.setDuration(500);//from w w w . ja va 2 s . c o m valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { WindowManager.LayoutParams params = window.getAttributes(); params.alpha = (Float) animation.getAnimatedValue(); window.setAttributes(params); } }); valueAnimator.start(); }
From source file:enterprayz.megatools.Tools.java
@TargetApi(19) private static void setTranslucentStatus(Activity activity, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) {// w w w. ja v a 2 s . c o m winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); }