From a5fef0da54bb69d4f71bba7d7780c729a2f292fa Mon Sep 17 00:00:00 2001 From: m-derakhshan <43886409+m-derakhshan@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:48:15 +0200 Subject: [PATCH] Disable system gestures on the `SeekBar` component (#30) The `SeekBar` shouldn't receive system gestures, otherwise users aren't able to drag it when it's near the edge of the screen. --------- Co-authored-by: Mattias Buelens --- CHANGELOG.md | 4 ++++ ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bdb5ad..dac98c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ > - 🏠 Internal > - 💅 Polish +## Unreleased + +* 🐛 Disable system gestures on the `SeekBar` component. ([#30](https://github.com/THEOplayer/android-ui/pull/30)) + ## v1.7.0 (2024-08-12) * 💥 Updated to Jetpack Compose version 1.6.8 ([BOM](https://developer.android.com/jetpack/compose/bom) 2024.06.00). diff --git a/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt b/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt index 012e686..996b19d 100644 --- a/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt +++ b/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt @@ -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 @@ -42,7 +43,7 @@ fun SeekBar( var wasPlayingBeforeSeek by remember { mutableStateOf(false) } Slider( - modifier = modifier, + modifier = modifier.systemGestureExclusion(), colors = colors, value = seekTime ?: currentTime, valueRange = valueRange,