diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt index 3537e3c3d5..4144ebe81c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/PlayerActivity.kt @@ -13,6 +13,8 @@ import android.widget.SeekBar import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.WindowInsetsControllerCompat import com.github.vkay94.dtpv.DoubleTapPlayerView import com.github.vkay94.dtpv.youtube.YouTubeOverlay import com.google.android.exoplayer2.DefaultLoadControl @@ -65,7 +67,6 @@ import eu.kanade.tachiyomi.util.lang.launchUI import eu.kanade.tachiyomi.util.system.isOnline import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.toast -import eu.kanade.tachiyomi.util.view.hideBar import eu.kanade.tachiyomi.widget.listener.SimpleSeekBarListener import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll @@ -132,9 +133,10 @@ class PlayerActivity : AppCompatActivity() { applyAppTheme(preferences) super.onCreate(savedInstanceState) setContentView(R.layout.watcher_activity) - window.decorView.setOnSystemUiVisibilityChangeListener { - window.hideBar() - } + val windowInsetsController = WindowInsetsControllerCompat(window, findViewById(R.id.watcher_activity)) + windowInsetsController.hide(WindowInsetsCompat.Type.systemBars()) + windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE + playerView = findViewById(R.id.player_view) playerView.resizeMode = preferences.getPlayerViewMode() youTubeDoubleTap = findViewById(R.id.youtube_overlay) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt index cefe188d33..e3f8724a23 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/WindowExtensions.kt @@ -3,32 +3,11 @@ package eu.kanade.tachiyomi.util.view import android.content.Context import android.graphics.Color import android.os.Build -import android.view.View import android.view.Window import android.view.WindowManager import eu.kanade.tachiyomi.util.system.InternalResourceHelper import eu.kanade.tachiyomi.util.system.getResourceColor -fun Window.showBar() { - decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or - View.SYSTEM_UI_FLAG_LAYOUT_STABLE -} - -fun Window.hideBar() { - decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or - View.SYSTEM_UI_FLAG_FULLSCREEN or - View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or - View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY -} - -fun Window.defaultBar() { - decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE -} - -fun Window.isDefaultBar() = decorView.systemUiVisibility == View.SYSTEM_UI_FLAG_VISIBLE - /** * Sets navigation bar color to transparent if system's config_navBarNeedsScrim is false, * otherwise it will use the theme navigationBarColor with 70% opacity.