@@ -30,6 +30,7 @@ import android.view.ViewGroup.MarginLayoutParams
3030import android.view.inputmethod.EditorInfo
3131import android.view.inputmethod.InputMethodManager
3232import android.webkit.WebView
33+ import android.widget.FrameLayout
3334import android.widget.LinearLayout
3435import androidx.appcompat.app.AlertDialog
3536import androidx.appcompat.widget.ActionMenuView
@@ -666,6 +667,8 @@ class ReviewerFragment :
666667
667668 override fun onCreateWebViewClient (savedInstanceState : Bundle ? ): CardViewerWebViewClient = ReviewerWebViewClient (savedInstanceState)
668669
670+ override fun onCreateWebChromeClient (): CardViewerWebChromeClient = ReviewerWebChromeClient ()
671+
669672 private inner class ReviewerWebViewClient (
670673 savedInstanceState : Bundle ? ,
671674 ) : CardViewerWebViewClient(savedInstanceState) {
@@ -740,6 +743,29 @@ class ReviewerFragment :
740743 }
741744 }
742745
746+ private inner class ReviewerWebChromeClient : CardViewerWebChromeClient () {
747+ override fun onHideCustomView () {
748+ val barsToHide = Prefs .hideSystemBars
749+ if (barsToHide == HideSystemBars .NONE ) {
750+ super .onHideCustomView()
751+ } else {
752+ val window = requireActivity().window
753+ (window.decorView as FrameLayout ).removeView(paramView)
754+
755+ val barsToShowBack =
756+ when (barsToHide) {
757+ HideSystemBars .STATUS_BAR -> WindowInsetsCompat .Type .navigationBars()
758+ HideSystemBars .NAVIGATION_BAR -> WindowInsetsCompat .Type .statusBars()
759+ HideSystemBars .ALL , HideSystemBars .NONE -> return
760+ }
761+ with (WindowInsetsControllerCompat (window, window.decorView)) {
762+ show(barsToShowBack)
763+ systemBarsBehavior = WindowInsetsControllerCompat .BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
764+ }
765+ }
766+ }
767+ }
768+
743769 companion object {
744770 fun getIntent (context : Context ): Intent = CardViewerActivity .getIntent(context, ReviewerFragment ::class )
745771 }
0 commit comments