[Android] Switch to SimpleGesturelistener

Geoffrey Métais git at videolan.org
Thu Dec 8 18:32:31 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Dec  8 18:31:59 2016 +0100| [eb038c873b2c65282765ed4e0e45a0d2b20d3f82] | committer: Geoffrey Métais

Switch to SimpleGesturelistener

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

 .../vlc/gui/video/VideoPlayerActivity.java         | 64 ++++++----------------
 1 file changed, 17 insertions(+), 47 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 e248c87..b28ba00 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -138,8 +138,8 @@ import java.util.Date;
 import java.util.Locale;
 
 public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.Callback,
-        GestureDetector.OnDoubleTapListener, IPlaybackSettingsController,
-        PlaybackService.Client.Callback, PlaybackService.Callback, PlaylistAdapter.IPlayer, OnClickListener, View.OnLongClickListener, ScaleGestureDetector.OnScaleGestureListener {
+        IPlaybackSettingsController, PlaybackService.Client.Callback, PlaybackService.Callback,
+        PlaylistAdapter.IPlayer, OnClickListener, View.OnLongClickListener, ScaleGestureDetector.OnScaleGestureListener {
 
     public final static String TAG = "VLC/VideoPlayerActivity";
 
@@ -1550,31 +1550,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         }
     }
 
-    @Override
-    public boolean onSingleTapConfirmed(MotionEvent e) {
-        if (mShowing)
-            hideOverlay(true);
-        else
-            showOverlay();
-        return true;
-    }
-
-    @Override
-    public boolean onDoubleTap(MotionEvent e) {
-        if (mService == null)
-            return false;
-        if (!mIsLocked) {
-            doPlayPause();
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public boolean onDoubleTapEvent(MotionEvent e) {
-        return false;
-    }
-
     /* PlaybackService.Callback */
 
     @Override
@@ -2032,7 +2007,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             if (event.getAction() == MotionEvent.ACTION_UP)
                 endPlaybackSetting();
             return true;
-        } else if(mPlaylist.getVisibility() == View.VISIBLE) {
+        } else if (mPlaylist.getVisibility() == View.VISIBLE) {
             togglePlaylist();
             return true;
         }
@@ -2583,7 +2558,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
             mPlayPause.setImageResource(R.drawable.ic_play_circle_disable_o);
         else {
             mDetector = new GestureDetectorCompat(this, mGestureListener);
-            mDetector.setOnDoubleTapListener(this);
+            mDetector.setOnDoubleTapListener(mGestureListener);
         }
         mScaleGestureDetector = new ScaleGestureDetector(this, this);
     }
@@ -3514,30 +3489,25 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         supportInvalidateOptionsMenu();
     }
 
-    private GestureDetector.OnGestureListener mGestureListener = new GestureDetector.OnGestureListener() {
-        @Override
-        public boolean onDown(MotionEvent e) {
-            return false;
-        }
-
-        @Override
-        public void onShowPress(MotionEvent e) {}
+    private GestureDetector.SimpleOnGestureListener mGestureListener = new GestureDetector.SimpleOnGestureListener() {
 
         @Override
         public boolean onSingleTapUp(MotionEvent e) {
-            return false;
-        }
-
-        @Override
-        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
-            return false;
+        if (mShowing)
+            hideOverlay(true);
+        else
+            showOverlay();
+            return true;
         }
 
         @Override
-        public void onLongPress(MotionEvent e) {}
-
-        @Override
-        public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+        public boolean onDoubleTap(MotionEvent e) {
+            if (mService == null)
+                return false;
+            if (!mIsLocked) {
+                doPlayPause();
+                return true;
+            }
             return false;
         }
     };



More information about the Android mailing list