mirror of https://github.com/encounter/SDL.git
Fixed Java string comparison with ""
This commit is contained in:
parent
fa5db3a931
commit
6d23ea4bf0
|
@ -542,41 +542,39 @@ public class SDLActivity extends Activity {
|
||||||
*/
|
*/
|
||||||
public void setOrientationBis(int w, int h, boolean resizable, String hint)
|
public void setOrientationBis(int w, int h, boolean resizable, String hint)
|
||||||
{
|
{
|
||||||
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")) {
|
||||||
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
|
||||||
} else if (hint.contains("LandscapeLeft")) {
|
} else if (hint.contains("LandscapeLeft")) {
|
||||||
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
|
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
|
||||||
} else if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
|
} else if (hint.contains("Portrait") && hint.contains("PortraitUpsideDown")) {
|
||||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||||
} else if (hint.contains("Portrait")) {
|
} else if (hint.contains("Portrait")) {
|
||||||
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
|
||||||
} 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) {
|
||||||
if (resizable) {
|
if (resizable) {
|
||||||
/* no fixed orientation */
|
/* no fixed orientation */
|
||||||
} else {
|
|
||||||
if (w > h) {
|
|
||||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
|
||||||
} else {
|
} else {
|
||||||
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
if (w > h) {
|
||||||
|
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||||
|
} else {
|
||||||
|
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Log.v("SDL", "setOrientation() orientation=" + orientation + " width=" + w +" height="+ h +" resizable=" + resizable + " hint=" + hint);
|
Log.v("SDL", "setOrientation() orientation=" + orientation + " width=" + w +" height="+ h +" resizable=" + resizable + " hint=" + hint);
|
||||||
if (orientation != -1) {
|
if (orientation != -1) {
|
||||||
mSingleton.setRequestedOrientation(orientation);
|
mSingleton.setRequestedOrientation(orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue