diff --git a/F-Droid/src/org/fdroid/fdroid/CompatibilityChecker.java b/F-Droid/src/org/fdroid/fdroid/CompatibilityChecker.java index be6e65516..09552b0bd 100644 --- a/F-Droid/src/org/fdroid/fdroid/CompatibilityChecker.java +++ b/F-Droid/src/org/fdroid/fdroid/CompatibilityChecker.java @@ -96,7 +96,7 @@ public class CompatibilityChecker extends Compatibility { if (apk.features != null) { for (final String feat : apk.features) { - if (ignoreTouchscreen && feat.equals("android.hardware.touchscreen")) { + if (ignoreTouchscreen && "android.hardware.touchscreen".equals(feat)) { continue; } if (!features.contains(feat)) { diff --git a/F-Droid/src/org/fdroid/fdroid/FDroid.java b/F-Droid/src/org/fdroid/fdroid/FDroid.java index d7792caa7..8ae734c1c 100644 --- a/F-Droid/src/org/fdroid/fdroid/FDroid.java +++ b/F-Droid/src/org/fdroid/fdroid/FDroid.java @@ -137,7 +137,7 @@ public class FDroid extends ActionBarActivity { appId = data.getQueryParameter("fdid"); } else if (path.startsWith("/app")) { appId = data.getLastPathSegment(); - if (appId != null && appId.equals("app")) { + if ("app".equals(appId)) { appId = null; } } @@ -168,10 +168,10 @@ public class FDroid extends ActionBarActivity { query = data.getQueryParameter("s"); break; } - } else if (scheme.equals("fdroid.app")) { + } else if ("fdroid.app".equals(scheme)) { // fdroid.app:app.id appId = data.getSchemeSpecificPart(); - } else if (scheme.equals("fdroid.search")) { + } else if ("fdroid.search".equals(scheme)) { // fdroid.search:query query = data.getSchemeSpecificPart(); } diff --git a/F-Droid/src/org/fdroid/fdroid/FDroidApp.java b/F-Droid/src/org/fdroid/fdroid/FDroidApp.java index 309f26d5c..ba2f048f8 100644 --- a/F-Droid/src/org/fdroid/fdroid/FDroidApp.java +++ b/F-Droid/src/org/fdroid/fdroid/FDroidApp.java @@ -315,8 +315,8 @@ public class FDroidApp extends Application { // let's find it for (ResolveInfo info : pm.queryIntentActivities(sendBt, 0)) { bluetoothPackageName = info.activityInfo.packageName; - if (bluetoothPackageName.equals("com.android.bluetooth") - || bluetoothPackageName.equals("com.mediatek.bluetooth")) { + if ("com.android.bluetooth".equals(bluetoothPackageName) + || "com.mediatek.bluetooth".equals(bluetoothPackageName)) { className = info.activityInfo.name; found = true; break; diff --git a/F-Droid/src/org/fdroid/fdroid/RepoXMLHandler.java b/F-Droid/src/org/fdroid/fdroid/RepoXMLHandler.java index bcfcb3514..5e37daaf3 100644 --- a/F-Droid/src/org/fdroid/fdroid/RepoXMLHandler.java +++ b/F-Droid/src/org/fdroid/fdroid/RepoXMLHandler.java @@ -88,7 +88,7 @@ public class RepoXMLHandler extends DefaultHandler { super.endElement(uri, localName, qName); - if (localName.equals("application") && curapp != null) { + if ("application".equals(localName) && curapp != null) { apps.add(curapp); curapp = null; // If the app id is already present in this apps list, then it @@ -99,7 +99,7 @@ public class RepoXMLHandler extends DefaultHandler { // happen, and I don't *think* it will crash the client, because // the first app will insert, the second one will update the newly // inserted one. - } else if (localName.equals("package") && curapk != null && curapp != null) { + } else if ("package".equals(localName) && curapk != null && curapp != null) { apksList.add(curapk); curapk = null; } else if (curchars.length() == 0) { @@ -119,12 +119,12 @@ public class RepoXMLHandler extends DefaultHandler { curapk.size = Utils.parseInt(str, 0); break; case "hash": - if (hashType == null || hashType.equals("md5")) { + if (hashType == null || "md5".equals(hashType)) { if (curapk.hash == null) { curapk.hash = str; curapk.hashType = "MD5"; } - } else if (hashType.equals("sha256")) { + } else if ("sha256".equals(hashType)) { curapk.hash = str; curapk.hashType = "SHA-256"; } @@ -227,7 +227,7 @@ public class RepoXMLHandler extends DefaultHandler { curapp.requirements = Utils.CommaSeparatedList.make(str); break; } - } else if (localName.equals("description")) { + } else if ("description".equals(localName)) { description = cleanWhiteSpace(str); } } @@ -237,7 +237,7 @@ public class RepoXMLHandler extends DefaultHandler { Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); - if (localName.equals("repo")) { + if ("repo".equals(localName)) { signingCertFromIndexXml = attributes.getValue("", "pubkey"); maxage = Utils.parseInt(attributes.getValue("", "maxage"), -1); version = Utils.parseInt(attributes.getValue("", "version"), -1); @@ -249,16 +249,16 @@ public class RepoXMLHandler extends DefaultHandler { if (dc != null) description = cleanWhiteSpace(dc); - } else if (localName.equals("application") && curapp == null) { + } else if ("application".equals(localName) && curapp == null) { curapp = new App(); curapp.id = attributes.getValue("", "id"); - } else if (localName.equals("package") && curapp != null && curapk == null) { + } else if ("package".equals(localName) && curapp != null && curapk == null) { curapk = new Apk(); curapk.id = curapp.id; curapk.repo = repo.getId(); hashType = null; - } else if (localName.equals("hash") && curapk != null) { + } else if ("hash".equals(localName) && curapk != null) { hashType = attributes.getValue("", "type"); } curchars.setLength(0); diff --git a/F-Droid/src/org/fdroid/fdroid/Utils.java b/F-Droid/src/org/fdroid/fdroid/Utils.java index 6defc1c15..133452c50 100644 --- a/F-Droid/src/org/fdroid/fdroid/Utils.java +++ b/F-Droid/src/org/fdroid/fdroid/Utils.java @@ -247,7 +247,7 @@ public final class Utils { XmlResourceParser xml = am.openXmlResourceParser("AndroidManifest.xml"); int eventType = xml.getEventType(); while (eventType != XmlPullParser.END_DOCUMENT) { - if (eventType == XmlPullParser.START_TAG && xml.getName().equals("uses-sdk")) { + if (eventType == XmlPullParser.START_TAG && "uses-sdk".equals(xml.getName())) { for (int j = 0; j < xml.getAttributeCount(); j++) { if (xml.getAttributeName(j).equals(attrName)) { return Integer.parseInt(xml.getAttributeValue(j)); diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java index adb8b93c5..b35f324e8 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Response.java @@ -74,7 +74,7 @@ public class Response { public int getFileSize() { if (headers != null) { for (Map.Entry entry : headers.entrySet()) { - if (entry.getKey().toLowerCase(Locale.ENGLISH).equals("content-length")) { + if ("content-length".equals(entry.getKey().toLowerCase(Locale.ENGLISH))) { try { return Integer.parseInt(entry.getValue()); } catch (NumberFormatException e) { diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/WifiQrView.java b/F-Droid/src/org/fdroid/fdroid/views/swap/WifiQrView.java index d89cd871d..6fce8959f 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/WifiQrView.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/WifiQrView.java @@ -148,7 +148,7 @@ public class WifiQrView extends ScrollView implements SwapWorkflowActivity.Inner // But it is only available on later Android versions. As such we use URLEncodedUtils instead. List parameters = URLEncodedUtils.parse(URI.create(sharingUri.toString()), "UTF-8"); for (NameValuePair parameter : parameters) { - if (!parameter.getName().equals("ssid")) { + if (!"ssid".equals(parameter.getName())) { if (first) { qrUriString += "?"; first = false; diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index b52234ca1..badc37e66 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -73,6 +73,7 @@ +