Merge pull request #4398 from Bnyro/master

feat: hide status bar if player locked
This commit is contained in:
Bnyro 2023-08-07 19:07:01 +02:00 committed by GitHub
commit 55bd88076d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.os.postDelayed import androidx.core.os.postDelayed
import androidx.core.view.ViewCompat import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.view.marginStart import androidx.core.view.marginStart
@ -47,6 +48,7 @@ import com.github.libretube.helpers.PlayerHelper
import com.github.libretube.helpers.PreferenceHelper import com.github.libretube.helpers.PreferenceHelper
import com.github.libretube.obj.BottomSheetItem import com.github.libretube.obj.BottomSheetItem
import com.github.libretube.ui.base.BaseActivity import com.github.libretube.ui.base.BaseActivity
import com.github.libretube.ui.extensions.toggleSystemBars
import com.github.libretube.ui.interfaces.PlayerGestureOptions import com.github.libretube.ui.interfaces.PlayerGestureOptions
import com.github.libretube.ui.interfaces.PlayerOptions import com.github.libretube.ui.interfaces.PlayerOptions
import com.github.libretube.ui.listeners.PlayerGestureController import com.github.libretube.ui.listeners.PlayerGestureController
@ -138,6 +140,11 @@ open class CustomExoPlayerView(
// change locked status // change locked status
isPlayerLocked = !isPlayerLocked isPlayerLocked = !isPlayerLocked
activity.toggleSystemBars(
types = WindowInsetsCompat.Type.statusBars(),
showBars = !isPlayerLocked
)
} }
resizeMode = when (resizeModePref) { resizeMode = when (resizeModePref) {

View File

@ -129,7 +129,7 @@ class OnlinePlayerView(
// Show status bar only not navigation bar if the player controls are visible and hide it otherwise // Show status bar only not navigation bar if the player controls are visible and hide it otherwise
activity.toggleSystemBars( activity.toggleSystemBars(
types = WindowInsetsCompat.Type.statusBars(), types = WindowInsetsCompat.Type.statusBars(),
showBars = visibility == View.VISIBLE showBars = visibility == View.VISIBLE && !isPlayerLocked
) )
} }
} }