[Android] Constraint the fast play bound to avoid launching it on home gesture

Nicolas Pomepuy git at videolan.org
Wed Jul 10 13:16:53 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Jul 10 09:22:10 2024 +0200| [d882e1d9362c8bf36718f75650eba6fa2ac830d2] | committer: Duncan McNamara

Constraint the fast play bound to avoid launching it on home gesture

> https://code.videolan.org/videolan/vlc-android/commit/d882e1d9362c8bf36718f75650eba6fa2ac830d2
---

 .../src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt            | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
index f7ebc463d9..fe8d9f3b69 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoTouchDelegate.kt
@@ -30,6 +30,7 @@ import org.videolan.libvlc.MediaPlayer
 import org.videolan.medialibrary.Tools
 import org.videolan.resources.AndroidDevices
 import org.videolan.resources.AndroidDevices.isTv
+import org.videolan.tools.dp
 import org.videolan.tools.readableString
 import org.videolan.tools.setVisible
 import org.videolan.vlc.BuildConfig
@@ -196,7 +197,10 @@ class VideoTouchDelegate(private val player: VideoPlayerActivity,
                                 touchAction = TOUCH_FASTPLAY
                             }
                         }
-                        if (touchControls and TOUCH_FLAG_FASTPLAY != 0)
+                        val fastPlaySecurityMargin = 48.dp.toFloat()
+                        if (touchControls and TOUCH_FLAG_FASTPLAY != 0
+                                && touchY in fastPlaySecurityMargin.. screenConfig.metrics.heightPixels.toFloat() - fastPlaySecurityMargin
+                                && touchX in fastPlaySecurityMargin.. screenConfig.metrics.widthPixels.toFloat() - fastPlaySecurityMargin)
                             handler.postDelayed(fastPlayRunable, 250)
                     }
                     MotionEvent.ACTION_MOVE -> {



More information about the Android mailing list