mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Seek bar uses same skip intervals
This commit is contained in:
parent
8dba561376
commit
d1e9561eae
2 changed files with 12 additions and 5 deletions
|
|
@ -156,6 +156,8 @@ fun PlaybackControls(
|
|||
interactionSource = seekBarInteractionSource,
|
||||
isEnabled = seekEnabled,
|
||||
intervals = seekBarIntervals,
|
||||
seekBack = seekBack,
|
||||
seekForward = seekForward,
|
||||
modifier =
|
||||
Modifier
|
||||
.padding(vertical = 0.dp)
|
||||
|
|
@ -211,6 +213,8 @@ fun SeekBar(
|
|||
intervals: Int,
|
||||
controllerViewState: ControllerViewState,
|
||||
onSeekProgress: (Long) -> Unit,
|
||||
seekBack: Duration,
|
||||
seekForward: Duration,
|
||||
modifier: Modifier = Modifier,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
) {
|
||||
|
|
@ -241,6 +245,8 @@ fun SeekBar(
|
|||
interactionSource = interactionSource,
|
||||
enabled = isEnabled,
|
||||
durationMs = player.contentDuration,
|
||||
seekBack = seekBack,
|
||||
seekForward = seekForward,
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.tv.material3.MaterialTheme
|
||||
import com.github.damontecres.dolphin.ui.handleDPadKeyEvents
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
import kotlin.time.Duration
|
||||
|
||||
@Composable
|
||||
fun SteppedSeekBarImpl(
|
||||
|
|
@ -105,6 +105,8 @@ fun IntervalSeekBarImpl(
|
|||
bufferedProgress: Float,
|
||||
onSeek: (Long) -> Unit,
|
||||
controllerViewState: ControllerViewState,
|
||||
seekBack: Duration,
|
||||
seekForward: Duration,
|
||||
modifier: Modifier = Modifier,
|
||||
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
|
||||
enabled: Boolean = true,
|
||||
|
|
@ -120,21 +122,20 @@ fun IntervalSeekBarImpl(
|
|||
if (!isFocused) hasSeeked = false
|
||||
}
|
||||
|
||||
val offset = 30.seconds.inWholeMilliseconds
|
||||
|
||||
SeekBarDisplay(
|
||||
enabled = enabled,
|
||||
progress = (progressToUse.toDouble() / durationMs).toFloat(),
|
||||
bufferedProgress = bufferedProgress,
|
||||
onLeft = {
|
||||
controllerViewState.pulseControls()
|
||||
seekPositionMs = (progressToUse - offset).coerceAtLeast(0L)
|
||||
seekPositionMs = (progressToUse - seekBack.inWholeMilliseconds).coerceAtLeast(0L)
|
||||
hasSeeked = true
|
||||
onSeek(seekPositionMs)
|
||||
},
|
||||
onRight = {
|
||||
controllerViewState.pulseControls()
|
||||
seekPositionMs = (progressToUse + offset).coerceAtMost(durationMs)
|
||||
seekPositionMs =
|
||||
(progressToUse + seekForward.inWholeMilliseconds).coerceAtMost(durationMs)
|
||||
hasSeeked = true
|
||||
onSeek(seekPositionMs)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue