mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 14:50:30 +05:30
fix status bar
This commit is contained in:
parent
29afd06478
commit
1f13c0a67f
@ -494,6 +494,8 @@ class MainActivity : BaseActivity() {
|
||||
private fun unsetFullscreen() {
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
|
||||
|
||||
showSystemBars()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
window.attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
|
||||
@ -512,6 +514,36 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* hide the status bar
|
||||
*/
|
||||
fun hideSystemBars() {
|
||||
if (resources.configuration.orientation != Configuration.ORIENTATION_LANDSCAPE) return
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.insetsController?.hide(WindowInsets.Type.statusBars())
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.setFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* show the status bar
|
||||
*/
|
||||
fun showSystemBars() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.insetsController?.show(WindowInsets.Type.statusBars())
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.clearFlags(
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUserLeaveHint() {
|
||||
super.onUserLeaveHint()
|
||||
supportFragmentManager.fragments.forEach { fragment ->
|
||||
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import com.github.libretube.activities.MainActivity
|
||||
import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
|
||||
import com.github.libretube.interfaces.DoubleTapInterface
|
||||
import com.github.libretube.util.DoubleTapListener
|
||||
@ -31,7 +32,7 @@ internal class CustomExoPlayerView(
|
||||
if (isControllerFullyVisible) hideController() else showController()
|
||||
}
|
||||
|
||||
val doubleTouchListener = object : DoubleTapListener() {
|
||||
private val doubleTouchListener = object : DoubleTapListener() {
|
||||
override fun onDoubleClick() {
|
||||
doubleTapListener?.onEvent(xPos)
|
||||
}
|
||||
@ -46,6 +47,11 @@ internal class CustomExoPlayerView(
|
||||
setOnClickListener(doubleTouchListener)
|
||||
}
|
||||
|
||||
override fun hideController() {
|
||||
(context as? MainActivity)?.hideSystemBars()
|
||||
super.hideController()
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
// save the x position of the touch event
|
||||
xPos = event.x
|
||||
|
Loading…
Reference in New Issue
Block a user