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 int getTitleHeight(Activity activity) {
    return activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
}

From source file:Main.java

public static void clearForstedGlassBackground(Activity activity) {
    activity.getWindow().getDecorView().setBackground(null);
    if (mScreenShot != null && !mScreenShot.isRecycled()) {
        mScreenShot.recycle();//from ww w  . jav  a  2s. co m
        mScreenShot = null;
    }
}

From source file:Main.java

public static boolean isFullScreen(final Activity activity) {
    return (activity.getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
}

From source file:Main.java

public static void showSystemUI(Activity activity, int uiOptions) {
    activity.getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}

From source file:Main.java

public static void hideSoftInput(Activity activity) {
    activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

From source file:Main.java

public static void setSystemUiInVisible(Activity activity) {
    View decor = activity.getWindow().getDecorView();
    decor.setSystemUiVisibility(decor.getSystemUiVisibility() & ~FLAG_IMMERSIVE);
}

From source file:Main.java

public static void setSystemUiVisible(Activity activity) {
    View decor = activity.getWindow().getDecorView();
    decor.setSystemUiVisibility(decor.getSystemUiVisibility() | FLAG_IMMERSIVE);
}

From source file:Main.java

public static void clearImmersiveStickyMode(Activity activity) {
    activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
}

From source file:Main.java

public static ViewGroup getDecorView(Activity activity) {
    return (ViewGroup) activity.getWindow().getDecorView();
}

From source file:Main.java

public static void closeSoftPan(Activity act) {
    View view = act.getWindow().peekDecorView();
    if (view != null) {
        InputMethodManager inputmanger = (InputMethodManager) act
                .getSystemService(Activity.INPUT_METHOD_SERVICE);
        inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }/*from w  ww.  j  a  v a 2s.  co  m*/

}