Java Code Examples for android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
The following examples show how to use
android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From MoeGallery with GNU General Public License v3.0 | 6 votes |
@UiThread public void showSystemUI() { cancelHideSystemUIDelayed(); toolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start(); int flags = 0; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { flags = View.SYSTEM_UI_FLAG_VISIBLE; getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; } getWindow().getDecorView().setSystemUiVisibility(flags); }
Example 2
Source File: TransparentActivity.java From Rucky with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE); final int flags = 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; requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); View view = getWindow().getDecorView(); view.setSystemUiVisibility(flags); setContentView(R.layout.activity_transparent); new Handler().postDelayed(this::launchNext, 2000); }
Example 3
Source File: AndroidUtil.java From Alite with GNU General Public License v3.0 | 6 votes |
@SuppressLint("InlinedApi") public static void setImmersion(View view) { if (view == null || Settings.navButtonsVisible) { return; } int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_FULLSCREEN; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; } if (flags != 0) { view.setSystemUiVisibility(flags); } }
Example 4
Source File: ImmersionBar.java From a with GNU General Public License v3.0 | 6 votes |
/** * 初始化android 5.0以上状态栏和导航栏 * * @param uiFlags the ui flags * @return the int */ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private int initBarAboveLOLLIPOP(int uiFlags) { uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; //Activity全屏显示,但状态栏不会被隐藏覆盖,状态栏依然可见,Activity顶端布局部分会被状态栏遮住。 if (mBarParams.fullScreen && mBarParams.navigationBarEnable) { uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; //Activity全屏显示,但导航栏不会被隐藏覆盖,导航栏依然可见,Activity底部布局部分会被导航栏遮住。 } mWindow.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (mConfig.hasNavigtionBar()) { //判断是否存在导航栏 mWindow.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } mWindow.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //需要设置这个才能设置状态栏颜色 if (mBarParams.statusBarFlag) mWindow.setStatusBarColor(ColorUtils.blendARGB(mBarParams.statusBarColor, mBarParams.statusBarColorTransform, mBarParams.statusBarAlpha)); //设置状态栏颜色 else mWindow.setStatusBarColor(ColorUtils.blendARGB(mBarParams.statusBarColor, Color.TRANSPARENT, mBarParams.statusBarAlpha)); //设置状态栏颜色 if (mBarParams.navigationBarEnable) { mWindow.setNavigationBarColor(ColorUtils.blendARGB(mBarParams.navigationBarColor, mBarParams.navigationBarColorTransform, mBarParams.navigationBarAlpha)); //设置导航栏颜色 if (Build.VERSION.SDK_INT >= 28 && !mBarParams.navigationBarDivider) mWindow.setNavigationBarDividerColor(Color.TRANSPARENT); } return uiFlags; }
Example 5
Source File: ImmersionBar.java From ImmersionBar with Apache License 2.0 | 6 votes |
/** * Hide bar. * 隐藏或显示状态栏和导航栏。 * * @param uiFlags the ui flags * @return the int */ private int hideBar(int uiFlags) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { switch (mBarParams.barHide) { case FLAG_HIDE_BAR: uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.INVISIBLE; break; case FLAG_HIDE_STATUS_BAR: uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.INVISIBLE; break; case FLAG_HIDE_NAVIGATION_BAR: uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; break; case FLAG_SHOW_BAR: uiFlags |= View.SYSTEM_UI_FLAG_VISIBLE; break; default: break; } } return uiFlags | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; }
Example 6
Source File: SplashActivity.java From Rucky with GNU General Public License v3.0 | 6 votes |
private void splash() { final int flags = 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().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); View view = getWindow().getDecorView(); view.setSystemUiVisibility(flags); setContentView(R.layout.activity_splash); ImageView i1 = findViewById(R.id.imageViewBG); i1.setImageDrawable(ContextCompat.getDrawable(this,SettingsActivity.darkTheme ? R.drawable.splash_background_dark : R.drawable.splash_background_light)); FrameLayout l2= findViewById(R.id.splashTextView); i1.setAnimation(AnimationUtils.loadAnimation(this,R.anim.rotate)); l2.setAnimation(AnimationUtils.loadAnimation(this,R.anim.downtoup)); new Handler().postDelayed(this::launchNext, 5000); getSignature(); }
Example 7
Source File: DisplayUtils.java From GeometricWeather with GNU Lesser General Public License v3.0 | 6 votes |
public static void setSystemBarStyle(Context context, Window window, boolean miniAlpha, boolean statusShader, boolean lightStatus, boolean navigationShader, boolean lightNavigation) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return; } // statusShader &= Build.VERSION.SDK_INT < Build.VERSION_CODES.Q; lightStatus &= Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; navigationShader &= Build.VERSION.SDK_INT < Build.VERSION_CODES.Q; lightNavigation &= Build.VERSION.SDK_INT >= Build.VERSION_CODES.O; int visibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE; if (lightStatus) { visibility |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; } if (lightNavigation) { visibility |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; } window.getDecorView().setSystemUiVisibility(visibility); setSystemBarColor(context, window, miniAlpha, statusShader, lightStatus, navigationShader, lightNavigation); }
Example 8
Source File: AndroidMini2DxGame.java From mini2Dx with Apache License 2.0 | 6 votes |
@TargetApi(19) @Override public void useImmersiveMode(boolean use) { if (!use || getVersion() < Build.VERSION_CODES.KITKAT) return; View view = getWindow().getDecorView(); try { Method m = View.class.getMethod("setSystemUiVisibility", int.class); int code = 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; m.invoke(view, code); } catch (Exception e) { log("AndroidApplication", "Can't set immersive mode", e); } }
Example 9
Source File: MainActivity.java From Droid2JoyStick with Apache License 2.0 | 6 votes |
@Override public void enterFullscreen() { isFullscreen = true; int uiOption = 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; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { uiOption |= View.SYSTEM_UI_FLAG_IMMERSIVE; } getWindow().getDecorView().setSystemUiVisibility(uiOption); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (getSupportActionBar() != null) { getSupportActionBar().hide(); } ndMenu.getDrawerLayout().setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); }
Example 10
Source File: CordovaActivity.java From keemob with MIT License | 6 votes |
/** * Called when view focus is changed */ @SuppressLint("InlinedApi") @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 11
Source File: StatusBarUtil.java From LeisureRead with Apache License 2.0 | 6 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 12
Source File: BarUtils.java From AndroidUtilCode with Apache License 2.0 | 5 votes |
public static void transparentStatusBar(final Window window) { 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); int option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; int vis = window.getDecorView().getSystemUiVisibility(); window.getDecorView().setSystemUiVisibility(option | vis); window.setStatusBarColor(Color.TRANSPARENT); } else { window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } }
Example 13
Source File: BaseActivity.java From justaline-android with Apache License 2.0 | 5 votes |
void setupImmersive() { // Standard Android full-screen functionality. int visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; if (!BuildConfig.SHOW_NAVIGATION) { visibility |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } getWindow().getDecorView().setSystemUiVisibility(visibility); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); }
Example 14
Source File: MediaRouteControllerDialogFactory.java From AndroidChromium with Apache License 2.0 | 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 15
Source File: BaseAnncaFragment.java From phoenix with Apache License 2.0 | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View decorView = ((Activity) container.getContext()).getWindow().getDecorView(); if (Build.VERSION.SDK_INT > MIN_VERSION_ICECREAM) { int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); } return inflater.inflate(R.layout.generic_camera_layout, container, false); }
Example 16
Source File: WelcomeActivity.java From BlogDemo with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // 解决Android应用Launcher重复启动的问题 if (!isTaskRoot() && getIntent() != null) { String action = getIntent().getAction(); if (getIntent().hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) { finish(); return; } } setContentView(R.layout.activity_welcome); // 全屏,透明状态栏 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(Color.TRANSPARENT); } new QMUIDialog.MessageDialogBuilder(this) .setMessage("服务器地址为:" + BuildConfig.SERVER_URL) .addAction(R.string.btn_confirm, new QMUIDialogAction.ActionListener() { @Override public void onClick(QMUIDialog dialog, int index) { dialog.dismiss(); new Handler().postDelayed(new Runnable() { @Override public void run() { MainActivity.actionStart(WelcomeActivity.this); finish(); } }, 1500); } }) .show(); }
Example 17
Source File: BaseMediaRouteDialogManager.java From delion with Apache License 2.0 | 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 18
Source File: BaseMediaRouteDialogManager.java From 365browser with Apache License 2.0 | 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 19
Source File: Utils.java From TubiPlayer with MIT License | 5 votes |
public static void hideSystemUI(@NonNull final Activity activity, final boolean immediate, final int delayMs) { View decorView = activity.getWindow().getDecorView(); // Set the IMMERSIVE flag. // Set the content to appear under the system bars so that the content // doesn't resize when the system bars hide and show. int uiState = 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 if (Util.SDK_INT > 18) { uiState |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_IMMERSIVE; } else { final Handler handler = new Handler(); decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if (visibility == View.VISIBLE) { Runnable runnable = new Runnable() { @Override public void run() { hideSystemUI(activity, false); } }; if (immediate) { handler.post(runnable); } else { handler.postDelayed(runnable, delayMs); } } } }); } decorView.setSystemUiVisibility(uiState); }
Example 20
Source File: MirrorActivity.java From HomeMirror with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mirror); mConfigSettings = new ConfigurationSettings(this); AlarmReceiver.startMirrorUpdates(this); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } 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 | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_IMMERSIVE; decorView.setSystemUiVisibility(uiOptions); ActionBar actionBar = getSupportActionBar(); actionBar.hide(); } getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mBirthdayText = (TextView) findViewById(R.id.birthday_text); mDayText = (TextView) findViewById(R.id.day_text); mWeatherSummary = (TextView) findViewById(R.id.weather_summary); mHelloText = (TextView) findViewById(R.id.hello_text); mWaterPlants = findViewById(R.id.water_plants); mGroceryList = findViewById(R.id.grocery_list); mBikeTodayText = (TextView) findViewById(R.id.can_bike); mStockText = (TextView) findViewById(R.id.stock_text); mMoodText = (TextView) findViewById(R.id.mood_text); mXKCDImage = (ImageView) findViewById(R.id.xkcd_image); mNewsHeadline = (TextView) findViewById(R.id.news_headline); mCalendarTitleText = (TextView) findViewById(R.id.calendar_title); mCalendarDetailsText = (TextView) findViewById(R.id.calendar_details); mCountdownText = (TextView) findViewById(R.id.countdown_text); if (mConfigSettings.invertXKCD()) { //Negative of XKCD image float[] colorMatrixNegative = { -1.0f, 0, 0, 0, 255, //red 0, -1.0f, 0, 0, 255, //green 0, 0, -1.0f, 0, 255, //blue 0, 0, 0, 1.0f, 0 //alpha }; ColorFilter colorFilterNegative = new ColorMatrixColorFilter(colorMatrixNegative); mXKCDImage.setColorFilter(colorFilterNegative); // not inverting for now } setViewState(); }