Skip to content

Commit

Permalink
update seek bar
Browse files Browse the repository at this point in the history
disable the system gesture near to seek bar.
  • Loading branch information
m-derakhshan authored and MattiasBuelens committed Aug 19, 2024
1 parent 304a6d0 commit 7733ec6
Showing 1 changed file with 9 additions and 1 deletion.
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)
)
},
colors = colors,
value = seekTime ?: currentTime,
valueRange = valueRange,
Expand Down

0 comments on commit 7733ec6

Please sign in to comment.