[Android] Catch stick events in AudioPlayer

Geoffrey Métais git at videolan.org
Fri Mar 13 16:49:47 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 13 16:49:18 2015 +0100| [b37e650797a5ad5c82a4158ca45299d48da88ef4] | committer: Geoffrey Métais

Catch stick events in AudioPlayer

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=b37e650797a5ad5c82a4158ca45299d48da88ef4
---

 .../videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java    |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
index 8a6b7fc..d11704a 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
@@ -210,6 +210,11 @@ public class AudioPlayerActivity extends Activity implements AudioServiceControl
     }
 
     public boolean dispatchGenericMotionEvent(MotionEvent event){
+        //Check for a joystick event
+        if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) !=
+                InputDevice.SOURCE_JOYSTICK ||
+                event.getAction() != MotionEvent.ACTION_MOVE)
+            return false;
 
         InputDevice inputDevice = event.getDevice();
 
@@ -226,7 +231,7 @@ public class AudioPlayerActivity extends Activity implements AudioServiceControl
                 return true;
             }
         }
-        return false;
+        return true;
     }
 
     private void seek(int delta) {



More information about the Android mailing list