예제 #1
0
 private void ViewOnSystemUiVisibilityChange(object sender, View.SystemUiVisibilityChangeEventArgs e)
 {
     if (sender is View targetView && targetView.SystemUiVisibility != (StatusBarVisibility)_flags)
     {
         targetView.SystemUiVisibility = (StatusBarVisibility)_flags;
     }
 }
예제 #2
0
 private void DecorView_SystemUiVisibilityChange(object sender, View.SystemUiVisibilityChangeEventArgs e)
 {
     try
     {
         ((FrameLayout)sender).SystemUiVisibility = (StatusBarVisibility)
                                                    (SystemUiFlags.LayoutStable
                                                     | SystemUiFlags.LayoutHideNavigation
                                                     | SystemUiFlags.LayoutFullscreen
                                                     | SystemUiFlags.HideNavigation
                                                     | SystemUiFlags.Fullscreen
                                                     | SystemUiFlags.Immersive);
     }
     catch (Exception ex)
     {
         Toast.MakeText(ApplicationContext, "Decor event: " + ex.Message, ToastLength.Long);
     }
 }
        private void AnchorViewOnSystemUiVisibilityChange(object sender, View.SystemUiVisibilityChangeEventArgs systemUiVisibilityChangeEventArgs)
        {
            // Test against mTestFlags to see if the system UI is visible.
            if (((int)systemUiVisibilityChangeEventArgs.Visibility & m_TestFlags) != 0)
            {
                if ((int)Build.VERSION.SdkInt < 16)
                {
                    // Pre-Jelly Bean, we must manually hide the action bar
                    // and use the old window flags API.
                    if (m_Activity.ActionBar != null)
                    {
                        m_Activity.ActionBar.Hide();
                    }

                    m_Activity.Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
                }

                // Trigger the registered listener and cache the visibility
                // state.
                m_OnVisibilityChangeListener.OnVisibilityChange(false);
                IsVisible = false;
            }
            else
            {
                m_AnchorView.SystemUiVisibility = (StatusBarVisibility)m_ShowFlags;
                if ((int)Build.VERSION.SdkInt < 16)
                {
                    // Pre-Jelly Bean, we must manually show the action bar
                    // and use the old window flags API.
                    if (m_Activity.ActionBar != null)
                    {
                        m_Activity.ActionBar.Show();
                    }

                    m_Activity.Window.SetFlags(0, WindowManagerFlags.Fullscreen);
                }

                // Trigger the registered listener and cache the visibility
                // state.
                m_OnVisibilityChangeListener.OnVisibilityChange(true);
                IsVisible = true;
            }
        }