Commit dff56c34970dbf7bcba0206c3bc2b3d2510918aa

Sam Lantinga 2017-10-13T19:55:07

Android Studio code analyzer fixes

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;
         }