[Android] Filter accidental touch events in video player

Hamza Parnica git at videolan.org
Mon Apr 16 09:12:14 CEST 2018


vlc-android | branch: 3.0.x | Hamza Parnica <hparnica at gmail.com> | Fri Apr 13 18:23:12 2018 +0200| [0ed63449aaa14714c0a2f9f10709aae58bc84efd] | committer: Geoffrey Métais

Filter accidental touch events in video player

Close #558

(cherry picked from commit 04533842007307db7a74ebe33b34ba3d9d76fe8e)

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

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 1b5765388..4849fa4d2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -296,6 +296,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private static final int TOUCH_BRIGHTNESS = 2;
     private static final int TOUCH_MOVE = 3;
     private static final int TOUCH_SEEK = 4;
+    private static final int TOUCH_IGNORE = 5;
     private int mTouchAction = TOUCH_NONE;
     private int mSurfaceYDisplayRange, mSurfaceXDisplayRange;
     private float mFov;
@@ -2058,6 +2059,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 endPlaybackSetting();
             return true;
         } else if (mPlaylist.getVisibility() == View.VISIBLE) {
+            mTouchAction = TOUCH_IGNORE;
             togglePlaylist();
             return true;
         }
@@ -2107,6 +2109,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 sendMouseEvent(MotionEvent.ACTION_DOWN, xTouch, yTouch);
                 break;
             case MotionEvent.ACTION_MOVE:
+                if (mTouchAction == TOUCH_IGNORE) break;
+
                 // Mouse events for the core
                 sendMouseEvent(MotionEvent.ACTION_MOVE, xTouch, yTouch);
 
@@ -2133,6 +2137,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 }
                 break;
             case MotionEvent.ACTION_UP:
+                if (mTouchAction == TOUCH_IGNORE) mTouchAction = TOUCH_NONE;
                 // Mouse events for the core
                 sendMouseEvent(MotionEvent.ACTION_UP, xTouch, yTouch);
                 // Seek



More information about the Android mailing list