Android Studio code analyzer fixes

This commit is contained in:
Sam Lantinga 2017-10-13 19:55:07 -07:00
parent a223560a7f
commit dff56c3497
3 changed files with 13 additions and 31 deletions

View File

@ -2,12 +2,9 @@ package org.libsdl.app;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Objects;
import android.app.*; import android.app.*;
import android.content.*; import android.content.*;
@ -26,7 +23,6 @@ import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import android.graphics.*; import android.graphics.*;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.media.*;
import android.hardware.*; import android.hardware.*;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
@ -400,7 +396,6 @@ public class SDLActivity extends Activity {
mSurface.handleResume(); mSurface.handleResume();
mCurrentNativeState = mNextNativeState; mCurrentNativeState = mNextNativeState;
} }
return;
} }
} }
@ -547,7 +542,7 @@ public class SDLActivity extends Activity {
{ {
int orientation = -1; int orientation = -1;
if (hint != "") { if (!Objects.equals(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")) {
@ -580,8 +575,6 @@ public class SDLActivity extends Activity {
if (orientation != -1) { if (orientation != -1) {
mSingleton.setRequestedOrientation(orientation); mSingleton.setRequestedOrientation(orientation);
} }
return;
} }
@ -590,20 +583,17 @@ public class SDLActivity extends Activity {
*/ */
public static boolean isScreenKeyboardShown() public static boolean isScreenKeyboardShown()
{ {
if (mTextEdit == null) { if (mTextEdit == null) {
return false; return false;
} }
if (mScreenKeyboardShown == false) { if (!mScreenKeyboardShown) {
return false; return false;
} }
InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm.isAcceptingText()) { return imm.isAcceptingText();
return true;
}
return false;
} }
/** /**
@ -681,10 +671,7 @@ public class SDLActivity extends Activity {
} }
} }
if (event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE) { return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
return true;
}
return false;
} }
/** /**
@ -1010,7 +997,6 @@ public class SDLActivity extends Activity {
*/ */
public static void clipboardSetText(String string) { public static void clipboardSetText(String string) {
mClipboardHandler.clipboardSetText(string); mClipboardHandler.clipboardSetText(string);
return;
} }
} }
@ -1604,7 +1590,6 @@ class SDLClipboardHandler_Old implements
@Override @Override
public void clipboardSetText(String string) { public void clipboardSetText(String string) {
mClipMgrOld.setText(string); mClipMgrOld.setText(string);
return;
} }
} }

View File

@ -1,7 +1,6 @@
package org.libsdl.app; package org.libsdl.app;
import android.media.*; import android.media.*;
import android.hardware.*;
import android.util.Log; import android.util.Log;
public class SDLAudioManager public class SDLAudioManager

View File

@ -1,14 +1,12 @@
package org.libsdl.app; package org.libsdl.app;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Objects;
import android.app.*;
import android.content.Context; import android.content.Context;
import android.hardware.*;
import android.os.*; import android.os.*;
import android.view.*; import android.view.*;
import android.util.Log; import android.util.Log;
@ -268,7 +266,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 && !Objects.equals(desc, "")) {
return desc; return desc;
} }