Search in sources :

Example 76 with Window

use of android.view.Window in project StatusBarCompat by niorgai.

the class StatusBarCompatLollipop method translucentStatusBar.

/**
     * translucentStatusBar(full-screen)
     *
     * 1. set Flags to full-screen
     * 2. set FitsSystemWindows to false
     *
     * @param hideStatusBarBackground hide statusBar's shadow
     */
static void translucentStatusBar(Activity activity, boolean hideStatusBarBackground) {
    Window window = activity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    if (hideStatusBarBackground) {
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(Color.TRANSPARENT);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
    } else {
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
    }
    ViewGroup mContentView = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);
    View mChildView = mContentView.getChildAt(0);
    if (mChildView != null) {
        ViewCompat.setFitsSystemWindows(mChildView, false);
        ViewCompat.requestApplyInsets(mChildView);
    }
}
Also used : Window(android.view.Window) ViewGroup(android.view.ViewGroup) View(android.view.View)

Example 77 with Window

use of android.view.Window in project superCleanMaster by joyoyao.

the class RubbishCleanActivity method setTranslucentStatus.

@TargetApi(19)
private void setTranslucentStatus(boolean on) {
    Window win = 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);
}
Also used : Window(android.view.Window) WindowManager(android.view.WindowManager) TargetApi(android.annotation.TargetApi)

Example 78 with Window

use of android.view.Window in project T-MVP by north2016.

the class StatusBarUtil method setTranslucentBackground.

public static void setTranslucentBackground(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = activity.getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}
Also used : Window(android.view.Window)

Example 79 with Window

use of android.view.Window in project titanium-barcode by mwaylabs.

the class TitaniumBarcodeActivity method onCreate.

/**
	 * Lifecycle method which is called of the android runtime
	 */
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    captureView = new CaptureView(this);
    captureView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    setContentView(captureView);
    CameraManager.init(getApplication());
    viewfinderView = captureView.getViewfinderView();
    lastResult = null;
    hasSurface = false;
}
Also used : Window(android.view.Window) LayoutParams(android.view.ViewGroup.LayoutParams) CaptureView(com.mwaysolutions.barcode.views.CaptureView)

Example 80 with Window

use of android.view.Window in project CloudReader by youlookwhat.

the class StatusBarUtils method setFullScreen.

public static void setFullScreen(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = activity.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // 设置透明状态栏,这样才能让 ContentView 向上
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}
Also used : Window(android.view.Window)

Aggregations

Window (android.view.Window)322 View (android.view.View)72 WindowManager (android.view.WindowManager)58 TextView (android.widget.TextView)34 TargetApi (android.annotation.TargetApi)29 ImageView (android.widget.ImageView)25 ViewGroup (android.view.ViewGroup)22 Activity (android.app.Activity)17 Dialog (android.app.Dialog)17 ColorDrawable (android.graphics.drawable.ColorDrawable)16 AdapterView (android.widget.AdapterView)16 PhoneWindow (com.android.internal.policy.PhoneWindow)15 Intent (android.content.Intent)11 Context (android.content.Context)10 LayoutInflater (android.view.LayoutInflater)10 WindowDecorActionBar (com.android.internal.app.WindowDecorActionBar)10 RemoteException (android.os.RemoteException)9 DisplayMetrics (android.util.DisplayMetrics)9 LinearLayout (android.widget.LinearLayout)9 PopupWindow (android.widget.PopupWindow)8