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 committed Aug 18, 2024
1 parent 304a6d0 commit 3032ab8
Show file tree
Hide file tree
Showing 2 changed files with 261 additions and 1 deletion.
252 changes: 252 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 3032ab8

Please sign in to comment.