Example usage for android.view Window getAttributes

List of usage examples for android.view Window getAttributes

Introduction

In this page you can find the example usage for android.view Window getAttributes.

Prototype

public final WindowManager.LayoutParams getAttributes() 

Source Link

Document

Retrieve the current window attributes associated with this panel.

Usage

From source file:Main.java

public static void enterLightsOutMode(Window window) {
    WindowManager.LayoutParams params = window.getAttributes();
    params.systemUiVisibility = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    window.setAttributes(params);/*from   www .j a va2 s . com*/
}

From source file:Main.java

public static void setTranslucentStatus(Activity activity, boolean on) {
    Window win = activity.getWindow();
    WindowManager.LayoutParams winParams = win.getAttributes();
    win.setAttributes(winParams);//w  ww  .  j a va 2 s.  c  o m
}

From source file:Main.java

/**
 * Set the screen's brightness level.//from  ww  w  .j a v a 2s .  c om
 *
 * @param window
 * @param brightness
 */
public static void setBrightness(Window window, float brightness) {
    WindowManager.LayoutParams layout = window.getAttributes();
    layout.screenBrightness = brightness;
    window.setAttributes(layout);
}

From source file:Main.java

public static void forceShowInputMethod(Activity activity) {
    Window window = activity.getWindow();
    window.setSoftInputMode(//from   w  w w  .ja  va  2s  .com
            window.getAttributes().softInputMode | WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

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);//from w w  w .  j av a 2 s. c om
    } else {
        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)/*from  w ww  .  java2 s  .co  m*/
        winParams.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
    else
        winParams.flags &= ~WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
    win.setAttributes(winParams);
}

From source file:Main.java

private static void setTranslucentStatus(Activity context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window win = context.getWindow();
        WindowManager.LayoutParams winParams = win.getAttributes();
        final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
        winParams.flags |= bits;//from   www. j a  va 2s .c  o  m
        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 a  va  2  s .  co  m*/
        winParams.flags |= bits;
    } else {
        winParams.flags &= ~bits;
    }
    win.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) {//w w w.  j  a v a  2 s.c om
        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;/*from  w  w w  . j  a va  2s.  co  m*/
    } else {
        winParams.flags &= ~bits;
    }
    window.setAttributes(winParams);
}