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 setScreenBrightness(int paramInt, Activity context) {
    Window localWindow = context.getWindow();
    WindowManager.LayoutParams localLayoutParams = localWindow.getAttributes();
    float f = paramInt / 255.0F;
    localLayoutParams.screenBrightness = f;
    localWindow.setAttributes(localLayoutParams);
}

From source file:Main.java

@SuppressWarnings("unused")
public static boolean isShowImm(Activity activity) {
    return activity != null && activity.getWindow()
            .getAttributes().softInputMode == WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED;
}

From source file:Main.java

public static int getTitleBarHeight(Activity cx) {
    Rect frame = new Rect();
    cx.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
    return frame.top;
}

From source file:Main.java

public static Bitmap captureWithStatusBar(Activity activity) {
    View view = activity.getWindow().getDecorView();
    view.setDrawingCacheEnabled(true);/* w w  w .  jav a2 s.  c  o  m*/
    view.buildDrawingCache();
    Bitmap bmp = view.getDrawingCache();
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    Bitmap ret = Bitmap.createBitmap(bmp, 0, 0, dm.widthPixels, dm.heightPixels);
    view.destroyDrawingCache();
    return ret;
}

From source file:Main.java

public static void setTitle(Activity context, int reglayout) {
    context.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, reglayout);
}

From source file:Main.java

public static Bitmap getActivityBitmap(Activity activity) {
    View view = activity.getWindow().getDecorView().findViewById(android.R.id.content);
    view.setDrawingCacheEnabled(true);//  w w  w . j a v a2 s . c  o  m
    return view.getDrawingCache();
}

From source file:Main.java

public static int getTop(Activity cont) {
    Rect frame = new Rect();
    cont.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
    return frame.top;
}

From source file:Main.java

public static int getScreenHeight(Activity activity) {
    Rect out = new Rect();
    activity.getWindow().getDecorView().getHitRect(out);
    return out.height();
}

From source file:Main.java

public static int getStatusHeight(Activity activity) {
    Rect out = new Rect();
    activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(out);
    return out.top;
}

From source file:Main.java

public static void requestFullscreen(final Activity pActivity) {
    final Window window = pActivity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.requestFeature(Window.FEATURE_NO_TITLE);
}