mirror of https://github.com/encounter/SDL.git
Android: merge SDLJoystickHandler_API12 and SDLJoystickHandler_API16
This commit is contained in:
parent
a86754167c
commit
291f6006a1
|
@ -118,7 +118,6 @@ public class SDLControllerManager
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A null joystick handler for API level < 12 devices (the accelerometer is handled separately) */
|
|
||||||
class SDLJoystickHandler {
|
class SDLJoystickHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +137,7 @@ class SDLJoystickHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Actual joystick functionality available for API >= 12 devices */
|
/* Actual joystick functionality available for API >= 12 devices */
|
||||||
class SDLJoystickHandler_API12 extends SDLJoystickHandler {
|
class SDLJoystickHandler_API16 extends SDLJoystickHandler {
|
||||||
|
|
||||||
static class SDLJoystick {
|
static class SDLJoystick {
|
||||||
public int device_id;
|
public int device_id;
|
||||||
|
@ -170,7 +169,7 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
|
||||||
|
|
||||||
private ArrayList<SDLJoystick> mJoysticks;
|
private ArrayList<SDLJoystick> mJoysticks;
|
||||||
|
|
||||||
public SDLJoystickHandler_API12() {
|
public SDLJoystickHandler_API16() {
|
||||||
|
|
||||||
mJoysticks = new ArrayList<SDLJoystick>();
|
mJoysticks = new ArrayList<SDLJoystick>();
|
||||||
}
|
}
|
||||||
|
@ -274,6 +273,12 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getJoystickDescriptor(InputDevice joystickDevice) {
|
public String getJoystickDescriptor(InputDevice joystickDevice) {
|
||||||
|
String desc = joystickDevice.getDescriptor();
|
||||||
|
|
||||||
|
if (desc != null && !desc.isEmpty()) {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
return joystickDevice.getName();
|
return joystickDevice.getName();
|
||||||
}
|
}
|
||||||
public int getProductId(InputDevice joystickDevice) {
|
public int getProductId(InputDevice joystickDevice) {
|
||||||
|
@ -287,20 +292,6 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SDLJoystickHandler_API16 extends SDLJoystickHandler_API12 {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJoystickDescriptor(InputDevice joystickDevice) {
|
|
||||||
String desc = joystickDevice.getDescriptor();
|
|
||||||
|
|
||||||
if (desc != null && !desc.isEmpty()) {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.getJoystickDescriptor(joystickDevice);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
|
class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue