当前位置: 首页>>代码示例>>Java>>正文


Java View.SYSTEM_UI_FLAG_IMMERSIVE属性代码示例

本文整理汇总了Java中android.view.View.SYSTEM_UI_FLAG_IMMERSIVE属性的典型用法代码示例。如果您正苦于以下问题:Java View.SYSTEM_UI_FLAG_IMMERSIVE属性的具体用法?Java View.SYSTEM_UI_FLAG_IMMERSIVE怎么用?Java View.SYSTEM_UI_FLAG_IMMERSIVE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.view.View的用法示例。


在下文中一共展示了View.SYSTEM_UI_FLAG_IMMERSIVE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hideSystemUI

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);
}
 
开发者ID:Tubitv,项目名称:TubiPlayer,代码行数:36,代码来源:Utils.java

示例2: toggleHideyBar

public static void toggleHideyBar(Activity activity, boolean onResume) {

        int newUiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();

        if (onResume) {

            applyImmersiveMode(activity);

        } else {
            newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
            newUiOptions ^= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
            newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

            newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
            newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE;
            newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
            activity.getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
        }
    }
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:20,代码来源:ImmersiveUtils.java

示例3: createHideFlags

@Override
protected int createHideFlags() {
    int flag = super.createHideFlags();

    if (mLevel == SystemUiHelper.LEVEL_IMMERSIVE) {
        // If the client requested immersive mode, and we're on Android 4.4
        // or later, add relevant flags. Applying HIDE_NAVIGATION without
        // IMMERSIVE prevents the activity from accepting all touch events,
        // so we only do this on Android 4.4 and later (where IMMERSIVE is
        // present).
        flag |= ((mFlags & SystemUiHelper.FLAG_IMMERSIVE_STICKY) != 0)
                        ? View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                        : View.SYSTEM_UI_FLAG_IMMERSIVE;
    }

    return flag;
}
 
开发者ID:ujjwalagrawal17,项目名称:CodeCompilerApp,代码行数:17,代码来源:SystemUiHelperImplKK.java

示例4: setUiVisibilityKitKat

@TargetApi(Build.VERSION_CODES.KITKAT)
private void setUiVisibilityKitKat(boolean isVisible) {
  int flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
      | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
      | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
  if (!isVisible) {
    flags |= View.SYSTEM_UI_FLAG_LOW_PROFILE
        | View.SYSTEM_UI_FLAG_FULLSCREEN
        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
        | View.SYSTEM_UI_FLAG_IMMERSIVE;
  }
  viewPager.setSystemUiVisibility(flags);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:13,代码来源:PagerActivity.java

示例5: setFullScreen

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();
	}
}
 
开发者ID:alescdb,项目名称:LauncherTV,代码行数:28,代码来源:Launcher.java

示例6: showSystemBar

protected void showSystemBar(boolean show) {
    if (mSystemBarShowing == show) return;
    mSystemUiVisibility = mPlayerView.getSystemUiVisibility();
    if (PlayerConfig.hasHackedFullScreen()) {
        final int STATUS_BAR_GONE =  (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1 ? 0x00000004 : 0x000008);
        if (show)
            mSystemUiVisibility &= ~STATUS_BAR_GONE;
        else
            mSystemUiVisibility |= STATUS_BAR_GONE;
        manualVisibilityChange=true;
        mPlayerView.setSystemUiVisibility(mSystemUiVisibility);
        mSystemBarGone = !show;
    } else {
        int systemUiFlag = View.SYSTEM_UI_FLAG_LOW_PROFILE;
        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { /* ICS and less */
            if (show)
                mWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            else
                mWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else { /* JB and more */
            systemUiFlag |= 0x00000004 /* View.SYSTEM_UI_FLAG_FULLSCREEN */;
        }
        if (show) {
            mSystemUiVisibility &= ~systemUiFlag;
            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
                mSystemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
        }
        else {
            mSystemUiVisibility |= systemUiFlag;
            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
                    mSystemUiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
        }
        mPlayerView.setSystemUiVisibility(mSystemUiVisibility);
        manualVisibilityChange=true;
        mSystemBarGone = false;
        if (PlayerConfig.canSystemBarHide()) {
            if (!show)
                mHandler.sendEmptyMessageDelayed(MSG_HIDE_SYSTEM_BAR, 1000);
        }
    }
    mSystemBarShowing = show;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:42,代码来源:PlayerController.java

示例7: onResume

@Override
protected void onResume() {
    super.onResume();

    // Hide the status bar.
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY  ;
    getWindow().getDecorView().setSystemUiVisibility(uiOptions);

    mSounds = App.getInstance(this).getSoundEffects();


    unpause();

    updateScores();

    mSounds.playBGMusic();


}
 
开发者ID:quaap,项目名称:SeafoodBerserker,代码行数:19,代码来源:PlayActivity.java


注:本文中的android.view.View.SYSTEM_UI_FLAG_IMMERSIVE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。