mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Show status bar automatically with controls in offline player
This commit is contained in:
parent
44b893ba96
commit
2a4aad88ee
@ -6,9 +6,12 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateUtils
|
||||
import android.view.View
|
||||
import android.view.ViewGroup.MarginLayoutParams
|
||||
import androidx.activity.viewModels
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.media3.common.C
|
||||
import androidx.media3.common.MediaItem
|
||||
@ -29,6 +32,7 @@ import com.github.libretube.databinding.ExoStyledPlayerControlViewBinding
|
||||
import com.github.libretube.db.DatabaseHolder.Database
|
||||
import com.github.libretube.db.obj.DownloadItem
|
||||
import com.github.libretube.enums.FileType
|
||||
import com.github.libretube.extensions.dpToPx
|
||||
import com.github.libretube.extensions.toAndroidUri
|
||||
import com.github.libretube.extensions.updateParameters
|
||||
import com.github.libretube.helpers.PlayerHelper
|
||||
@ -101,6 +105,14 @@ class OfflinePlayerActivity : BaseActivity() {
|
||||
playerView.player = player
|
||||
playerBinding = binding.player.binding
|
||||
|
||||
// increase the margin to the status bar
|
||||
playerBinding.topBar.setPadding(
|
||||
playerBinding.topBar.paddingLeft,
|
||||
playerBinding.topBar.paddingTop * 2,
|
||||
playerBinding.topBar.paddingRight,
|
||||
playerBinding.topBar.paddingBottom
|
||||
)
|
||||
|
||||
playerBinding.fullscreen.isInvisible = true
|
||||
playerBinding.closeImageButton.setOnClickListener {
|
||||
finish()
|
||||
|
@ -251,12 +251,14 @@ internal class CustomExoPlayerView(
|
||||
cancelHideControllerTask()
|
||||
super.hideController()
|
||||
|
||||
// hide system bars if in fullscreen
|
||||
playerViewModel?.let {
|
||||
if (it.isFullscreen.value == true) {
|
||||
// hide system bars if in fullscreen or offline player
|
||||
if (playerViewModel != null) {
|
||||
if (playerViewModel!!.isFullscreen.value == true) {
|
||||
WindowHelper.toggleFullscreen(activity, true)
|
||||
}
|
||||
updateTopBarMargin()
|
||||
} else {
|
||||
activity.toggleSystemBars(WindowInsetsCompat.Type.systemBars(), false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,11 +268,14 @@ internal class CustomExoPlayerView(
|
||||
// automatically hide the controller after 2 seconds
|
||||
enqueueHideControllerTask()
|
||||
super.showController()
|
||||
|
||||
// show the system bars when in offline player
|
||||
if (playerViewModel == null) {
|
||||
activity.toggleSystemBars(WindowInsetsCompat.Type.statusBars(), true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
return false
|
||||
}
|
||||
override fun onTouchEvent(event: MotionEvent) = false
|
||||
|
||||
private fun initRewindAndForward() {
|
||||
val seekIncrementText = (PlayerHelper.seekIncrement / 1000).toString()
|
||||
|
Loading…
x
Reference in New Issue
Block a user