Android Studio code analyzer fixes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
diff --git a/android-project/src/org/libsdl/app/SDLActivity.java b/android-project/src/org/libsdl/app/SDLActivity.java
index ae18c57..9119473 100644
--- a/android-project/src/org/libsdl/app/SDLActivity.java
+++ b/android-project/src/org/libsdl/app/SDLActivity.java
@@ -2,12 +2,9 @@ package org.libsdl.app;
import java.io.IOException;
import java.io.InputStream;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
import java.lang.reflect.Method;
+import java.util.Objects;
import android.app.*;
import android.content.*;
@@ -26,7 +23,6 @@ import android.util.Log;
import android.util.SparseArray;
import android.graphics.*;
import android.graphics.drawable.Drawable;
-import android.media.*;
import android.hardware.*;
import android.content.pm.ActivityInfo;
@@ -400,7 +396,6 @@ public class SDLActivity extends Activity {
mSurface.handleResume();
mCurrentNativeState = mNextNativeState;
}
- return;
}
}
@@ -547,7 +542,7 @@ public class SDLActivity extends Activity {
{
int orientation = -1;
- if (hint != "") {
+ if (!Objects.equals(hint, "")) {
if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
} else if (hint.contains("LandscapeRight")) {
@@ -580,8 +575,6 @@ public class SDLActivity extends Activity {
if (orientation != -1) {
mSingleton.setRequestedOrientation(orientation);
}
-
- return;
}
@@ -590,20 +583,17 @@ public class SDLActivity extends Activity {
*/
public static boolean isScreenKeyboardShown()
{
- if (mTextEdit == null) {
- return false;
- }
+ if (mTextEdit == null) {
+ return false;
+ }
- if (mScreenKeyboardShown == false) {
- return false;
- }
+ if (!mScreenKeyboardShown) {
+ return false;
+ }
- InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
- if (imm.isAcceptingText()) {
- return true;
- }
+ InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+ return imm.isAcceptingText();
- return false;
}
/**
@@ -681,10 +671,7 @@ public class SDLActivity extends Activity {
}
}
- if (event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE) {
- return true;
- }
- return false;
+ return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
}
/**
@@ -1010,7 +997,6 @@ public class SDLActivity extends Activity {
*/
public static void clipboardSetText(String string) {
mClipboardHandler.clipboardSetText(string);
- return;
}
}
@@ -1604,7 +1590,6 @@ class SDLClipboardHandler_Old implements
@Override
public void clipboardSetText(String string) {
mClipMgrOld.setText(string);
- return;
}
}
diff --git a/android-project/src/org/libsdl/app/SDLAudioManager.java b/android-project/src/org/libsdl/app/SDLAudioManager.java
index 66c3fea..26baf82 100644
--- a/android-project/src/org/libsdl/app/SDLAudioManager.java
+++ b/android-project/src/org/libsdl/app/SDLAudioManager.java
@@ -1,7 +1,6 @@
package org.libsdl.app;
import android.media.*;
-import android.hardware.*;
import android.util.Log;
public class SDLAudioManager
diff --git a/android-project/src/org/libsdl/app/SDLControllerManager.java b/android-project/src/org/libsdl/app/SDLControllerManager.java
index ef946ac..3629442 100644
--- a/android-project/src/org/libsdl/app/SDLControllerManager.java
+++ b/android-project/src/org/libsdl/app/SDLControllerManager.java
@@ -1,14 +1,12 @@
package org.libsdl.app;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.Objects;
-import android.app.*;
import android.content.Context;
-import android.hardware.*;
import android.os.*;
import android.view.*;
import android.util.Log;
@@ -268,7 +266,7 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler_API12 {
public String getJoystickDescriptor(InputDevice joystickDevice) {
String desc = joystickDevice.getDescriptor();
- if (desc != null && desc != "") {
+ if (desc != null && !Objects.equals(desc, "")) {
return desc;
}