[Android] Correctly set gesture listeners in video player

Geoffrey Métais git at videolan.org
Wed Dec 21 14:59:25 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 21 14:34:45 2016 +0100| [aa16784f986992166737f5b56cbde54dd70e5b44] | committer: Geoffrey Métais

Correctly set gesture listeners in video player

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

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

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 571be63..7460c9f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -2006,6 +2006,12 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     public boolean onTouchEvent(MotionEvent event) {
         if (mService == null)
             return false;
+        if (mDetector == null) {
+            mDetector = new GestureDetectorCompat(this, mGestureListener);
+            mDetector.setOnDoubleTapListener(mGestureListener);
+        }
+        if (mFov != 0f && mScaleGestureDetector == null)
+            mScaleGestureDetector = new ScaleGestureDetector(this, this);
         if (mPlaybackSetting != DelayState.OFF) {
             if (event.getAction() == MotionEvent.ACTION_UP)
                 endPlaybackSetting();
@@ -2555,11 +2561,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mPlayPause.setEnabled(pausable);
         if (!pausable)
             mPlayPause.setImageResource(R.drawable.ic_play_circle_disable_o);
-        else {
-            mDetector = new GestureDetectorCompat(this, mGestureListener);
-            mDetector.setOnDoubleTapListener(mGestureListener);
-        }
-        mScaleGestureDetector = new ScaleGestureDetector(this, this);
     }
 
     private void doPlayPause() {



More information about the Android mailing list