From 3032ab84ca29f191f548440a7eef8c1148dca8d2 Mon Sep 17 00:00:00 2001 From: m-derakhshan <43886409+m-derakhshan@users.noreply.github.com> Date: Sun, 18 Aug 2024 11:32:47 +0200 Subject: [PATCH 1/6] update seek bar disable the system gesture near to seek bar. --- .idea/other.xml | 252 ++++++++++++++++++ .../java/com/theoplayer/android/ui/SeekBar.kt | 10 +- 2 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 .idea/other.xml diff --git a/.idea/other.xml b/.idea/other.xml new file mode 100644 index 0000000..4604c44 --- /dev/null +++ b/.idea/other.xml @@ -0,0 +1,252 @@ + + + + + + \ No newline at end of file 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..1454836 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 @@ -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. @@ -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, From 7733ec6d9e15f491cc6215942aac509d7965633c Mon Sep 17 00:00:00 2001 From: m-derakhshan <43886409+m-derakhshan@users.noreply.github.com> Date: Sun, 18 Aug 2024 11:32:47 +0200 Subject: [PATCH 2/6] update seek bar disable the system gesture near to seek bar. --- ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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..1454836 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 @@ -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. @@ -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, From dd628bddda84ce9eab5c3fb4137cf1e717a7835b Mon Sep 17 00:00:00 2001 From: m-derakhshan <43886409+m-derakhshan@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:35:01 +0200 Subject: [PATCH 3/6] remove the safe margin --- .idea/deploymentTargetSelector.xml | 18 ++++++++++++++++++ .../java/com/theoplayer/android/ui/SeekBar.kt | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .idea/deploymentTargetSelector.xml diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..0250db7 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file 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 1454836..8f86af0 100644 --- a/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt +++ b/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt @@ -48,7 +48,7 @@ fun SeekBar( modifier = modifier.systemGestureExclusion { Rect( topLeft = Offset(0f, 0f), - bottomRight = Offset(it.size.width.toFloat(), it.size.height.toFloat() + 20) + bottomRight = Offset(it.size.width.toFloat(), it.size.height.toFloat()) ) }, colors = colors, From 0d4393792507cee7650e75073ec017b3802bc776 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 20 Aug 2024 10:40:08 +0200 Subject: [PATCH 4/6] Clean up --- .idea/deploymentTargetSelector.xml | 18 --- .idea/other.xml | 252 ----------------------------- 2 files changed, 270 deletions(-) delete mode 100644 .idea/deploymentTargetSelector.xml delete mode 100644 .idea/other.xml diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml deleted file mode 100644 index 0250db7..0000000 --- a/.idea/deploymentTargetSelector.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/other.xml b/.idea/other.xml deleted file mode 100644 index 4604c44..0000000 --- a/.idea/other.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - \ No newline at end of file From 25ac2bdcfeb9f4058de06b75f94517e198b3183d Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 20 Aug 2024 10:41:03 +0200 Subject: [PATCH 5/6] Simplify --- ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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 8f86af0..996b19d 100644 --- a/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt +++ b/ui/src/main/java/com/theoplayer/android/ui/SeekBar.kt @@ -10,8 +10,6 @@ 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. @@ -45,12 +43,7 @@ fun SeekBar( var wasPlayingBeforeSeek by remember { mutableStateOf(false) } Slider( - modifier = modifier.systemGestureExclusion { - Rect( - topLeft = Offset(0f, 0f), - bottomRight = Offset(it.size.width.toFloat(), it.size.height.toFloat()) - ) - }, + modifier = modifier.systemGestureExclusion(), colors = colors, value = seekTime ?: currentTime, valueRange = valueRange, From 9afb16f5a1e5766552546ce45f5607d0566869ff Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Tue, 20 Aug 2024 10:43:41 +0200 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) 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).