public void OnSystemUiVisibilityChange([GeneratedEnum] StatusBarVisibility visibility) { var activity = ContextHelper.Current as Activity; var decorView = activity.Window.DecorView; #pragma warning disable 618 var newUiOptions = (int)decorView.SystemUiVisibility; #pragma warning restore 618 if (((int)visibility & (int)SystemUiFlags.HideNavigation) == 0) { newUiOptions &= ~(int)SystemUiFlags.HideNavigation; } else { newUiOptions |= (int)SystemUiFlags.HideNavigation; } // We actually don't want to update the decorView.SystemUiVisibility because of the difference between SystemUiFlags.HideNavigation and SystemUiFlags.LayoutHideNavigation // - HideNavigation : User can show the navigation bar by sliding up from the bottom of the screen but it will disappear after 2-3 seconds // - LayoutHideNavigation : User can show the navigation bar by sliding up from the bottom of the screen and have the option to dock it / undock it // In the case we set the navigation bar to LayoutHideNavigation, when the user hide the bar, HideNavigation will be triggered. // But we don't want to inject it in the decorView.SystemUiVisibility to let the navigation bar dockable again Window.Current.SystemUiVisibility = newUiOptions; activity.OnConfigurationChanged(activity.Resources.Configuration); }
public void OnSystemUiVisibilityChange(StatusBarVisibility v) { if (targetView.SystemUiVisibility != ((StatusBarVisibility)SystemUiFlags.HideNavigation | (StatusBarVisibility)SystemUiFlags.Immersive)) { targetView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.HideNavigation | (StatusBarVisibility)SystemUiFlags.ImmersiveSticky; } }
public void OnSystemUiVisibilityChange(StatusBarVisibility vis) { if (((int)vis & hider.test_flags) != 0) { if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean) { hider.activity.ActionBar.Hide(); //hider.activity.Window.SetFlags (WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); hider.activity.Window.AddFlags(WindowManagerFlags.Fullscreen); } hider.on_visibility_change_listener.OnVisibilityChange(false); hider.visible = false; } else { hider.anchor_view.SystemUiVisibility = (StatusBarVisibility)hider.show_flags; if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean) { hider.activity.Window.ClearFlags(WindowManagerFlags.Fullscreen); hider.activity.ActionBar.Show(); //hider.activity.Window.SetFlags (0, WindowManagerFlags.Fullscreen); } hider.on_visibility_change_listener.OnVisibilityChange(true); hider.visible = true; } }
public override void OnShowCustomView(View view, WebChromeClient.ICustomViewCallback callback) { base.OnShowCustomView(view, callback); /*if (this.mCustomView != null) * { * onHideCustomView(); * return; * } * this.mCustomView = paramView; * this.mOriginalSystemUiVisibility = MainActivity.this.getWindow().getDecorView().getSystemUiVisibility(); * this.mOriginalOrientation = MainActivity.this.getRequestedOrientation(); * this.mCustomViewCallback = paramCustomViewCallback; * ((FrameLayout)MainActivity.this.getWindow().getDecorView()).addView(this.mCustomView, new FrameLayout.LayoutParams(-1, -1)); * MainActivity.this.getWindow().getDecorView().setSystemUiVisibility(3846);*/ if (_customView != null) { OnHideCustomView(); return; } _customView = view; _customView.SetBackgroundColor(Color.Black); _originalSystemUiVisibility = _docView.Window.DecorView.SystemUiVisibility; _originalOrientation = _docView.RequestedOrientation; _customViewCallback = callback; ((FrameLayout)_docView.Window.DecorView).AddView(_customView, new FrameLayout.LayoutParams(-1, -1)); _docView.Window.DecorView.Visibility = ViewStates.Visible; }
public void OnClick(View v) { // When the user clicks, we toggle the visibility of navigation elements. StatusBarVisibility curVis = SystemUiVisibility; SetNavVisibility(((int)curVis & (int)SystemUiFlags.LowProfile) != 0); }
public void OnSystemUiVisibilityChange([GeneratedEnum] StatusBarVisibility visibility) { if (((int)visibility & 0x2) == 0) { mHandler.PostDelayed(() => { mActivity.SetFullscreenMode(); }, NAVIGATION_BAR_TIMEOUT_MS); } }
public void OnSystemUiVisibilityChange (StatusBarVisibility visibility) { // Detect when we go out of low-profile mode, to also go out // of full screen. We only do this when the low profile mode // is changing from its last state, and turning off. StatusBarVisibility diff = mLastSystemUiVis ^ visibility; mLastSystemUiVis = visibility; if (((int)diff&(int)SystemUiFlags.LowProfile) != 0 && ((int)visibility&(int)SystemUiFlags.LowProfile) == 0) { SetNavVisibility (true); } }
public void OnSystemUiVisibilityChange(StatusBarVisibility visibility) { //Log.Debug("Xenko", "OnSystemUiVisibilityChange: visibility=0x{0:X8}", (int)visibility); var diffVisibility = lastVisibility ^ visibility; lastVisibility = visibility; if ((((int)diffVisibility & (int)SystemUiFlags.LowProfile) != 0) && (((int)visibility & (int)SystemUiFlags.LowProfile) == 0)) { // visibility has changed out of low profile mode; change it back, which requires a delay to work properly: // http://stackoverflow.com/questions/11027193/maintaining-lights-out-mode-view-setsystemuivisibility-across-restarts RemoveFullscreenViewCallback(); PostFullscreenViewCallback(); } }
public void OnSystemUiVisibilityChange(StatusBarVisibility visibility) { // Detect when we go out of low-profile mode, to also go out // of full screen. We only do this when the low profile mode // is changing from its last state, and turning off. StatusBarVisibility diff = mLastSystemUiVis ^ visibility; mLastSystemUiVis = visibility; if (((int)diff & (int)SystemUiFlags.LowProfile) != 0 && ((int)visibility & (int)SystemUiFlags.LowProfile) == 0) { SetNavVisibility(true); } }
public void OnSystemUiVisibilityChange (StatusBarVisibility visibility) { // Detect when we go out of nav-hidden mode, to reset back to having // it hidden; our game wants those elements to stay hidden as long // as it is being played and stay shown when paused. StatusBarVisibility diff = mLastSystemUiVis ^ visibility; mLastSystemUiVis = visibility; if (!mPaused && ((int)diff & (int)SystemUiFlags.HideNavigation) != 0 && ((int)visibility & (int)SystemUiFlags.HideNavigation) == 0) { // We are running and the system UI navigation has become // shown... we want it to remain hidden, so update our system // UI state at the next game loop. mUpdateSystemUi = true; } }
private static void SetBarAppearance(Window currentWindow, bool?statusBarLight = null, bool?navigationBarLight = null) { StatusBarVisibility barAppearanceOld = 0; WindowInsetsControllerAppearance barAppearanceNew = 0; if ((int)Build.VERSION.SdkInt < 30) { #pragma warning disable CS0618 // Type or member is obsolete. Using new API for Sdk 30+ barAppearanceOld = currentWindow.DecorView.SystemUiVisibility; #pragma warning restore CS0618 // Type or member is obsolete } else { barAppearanceNew = (WindowInsetsControllerAppearance)currentWindow.InsetsController.SystemBarsAppearance; } if (statusBarLight == true) { barAppearanceOld = barAppearanceOld.AddFlag((StatusBarVisibility)SystemUiFlags.LightStatusBar); barAppearanceNew = barAppearanceNew.AddFlag(WindowInsetsControllerAppearance.LightStatusBars); } else if (statusBarLight == false) { barAppearanceOld = barAppearanceOld.RemoveFlag((StatusBarVisibility)SystemUiFlags.LightStatusBar); barAppearanceNew = barAppearanceNew.RemoveFlag(WindowInsetsControllerAppearance.LightStatusBars); } if (navigationBarLight == true) { barAppearanceOld = barAppearanceOld.AddFlag((StatusBarVisibility)SystemUiFlags.LightNavigationBar); barAppearanceNew = barAppearanceNew.AddFlag(WindowInsetsControllerAppearance.LightNavigationBars); } else if (navigationBarLight == false) { barAppearanceOld = barAppearanceOld.RemoveFlag((StatusBarVisibility)SystemUiFlags.LightNavigationBar); barAppearanceNew = barAppearanceNew.RemoveFlag(WindowInsetsControllerAppearance.LightNavigationBars); } if ((int)Build.VERSION.SdkInt < 30) { #pragma warning disable CS0618 // Type or member is obsolete. Using new API for Sdk 30+ currentWindow.DecorView.SystemUiVisibility = barAppearanceOld; #pragma warning restore CS0618 // Type or member is obsolete } else { currentWindow.InsetsController?.SetSystemBarsAppearance((int)barAppearanceNew, (int)barAppearanceNew); } }
public override void OnShowCustomView(Android.Views.View view, ICustomViewCallback callback) { if (customView != null) { OnHideCustomView(); } else { originalSystemUIVisibility = (Forms.Context as Activity).Window.DecorView.SystemUiVisibility; originalOrientation = (Forms.Context as Activity).RequestedOrientation; customView = view; viewCallback = callback; ((FrameLayout)(Forms.Context as Activity).Window.DecorView) .AddView(customView, new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); } }
public void OnSystemUiVisibilityChange(StatusBarVisibility visibility) { // Detect when we go out of nav-hidden mode, to reset back to having // it hidden; our game wants those elements to stay hidden as long // as it is being played and stay shown when paused. StatusBarVisibility diff = mLastSystemUiVis ^ visibility; mLastSystemUiVis = visibility; if (!mPaused && ((int)diff & (int)SystemUiFlags.HideNavigation) != 0 && ((int)visibility & (int)SystemUiFlags.HideNavigation) == 0) { // We are running and the system UI navigation has become // shown... we want it to remain hidden, so update our system // UI state at the next game loop. mUpdateSystemUi = true; } }
public void SetStatusBarColor(System.Drawing.Color color, bool darkStatusBarTint) { // Window.SetStatusBarColor added in Android 5.0 Lollipop API 21 if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { var activity = Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity; var window = activity.Window; window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); window.ClearFlags(WindowManagerFlags.TranslucentStatus); window.SetStatusBarColor(color.ToPlatformColor()); // SYSTEM_UI_FLAG_LIGHT_STATUS_BAR added in Android 6.0 Marshmallow API 23 if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { const StatusBarVisibility flag = (StatusBarVisibility)SystemUiFlags.LightStatusBar; window.DecorView.SystemUiVisibility = darkStatusBarTint ? flag : 0; } } }
public void SetStatusBarColor(Color color, bool darkStatusBarTint) { if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop) { return; } Activity activity = Platform.CurrentActivity; Window window = activity.Window; window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); window.ClearFlags(WindowManagerFlags.TranslucentStatus); window.SetStatusBarColor(color.ToPlatformColor()); if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { StatusBarVisibility flag = (StatusBarVisibility)SystemUiFlags.LightStatusBar; #pragma warning disable CS0618 // Type or member is obsolete and known window.DecorView.SystemUiVisibility = darkStatusBarTint ? flag : 0; #pragma warning restore CS0618 // Type or member is obsolete and known } }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; this.Window.AddFlags(WindowManagerFlags.Fullscreen); this.Window.DecorView.SystemUiVisibility = StatusBarVisibility.Hidden; if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { var statusBarHeightInfo = typeof(FormsAppCompatActivity) .GetField("_statusBarHeight", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); statusBarHeightInfo.SetValue(this, 0); } base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); var decorView = Window.DecorView; StatusBarVisibility uiOptions = decorView.SystemUiVisibility; var newUiOptions = (int)uiOptions; newUiOptions |= (int)SystemUiFlags.LowProfile; newUiOptions |= (int)SystemUiFlags.Fullscreen; newUiOptions |= (int)SystemUiFlags.HideNavigation; newUiOptions |= (int)SystemUiFlags.Immersive; newUiOptions |= (int)SystemUiFlags.ImmersiveSticky; newUiOptions |= (int)SystemUiFlags.LayoutFullscreen; decorView.SystemUiVisibility = (StatusBarVisibility)newUiOptions; this.Window.AddFlags(WindowManagerFlags.KeepScreenOn); Forms.SetTitleBarVisibility(AndroidTitleBarVisibility.Never); }
public void OnSystemUiVisibilityChange(StatusBarVisibility vis) { if (((int)vis & hider.test_flags) != 0) { if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean) { hider.activity.ActionBar.Hide (); //hider.activity.Window.SetFlags (WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); hider.activity.Window.AddFlags (WindowManagerFlags.Fullscreen); } hider.on_visibility_change_listener.OnVisibilityChange (false); hider.visible = false; } else { hider.anchor_view.SystemUiVisibility = (StatusBarVisibility)hider.show_flags; if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean) { hider.activity.Window.ClearFlags (WindowManagerFlags.Fullscreen); hider.activity.ActionBar.Show (); //hider.activity.Window.SetFlags (0, WindowManagerFlags.Fullscreen); } hider.on_visibility_change_listener.OnVisibilityChange (true); hider.visible = true; } }
public void OnSystemUiVisibilityChange(StatusBarVisibility visibility) { throw new NotImplementedException(); }
internal static void AddBarAppearanceFlag(Activity activity, StatusBarVisibility flag) => SetBarAppearance(activity, barAppearance => barAppearance |= flag);
internal static void RemoveBarAppearanceFlag(Activity activity, StatusBarVisibility flag) => SetBarAppearance(activity, barAppearance => barAppearance &= ~flag);
public void OnSystemUiVisibilityChange(StatusBarVisibility visibility) { HideSystemUI(); }
public void OnSystemUiVisibilityChange([GeneratedEnum] StatusBarVisibility visibility) { var isVisibleNavigationBar = ((int)visibility & (int)SystemUiFlags.HideNavigation) == 0; MeasureRect(isVisibleNavigationBar); }
public void OnSystemUiVisibilityChange (StatusBarVisibility visibility) { throw new NotImplementedException (); }