Fixed Java string comparison with ""

This commit is contained in:
Sam Lantinga 2017-10-29 21:09:09 -07:00
parent fa5db3a931
commit 6d23ea4bf0
2 changed files with 23 additions and 25 deletions

View File

@ -544,7 +544,6 @@ public class SDLActivity extends Activity {
{ {
int orientation = -1; int orientation = -1;
if (hint != "") {
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) { if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) { } else if (hint.contains("LandscapeRight")) {
@ -558,7 +557,6 @@ public class SDLActivity extends Activity {
} else if (hint.contains("PortraitUpsideDown")) { } else if (hint.contains("PortraitUpsideDown")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
} }
}
/* no valid hint */ /* no valid hint */
if (orientation == -1) { if (orientation == -1) {

View File

@ -265,7 +265,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler_API12 {
public String getJoystickDescriptor(InputDevice joystickDevice) { public String getJoystickDescriptor(InputDevice joystickDevice) {
String desc = joystickDevice.getDescriptor(); String desc = joystickDevice.getDescriptor();
if (desc != null && desc != "") { if (desc != null && !desc.isEmpty()) {
return desc; return desc;
} }