From 56f4a711e3f0eb3ac7814b2ab84f054a69c14314 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Thu, 17 Jan 2019 13:42:13 +0100 Subject: [PATCH] Android: minor change in the evaluation of SOURCE_CLASS_JOYSTICK (no op!) InputDevice.SOURCE_CLASS_* are one bit More readable to check that the source has this class_joystick set, compared to the other statements, where the source is gamepad or dpad. (Clean-up from bug 3958) --- .../src/main/java/org/libsdl/app/SDLControllerManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java index cdc9fbb64f5d7..ed671262a4b16 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -99,8 +99,8 @@ public static boolean isDeviceSDLJoystick(int deviceId) { /* This is called for every button press, so let's not spam the logs */ /** - if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) { - Log.v(TAG, "Input device " + device.getName() + " is a joystick."); + if ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { + Log.v(TAG, "Input device " + device.getName() + " has class joystick."); } if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) { Log.v(TAG, "Input device " + device.getName() + " is a dpad."); @@ -110,7 +110,7 @@ public static boolean isDeviceSDLJoystick(int deviceId) { } **/ - return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) || + return ((sources & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 || ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) || ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) );