Example usage for android.app Activity getWindow

List of usage examples for android.app Activity getWindow

Introduction

In this page you can find the example usage for android.app Activity getWindow.

Prototype

public Window getWindow() 

Source Link

Document

Retrieve the current android.view.Window for the activity.

Usage

From source file:Main.java

public static void setDefaultBrightness(Activity activity) {
    try {// w  ww.j  a  v  a  2  s . c  om
        WindowManager.LayoutParams lp = activity.getWindow().getAttributes();
        lp.screenBrightness = WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
        activity.getWindow().setAttributes(lp);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void makeFullScreen(Activity a) {
    a.requestWindowFeature(Window.FEATURE_NO_TITLE);
    a.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

}

From source file:Main.java

public static void RequestFullscreenMode(Activity activity) {
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

From source file:Main.java

public static void setFullScreen(Activity activity, boolean isFull) {
    Window window = activity.getWindow();
    WindowManager.LayoutParams params = window.getAttributes();
    if (isFull) {
        params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        window.setAttributes(params);//from  w  ww  .  j a v  a  2s  . com
        window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    } else {
        params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
        window.setAttributes(params);
        window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }
}

From source file:Main.java

public static void hideStatusBar(Activity activity) {
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

From source file:Main.java

public static void asFullScreen(Activity activity) {
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

From source file:Main.java

public static void setDarkIcon(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }//ww  w  . j  a  va  2 s  .c om
}

From source file:Main.java

/**
 * @param pActivity/*from w w  w  .j a v a2s. co m*/
 * @param pScreenBrightness [0..1]
 */
public static void setScreenBrightness(final Activity pActivity, final float pScreenBrightness) {
    final Window window = pActivity.getWindow();
    final WindowManager.LayoutParams windowLayoutParams = window.getAttributes();
    windowLayoutParams.screenBrightness = pScreenBrightness;
    window.setAttributes(windowLayoutParams);
}

From source file:Main.java

public static boolean hasStatusBar(Context context) {
    if (context instanceof Activity) {
        Activity activity = (Activity) context;
        WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
        return (attrs.flags
                & WindowManager.LayoutParams.FLAG_FULLSCREEN) != WindowManager.LayoutParams.FLAG_FULLSCREEN;
    }/*from  w  ww .j a  v  a  2s. co m*/
    return true;
}

From source file:Main.java

/**
 * Make fullscreen window/*from w ww .j a  v a  2  s .com*/
 * @param activity
 */
public static void Fullscreen(Activity activity) {
    activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
    activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
}