[Android] Fix Gamepad support in VideoPlayerActivity

Geoffrey Métais git at videolan.org
Thu Jan 15 11:15:59 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jan 15 11:15:21 2015 +0100| [fe52971fa3b1d96840e468aaff495532c8081ebc] | committer: Geoffrey Métais

Fix Gamepad support in VideoPlayerActivity

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

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

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 d1e497d..145f777 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -786,6 +786,11 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
 
 		InputDevice mInputDevice = event.getDevice();
 
+        float dpadx = event.getAxisValue(MotionEvent.AXIS_HAT_X);
+        float dpady = event.getAxisValue(MotionEvent.AXIS_HAT_Y);
+        if (Math.abs(dpadx) == 1.0f || Math.abs(dpady) == 1.0f)
+            return false;
+
 		float x = AndroidDevices.getCenteredAxis(event, mInputDevice,
 				MotionEvent.AXIS_X);
 		float y = AndroidDevices.getCenteredAxis(event, mInputDevice,
@@ -833,11 +838,13 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
         case KeyEvent.KEYCODE_BUTTON_L1:
             seek(-10000);
             return true;
+        case KeyEvent.KEYCODE_BUTTON_A:
+            if (mOverlayProgress.getVisibility() == View.VISIBLE)
+                return false;
         case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
         case KeyEvent.KEYCODE_MEDIA_PLAY:
         case KeyEvent.KEYCODE_MEDIA_PAUSE:
         case KeyEvent.KEYCODE_SPACE:
-        case KeyEvent.KEYCODE_BUTTON_A:
             if (mIsNavMenu)
                 return navigateDvdMenu(keyCode);
             else



More information about the Android mailing list