From b619a12ae38f600b0dfb6a1b33e8a706171f0385 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Thu, 20 Aug 2015 20:59:24 -0400 Subject: [PATCH] Miscellaneous code analysis warning fixes --- .../java/acr/browser/lightning/utils/ProxyUtils.java | 7 +++---- .../lightning/activity/ThemableSettingsActivity.java | 1 - .../java/acr/browser/lightning/download/WebAddress.java | 4 ++-- .../lightning/fragment/AdvancedSettingsFragment.java | 1 - .../lightning/fragment/DisplaySettingsFragment.java | 1 - .../browser/lightning/reading/ArticleTextExtractor.java | 2 +- .../main/java/acr/browser/lightning/reading/MapEntry.java | 2 +- .../main/java/acr/browser/lightning/utils/ThemeUtils.java | 2 -- 8 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/src/LightningPlus/java/acr/browser/lightning/utils/ProxyUtils.java b/app/src/LightningPlus/java/acr/browser/lightning/utils/ProxyUtils.java index 32e01aa..64d2a00 100644 --- a/app/src/LightningPlus/java/acr/browser/lightning/utils/ProxyUtils.java +++ b/app/src/LightningPlus/java/acr/browser/lightning/utils/ProxyUtils.java @@ -3,7 +3,6 @@ package acr.browser.lightning.utils; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; -import android.os.Build; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.util.Log; @@ -42,8 +41,8 @@ public class ProxyUtils { /* * If Orbot/Tor or I2P is installed, prompt the user if they want to enable - * proxying for this session - */ + * proxying for this session + */ public void checkForProxy(final Activity activity) { boolean useProxy = mPreferences.getUseProxy(); @@ -106,7 +105,7 @@ public class ProxyUtils { /* * Initialize WebKit Proxying - */ + */ private void initializeProxy(Activity activity) { String host; int port; diff --git a/app/src/main/java/acr/browser/lightning/activity/ThemableSettingsActivity.java b/app/src/main/java/acr/browser/lightning/activity/ThemableSettingsActivity.java index ebcb0fe..c5a4573 100644 --- a/app/src/main/java/acr/browser/lightning/activity/ThemableSettingsActivity.java +++ b/app/src/main/java/acr/browser/lightning/activity/ThemableSettingsActivity.java @@ -1,6 +1,5 @@ package acr.browser.lightning.activity; -import android.content.Intent; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; diff --git a/app/src/main/java/acr/browser/lightning/download/WebAddress.java b/app/src/main/java/acr/browser/lightning/download/WebAddress.java index cbaf276..7aa1eda 100644 --- a/app/src/main/java/acr/browser/lightning/download/WebAddress.java +++ b/app/src/main/java/acr/browser/lightning/download/WebAddress.java @@ -97,7 +97,7 @@ public class WebAddress { /* * Get port from scheme or scheme from port, if necessary and possible */ - if (mPort == 443 && "".equals(mScheme)) { + if (mPort == 443 && mScheme != null && mScheme.isEmpty()) { mScheme = "https"; } else if (mPort == -1) { if ("https".equals(mScheme)) { @@ -106,7 +106,7 @@ public class WebAddress { mPort = 80; // default } } - if ("".equals(mScheme)) { + if (mScheme != null && mScheme.isEmpty()) { mScheme = "http"; } } diff --git a/app/src/main/java/acr/browser/lightning/fragment/AdvancedSettingsFragment.java b/app/src/main/java/acr/browser/lightning/fragment/AdvancedSettingsFragment.java index b361506..597d600 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/AdvancedSettingsFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/AdvancedSettingsFragment.java @@ -11,7 +11,6 @@ import android.preference.Preference; import android.preference.PreferenceFragment; import android.support.v7.app.AlertDialog; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/app/src/main/java/acr/browser/lightning/fragment/DisplaySettingsFragment.java b/app/src/main/java/acr/browser/lightning/fragment/DisplaySettingsFragment.java index 7285cc8..9c6ee48 100644 --- a/app/src/main/java/acr/browser/lightning/fragment/DisplaySettingsFragment.java +++ b/app/src/main/java/acr/browser/lightning/fragment/DisplaySettingsFragment.java @@ -12,7 +12,6 @@ import android.preference.PreferenceFragment; import android.support.v7.app.AlertDialog; import android.view.Gravity; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; import android.widget.LinearLayout; diff --git a/app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java b/app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java index ae22cd3..4e85f67 100644 --- a/app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java +++ b/app/src/main/java/acr/browser/lightning/reading/ArticleTextExtractor.java @@ -238,7 +238,7 @@ public class ArticleTextExtractor { content = content.substring(1, content.length() - 1); String[] split = content.split("\\s*,\\s*"); - if (split.length > 1 || (split.length > 0 && !"".equals(split[0]))) + if (split.length > 1 || (split.length > 0 && split[0] != null && !split[0].isEmpty())) return Arrays.asList(split); return Collections.emptyList(); } diff --git a/app/src/main/java/acr/browser/lightning/reading/MapEntry.java b/app/src/main/java/acr/browser/lightning/reading/MapEntry.java index 83b7712..e931062 100644 --- a/app/src/main/java/acr/browser/lightning/reading/MapEntry.java +++ b/app/src/main/java/acr/browser/lightning/reading/MapEntry.java @@ -53,7 +53,7 @@ public class MapEntry implements Map.Entry, Serializable { @Override public String toString() { - return getKey() + ", " + getValue(); + return key + ", " + value; } @Override diff --git a/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java b/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java index 6b541ec..e499eb3 100644 --- a/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java +++ b/app/src/main/java/acr/browser/lightning/utils/ThemeUtils.java @@ -1,7 +1,6 @@ package acr.browser.lightning.utils; import android.content.Context; -import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -10,7 +9,6 @@ import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; -import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.support.annotation.AttrRes;