mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +05:30
Merge pull request #4611 from Bnyro/master
fix: limit chapter bottom sheet to one instance
This commit is contained in:
commit
b72993cfee
@ -536,9 +536,9 @@ object PlayerHelper {
|
|||||||
return chapters
|
return chapters
|
||||||
.filter {
|
.filter {
|
||||||
it.highlightDrawable == null ||
|
it.highlightDrawable == null ||
|
||||||
// remove the video highlight if it's already longer ago than [ChapterSegment.HIGHLIGHT_LENGTH],
|
// remove the video highlight if it's already longer ago than [ChapterSegment.HIGHLIGHT_LENGTH],
|
||||||
// otherwise the SponsorBlock highlight would be shown from its starting point to the end
|
// otherwise the SponsorBlock highlight would be shown from its starting point to the end
|
||||||
(currentPosition - it.start) < ChapterSegment.HIGHLIGHT_LENGTH
|
(currentPosition - it.start) < ChapterSegment.HIGHLIGHT_LENGTH
|
||||||
}
|
}
|
||||||
.sortedBy { it.start }
|
.sortedBy { it.start }
|
||||||
.indexOfLast { currentPosition >= it.start }
|
.indexOfLast { currentPosition >= it.start }
|
||||||
|
@ -200,6 +200,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
.getInsetsController(mainActivity.window, mainActivity.window.decorView)
|
.getInsetsController(mainActivity.window, mainActivity.window.decorView)
|
||||||
|
|
||||||
private var scrubbingTimeBar = false
|
private var scrubbingTimeBar = false
|
||||||
|
private var chaptersBottomSheet: ChaptersBottomSheet? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receiver for all actions in the PiP mode
|
* Receiver for all actions in the PiP mode
|
||||||
@ -772,8 +773,14 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
// enable the chapters dialog in the player
|
// enable the chapters dialog in the player
|
||||||
playerBinding.chapterLL.setOnClickListener {
|
playerBinding.chapterLL.setOnClickListener {
|
||||||
updateMaxSheetHeight()
|
updateMaxSheetHeight()
|
||||||
ChaptersBottomSheet(chapters, exoPlayer)
|
val sheet = chaptersBottomSheet ?: ChaptersBottomSheet(chapters, exoPlayer).also {
|
||||||
.show(childFragmentManager)
|
chaptersBottomSheet = it
|
||||||
|
}
|
||||||
|
if (sheet.isVisible) {
|
||||||
|
sheet.dismiss()
|
||||||
|
} else {
|
||||||
|
sheet.show(childFragmentManager)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrentChapterName()
|
setCurrentChapterName()
|
||||||
@ -822,6 +829,9 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
playVideo()
|
playVideo()
|
||||||
// close comment bottom sheet for next video
|
// close comment bottom sheet for next video
|
||||||
commentsViewModel.commentsSheetDismiss?.invoke()
|
commentsViewModel.commentsSheetDismiss?.invoke()
|
||||||
|
// kill the chapters bottom sheet
|
||||||
|
chaptersBottomSheet?.dismiss()
|
||||||
|
chaptersBottomSheet = null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun prepareExoPlayerView() {
|
private fun prepareExoPlayerView() {
|
||||||
|
@ -4,7 +4,6 @@ import android.content.Context
|
|||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.media3.exoplayer.trackselection.TrackSelector
|
import androidx.media3.exoplayer.trackselection.TrackSelector
|
||||||
|
Loading…
x
Reference in New Issue
Block a user