Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update seek bar #30

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.theoplayer.android.ui

import androidx.compose.foundation.systemGestureExclusion
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderColors
import androidx.compose.material3.SliderDefaults
Expand All @@ -9,6 +10,8 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect

/**
* A seek bar showing the current time of the player, and which seeks the player when clicked or dragged.
Expand Down Expand Up @@ -42,7 +45,12 @@ fun SeekBar(
var wasPlayingBeforeSeek by remember { mutableStateOf(false) }

Slider(
modifier = modifier,
modifier = modifier.systemGestureExclusion {
Rect(
topLeft = Offset(0f, 0f),
bottomRight = Offset(it.size.width.toFloat(), it.size.height.toFloat() + 20)
MattiasBuelens marked this conversation as resolved.
Show resolved Hide resolved
)
},
colors = colors,
value = seekTime ?: currentTime,
valueRange = valueRange,
Expand Down