Kill off some checking for Integer being null in GL2JNIActivity.java. These will never be null, since the functions return a primitive int.
This commit is contained in:
parent
6e3ab6d62c
commit
37eb9d26c8
|
@ -249,7 +249,7 @@ public class GL2JNIActivity extends Activity {
|
|||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||
|
||||
Integer playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId());
|
||||
int playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && playerNum == -1) {
|
||||
playerNum = pad.deviceDescriptor_PlayerNum
|
||||
.get(pad.deviceId_deviceDescriptor.get(event.getDeviceId()));
|
||||
|
@ -257,7 +257,7 @@ public class GL2JNIActivity extends Activity {
|
|||
playerNum = -1;
|
||||
}
|
||||
|
||||
if (playerNum == null || playerNum == -1)
|
||||
if (playerNum == -1)
|
||||
return false;
|
||||
|
||||
if (!pad.compat[playerNum]) {
|
||||
|
@ -333,8 +333,8 @@ public class GL2JNIActivity extends Activity {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean handle_key(Integer playerNum, int kc, boolean down) {
|
||||
if (playerNum == null || playerNum == -1)
|
||||
public boolean handle_key(int playerNum, int kc, boolean down) {
|
||||
if (playerNum == -1)
|
||||
return false;
|
||||
if (kc == pad.getSelectButtonCode()) {
|
||||
return false;
|
||||
|
@ -416,7 +416,7 @@ public class GL2JNIActivity extends Activity {
|
|||
}
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
Integer playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId());
|
||||
int playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && playerNum == -1) {
|
||||
playerNum = pad.deviceDescriptor_PlayerNum
|
||||
.get(pad.deviceId_deviceDescriptor.get(event.getDeviceId()));
|
||||
|
@ -424,7 +424,7 @@ public class GL2JNIActivity extends Activity {
|
|||
playerNum = -1;
|
||||
}
|
||||
|
||||
if (playerNum != null && playerNum != -1) {
|
||||
if (playerNum != -1) {
|
||||
if (pad.compat[playerNum] || pad.custom[playerNum]) {
|
||||
String id = pad.portId[playerNum];
|
||||
if (keyCode == prefs.getInt(Gamepad.pref_button_l + id,
|
||||
|
@ -441,7 +441,7 @@ public class GL2JNIActivity extends Activity {
|
|||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
Integer playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId());
|
||||
int playerNum = Arrays.asList(pad.name).indexOf(event.getDeviceId());
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && playerNum == -1) {
|
||||
playerNum = pad.deviceDescriptor_PlayerNum
|
||||
.get(pad.deviceId_deviceDescriptor.get(event.getDeviceId()));
|
||||
|
@ -449,7 +449,7 @@ public class GL2JNIActivity extends Activity {
|
|||
playerNum = -1;
|
||||
}
|
||||
|
||||
if (playerNum != null && playerNum != -1) {
|
||||
if (playerNum != -1) {
|
||||
if (pad.compat[playerNum] || pad.custom[playerNum]) {
|
||||
String id = pad.portId[playerNum];
|
||||
if (keyCode == prefs.getInt(Gamepad.pref_button_l + id, KeyEvent.KEYCODE_BUTTON_L1)) {
|
||||
|
|
Loading…
Reference in New Issue