Android Studio code analyzer fixes
authorSam Lantinga <slouken@libsdl.org>
Fri, 13 Oct 2017 19:55:07 -0700
changeset 11623817e632daa35
parent 11622 7abd358d3cec
child 11625 6a676d8b788f
Android Studio code analyzer fixes
android-project/src/org/libsdl/app/SDLActivity.java
android-project/src/org/libsdl/app/SDLAudioManager.java
android-project/src/org/libsdl/app/SDLControllerManager.java
     1.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Fri Oct 13 19:30:34 2017 -0700
     1.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Fri Oct 13 19:55:07 2017 -0700
     1.3 @@ -2,12 +2,9 @@
     1.4  
     1.5  import java.io.IOException;
     1.6  import java.io.InputStream;
     1.7 -import java.util.ArrayList;
     1.8  import java.util.Arrays;
     1.9 -import java.util.Collections;
    1.10 -import java.util.Comparator;
    1.11 -import java.util.List;
    1.12  import java.lang.reflect.Method;
    1.13 +import java.util.Objects;
    1.14  
    1.15  import android.app.*;
    1.16  import android.content.*;
    1.17 @@ -26,7 +23,6 @@
    1.18  import android.util.SparseArray;
    1.19  import android.graphics.*;
    1.20  import android.graphics.drawable.Drawable;
    1.21 -import android.media.*;
    1.22  import android.hardware.*;
    1.23  import android.content.pm.ActivityInfo;
    1.24  
    1.25 @@ -400,7 +396,6 @@
    1.26                  mSurface.handleResume();
    1.27                  mCurrentNativeState = mNextNativeState;
    1.28              }
    1.29 -            return;
    1.30          }
    1.31      }
    1.32  
    1.33 @@ -547,7 +542,7 @@
    1.34      {
    1.35        int orientation = -1;
    1.36  
    1.37 -      if (hint != "") {
    1.38 +      if (!Objects.equals(hint, "")) {
    1.39           if (hint.contains("LandscapeRight") && hint.contains("LandscapeLeft")) {
    1.40              orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
    1.41           } else if (hint.contains("LandscapeRight")) {
    1.42 @@ -580,8 +575,6 @@
    1.43        if (orientation != -1) {
    1.44           mSingleton.setRequestedOrientation(orientation);
    1.45        }
    1.46 - 
    1.47 -      return;
    1.48      }
    1.49  
    1.50  
    1.51 @@ -590,20 +583,17 @@
    1.52       */
    1.53      public static boolean isScreenKeyboardShown() 
    1.54      {
    1.55 -       if (mTextEdit == null) {
    1.56 -          return false;
    1.57 -       }
    1.58 +        if (mTextEdit == null) {
    1.59 +            return false;
    1.60 +        }
    1.61  
    1.62 -       if (mScreenKeyboardShown == false) {
    1.63 -          return false;
    1.64 -       }
    1.65 +        if (!mScreenKeyboardShown) {
    1.66 +            return false;
    1.67 +        }
    1.68  
    1.69 -       InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    1.70 -       if (imm.isAcceptingText()) {
    1.71 -          return true;
    1.72 -       }
    1.73 +        InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    1.74 +        return imm.isAcceptingText();
    1.75  
    1.76 -       return false;
    1.77      }
    1.78  
    1.79      /**
    1.80 @@ -681,10 +671,7 @@
    1.81              }  
    1.82          }
    1.83  
    1.84 -        if (event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE) {
    1.85 -            return true;
    1.86 -        }
    1.87 -        return false;
    1.88 +        return event.isPrintingKey() || event.getKeyCode() == KeyEvent.KEYCODE_SPACE;
    1.89      }
    1.90  
    1.91      /**
    1.92 @@ -1010,7 +997,6 @@
    1.93       */
    1.94      public static void clipboardSetText(String string) {
    1.95          mClipboardHandler.clipboardSetText(string);
    1.96 -        return;
    1.97      }
    1.98  
    1.99  }
   1.100 @@ -1604,7 +1590,6 @@
   1.101      @Override
   1.102      public void clipboardSetText(String string) {
   1.103         mClipMgrOld.setText(string);
   1.104 -       return;
   1.105      }
   1.106  }
   1.107  
     2.1 --- a/android-project/src/org/libsdl/app/SDLAudioManager.java	Fri Oct 13 19:30:34 2017 -0700
     2.2 +++ b/android-project/src/org/libsdl/app/SDLAudioManager.java	Fri Oct 13 19:55:07 2017 -0700
     2.3 @@ -1,7 +1,6 @@
     2.4  package org.libsdl.app;
     2.5  
     2.6  import android.media.*;
     2.7 -import android.hardware.*;
     2.8  import android.util.Log;
     2.9  
    2.10  public class SDLAudioManager
     3.1 --- a/android-project/src/org/libsdl/app/SDLControllerManager.java	Fri Oct 13 19:30:34 2017 -0700
     3.2 +++ b/android-project/src/org/libsdl/app/SDLControllerManager.java	Fri Oct 13 19:55:07 2017 -0700
     3.3 @@ -1,14 +1,12 @@
     3.4  package org.libsdl.app;
     3.5  
     3.6  import java.util.ArrayList;
     3.7 -import java.util.Arrays;
     3.8  import java.util.Collections;
     3.9  import java.util.Comparator;
    3.10  import java.util.List;
    3.11 +import java.util.Objects;
    3.12  
    3.13 -import android.app.*;
    3.14  import android.content.Context;
    3.15 -import android.hardware.*;
    3.16  import android.os.*;
    3.17  import android.view.*;
    3.18  import android.util.Log;
    3.19 @@ -268,7 +266,7 @@
    3.20      public String getJoystickDescriptor(InputDevice joystickDevice) {
    3.21          String desc = joystickDevice.getDescriptor();
    3.22  
    3.23 -        if (desc != null && desc != "") {
    3.24 +        if (desc != null && !Objects.equals(desc, "")) {
    3.25              return desc;
    3.26          }
    3.27