List of usage examples for android.view View SYSTEM_UI_FLAG_HIDE_NAVIGATION
int SYSTEM_UI_FLAG_HIDE_NAVIGATION
To view the source code for android.view View SYSTEM_UI_FLAG_HIDE_NAVIGATION.
Click Source Link
From source file:org.centum.android.learn.LearnActivity.java
@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus && Build.VERSION.SDK_INT >= 16) { viewPager.setSystemUiVisibility( 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); }//from w w w . j a v a 2 s . c o m }
From source file:it.cammino.risuscito.LUtils.java
public void goFullscreen() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { mActivity.requestWindowFeature(Window.FEATURE_NO_TITLE); mActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } else/* w ww . jav a2s . co m*/ mActivity.getWindow().getDecorView().setSystemUiVisibility( 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); }
From source file:au.com.dektech.dektalk.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set window styles for fullscreen-window size. Needs to be done before // adding content. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); setContentView(R.layout.activity_main); // initialize UI btnDial = (Button) findViewById(R.id.button_dial); btnDial.setOnClickListener(this); btnHangup = (Button) findViewById(R.id.button_hangup); btnHangup.setOnClickListener(this); }
From source file:com.example.android.advancedimmersivemode.AdvancedImmersiveModeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) { final View flagsView = inflater.inflate(R.layout.fragment_flags, container, false); mLowProfileCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_enable_lowprof); mHideNavCheckbox = (CheckBox) flagsView.findViewById(R.id.flag_hide_navbar); mHideStatusBarCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_hide_statbar); mImmersiveModeCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_enable_immersive); mImmersiveModeStickyCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_enable_immersive_sticky); Button toggleFlagsButton = (Button) flagsView.findViewById(R.id.btn_changeFlags); toggleFlagsButton.setOnClickListener(new View.OnClickListener() { @Override/*from ww w.j av a 2 s.c o m*/ public void onClick(View view) { toggleUiFlags(); } }); Button presetsImmersiveModeButton = (Button) flagsView.findViewById(R.id.btn_immersive); presetsImmersiveModeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // BEGIN_INCLUDE(immersive_presets) // For immersive mode, the FULLSCREEN, HIDE_HAVIGATION and IMMERSIVE // flags should be set (you can use IMMERSIVE_STICKY instead of IMMERSIVE // as appropriate for your app). The LOW_PROFILE flag should be cleared. // Immersive mode is primarily for situations where the user will be // interacting with the screen, like games or reading books. int uiOptions = flagsView.getSystemUiVisibility(); uiOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; uiOptions |= View.SYSTEM_UI_FLAG_FULLSCREEN; uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE; uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; flagsView.setSystemUiVisibility(uiOptions); // END_INCLUDE(immersive_presets) dumpFlagStateToLog(uiOptions); // The below code just updates the checkboxes to reflect which flags have been set. mLowProfileCheckBox.setChecked(false); mHideNavCheckbox.setChecked(true); mHideStatusBarCheckBox.setChecked(true); mImmersiveModeCheckBox.setChecked(true); mImmersiveModeStickyCheckBox.setChecked(false); } }); Button presetsLeanbackModeButton = (Button) flagsView.findViewById(R.id.btn_leanback); presetsLeanbackModeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // BEGIN_INCLUDE(leanback_presets) // For leanback mode, only the HIDE_NAVE and HIDE_STATUSBAR flags // should be checked. In this case IMMERSIVE should *not* be set, // since this mode is left as soon as the user touches the screen. int uiOptions = flagsView.getSystemUiVisibility(); uiOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; uiOptions |= View.SYSTEM_UI_FLAG_FULLSCREEN; uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE; uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; flagsView.setSystemUiVisibility(uiOptions); // END_INCLUDE(leanback_presets) dumpFlagStateToLog(uiOptions); // The below code just updates the checkboxes to reflect which flags have been set. mLowProfileCheckBox.setChecked(false); mHideNavCheckbox.setChecked(true); mHideStatusBarCheckBox.setChecked(true); mImmersiveModeCheckBox.setChecked(false); mImmersiveModeStickyCheckBox.setChecked(false); } }); // Setting these flags makes the content appear under the navigation // bars, so that showing/hiding the nav bars doesn't resize the content // window, which can be jarring. int uiOptions = flagsView.getSystemUiVisibility(); uiOptions |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; uiOptions |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; uiOptions |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; flagsView.setSystemUiVisibility(uiOptions); return flagsView; }
From source file:info.ipeanut.googletrainingcoursedemos.advancedimmersivemode.AdvancedImmersiveModeFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) { final View flagsView = inflater.inflate(R.layout.fragment_flags, container, false); mLowProfileCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_enable_lowprof); mHideNavCheckbox = (CheckBox) flagsView.findViewById(R.id.flag_hide_navbar); mHideStatusBarCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_hide_statbar); mImmersiveModeCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_enable_immersive); mImmersiveModeStickyCheckBox = (CheckBox) flagsView.findViewById(R.id.flag_enable_immersive_sticky); Button toggleFlagsButton = (Button) flagsView.findViewById(R.id.btn_changeFlags); toggleFlagsButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . j av a 2s .c o m*/ public void onClick(View view) { toggleUiFlags(); } }); Button presetsImmersiveModeButton = (Button) flagsView.findViewById(R.id.btn_immersive); presetsImmersiveModeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // For immersive mode, the FULLSCREEN, HIDE_HAVIGATION and IMMERSIVE // flags should be set (you can use IMMERSIVE_STICKY instead of IMMERSIVE // as appropriate for your app). The LOW_PROFILE flag should be cleared. // Immersive mode is primarily for situations where the user will be // interacting with the screen, like games or reading books. int uiOptions = flagsView.getSystemUiVisibility(); uiOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; uiOptions |= View.SYSTEM_UI_FLAG_FULLSCREEN; uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; uiOptions |= View.SYSTEM_UI_FLAG_IMMERSIVE; uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; flagsView.setSystemUiVisibility(uiOptions); dumpFlagStateToLog(uiOptions); // The below code just updates the checkboxes to reflect which flags have been set. mLowProfileCheckBox.setChecked(false); mHideNavCheckbox.setChecked(true); mHideStatusBarCheckBox.setChecked(true); mImmersiveModeCheckBox.setChecked(true); mImmersiveModeStickyCheckBox.setChecked(false); } }); Button presetsLeanbackModeButton = (Button) flagsView.findViewById(R.id.btn_leanback); presetsLeanbackModeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // For leanback mode, only the HIDE_NAVE and HIDE_STATUSBAR flags // should be checked. In this case IMMERSIVE should *not* be set, // since this mode is left as soon as the user touches the screen. int uiOptions = flagsView.getSystemUiVisibility(); uiOptions &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; uiOptions |= View.SYSTEM_UI_FLAG_FULLSCREEN; uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE; uiOptions &= ~View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; flagsView.setSystemUiVisibility(uiOptions); dumpFlagStateToLog(uiOptions); // The below code just updates the checkboxes to reflect which flags have been set. mLowProfileCheckBox.setChecked(false); mHideNavCheckbox.setChecked(true); mHideStatusBarCheckBox.setChecked(true); mImmersiveModeCheckBox.setChecked(false); mImmersiveModeStickyCheckBox.setChecked(false); } }); // Setting these flags makes the content appear under the navigation // bars, so that showing/hiding the nav bars doesn't resize the content // window, which can be jarring. int uiOptions = flagsView.getSystemUiVisibility(); uiOptions |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; uiOptions |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; uiOptions |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; flagsView.setSystemUiVisibility(uiOptions); return flagsView; }
From source file:com.avolatile.randomdaily.IntroductionActivity.java
@Override protected void onResume() { /* The following code will enable immersive mode for the introduction screen * for devices running on Android 3.0 Honeycomb or higher. This will effectively * enable immersive mode all of the app's instances as the app is only compatible * with devices running on Android 4.1 Jelly Bean or higher */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( 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); }/*from w w w . j ava 2s .co m*/ super.onResume(); }
From source file:com.example.android.threadsample.DisplayActivity.java
/** * Sets full screen mode on the device, by setting parameters in the current * window and View/* ww w.j a v a 2 s . c om*/ * @param fullscreen */ public void setFullScreen(boolean fullscreen) { // If full screen is set, sets the fullscreen flag in the Window manager getWindow().setFlags(fullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Sets the global fullscreen flag to the current setting mFullScreen = fullscreen; // If the platform version is Android 3.0 (Honeycomb) or above if (Build.VERSION.SDK_INT >= 11) { // Sets the View to be "low profile". Status and navigation bar icons will be dimmed int flag = fullscreen ? View.SYSTEM_UI_FLAG_LOW_PROFILE : 0; // If the platform version is Android 4.0 (ICS) or above if (Build.VERSION.SDK_INT >= 14 && fullscreen) { // Hides all of the navigation icons flag |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; } // Applies the settings to the screen View mMainView.setSystemUiVisibility(flag); // If the user requests a full-screen view, hides the Action Bar. if (fullscreen) { this.getActionBar().hide(); } else { this.getActionBar().show(); } } }
From source file:com.cranberrygame.phonegap.plugin.NavigationBar.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void _setUp(boolean autoHideNavigationBar) { if (autoHideNavigationBar) { Activity activity = cordova.getActivity(); //http://stackoverflow.com/questions/21164836/immersive-mode-navigation-becomes-sticky-after-volume-press-or-minimise-restore //http://www.youtube.com/watch?v=Xw9TIS_JsPM //https://developer.android.com/training/system-ui/status.html activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION //| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN //| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); final CordovaInterface cordova_final = cordova; //http://stackoverflow.com/questions/11762306/listen-for-first-touchevent-when-using-system-ui-flag-hide-navigation //http://stackoverflow.com/questions/15103339/android-full-screen-modeics-first-touch-shows-the-navigation-bar //http://developer.android.com/reference/android/view/View.OnSystemUiVisibilityChangeListener.html webView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override//from w ww .ja v a 2s. co m public void onSystemUiVisibilityChange(int vis) { if (vis == 0) { //http://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay-in-android Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Activity activity = cordova_final.getActivity(); activity.getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION //| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN //| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } }, 3000);//after ms } } }); } }
From source file:com.cranberrygame.cordova.plugin.navigationbar.NavigationBar.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private void _setUp(boolean autoHideNavigationBar) { if (autoHideNavigationBar) { Activity activity = cordova.getActivity(); //http://stackoverflow.com/questions/21164836/immersive-mode-navigation-becomes-sticky-after-volume-press-or-minimise-restore //http://www.youtube.com/watch?v=Xw9TIS_JsPM //https://developer.android.com/training/system-ui/status.html activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION //| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN //| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); final CordovaInterface cordova_final = cordova; //http://stackoverflow.com/questions/11762306/listen-for-first-touchevent-when-using-system-ui-flag-hide-navigation //http://stackoverflow.com/questions/15103339/android-full-screen-modeics-first-touch-shows-the-navigation-bar //http://developer.android.com/reference/android/view/View.OnSystemUiVisibilityChangeListener.html //webView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener(){//cordova5 build error getView(webView).setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {//fixed cordova5 build error @Override//from w w w. j a v a 2 s .c o m public void onSystemUiVisibilityChange(int vis) { if (vis == 0) { //http://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay-in-android Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Activity activity = cordova_final.getActivity(); activity.getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION //| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN //| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } }, 3000);//after ms } } }); } }
From source file:com.jungle.base.utils.MiscUtils.java
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB) public static void setImmersiveMode(Activity activity) { View decorView = activity.getWindow().getDecorView(); int option = decorView.getSystemUiVisibility(); if (Build.VERSION.SDK_INT >= 14) { option ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; }/* w w w .j a v a 2 s. co m*/ if (Build.VERSION.SDK_INT >= 16) { option ^= View.SYSTEM_UI_FLAG_FULLSCREEN; } if (Build.VERSION.SDK_INT >= 19) { //option ^= View.SYSTEM_UI_FLAG_IMMERSIVE; } decorView.setSystemUiVisibility(option); }