From cd2cb5a3d901538fc45750be0367e7edc2668f93 Mon Sep 17 00:00:00 2001 From: Guflly <145608489+Guflly@users.noreply.github.com> Date: Fri, 7 Aug 2026 22:11:20 -0700 Subject: [PATCH 1/2] fix: prevent page swipes while seeking --- .../voicerecorder/views/PlayerSeekBar.kt | 44 +++++++++++++++++++ app/src/main/res/layout/fragment_player.xml | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt diff --git a/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt b/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt new file mode 100644 index 000000000..bc6c9b53c --- /dev/null +++ b/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt @@ -0,0 +1,44 @@ +package org.fossify.voicerecorder.views + +import android.content.Context +import android.util.AttributeSet +import android.view.MotionEvent +import org.fossify.commons.views.MySeekBar + +class PlayerSeekBar : MySeekBar { + private var isParentInterceptionDisallowed = false + + constructor(context: Context) : super(context) + + constructor(context: Context, attrs: AttributeSet) : super(context, attrs) + + constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) + + override fun onTouchEvent(event: MotionEvent): Boolean { + val action = event.actionMasked + if (action == MotionEvent.ACTION_DOWN) { + setParentInterceptionDisallowed(true) + } + + val handled = super.onTouchEvent(event) + if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL || !handled) { + setParentInterceptionDisallowed(false) + } + + return handled + } + + override fun performClick() = super.performClick() + + override fun onDetachedFromWindow() { + setParentInterceptionDisallowed(false) + super.onDetachedFromWindow() + } + + private fun setParentInterceptionDisallowed(disallowed: Boolean) { + if (isParentInterceptionDisallowed != disallowed) { + parent?.requestDisallowInterceptTouchEvent(disallowed) + isParentInterceptionDisallowed = disallowed + } + } +} diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml index 195911fc5..344c6aec1 100644 --- a/app/src/main/res/layout/fragment_player.xml +++ b/app/src/main/res/layout/fragment_player.xml @@ -90,7 +90,7 @@ android:paddingEnd="@dimen/medium_margin" android:text="00:00" /> - Date: Fri, 7 Aug 2026 23:12:23 -0700 Subject: [PATCH 2/2] fix: expose seek bar clicks to accessibility --- .../kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt b/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt index bc6c9b53c..cd79f392f 100644 --- a/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt +++ b/app/src/main/kotlin/org/fossify/voicerecorder/views/PlayerSeekBar.kt @@ -21,6 +21,10 @@ class PlayerSeekBar : MySeekBar { } val handled = super.onTouchEvent(event) + if (action == MotionEvent.ACTION_UP && handled) { + performClick() + } + if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL || !handled) { setParentInterceptionDisallowed(false) }