Java Code Examples for android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

The following are Jave code examples for showing how to use SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: BilibiliClient   File: StatusBarUtil.java   View Source Code Vote up 7 votes
@TargetApi(Build.VERSION_CODES.M)
private void processM() {

  if (current < Build.VERSION_CODES.M) {
    return;
  }
  int flag = window.getDecorView().getSystemUiVisibility();
  if (lightStatusBar) {
    /**
     * 改变字体颜色
     * see {@link <a href="https://developer.android.com/reference/android/R.attr.html#windowLightStatusBar"></a>}
     */
    flag |= (WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
        | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    window.setStatusBarColor(Color.TRANSPARENT);
  }
  if (transparentStatusBar) {
    flag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.setStatusBarColor(Color.TRANSPARENT);
  }
  if (transparentNavigationbar) {
    flag |= (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    window.setNavigationBarColor(Color.TRANSPARENT);
  }
  window.getDecorView().setSystemUiVisibility(flag);
}
 
Example 2
Project: RetroMusicPlayer   File: SystemUiHelperImplJB.java   View Source Code Vote up 7 votes
@Override
protected int createHideFlags() {
    int flag = super.createHideFlags();

    if (mLevel >= SystemUiHelper.LEVEL_HIDE_STATUS_BAR) {
        flag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;

        if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
            flag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        }
    }

    return flag;
}
 
Example 3
Project: whatanime-android   File: VideoPreviewActivity.java   View Source Code Vote up 6 votes
private int getFullscreenUiFlags() {
    int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    return flags;
}
 
Example 4
Project: PicKing   File: BaseActivity.java   View Source Code Vote up 6 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    changeTheme((String) SPUtils.get(this, AppConfig.choose_theme, AppConfig.DEFAULT_COLOR));
    super.onCreate(savedInstanceState);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
        localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            View decorView = getWindow().getDecorView();
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(option);
        }
    }
}
 
Example 5
Project: TitanCompanion   File: SystemUiHiderHoneycomb.java   View Source Code Vote up 6 votes
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
	super(activity, anchorView, flags);

	mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
	mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
	mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

	if ((mFlags & FLAG_FULLSCREEN) != 0) {
		// If the client requested fullscreen, add flags relevant to hiding
		// the status bar. Note that some of these constants are new as of
		// API 16 (Jelly Bean). It is safe to use them, as they are inlined
		// at compile-time and do nothing on pre-Jelly Bean devices.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN;
	}

	if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
		// If the client requested hiding navigation, add relevant flags.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
		mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
	}
}
 
Example 6
Project: BilibiliClient   File: SystemBarHelper.java   View Source Code Vote up 6 votes
/**
 * Android4.4以上的状态栏着色(针对于DrawerLayout)
 * 注:
 * 1.如果出现界面展示不正确,删除布局中所有fitsSystemWindows属性,尤其是DrawerLayout的fitsSystemWindows属性
 * 2.可以版本判断在5.0以上不调用该方法,使用系统自带
 *
 * @param activity Activity对象
 * @param drawerLayout DrawerLayout对象
 * @param statusBarColor 状态栏颜色
 * @param alpha 透明栏透明度[0.0-1.0]
 */
public static void tintStatusBarForDrawer(Activity activity, DrawerLayout drawerLayout,
                                          @ColorInt int statusBarColor,
                                          @FloatRange(from = 0.0, to = 1.0) float alpha) {

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    return;
  }

  Window window = activity.getWindow();
  ViewGroup decorView = (ViewGroup) window.getDecorView();
  ViewGroup drawContent = (ViewGroup) drawerLayout.getChildAt(0);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(Color.TRANSPARENT);
    drawerLayout.setStatusBarBackgroundColor(statusBarColor);

    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  } else {
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  }

  setStatusBar(decorView, statusBarColor, true, true);
  setTranslucentView(decorView, alpha);

  drawerLayout.setFitsSystemWindows(false);
  drawContent.setFitsSystemWindows(true);
  ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
  drawer.setFitsSystemWindows(false);
}
 
Example 7
Project: Auto.js   File: BaseActivity.java   View Source Code Vote up 6 votes
@Override
protected void onStart() {
    super.onStart();
    if ((getWindow().getDecorView().getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == 0) {
        ThemeColorManager.addActivityStatusBar(this);
    }

}
 
Example 8
Project: localcloud_fe   File: CordovaActivity.java   View Source Code Vote up 5 votes
/**
 * Called when view focus is changed
 */
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus && immersiveMode) {
        final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

        getWindow().getDecorView().setSystemUiVisibility(uiOptions);
    }
}
 
Example 9
Project: chromium-for-android-56-debug-video   File: MediaRouteControllerDialogFactory.java   View Source Code Vote up 5 votes
void saveSystemVisibility(Activity activity) {
    // If we are in fullscreen we may have also have hidden the system UI. This
    // is overridden when we display the dialog. Save the system UI visibility
    // state so we can restore it.
    FrameLayout decor = (FrameLayout) activity.getWindow().getDecorView();
    mSystemVisibility = decor.getSystemUiVisibility();
    mRestoreSystemVisibility = (
            (mSystemVisibility & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0);
}
 
Example 10
Project: LauncherTV   File: Launcher.java   View Source Code Vote up 5 votes
private void setFullScreen() {
	try {
		if (Build.VERSION.SDK_INT < 19) {
			getWindow().setFlags(
					WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER,
					WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
			);
		} else {
			View decorView = getWindow().getDecorView();

			int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
					| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
					| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
					| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
					| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
					| View.SYSTEM_UI_FLAG_IMMERSIVE;

			decorView.setSystemUiVisibility(uiOptions);

			getWindow().setFlags(
					WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER,
					WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
			);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example 11
Project: ApplicationCollention   File: TopbarActivity.java   View Source Code Vote up 5 votes
/**
 * 设置状态栏颜色
 */
private void setStatusBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimary));
    }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}
 
Example 12
Project: chromium-for-android-56-debug-video   File: BaseMediaRouteDialogManager.java   View Source Code Vote up 5 votes
void restoreSystemVisibility(Activity activity) {
    if (!mWasFullscreenBeforeShowing) return;

    FrameLayout decor = (FrameLayout) activity.getWindow().getDecorView();
    // In some cases we come out of fullscreen before closing this dialog. In these
    // cases we don't want to restore the system UI visibility state.
    boolean isStillFullscreen =
            (decor.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) == 0;
    if (!isStillFullscreen) return;

    decor.setSystemUiVisibility(mSystemVisibilityToRestore);
}
 
Example 13
Project: bombsquad-remote-android   File: GamePadActivity.java   View Source Code Vote up 5 votes
@TargetApi(19)
private void _setImmersiveMode(){
	//if (true) return;
	int vis = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
			| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
			| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
			| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
			| View.SYSTEM_UI_FLAG_FULLSCREEN
			| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
	if (mGLView.getSystemUiVisibility() != vis){
		//screenMessage("FORCING IMMERSIVE");
		mGLView.setSystemUiVisibility(vis);
	}
}
 
Example 14
Project: Instincts-2k17   File: GalleryViewPagerActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityCompat.postponeEnterTransition(this);
    ActivityCompat.setEnterSharedElementCallback(this, enterTransitionCallback);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_view_pager_gallery);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Gallery");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    galleryViewPagerAdapter = new GalleryViewPagerAdapter(this);

    viewPager = (ViewPager) findViewById(R.id.container);
    viewPager.setAdapter(galleryViewPagerAdapter);

    int position = selectedIndex = getIntent().getIntExtra(EXTRA_POSITION, 0);
    viewPager.setCurrentItem(position);
    viewPager.setOnPageChangeListener(pageChangeListener);
    viewPager.getViewTreeObserver().addOnGlobalLayoutListener(pagerLayoutListener);
}
 
Example 15
Project: Instincts-2k17   File: SplashActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_splash);
    ButterKnife.bind(this);

    DisplayMetrics displayMetrics = this.getResources().getDisplayMetrics();
    spinArrow.setTranslationX(-2000);
    wheelView.setTranslationX(2000);
    wheelView.setWheelRadius(displayMetrics.widthPixels / 2);
    wheelView.setWheelItemRadius(displayMetrics.widthPixels / 6);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            startSecondActivity();
        }
    }, 1000);
}
 
Example 16
Project: CodeCompilerApp   File: SystemUiHelperImplJB.java   View Source Code Vote up 5 votes
@Override
protected int createShowFlags() {
    int flag = super.createShowFlags();

    if (mLevel >= SystemUiHelper.LEVEL_HIDE_STATUS_BAR) {
        flag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

        if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
            flag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        }
    }

    return flag;
}
 
Example 17
Project: BilibiliClient   File: SystemBarHelper.java   View Source Code Vote up 5 votes
/**
 * Android4.4以上的沉浸式全屏模式
 * 注:
 * 1.删除fitsSystemWindows属性:Android5.0以上使用该方法如果出现界面展示不正确,删除布局中所有fitsSystemWindows属性
 * 或者调用forceFitsSystemWindows方法
 * 2.不删除fitsSystemWindows属性:也可以区别处理,Android5.0以上使用自己的方式实现,不调用该方法
 *
 * @param window 一般都是用于Activity的window,也可以是其他的例如Dialog,DialogFragment
 * @param alpha 透明栏透明度[0.0-1.0]
 */
public static void immersiveStatusBar(Window window,
                                      @FloatRange(from = 0.0, to = 1.0) float alpha) {

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    return;
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(Color.TRANSPARENT);

    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  } else {
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  }

  ViewGroup decorView = (ViewGroup) window.getDecorView();
  ViewGroup contentView = (ViewGroup) window.getDecorView()
      .findViewById(Window.ID_ANDROID_CONTENT);
  View rootView = contentView.getChildAt(0);
  int statusBarHeight = getStatusBarHeight(window.getContext());
  if (rootView != null) {
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rootView.getLayoutParams();
    ViewCompat.setFitsSystemWindows(rootView, true);
    lp.topMargin = -statusBarHeight;
    rootView.setLayoutParams(lp);
  }

  setTranslucentView(decorView, alpha);
}
 
Example 18
Project: BilibiliClient   File: SystemBarHelper.java   View Source Code Vote up 5 votes
/**
 * Android4.4以上的沉浸式全屏模式
 * 注:
 * 1.删除fitsSystemWindows属性:Android5.0以上使用该方法如果出现界面展示不正确,删除布局中所有fitsSystemWindows属性
 * 或者调用forceFitsSystemWindows方法
 * 2.不删除fitsSystemWindows属性:也可以区别处理,Android5.0以上使用自己的方式实现,不调用该方法
 *
 * @param window 一般都是用于Activity的window,也可以是其他的例如Dialog,DialogFragment
 * @param alpha 透明栏透明度[0.0-1.0]
 */
public static void immersiveStatusBar(Window window,
                                      @FloatRange(from = 0.0, to = 1.0) float alpha) {

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    return;
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(Color.TRANSPARENT);

    int systemUiVisibility = window.getDecorView().getSystemUiVisibility();
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    systemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    window.getDecorView().setSystemUiVisibility(systemUiVisibility);
  } else {
    window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
  }

  ViewGroup decorView = (ViewGroup) window.getDecorView();
  ViewGroup contentView = (ViewGroup) window.getDecorView()
      .findViewById(Window.ID_ANDROID_CONTENT);
  View rootView = contentView.getChildAt(0);
  int statusBarHeight = getStatusBarHeight(window.getContext());
  if (rootView != null) {
    FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) rootView.getLayoutParams();
    ViewCompat.setFitsSystemWindows(rootView, true);
    lp.topMargin = -statusBarHeight;
    rootView.setLayoutParams(lp);
  }

  setTranslucentView(decorView, alpha);
}
 
Example 19
Project: RetroMusicPlayer   File: SystemUiHelperImplJB.java   View Source Code Vote up 5 votes
@Override
protected int createShowFlags() {
    int flag = super.createShowFlags();

    if (mLevel >= SystemUiHelper.LEVEL_HIDE_STATUS_BAR) {
        flag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

        if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
            flag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        }
    }

    return flag;
}
 
Example 20
Project: chromium-for-android-56-debug-video   File: MediaRouteChooserDialogFactory.java   View Source Code Vote up 5 votes
void saveSystemVisibility(Activity activity) {
    // If we are in fullscreen we may have also have hidden the system UI. This
    // is overridden when we display the dialog. Save the system UI visibility
    // state so we can restore it.
    FrameLayout decor = (FrameLayout) activity.getWindow().getDecorView();
    mSystemVisibility = decor.getSystemUiVisibility();
    mRestoreSystemVisibility = (
            (mSystemVisibility & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0);
}