@@ -405,7 +405,7 @@ private void Frame()
405405
406406 lock ( renderWindow . renderLock )
407407 {
408- renderWindow . shouldRender = renderWindow . window . Unavailable == false && ( AppSettings . Current . runInBackground == true || renderWindow . window . IsFocused == true ) ;
408+ renderWindow . shouldRender = renderWindow . window . Unavailable == false && renderWindow . window . IsFocused ;
409409 }
410410
411411 if ( renderWindow . window . Unavailable )
@@ -431,7 +431,7 @@ private void Frame()
431431
432432 renderWindow . CheckContextLost ( ) ;
433433
434- if ( AppSettings . Current . runInBackground == false && renderWindow . window . IsFocused != renderWindow . hasFocus )
434+ if ( renderWindow . window . IsFocused != renderWindow . hasFocus )
435435 {
436436 renderWindow . hasFocus = renderWindow . window . IsFocused ;
437437
@@ -505,8 +505,6 @@ void Finish()
505505 renderWindow . screenHeight = height ;
506506 renderWindow . window = nativeWindow ;
507507 renderWindow . unavailable = false ;
508-
509- renderWindow . ContextLost = true ;
510508 } ) ;
511509
512510 new Handler ( Looper . MainLooper ) . Post ( ( ) =>
@@ -551,6 +549,7 @@ public void SurfaceDestroyed(ISurfaceHolder holder)
551549 AndroidRenderWindow . Instance . Mutate ( ( renderWindow ) =>
552550 {
553551 renderWindow . unavailable = true ;
552+ renderWindow . contextLost = true ;
554553 } ) ;
555554 }
556555
@@ -574,6 +573,35 @@ protected virtual string[] AdditionalLibraries()
574573 return outValue . ToArray ( ) ;
575574 }
576575
576+ public override void OnWindowFocusChanged ( bool hasFocus )
577+ {
578+ base . OnWindowFocusChanged ( hasFocus ) ;
579+
580+ if ( hasFocus )
581+ {
582+ if ( OperatingSystem . IsAndroidVersionAtLeast ( 35 ) )
583+ {
584+ Window . InsetsController . Hide ( WindowInsets . Type . SystemBars ( ) ) ;
585+ Window . InsetsController . SystemBarsBehavior = ( int ) WindowInsetsControllerBehavior . ShowTransientBarsBySwipe ;
586+ }
587+ else if ( OperatingSystem . IsAndroidVersionAtLeast ( 30 ) )
588+ {
589+ Window . SetDecorFitsSystemWindows ( false ) ;
590+ Window . InsetsController . Hide ( WindowInsets . Type . SystemBars ( ) ) ;
591+ Window . InsetsController . SystemBarsBehavior = ( int ) WindowInsetsControllerBehavior . ShowTransientBarsBySwipe ;
592+ }
593+ else if ( OperatingSystem . IsAndroidVersionAtLeast ( 19 ) )
594+ {
595+ Window . DecorView . SystemUiFlags = SystemUiFlags . LayoutStable |
596+ SystemUiFlags . LayoutHideNavigation |
597+ SystemUiFlags . LayoutFullscreen |
598+ SystemUiFlags . HideNavigation |
599+ SystemUiFlags . Fullscreen |
600+ SystemUiFlags . ImmersiveSticky ;
601+ }
602+ }
603+ }
604+
577605 protected override void OnCreate ( Bundle ? savedInstanceState )
578606 {
579607 base . OnCreate ( savedInstanceState ) ;
@@ -587,6 +615,10 @@ protected override void OnCreate(Bundle? savedInstanceState)
587615 Java . Lang . JavaSystem . LoadLibrary ( library ) ;
588616 }
589617
618+ RequestWindowFeature ( WindowFeatures . NoTitle ) ;
619+
620+ Window . SetFlags ( WindowManagerFlags . Fullscreen , WindowManagerFlags . Fullscreen ) ;
621+
590622 if ( OperatingSystem . IsAndroidVersionAtLeast ( 23 ) )
591623 {
592624 WindowManagerLayoutParams p = Window . Attributes ;
@@ -621,22 +653,6 @@ protected override void OnCreate(Bundle? savedInstanceState)
621653 Window . Attributes . LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode . Always ;
622654 }
623655
624- if ( OperatingSystem . IsAndroidVersionAtLeast ( 30 ) )
625- {
626- Window . SetDecorFitsSystemWindows ( false ) ;
627- Window . InsetsController . Hide ( WindowInsets . Type . StatusBars ( ) | WindowInsets . Type . NavigationBars ( ) ) ;
628- Window . InsetsController . SystemBarsBehavior = ( int ) WindowInsetsControllerBehavior . ShowTransientBarsBySwipe ;
629- }
630- else if ( OperatingSystem . IsAndroidVersionAtLeast ( 19 ) )
631- {
632- Window . DecorView . SystemUiFlags = SystemUiFlags . HideNavigation |
633- SystemUiFlags . LayoutHideNavigation |
634- SystemUiFlags . LayoutFullscreen |
635- SystemUiFlags . Fullscreen |
636- SystemUiFlags . LayoutStable |
637- SystemUiFlags . ImmersiveSticky ;
638- }
639-
640656 MessagePackInit . Initialize ( ) ;
641657
642658 ResourceManager . instance . assetManager = Assets ;
0 commit comments