aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-08-11 18:31:13 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-08-11 21:15:02 +0200
commitd44ae263be6167ca983953ad621cae75bb84f0ad (patch)
treecbc0fc280029ec762a1b180304359fee270fb10d
parentbbaad718eca730232ff1751a64d1335bc1031c52 (diff)
downloadcgeo-d44ae263be6167ca983953ad621cae75bb84f0ad.zip
cgeo-d44ae263be6167ca983953ad621cae75bb84f0ad.tar.gz
cgeo-d44ae263be6167ca983953ad621cae75bb84f0ad.tar.bz2
Remove uses of "== true" and "!= false"
-rw-r--r--src/cgeo/geocaching/apps/cache/navi/LocusApp.java2
-rw-r--r--src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java2
-rw-r--r--src/cgeo/geocaching/cgBase.java146
-rw-r--r--src/cgeo/geocaching/cgCache.java12
-rw-r--r--src/cgeo/geocaching/cgCacheListAdapter.java70
-rw-r--r--src/cgeo/geocaching/cgCompass.java4
-rw-r--r--src/cgeo/geocaching/cgCompassMini.java2
-rw-r--r--src/cgeo/geocaching/cgData.java60
-rw-r--r--src/cgeo/geocaching/cgDirectionImg.java2
-rw-r--r--src/cgeo/geocaching/cgFileList.java12
-rw-r--r--src/cgeo/geocaching/cgGPXParser.java4
-rw-r--r--src/cgeo/geocaching/cgGeo.java36
-rw-r--r--src/cgeo/geocaching/cgHtmlImg.java10
-rw-r--r--src/cgeo/geocaching/cgMapImg.java2
-rw-r--r--src/cgeo/geocaching/cgOAuth.java2
-rw-r--r--src/cgeo/geocaching/cgeo.java8
-rw-r--r--src/cgeo/geocaching/cgeoapplication.java12
-rw-r--r--src/cgeo/geocaching/cgeoauth.java12
-rw-r--r--src/cgeo/geocaching/cgeocaches.java44
-rw-r--r--src/cgeo/geocaching/cgeodetail.java50
-rw-r--r--src/cgeo/geocaching/cgeoimages.java4
-rw-r--r--src/cgeo/geocaching/cgeoinit.java14
-rw-r--r--src/cgeo/geocaching/cgeopoint.java14
-rw-r--r--src/cgeo/geocaching/cgeopopup.java20
-rw-r--r--src/cgeo/geocaching/cgeosmaps.java2
-rw-r--r--src/cgeo/geocaching/cgeotouch.java2
-rw-r--r--src/cgeo/geocaching/cgeotrackable.java8
-rw-r--r--src/cgeo/geocaching/cgeovisit.java20
-rw-r--r--src/cgeo/geocaching/cgeowaypoint.java2
-rw-r--r--src/cgeo/geocaching/cgeowaypointadd.java12
-rw-r--r--src/cgeo/geocaching/mapcommon/cgMapOverlay.java8
-rw-r--r--src/cgeo/geocaching/mapcommon/cgUsersOverlay.java8
-rw-r--r--src/cgeo/geocaching/mapcommon/cgeomap.java14
33 files changed, 310 insertions, 310 deletions
diff --git a/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
index 2d3a199..2b4baf4 100644
--- a/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
+++ b/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
@@ -48,7 +48,7 @@ class LocusApp extends AbstractLocusApp implements NavigationApp {
dos.writeInt(1); // not used
if (cache != null) {
- if (waypoints == null || waypoints.isEmpty() == true) {
+ if (waypoints == null || waypoints.isEmpty()) {
dos.writeInt(1); // cache only
} else {
dos.writeInt((1 + waypoints.size())); // cache and
diff --git a/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java b/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java
index 5baa315..6f4f1b7 100644
--- a/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java
+++ b/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java
@@ -24,7 +24,7 @@ class LocusCacheListApp extends AbstractLocusApp implements CacheListApp {
@Override
public boolean invoke(cgGeo geo, List<cgCache> cacheList, Activity activity, Resources res, final Integer searchId) {
- if (cacheList == null || cacheList.isEmpty() == true) {
+ if (cacheList == null || cacheList.isEmpty()) {
return false;
}
diff --git a/src/cgeo/geocaching/cgBase.java b/src/cgeo/geocaching/cgBase.java
index 30d0dc2..3e1f67b 100644
--- a/src/cgeo/geocaching/cgBase.java
+++ b/src/cgeo/geocaching/cgBase.java
@@ -401,7 +401,7 @@ public class cgBase {
loginResponse = request(true, host, path, "GET", new HashMap<String, String>(), false, false, false);
loginData = loginResponse.getData();
if (loginData != null && loginData.length() > 0) {
- if (checkLogin(loginData) == true) {
+ if (checkLogin(loginData)) {
Log.i(cgSettings.tag, "Already logged in Geocaching.com as " + loginStart.get("username"));
switchToEnglish(viewstate, viewstate1);
@@ -447,7 +447,7 @@ public class cgBase {
loginData = loginResponse.getData();
if (loginData != null && loginData.length() > 0) {
- if (checkLogin(loginData) == true) {
+ if (checkLogin(loginData)) {
Log.i(cgSettings.tag, "Successfully logged in Geocaching.com as " + login.get("username"));
switchToEnglish(findViewstate(loginData, 0), findViewstate(loginData, 1));
@@ -549,7 +549,7 @@ public class cgBase {
caches.viewstate1 = findViewstate(page, 1);
// recaptcha
- if (showCaptcha == true) {
+ if (showCaptcha) {
try {
String recaptchaJsParam = null;
final Matcher matcherRecaptcha = patternRecaptcha.matcher(page);
@@ -631,13 +631,13 @@ public class cgBase {
final String attr = matcherGuidAndDisabled.group(2);
if (attr != null) {
- if (attr.contains("Strike") == true) {
+ if (attr.contains("Strike")) {
cache.disabled = true;
} else {
cache.disabled = false;
}
- if (attr.contains("OldWarning") == true) {
+ if (attr.contains("OldWarning")) {
cache.archived = true;
} else {
cache.archived = false;
@@ -650,7 +650,7 @@ public class cgBase {
Log.w(cgSettings.tag, "cgeoBase.parseSearch: Failed to parse GUID and/or Disabled data");
}
- if (settings.excludeDisabled == 1 && (cache.disabled == true || cache.archived == true)) {
+ if (settings.excludeDisabled == 1 && (cache.disabled || cache.archived)) {
// skip disabled and archived caches
cache = null;
continue;
@@ -782,7 +782,7 @@ public class cgBase {
if (cache.nameSp == null) {
cache.nameSp = (new Spannable.Factory()).newSpannable(cache.name);
- if (cache.disabled == true || cache.archived == true) { // strike
+ if (cache.disabled || cache.archived) { // strike
cache.nameSp.setSpan(new StrikethroughSpan(), 0, cache.nameSp.toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
@@ -888,24 +888,24 @@ public class cgBase {
final Matcher matcherConCode = patternCidCon.matcher(point);
HashMap<String, Object> tmp = null;
- if (matcherCidCode.find() == true) {
+ if (matcherCidCode.find()) {
pointCoord.name = matcherCidCode.group(1).trim().toUpperCase();
}
- if (matcherLatCode.find() == true) {
+ if (matcherLatCode.find()) {
tmp = parseCoordinate(matcherLatCode.group(1), "lat");
pointCoord.latitude = (Double) tmp.get("coordinate");
}
- if (matcherLonCode.find() == true) {
+ if (matcherLonCode.find()) {
tmp = parseCoordinate(matcherLonCode.group(1), "lon");
pointCoord.longitude = (Double) tmp.get("coordinate");
}
- if (matcherDifCode.find() == true) {
+ if (matcherDifCode.find()) {
pointCoord.difficulty = new Float(matcherDifCode.group(1));
}
- if (matcherTerCode.find() == true) {
+ if (matcherTerCode.find()) {
pointCoord.terrain = new Float(matcherTerCode.group(1));
}
- if (matcherConCode.find() == true) {
+ if (matcherConCode.find()) {
final int size = Integer.parseInt(matcherConCode.group(1));
if (size == 1) {
@@ -934,7 +934,7 @@ public class cgBase {
// save found cache coordinates
for (cgCache oneCache : caches.cacheList) {
- if (cidCoords.containsKey(oneCache.geocode) == true) {
+ if (cidCoords.containsKey(oneCache.geocode)) {
cgCoord thisCoords = cidCoords.get(oneCache.geocode);
oneCache.latitude = thisCoords.latitude;
@@ -967,7 +967,7 @@ public class cgBase {
if (ratings != null) {
// save found cache coordinates
for (cgCache oneCache : caches.cacheList) {
- if (ratings.containsKey(oneCache.guid) == true) {
+ if (ratings.containsKey(oneCache.guid)) {
cgRating thisRating = ratings.get(oneCache.guid);
oneCache.rating = thisRating.rating;
@@ -1602,7 +1602,7 @@ public class cgBase {
String typeStr = matcherLog.group(1);
String countStr = matcherLog.group(2);
if (typeStr != null && typeStr.length() > 0) {
- if (logTypes.containsKey(typeStr.toLowerCase()) == true) {
+ if (logTypes.containsKey(typeStr.toLowerCase())) {
type = logTypes.get(typeStr.toLowerCase());
}
}
@@ -1699,7 +1699,7 @@ public class cgBase {
logDate = 0;
}
- if (logTypes.containsKey(matcherLog.group(1).toLowerCase()) == true) {
+ if (logTypes.containsKey(matcherLog.group(1).toLowerCase())) {
logDone.type = logTypes.get(matcherLog.group(1).toLowerCase());
} else {
logDone.type = logTypes.get("icon_note");
@@ -1978,7 +1978,7 @@ public class cgBase {
try {
final HashMap<String, String> params = new HashMap<String, String>();
- if (settings.isLogin() == true) {
+ if (settings.isLogin()) {
final HashMap<String, String> login = settings.getGCvoteLogin();
if (login != null) {
params.put("userName", login.get("username"));
@@ -2033,7 +2033,7 @@ public class cgBase {
final Matcher matcherLoggedIn = patternLogIn.matcher(votes);
if (matcherLoggedIn.find()) {
if (matcherLoggedIn.groupCount() > 0) {
- if (matcherLoggedIn.group(1).equalsIgnoreCase("true") == true) {
+ if (matcherLoggedIn.group(1).equalsIgnoreCase("true")) {
loggedIn = true;
}
}
@@ -2064,7 +2064,7 @@ public class cgBase {
Log.w(cgSettings.tag, "cgBase.getRating: Failed to parse vote count");
}
- if (loggedIn == true) {
+ if (loggedIn) {
try {
final Matcher matcherVote = patternVote.matcher(voteData);
if (matcherVote.find()) {
@@ -2402,7 +2402,7 @@ public class cgBase {
logDate = 0;
}
- if (logTypes.containsKey(matcherLog.group(1).toLowerCase()) == true) {
+ if (logTypes.containsKey(matcherLog.group(1).toLowerCase())) {
logDone.type = logTypes.get(matcherLog.group(1).toLowerCase());
} else {
logDone.type = logTypes.get("icon_note");
@@ -2557,7 +2557,7 @@ public class cgBase {
try {
final Pattern findPattern = Pattern.compile("<strong>Caches Found:<\\/strong>([^<]+)<br", Pattern.CASE_INSENSITIVE);
final Matcher findMatcher = findPattern.matcher(page);
- if (findMatcher.find() == true) {
+ if (findMatcher.find()) {
if (findMatcher.groupCount() > 0) {
String count = findMatcher.group(1);
@@ -2638,7 +2638,7 @@ public class cgBase {
final Matcher matcher = pattern.matcher(dst);
while (matcher.find()) {
if (matcher.groupCount() > 1) {
- if (matcher.group(2).equalsIgnoreCase("km") == true) {
+ if (matcher.group(2).equalsIgnoreCase("km")) {
distance = Double.valueOf(matcher.group(1));
} else {
distance = Double.valueOf(matcher.group(1)) / kmInMiles;
@@ -2824,14 +2824,14 @@ public class cgBase {
}
String worldSide = "";
- if (latlon.equalsIgnoreCase("lat") == true) {
+ if (latlon.equalsIgnoreCase("lat")) {
if (coord >= 0) {
// have the blanks here at the direction to avoid one String concatenation
worldSide = "N ";
} else {
worldSide = "S ";
}
- } else if (latlon.equalsIgnoreCase("lon") == true) {
+ } else if (latlon.equalsIgnoreCase("lon")) {
if (coord >= 0) {
worldSide = "E ";
} else {
@@ -2841,14 +2841,14 @@ public class cgBase {
coord = Math.abs(coord);
- if (latlon.equalsIgnoreCase("lat") == true) {
- if (degrees == true) {
+ if (latlon.equalsIgnoreCase("lat")) {
+ if (degrees) {
formatted = worldSide + String.format(Locale.getDefault(), "%02.0f", Math.floor(coord)) + "° " + String.format(Locale.getDefault(), "%06.3f", ((coord - Math.floor(coord)) * 60));
} else {
formatted = worldSide + String.format(Locale.getDefault(), "%02.0f", Math.floor(coord)) + " " + String.format(Locale.getDefault(), "%06.3f", ((coord - Math.floor(coord)) * 60));
}
} else {
- if (degrees == true) {
+ if (degrees) {
formatted = worldSide + String.format(Locale.getDefault(), "%03.0f", Math.floor(coord)) + "° " + String.format(Locale.getDefault(), "%06.3f", ((coord - Math.floor(coord)) * 60));
} else {
formatted = worldSide + String.format(Locale.getDefault(), "%03.0f", Math.floor(coord)) + " " + String.format(Locale.getDefault(), "%06.3f", ((coord - Math.floor(coord)) * 60));
@@ -2880,7 +2880,7 @@ public class cgBase {
final Matcher matcher0 = pattern0.matcher(coord);
int latlonNegative;
- if (matcherA.find() == true && matcherA.groupCount() > 0) {
+ if (matcherA.find() && matcherA.groupCount() > 0) {
if (matcherA.group(1).equalsIgnoreCase("N") || matcherA.group(1).equalsIgnoreCase("E")) {
latlonNegative = 1;
} else {
@@ -2896,7 +2896,7 @@ public class cgBase {
}
return coords;
- } else if (matcherB.find() == true && matcherB.groupCount() > 0) {
+ } else if (matcherB.find() && matcherB.groupCount() > 0) {
if (matcherB.group(1).equalsIgnoreCase("N") || matcherB.group(1).equalsIgnoreCase("E")) {
latlonNegative = 1;
} else {
@@ -2908,13 +2908,13 @@ public class cgBase {
} else {
coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherB.group(2) + "." + matcherB.group(4)))));
}
- } else if (matcherC.find() == true && matcherC.groupCount() > 0) {
+ } else if (matcherC.find() && matcherC.groupCount() > 0) {
if (matcherC.groupCount() < 3 || matcherC.group(3) == null) {
coords.put("coordinate", Double.valueOf(new Float(matcherC.group(1) + ".0")));
} else {
coords.put("coordinate", Double.valueOf(new Float(matcherC.group(1) + "." + matcherC.group(3))));
}
- } else if (matcherD.find() == true && matcherD.groupCount() > 0) {
+ } else if (matcherD.find() && matcherD.groupCount() > 0) {
if (matcherD.group(1).equalsIgnoreCase("N") || matcherD.group(1).equalsIgnoreCase("E")) {
latlonNegative = 1;
} else {
@@ -2922,9 +2922,9 @@ public class cgBase {
}
coords.put("coordinate", Double.valueOf(latlonNegative * (Double.valueOf(matcherB.group(2)))));
- } else if (matcherE.find() == true && matcherE.groupCount() > 0) {
+ } else if (matcherE.find() && matcherE.groupCount() > 0) {
coords.put("coordinate", Double.valueOf(matcherE.group(1)));
- } else if (matcherF.find() == true && matcherF.groupCount() > 0) {
+ } else if (matcherF.find() && matcherF.groupCount() > 0) {
if (matcherF.group(1).equalsIgnoreCase("N") || matcherF.group(1).equalsIgnoreCase("E")) {
latlonNegative = 1;
} else {
@@ -2936,7 +2936,7 @@ public class cgBase {
return null;
}
- if (matcher0.find() == true && matcher0.groupCount() > 0) {
+ if (matcher0.find() && matcher0.groupCount() > 0) {
String tmpDir = null;
Float tmpCoord;
if (matcher0.groupCount() < 3 || matcher0.group(3) == null) {
@@ -3070,7 +3070,7 @@ public class cgBase {
return null;
}
- if (forceReload == false && reason == 0 && (app.isOffline(geocode, guid) == true || app.isThere(geocode, guid, true, true) == true)) {
+ if (forceReload == false && reason == 0 && (app.isOffline(geocode, guid) || app.isThere(geocode, guid, true, true))) {
if ((geocode == null || geocode.length() == 0) && guid != null && guid.length() > 0) {
geocode = app.getGeocode(guid);
}
@@ -3103,7 +3103,7 @@ public class cgBase {
String page = requestLogged(false, host, path, method, params, false, false, false);
if (page == null || page.length() == 0) {
- if (app.isThere(geocode, guid, true, false) == true) {
+ if (app.isThere(geocode, guid, true, false)) {
if ((geocode == null || geocode.length() == 0) && guid != null && guid.length() > 0) {
Log.i(cgSettings.tag, "Loading old cache from cache.");
@@ -3188,16 +3188,16 @@ public class cgBase {
String cachetype = null;
Integer list = 1;
- if (parameters.containsKey("latitude") == true && parameters.containsKey("longitude") == true) {
+ if (parameters.containsKey("latitude") && parameters.containsKey("longitude")) {
latitude = (Double) parameters.get("latitude");
longitude = (Double) parameters.get("longitude");
}
- if (parameters.containsKey("cachetype") == true) {
+ if (parameters.containsKey("cachetype")) {
cachetype = (String) parameters.get("cachetype");
}
- if (parameters.containsKey("list") == true) {
+ if (parameters.containsKey("list")) {
list = (Integer) parameters.get("list");
}
@@ -3215,7 +3215,7 @@ public class cgBase {
String cachetype = null;
- if (parameters.containsKey("cachetype") == true) {
+ if (parameters.containsKey("cachetype")) {
cachetype = (String) parameters.get("cachetype");
}
@@ -3250,7 +3250,7 @@ public class cgBase {
final String path = "/seek/nearest.aspx";
final String method = "GET";
final HashMap<String, String> params = new HashMap<String, String>();
- if (cacheType != null && cacheIDs.containsKey(cacheType) == true) {
+ if (cacheType != null && cacheIDs.containsKey(cacheType)) {
params.put("tx", cacheIDs.get(cacheType));
} else {
params.put("tx", cacheIDs.get("all"));
@@ -3324,7 +3324,7 @@ public class cgBase {
final String path = "/seek/nearest.aspx";
final String method = "GET";
final HashMap<String, String> params = new HashMap<String, String>();
- if (cacheType != null && cacheIDs.containsKey(cacheType) == true) {
+ if (cacheType != null && cacheIDs.containsKey(cacheType)) {
params.put("tx", cacheIDs.get(cacheType));
} else {
params.put("tx", cacheIDs.get("all"));
@@ -3397,7 +3397,7 @@ public class cgBase {
final String path = "/seek/nearest.aspx";
final String method = "GET";
final HashMap<String, String> params = new HashMap<String, String>();
- if (cacheType != null && cacheIDs.containsKey(cacheType) == true) {
+ if (cacheType != null && cacheIDs.containsKey(cacheType)) {
params.put("tx", cacheIDs.get(cacheType));
} else {
params.put("tx", cacheIDs.get("all"));
@@ -3405,7 +3405,7 @@ public class cgBase {
params.put("ul", userName);
boolean my = false;
- if (userName.equalsIgnoreCase(settings.getLogin().get("username")) == true) {
+ if (userName.equalsIgnoreCase(settings.getLogin().get("username"))) {
my = true;
Log.i(cgSettings.tag, "cgBase.searchByUsername: Overriding users choice, downloading all caches.");
}
@@ -3476,7 +3476,7 @@ public class cgBase {
final String path = "/seek/nearest.aspx";
final String method = "GET";
final HashMap<String, String> params = new HashMap<String, String>();
- if (cacheType != null && cacheIDs.containsKey(cacheType) == true) {
+ if (cacheType != null && cacheIDs.containsKey(cacheType)) {
params.put("tx", cacheIDs.get(cacheType));
} else {
params.put("tx", cacheIDs.get("all"));
@@ -3596,7 +3596,7 @@ public class cgBase {
if ((settings.excludeDisabled == 0 || (settings.excludeDisabled == 1 && cache.disabled == false))
&& (settings.excludeMine == 0 || (settings.excludeMine == 1 && cache.own == false))
&& (settings.excludeMine == 0 || (settings.excludeMine == 1 && cache.found == false))
- && (settings.cacheType == null || (settings.cacheType.equals(cache.type) == true))) {
+ && (settings.cacheType == null || (settings.cacheType.equals(cache.type)))) {
search.addGeocode(cache.geocode);
cacheList.add(cache);
}
@@ -3811,7 +3811,7 @@ public class cgBase {
final Matcher matcher = pattern.matcher(page);
try {
- if (matcher.find() == true && matcher.groupCount() > 0) {
+ if (matcher.find() && matcher.groupCount() > 0) {
final String viewstateConfirm = findViewstate(page, 0);
final String viewstate1Confirm = findViewstate(page, 1);
@@ -3865,7 +3865,7 @@ public class cgBase {
try {
final Pattern patternOk = Pattern.compile("<h2[^>]*>[^<]*<span id=\"ctl00_ContentBody_lbHeading\"[^>]*>[^<]*</span>[^<]*</h2>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
final Matcher matcherOk = patternOk.matcher(page);
- if (matcherOk.find() == true) {
+ if (matcherOk.find()) {
Log.i(cgSettings.tag, "Log successfully posted to cache #" + cacheid);
if (app != null && geocode != null) {
@@ -3949,7 +3949,7 @@ public class cgBase {
try {
final Pattern patternOk = Pattern.compile("<div id=[\"|']ctl00_ContentBody_LogBookPanel1_ViewLogPanel[\"|']>", Pattern.CASE_INSENSITIVE);
final Matcher matcherOk = patternOk.matcher(page);
- if (matcherOk.find() == true) {
+ if (matcherOk.find()) {
Log.i(cgSettings.tag, "Log successfully posted to trackable #" + trackingCode);
return 1;
}
@@ -4228,7 +4228,7 @@ public class cgBase {
if (params == null) {
params = new HashMap<String, String>();
}
- if (addF == true) {
+ if (addF) {
params.put("f", "1");
}
@@ -4330,7 +4330,7 @@ public class cgBase {
// prepare cookies
String cookiesDone = null;
- if (cookies == null || cookies.isEmpty() == true) {
+ if (cookies == null || cookies.isEmpty()) {
if (cookies == null) {
cookies = new HashMap<String, String>();
}
@@ -4339,7 +4339,7 @@ public class cgBase {
final Set<String> prefsKeys = prefsAll.keySet();
for (String key : prefsKeys) {
- if (key.matches("cookie_.+") == true) {
+ if (key.matches("cookie_.+")) {
final String cookieKey = key.substring(7);
final String cookieValue = (String) prefsAll.get(key);
@@ -4371,7 +4371,7 @@ public class cgBase {
final int length = keys.length;
for (int i = 0; i < length; i++) {
- if (keys[i].toString().length() > 7 && keys[i].toString().substring(0, 7).equals("cookie_") == true) {
+ if (keys[i].toString().length() > 7 && keys[i].toString().substring(0, 7).equals("cookie_")) {
cookiesEncoded.add(keys[i].toString().substring(7) + "=" + prefsValues.get(keys[i].toString()));
}
}
@@ -4407,7 +4407,7 @@ public class cgBase {
uc.setRequestProperty("Host", host);
uc.setRequestProperty("Cookie", cookiesDone);
- if (xContentType == true) {
+ if (xContentType) {
uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
}
@@ -4434,7 +4434,7 @@ public class cgBase {
uc.setRequestProperty("Host", host);
uc.setRequestProperty("Cookie", cookiesDone);
- if (xContentType == true) {
+ if (xContentType) {
uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
}
@@ -4532,7 +4532,7 @@ public class cgBase {
try {
if (httpCode == 302 && httpLocation != null) {
final Uri newLocation = Uri.parse(httpLocation);
- if (newLocation.isRelative() == true) {
+ if (newLocation.isRelative()) {
response = request(secure, host, path, "GET", new HashMap<String, String>(), requestId, false, false, false);
} else {
boolean secureRedir = false;
@@ -4592,7 +4592,7 @@ public class cgBase {
// prepare cookies
String cookiesDone = null;
- if (cookies == null || cookies.isEmpty() == true) {
+ if (cookies == null || cookies.isEmpty()) {
if (cookies == null) {
cookies = new HashMap<String, String>();
}
@@ -4601,7 +4601,7 @@ public class cgBase {
final Set<String> prefsKeys = prefsAll.keySet();
for (String key : prefsKeys) {
- if (key.matches("cookie_.+") == true) {
+ if (key.matches("cookie_.+")) {
final String cookieKey = key.substring(7);
final String cookieValue = (String) prefsAll.get(key);
@@ -4633,7 +4633,7 @@ public class cgBase {
final int length = keys.length;
for (int i = 0; i < length; i++) {
- if (keys[i].toString().length() > 7 && keys[i].toString().substring(0, 7).equals("cookie_") == true) {
+ if (keys[i].toString().length() > 7 && keys[i].toString().substring(0, 7).equals("cookie_")) {
cookiesEncoded.add(keys[i].toString().substring(7) + "=" + prefsValues.get(keys[i].toString()));
}
}
@@ -4757,7 +4757,7 @@ public class cgBase {
String page = null;
if (httpCode == 302 && httpLocation != null) {
final Uri newLocation = Uri.parse(httpLocation);
- if (newLocation.isRelative() == true) {
+ if (newLocation.isRelative()) {
page = requestJSONgc(host, path, params);
} else {
page = requestJSONgc(newLocation.getHost(), newLocation.getPath(), params);
@@ -4901,7 +4901,7 @@ public class cgBase {
//2011-08-09 - 302 is redirect so something should probably be done
/*if (httpCode == 302 && httpLocation != null) {
final Uri newLocation = Uri.parse(httpLocation);
- if (newLocation.isRelative() == true) {
+ if (newLocation.isRelative()) {
page = requestJSONgc(host, path, params);
} else {
page = requestJSONgc(newLocation.getHost(), newLocation.getPath(), params);
@@ -5038,7 +5038,7 @@ public class cgBase {
}
// store images from logs
- if (settings.storelogimages == true) {
+ if (settings.storelogimages) {
for (cgLog log : cache.logs) {
if (log.logImages != null && log.logImages.isEmpty() == false) {
for (cgImage oneLogImg : log.logImages) {
@@ -5062,9 +5062,9 @@ public class cgBase {
}
String type = "mystery";
- if (cache.found == true) {
+ if (cache.found) {
type = cache.type + "_found";
- } else if (cache.disabled == true) {
+ } else if (cache.disabled) {
type = cache.type + "_disabled";
} else {
type = cache.type;
@@ -5195,7 +5195,7 @@ public class cgBase {
lonOk = true;
}
- if (latOk == true && lonOk == true) {
+ if (latOk && lonOk) {
return true;
} else {
return false;
@@ -5374,13 +5374,13 @@ public class cgBase {
int icon = -1;
String iconTxt = null;
- if (cache == true) {
+ if (cache) {
if (type != null && type.length() > 0) {
- if (own == true) {
+ if (own) {
iconTxt = type + "-own";
- } else if (found == true) {
+ } else if (found) {
iconTxt = type + "-found";
- } else if (disabled == true) {
+ } else if (disabled) {
iconTxt = type + "-disabled";
} else {
iconTxt = type;
@@ -5389,7 +5389,7 @@ public class cgBase {
iconTxt = "traditional";
}
- if (gcIcons.containsKey(iconTxt) == true) {
+ if (gcIcons.containsKey(iconTxt)) {
icon = gcIcons.get(iconTxt);
} else {
icon = gcIcons.get("traditional");
@@ -5401,7 +5401,7 @@ public class cgBase {
iconTxt = "waypoint";
}
- if (wpIcons.containsKey(iconTxt) == true) {
+ if (wpIcons.containsKey(iconTxt)) {
icon = wpIcons.get(iconTxt);
} else {
icon = wpIcons.get("waypoint");
@@ -5500,7 +5500,7 @@ public class cgBase {
return elv;
}
- if (response.has("results") == true) {
+ if (response.has("results")) {
JSONArray results = response.getJSONArray("results");
JSONObject result = results.getJSONObject(0);
elv = result.getDouble("elevation");
diff --git a/src/cgeo/geocaching/cgCache.java b/src/cgeo/geocaching/cgCache.java
index 5c635ca..a53740b 100644
--- a/src/cgeo/geocaching/cgCache.java
+++ b/src/cgeo/geocaching/cgCache.java
@@ -74,19 +74,19 @@ public class cgCache {
boolean loadL = true;
boolean loadI = true;
- if (attributes == null || attributes.isEmpty() == true) {
+ if (attributes == null || attributes.isEmpty()) {
loadA = false;
}
- if (waypoints == null || waypoints.isEmpty() == true) {
+ if (waypoints == null || waypoints.isEmpty()) {
loadW = false;
}
- if (spoilers == null || spoilers.isEmpty() == true) {
+ if (spoilers == null || spoilers.isEmpty()) {
loadS = false;
}
- if (logs == null || logs.isEmpty() == true) {
+ if (logs == null || logs.isEmpty()) {
loadL = false;
}
- if (inventory == null || inventory.isEmpty() == true) {
+ if (inventory == null || inventory.isEmpty()) {
loadI = false;
}
@@ -97,7 +97,7 @@ public class cgCache {
}
updated = System.currentTimeMillis();
- if (detailed == false && oldCache.detailed == true) {
+ if (detailed == false && oldCache.detailed) {
detailed = true;
detailedUpdate = System.currentTimeMillis();
}
diff --git a/src/cgeo/geocaching/cgCacheListAdapter.java b/src/cgeo/geocaching/cgCacheListAdapter.java
index c6b9f02..ac91372 100644
--- a/src/cgeo/geocaching/cgCacheListAdapter.java
+++ b/src/cgeo/geocaching/cgCacheListAdapter.java
@@ -174,7 +174,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
public void setHistoric(boolean historicIn) {
historic = historicIn;
- if (historic == true) {
+ if (historic) {
statComparator = new VisitComparator();
} else {
statComparator = null;
@@ -188,13 +188,13 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
public boolean setSelectMode(boolean status, boolean clear) {
selectMode = status;
- if (selectMode == false && clear == true) {
+ if (selectMode == false && clear) {
for (cgCache cache : list) {
cache.statusChecked = false;
cache.statusCheckedView = false;
}
checked = 0;
- } else if (selectMode == true) {
+ } else if (selectMode) {
for (cgCache cache : list) {
cache.statusCheckedView = false;
}
@@ -219,7 +219,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
cache.statusCheckedView = false;
}
checked = 0;
- } else if (selectMode == true) {
+ } else if (selectMode) {
for (cgCache cache : list) {
cache.statusCheckedView = false;
}
@@ -233,7 +233,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
int check = 0;
for (cgCache cache : list) {
- if (cache.statusChecked == true) {
+ if (cache.statusChecked) {
cache.statusChecked = false;
cache.statusCheckedView = false;
} else {
@@ -249,7 +249,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
}
public void forceSort(Double latitudeIn, Double longitudeIn) {
- if (list == null || list.isEmpty() == true) {
+ if (list == null || list.isEmpty()) {
return;
}
if (sort == false) {
@@ -281,7 +281,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
latitude = latitudeIn;
longitude = longitudeIn;
- if (list != null && list.isEmpty() == false && (System.currentTimeMillis() - lastSort) > 1000 && sort == true) {
+ if (list != null && list.isEmpty() == false && (System.currentTimeMillis() - lastSort) > 1000 && sort) {
try {
if (statComparator != null) {
Collections.sort((List<cgCache>) list, statComparator);
@@ -325,7 +325,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
}
public boolean resetChecks() {
- if (list.isEmpty() == true) {
+ if (list.isEmpty()) {
return false;
}
if (checked <= 0) {
@@ -335,7 +335,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
boolean status = getSelectMode();
int cleared = 0;
for (cgCache cache : list) {
- if (cache.statusChecked == true) {
+ if (cache.statusChecked) {
cache.statusChecked = false;
checkChecked(-1);
@@ -345,7 +345,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
setSelectMode(false, false);
notifyDataSetChanged();
- if (cleared > 0 || status == true) {
+ if (cleared > 0 || status) {
return true;
} else {
return false;
@@ -391,7 +391,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
holder = (cgCacheView) rowView.getTag();
}
- if (cache.own == true) {
+ if (cache.own) {
if (settings.skin == 1) {
holder.oneInfo.setBackgroundResource(R.color.owncache_background_light);
holder.oneCheckbox.setBackgroundResource(R.color.owncache_background_light);
@@ -415,15 +415,15 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
rowView.setOnTouchListener(touchLst);
rowView.setLongClickable(true);
- if (selectMode == true) {
- if (cache.statusCheckedView == true) {
+ if (selectMode) {
+ if (cache.statusCheckedView) {
moveRight(holder, cache, true); // move fast when already slided
} else {
moveRight(holder, cache, false);
}
- } else if (cache.statusChecked == true) {
+ } else if (cache.statusChecked) {
holder.checkbox.setChecked(true);
- if (cache.statusCheckedView == true) {
+ if (cache.statusCheckedView) {
moveRight(holder, cache, true); // move fast when already slided
} else {
moveRight(holder, cache, false);
@@ -448,10 +448,10 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
}
holder.direction.setContent(cache.latitude, cache.longitude);
- if (cache.logOffline == true) {
+ if (cache.logOffline) {
holder.offlineMark.setVisibility(View.VISIBLE);
holder.foundMark.setVisibility(View.GONE);
- } else if (cache.found == true) {
+ } else if (cache.found) {
holder.offlineMark.setVisibility(View.GONE);
holder.foundMark.setVisibility(View.VISIBLE);
} else {
@@ -461,13 +461,13 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
if (cache.nameSp == null) {
cache.nameSp = (new Spannable.Factory()).newSpannable(cache.name);
- if (cache.disabled == true || cache.archived == true) { // strike
+ if (cache.disabled || cache.archived) { // strike
cache.nameSp.setSpan(new StrikethroughSpan(), 0, cache.nameSp.toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
holder.text.setText(cache.nameSp, TextView.BufferType.SPANNABLE);
- if (gcIcons.containsKey(cache.type) == true) { // cache icon
+ if (gcIcons.containsKey(cache.type)) { // cache icon
holder.text.setCompoundDrawablesWithIntrinsicBounds(gcIcons.get(cache.type), null, null, null);
} else { // unknown cache type, "mystery" icon
holder.text.setCompoundDrawablesWithIntrinsicBounds(gcIcons.get("mystery"), null, null, null);
@@ -510,7 +510,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
}
}
- if (setDiDi == true) {
+ if (setDiDi) {
holder.directionLayout.setVisibility(View.VISIBLE);
holder.dirImgLayout.setVisibility(View.GONE);
} else {
@@ -583,7 +583,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
holder.favourite.setBackgroundResource(favoriteBack);
StringBuilder cacheInfo = new StringBuilder();
- if (historic == true && cache.visitedDate != null) {
+ if (historic && cache.visitedDate != null) {
cacheInfo.append(base.formatTime(cache.visitedDate));
cacheInfo.append("; ");
cacheInfo.append(base.formatDate(cache.visitedDate));
@@ -611,7 +611,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
cacheInfo.append(String.format(Locale.getDefault(), "%.1f", cache.terrain));
}
}
- if (cache.members == true) {
+ if (cache.members) {
if (cacheInfo.length() > 0) {
cacheInfo.append(" | ");
}
@@ -635,7 +635,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
checked = 0;
for (cgCache cache : list) {
- if (cache.statusChecked == true) {
+ if (cache.statusChecked) {
checked++;
}
}
@@ -655,7 +655,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
public void onClick(View view) {
final boolean checkNow = ((CheckBox) view).isChecked();
- if (checkNow == true) {
+ if (checkNow) {
cache.statusChecked = true;
checked++;
} else {
@@ -690,7 +690,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
return;
}
- if (getSelectMode() == true || getChecked() > 0) {
+ if (getSelectMode() || getChecked() > 0) {
return;
}
@@ -714,7 +714,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
// swipe on item
public boolean onTouch(View view, MotionEvent event) {
- if (gestureDetector.onTouchEvent(event) == true) {
+ if (gestureDetector.onTouchEvent(event)) {
touch = false;
return true;
@@ -737,7 +737,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
try {
- if (getSelectMode() == true) {
+ if (getSelectMode()) {
return false;
}
@@ -747,7 +747,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
if ((e2.getX() - e1.getX()) > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > Math.abs(velocityY)) {
// left to right swipe
- if (cache.statusChecked == true) {
+ if (cache.statusChecked) {
return true;
}
@@ -766,7 +766,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
}
if (holder != null && holder.oneInfo != null) {
- if (getSelectMode() == true) {
+ if (getSelectMode()) {
setSelectMode(false, false);
}
@@ -798,7 +798,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
statusChecked = true;
}
- if (getSelectMode() == true) {
+ if (getSelectMode()) {
statusSort = false;
} else {
statusSort = true;
@@ -810,7 +810,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
sort = true;
}
- if (sort == true) {
+ if (sort) {
forceSort(latitude, longitude);
}
}
@@ -826,7 +826,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
// slide cache info
Animation showCheckbox = new TranslateAnimation(0, (int) (SWIPE_DISTANCE * pixelDensity), 0, 0);
showCheckbox.setRepeatCount(0);
- if (force == true) {
+ if (force) {
showCheckbox.setDuration(0);
} else {
showCheckbox.setDuration(400);
@@ -838,7 +838,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
// dim cache info
Animation dimInfo = new AlphaAnimation(1.0f, SWIPE_OPACITY);
dimInfo.setRepeatCount(0);
- if (force == true) {
+ if (force) {
dimInfo.setDuration(0);
} else {
dimInfo.setDuration(400);
@@ -873,7 +873,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
// slide cache info
Animation hideCheckbox = new TranslateAnimation((int) (SWIPE_DISTANCE * pixelDensity), 0, 0, 0);
hideCheckbox.setRepeatCount(0);
- if (force == true) {
+ if (force) {
hideCheckbox.setDuration(0);
} else {
hideCheckbox.setDuration(400);
@@ -885,7 +885,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
// brighten cache info
Animation brightenInfo = new AlphaAnimation(SWIPE_OPACITY, 1.0f);
brightenInfo.setRepeatCount(0);
- if (force == true) {
+ if (force) {
brightenInfo.setDuration(0);
} else {
brightenInfo.setDuration(400);
diff --git a/src/cgeo/geocaching/cgCompass.java b/src/cgeo/geocaching/cgCompass.java
index f8abb69..2774093 100644
--- a/src/cgeo/geocaching/cgCompass.java
+++ b/src/cgeo/geocaching/cgCompass.java
@@ -221,10 +221,10 @@ public class cgCompass extends View {
@Override
protected void onDraw(Canvas canvas) {
- if (lock == true) {
+ if (lock) {
return;
}
- if (drawing == true) {
+ if (drawing) {
return;
}
diff --git a/src/cgeo/geocaching/cgCompassMini.java b/src/cgeo/geocaching/cgCompassMini.java
index 0f8607e..17c26ce 100644
--- a/src/cgeo/geocaching/cgCompassMini.java
+++ b/src/cgeo/geocaching/cgCompassMini.java
@@ -80,7 +80,7 @@ public class cgCompassMini extends View {
}
protected void updateDirection() {
- if (compassArrow == null || compassArrow.isRecycled() == true) {
+ if (compassArrow == null || compassArrow.isRecycled()) {
return;
}
diff --git a/src/cgeo/geocaching/cgData.java b/src/cgeo/geocaching/cgData.java
index 644e6c9..73c9384 100644
--- a/src/cgeo/geocaching/cgData.java
+++ b/src/cgeo/geocaching/cgData.java
@@ -211,7 +211,7 @@ public class cgData {
Log.e(cgSettings.tag, "Failed to open connection to RW database.");
}
- if (databaseRW.inTransaction() == true) {
+ if (databaseRW.inTransaction()) {
databaseRW.endTransaction();
}
} catch (Exception e) {
@@ -251,7 +251,7 @@ public class cgData {
if (databaseRO != null) {
path = databaseRO.getPath();
- if (databaseRO.inTransaction() == true) {
+ if (databaseRO.inTransaction()) {
databaseRO.endTransaction();
}
@@ -265,7 +265,7 @@ public class cgData {
if (databaseRW != null) {
path = databaseRW.getPath();
- if (databaseRW.inTransaction() == true) {
+ if (databaseRW.inTransaction()) {
databaseRW.endTransaction();
}
@@ -432,7 +432,7 @@ public class cgData {
Log.i(cgSettings.tag, "Upgrade database from ver. " + oldVersion + " to ver. " + newVersion + ": start");
try {
- if (db.isReadOnly() == true) {
+ if (db.isReadOnly()) {
return;
}
@@ -879,17 +879,17 @@ public class cgData {
}
if (cnt > 0) {
- if (detailed == true && dataDetailed == 0) {
+ if (detailed && dataDetailed == 0) {
// we want details, but these are not stored
return false;
}
- if (checkTime == true && detailed == true && dataDetailedUpdate < (System.currentTimeMillis() - (3 * 24 * 60 * 60 * 1000))) {
+ if (checkTime && detailed && dataDetailedUpdate < (System.currentTimeMillis() - (3 * 24 * 60 * 60 * 1000))) {
// we want to check time for detailed cache, but data are older than 3 hours
return false;
}
- if (checkTime == true && detailed == false && dataUpdated < (System.currentTimeMillis() - (3 * 24 * 60 * 60 * 1000))) {
+ if (checkTime && detailed == false && dataUpdated < (System.currentTimeMillis() - (3 * 24 * 60 * 60 * 1000))) {
// we want to check time for short cache, but data are older than 3 hours
return false;
}
@@ -1318,14 +1318,14 @@ public class cgData {
boolean ok = false;
databaseRW.beginTransaction();
try {
- if (drop == true) {
+ if (drop) {
databaseRW.delete(dbTableWaypoints, "geocode = \"" + geocode + "\" and type <> \"own\"", null);
}
if (!waypoints.isEmpty()) {
ContentValues values = new ContentValues();
for (cgWaypoint oneWaypoint : waypoints) {
- if (oneWaypoint.type.equalsIgnoreCase("own") == true) {
+ if (oneWaypoint.type.equalsIgnoreCase("own")) {
continue;
}
@@ -1460,7 +1460,7 @@ public class cgData {
databaseRW.beginTransaction();
try {
- if (drop == true) {
+ if (drop) {
databaseRW.delete(dbTableLogs, "geocode = \"" + geocode + "\"", null);
}
@@ -1510,7 +1510,7 @@ public class cgData {
databaseRW.beginTransaction();
try {
- if (drop == true) {
+ if (drop) {
databaseRW.delete(dbTableLogCount, "geocode = \"" + geocode + "\"", null);
}
@@ -1676,7 +1676,7 @@ public class cgData {
}
public ArrayList<cgCache> loadCaches(Object[] geocodes, Object[] guids, boolean lite) {
- if (lite == true) {
+ if (lite) {
return loadCaches(geocodes, guids, null, null, null, null, false, true, false, false, false, false);
} else {
return loadCaches(geocodes, guids, null, null, null, null, true, true, true, true, true, true);
@@ -1805,13 +1805,13 @@ public class cgData {
cache.size = (String) cursor.getString(cursor.getColumnIndex("size"));
cache.difficulty = (Float) cursor.getFloat(cursor.getColumnIndex("difficulty"));
index = cursor.getColumnIndex("direction");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
cache.direction = null;
} else {
cache.direction = (Double) cursor.getDouble(index);
}
index = cursor.getColumnIndex("distance");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
cache.distance = null;
} else {
cache.distance = (Double) cursor.getDouble(index);
@@ -1822,19 +1822,19 @@ public class cgData {
cache.longitudeString = (String) cursor.getString(cursor.getColumnIndex("longitude_string"));
cache.location = (String) cursor.getString(cursor.getColumnIndex("location"));
index = cursor.getColumnIndex("latitude");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
cache.latitude = null;
} else {
cache.latitude = (Double) cursor.getDouble(index);
}
index = cursor.getColumnIndex("longitude");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
cache.longitude = null;
} else {
cache.longitude = (Double) cursor.getDouble(index);
}
index = cursor.getColumnIndex("elevation");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
cache.elevation = null;
} else {
cache.elevation = (Double) cursor.getDouble(index);
@@ -1854,7 +1854,7 @@ public class cgData {
cache.inventoryItems = (Integer) cursor.getInt(cursor.getColumnIndex("inventoryunknown"));
cache.onWatchlist = cursor.getLong(cursor.getColumnIndex("onWatchlist")) == 1l;
- if (loadA == true) {
+ if (loadA) {
ArrayList<String> attributes = loadAttributes(cache.geocode);
if (attributes != null && attributes.isEmpty() == false) {
if (cache.attributes == null)
@@ -1865,7 +1865,7 @@ public class cgData {
}
}
- if (loadW == true) {
+ if (loadW) {
ArrayList<cgWaypoint> waypoints = loadWaypoints(cache.geocode);
if (waypoints != null && waypoints.isEmpty() == false) {
if (cache.waypoints == null)
@@ -1876,7 +1876,7 @@ public class cgData {
}
}
- if (loadS == true) {
+ if (loadS) {
ArrayList<cgImage> spoilers = loadSpoilers(cache.geocode);
if (spoilers != null && spoilers.isEmpty() == false) {
if (cache.spoilers == null)
@@ -1887,7 +1887,7 @@ public class cgData {
}
}
- if (loadL == true) {
+ if (loadL) {
ArrayList<cgLog> logs = loadLogs(cache.geocode);
if (logs != null && logs.isEmpty() == false) {
if (cache.logs == null)
@@ -1903,7 +1903,7 @@ public class cgData {
}
}
- if (loadI == true) {
+ if (loadI) {
ArrayList<cgTrackable> inventory = loadInventory(cache.geocode);
if (inventory != null && inventory.isEmpty() == false) {
if (cache.inventory == null)
@@ -1914,7 +1914,7 @@ public class cgData {
}
}
- if (loadO == true) {
+ if (loadO) {
cache.logOffline = hasLogOffline(cache.geocode);
}
@@ -2008,13 +2008,13 @@ public class cgData {
waypoint.latitudeString = (String) cursor.getString(cursor.getColumnIndex("latitude_string"));
waypoint.longitudeString = (String) cursor.getString(cursor.getColumnIndex("longitude_string"));
index = cursor.getColumnIndex("latitude");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
waypoint.latitude = null;
} else {
waypoint.latitude = (Double) cursor.getDouble(index);
}
index = cursor.getColumnIndex("longitude");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
waypoint.longitude = null;
} else {
waypoint.longitude = (Double) cursor.getDouble(index);
@@ -2065,13 +2065,13 @@ public class cgData {
waypoint.latitudeString = (String) cursor.getString(cursor.getColumnIndex("latitude_string"));
waypoint.longitudeString = (String) cursor.getString(cursor.getColumnIndex("longitude_string"));
index = cursor.getColumnIndex("latitude");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
waypoint.latitude = null;
} else {
waypoint.latitude = (Double) cursor.getDouble(index);
}
index = cursor.getColumnIndex("longitude");
- if (cursor.isNull(index) == true) {
+ if (cursor.isNull(index)) {
waypoint.longitude = null;
} else {
waypoint.longitude = (Double) cursor.getDouble(index);
@@ -2469,7 +2469,7 @@ public class cgData {
specifySql.append("reason = ");
specifySql.append(list);
- if (detailedOnly == true) {
+ if (detailedOnly) {
if (specifySql.length() > 0) {
specifySql.append(" and ");
}
@@ -2527,7 +2527,7 @@ public class cgData {
ArrayList<String> geocodes = new ArrayList<String>();
StringBuilder specifySql = new StringBuilder();
- if (detailedOnly == true) {
+ if (detailedOnly) {
specifySql.append(" and detailed = 1");
}
if (cachetype != null) {
@@ -2912,7 +2912,7 @@ public class cgData {
values.put("date", date.getTime());
try {
- if (hasLogOffline(geocode) == true) {
+ if (hasLogOffline(geocode)) {
final int rows = databaseRW.update(dbTableLogsOffline, values, "geocode = \"" + geocode + "\"", null);
if (rows > 0) {
diff --git a/src/cgeo/geocaching/cgDirectionImg.java b/src/cgeo/geocaching/cgDirectionImg.java
index f9227b2..573cf47 100644
--- a/src/cgeo/geocaching/cgDirectionImg.java
+++ b/src/cgeo/geocaching/cgDirectionImg.java
@@ -82,7 +82,7 @@ public class cgDirectionImg {
}
}
- if (ok == true) {
+ if (ok) {
break;
}
} catch (Exception e) {
diff --git a/src/cgeo/geocaching/cgFileList.java b/src/cgeo/geocaching/cgFileList.java
index 633e2fb..e8768a8 100644
--- a/src/cgeo/geocaching/cgFileList.java
+++ b/src/cgeo/geocaching/cgFileList.java
@@ -91,7 +91,7 @@ public abstract class cgFileList<T extends ArrayAdapter<File>> extends AbstractL
if (searchingThread != null && searchingThread.isAlive()) {
searchingThread.notifyEnd();
}
- if (files.isEmpty() == true) {
+ if (files.isEmpty()) {
finish();
}
}
@@ -139,7 +139,7 @@ public abstract class cgFileList<T extends ArrayAdapter<File>> extends AbstractL
ArrayList<File> list = new ArrayList<File>();
try {
- if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) == true) {
+ if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
boolean loaded = false;
for(String baseFolder : getBaseFolders())
{
@@ -192,11 +192,11 @@ public abstract class cgFileList<T extends ArrayAdapter<File>> extends AbstractL
final int listCnt = listPre.length;
for (int i = 0; i < listCnt; i++) {
- if (endSearching == true) {
+ if (endSearching) {
return;
}
- if (listPre[i].canRead() == true && listPre[i].isFile() == true) {
+ if (listPre[i].canRead() && listPre[i].isFile()) {
final String[] nameParts = listPre[i].getName().split("\\.");
if (nameParts.length > 1) {
final String extension = nameParts[(nameParts.length - 1)].toLowerCase();
@@ -209,10 +209,10 @@ public abstract class cgFileList<T extends ArrayAdapter<File>> extends AbstractL
}
list.add(listPre[i]); // add file to list
- } else if (listPre[i].canRead() == true && listPre[i].isDirectory() == true) {
+ } else if (listPre[i].canRead() && listPre[i].isDirectory()) {
final Message msg = new Message();
String name = listPre[i].getName();
- if (name.substring(0, 1).equals(".") == true) {
+ if (name.substring(0, 1).equals(".")) {
continue; // skip hidden directories
}
if (name.length() > 16) {
diff --git a/src/cgeo/geocaching/cgGPXParser.java b/src/cgeo/geocaching/cgGPXParser.java
index fcb0c95..c8c013f 100644
--- a/src/cgeo/geocaching/cgGPXParser.java
+++ b/src/cgeo/geocaching/cgGPXParser.java
@@ -187,7 +187,7 @@ public class cgGPXParser {
final String content = Html.fromHtml(body).toString().trim();
cache.name = content;
- if (cache.name.length() > 2 && cache.name.substring(0, 2).equalsIgnoreCase("GC") == true) {
+ if (cache.name.length() > 2 && cache.name.substring(0, 2).equalsIgnoreCase("GC")) {
cache.geocode = cache.name.toUpperCase();
}
}
@@ -514,7 +514,7 @@ public class cgGPXParser {
public void end(String body) {
final String content = body.trim().toLowerCase();
- if (cgBase.logTypes0.containsKey(content) == true) {
+ if (cgBase.logTypes0.containsKey(content)) {
log.type = cgBase.logTypes0.get(content);
} else {
log.type = 4;
diff --git a/src/cgeo/geocaching/cgGeo.java b/src/cgeo/geocaching/cgGeo.java
index 407ca40..4ae2e32 100644
--- a/src/cgeo/geocaching/cgGeo.java
+++ b/src/cgeo/geocaching/cgGeo.java
@@ -61,7 +61,7 @@ public class cgGeo {
prefs = context.getSharedPreferences(cgSettings.preferences, 0);
}
distanceNow = prefs.getFloat("dst", 0f);
- if (Double.isNaN(distanceNow) == true) {
+ if (Double.isNaN(distanceNow)) {
distanceNow = 0d;
}
if (distanceNow == 0f) {
@@ -153,10 +153,10 @@ public class cgGeo {
@Override
public void onLocationChanged(Location location) {
- if (location.getProvider().equals(LocationManager.GPS_PROVIDER) == true) {
+ if (location.getProvider().equals(LocationManager.GPS_PROVIDER)) {
locGps = location;
locGpsLast = System.currentTimeMillis();
- } else if (location.getProvider().equals(LocationManager.NETWORK_PROVIDER) == true) {
+ } else if (location.getProvider().equals(LocationManager.NETWORK_PROVIDER)) {
locNet = location;
}
@@ -165,11 +165,11 @@ public class cgGeo {
@Override
public void onProviderDisabled(String provider) {
- if (provider.equals(LocationManager.NETWORK_PROVIDER) == true) {
+ if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
if (geoManager != null && geoNetListener != null) {
geoManager.removeUpdates(geoNetListener);
}
- } else if (provider.equals(LocationManager.GPS_PROVIDER) == true) {
+ } else if (provider.equals(LocationManager.GPS_PROVIDER)) {
if (geoManager != null && geoGpsListener != null) {
geoManager.removeUpdates(geoGpsListener);
}
@@ -178,12 +178,12 @@ public class cgGeo {
@Override
public void onProviderEnabled(String provider) {
- if (provider.equals(LocationManager.NETWORK_PROVIDER) == true) {
+ if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
if (geoNetListener == null) {
geoNetListener = new cgeoGeoListener();
}
geoNetListener.setProvider(LocationManager.NETWORK_PROVIDER);
- } else if (provider.equals(LocationManager.GPS_PROVIDER) == true) {
+ } else if (provider.equals(LocationManager.GPS_PROVIDER)) {
if (geoGpsListener == null) {
geoGpsListener = new cgeoGeoListener();
}
@@ -192,14 +192,14 @@ public class cgGeo {
}
public void setProvider(String provider) {
- if (provider.equals(LocationManager.GPS_PROVIDER) == true) {
- if (geoManager != null && geoManager.isProviderEnabled(LocationManager.GPS_PROVIDER) == true) {
+ if (provider.equals(LocationManager.GPS_PROVIDER)) {
+ if (geoManager != null && geoManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
active = provider;
} else {
active = null;
}
- } else if (provider.equals(LocationManager.NETWORK_PROVIDER) == true) {
- if (geoManager != null && geoManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER) == true) {
+ } else if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
+ if (geoManager != null && geoManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
active = provider;
} else {
active = null;
@@ -221,7 +221,7 @@ public class cgGeo {
while (statusIterator.hasNext()) {
GpsSatellite sat = statusIterator.next();
- if (sat.usedInFix() == true) {
+ if (sat.usedInFix()) {
fixed++;
}
satellites++;
@@ -245,7 +245,7 @@ public class cgGeo {
changed = true;
}
- if (changed == true) {
+ if (changed) {
selectBest(null);
}
}
@@ -268,7 +268,7 @@ public class cgGeo {
return;
}
- if (initProvider != null && initProvider.equals(LocationManager.GPS_PROVIDER) == true) { // we have new location from GPS
+ if (initProvider != null && initProvider.equals(LocationManager.GPS_PROVIDER)) { // we have new location from GPS
assign(locGps);
return;
}
@@ -308,11 +308,11 @@ public class cgGeo {
location = loc;
String provider = location.getProvider();
- if (provider.equals(LocationManager.GPS_PROVIDER) == true) {
+ if (provider.equals(LocationManager.GPS_PROVIDER)) {
gps = 1;
- } else if (provider.equals(LocationManager.NETWORK_PROVIDER) == true) {
+ } else if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
gps = 0;
- } else if (provider.equals("last") == true) {
+ } else if (provider.equals("last")) {
gps = -1;
}
@@ -375,7 +375,7 @@ public class cgGeo {
@Override
public void run() {
- if (g4cRunning == true) {
+ if (g4cRunning) {
return;
}
diff --git a/src/cgeo/geocaching/cgHtmlImg.java b/src/cgeo/geocaching/cgHtmlImg.java
index f3e9f20..e6e5a2e 100644
--- a/src/cgeo/geocaching/cgHtmlImg.java
+++ b/src/cgeo/geocaching/cgHtmlImg.java
@@ -109,7 +109,7 @@ public class cgHtmlImg implements Html.ImageGetter {
final Date now = new Date();
final File file = new File(fileName);
- if (file.exists() == true) {
+ if (file.exists()) {
final long imageSize = file.length();
// large images will be downscaled on input to save memory
@@ -132,7 +132,7 @@ public class cgHtmlImg implements Html.ImageGetter {
if (imagePre == null) {
final File fileSec = new File(fileNameSec);
- if (fileSec.exists() == true) {
+ if (fileSec.exists()) {
final long imageSize = fileSec.length();
// large images will be downscaled on input to save memory
@@ -159,7 +159,7 @@ public class cgHtmlImg implements Html.ImageGetter {
}
// download image and save it to the cache
- if ((imagePre == null && reason == 0) || onlySave == true) {
+ if ((imagePre == null && reason == 0) || onlySave) {
Uri uri = null;
HttpClient client = null;
HttpGet getMethod = null;
@@ -218,7 +218,7 @@ public class cgHtmlImg implements Html.ImageGetter {
}
}
- if (save == true) {
+ if (save) {
try {
// save to memory/SD cache
if (bufferedEntity != null) {
@@ -247,7 +247,7 @@ public class cgHtmlImg implements Html.ImageGetter {
bufferedEntity = null;
}
- if (onlySave == true) {
+ if (onlySave) {
return null;
}
diff --git a/src/cgeo/geocaching/cgMapImg.java b/src/cgeo/geocaching/cgMapImg.java
index 1ab8cdb..769e997 100644
--- a/src/cgeo/geocaching/cgMapImg.java
+++ b/src/cgeo/geocaching/cgMapImg.java
@@ -103,7 +103,7 @@ public class cgMapImg {
}
}
- if (ok == true) {
+ if (ok) {
break;
}
} catch (Exception e) {
diff --git a/src/cgeo/geocaching/cgOAuth.java b/src/cgeo/geocaching/cgOAuth.java
index 8897993..4cb9cfb 100644
--- a/src/cgeo/geocaching/cgOAuth.java
+++ b/src/cgeo/geocaching/cgOAuth.java
@@ -42,7 +42,7 @@ public class cgOAuth {
String requestPacked;
keysPacked = cgSettings.keyConsumerSecret + "&" + tokenSecret; // both even if empty some of them!
- if (https == true) requestPacked = method + "&" + cgBase.urlencode_rfc3986("https://" + host + path) + "&" + cgBase.urlencode_rfc3986(cgBase.implode("&", paramsEncoded.toArray()));
+ if (https) requestPacked = method + "&" + cgBase.urlencode_rfc3986("https://" + host + path) + "&" + cgBase.urlencode_rfc3986(cgBase.implode("&", paramsEncoded.toArray()));
else requestPacked = method + "&" + cgBase.urlencode_rfc3986("http://" + host + path) + "&" + cgBase.urlencode_rfc3986(cgBase.implode("&", paramsEncoded.toArray()));
paramsEncoded.add("oauth_signature=" + cgBase.urlencode_rfc3986(cgBase.base64Encode(cgBase.hashHmac(requestPacked, keysPacked))));
diff --git a/src/cgeo/geocaching/cgeo.java b/src/cgeo/geocaching/cgeo.java
index 790d5cc..3a509db 100644
--- a/src/cgeo/geocaching/cgeo.java
+++ b/src/cgeo/geocaching/cgeo.java
@@ -337,7 +337,7 @@ public class cgeo extends AbstractActivity {
}
private void init() {
- if (initialized == true) {
+ if (initialized) {
return;
}
@@ -346,7 +346,7 @@ public class cgeo extends AbstractActivity {
settings.getLogin();
settings.reloadCacheType();
- if (app.firstRun == true) {
+ if (app.firstRun) {
new Thread() {
@Override
@@ -577,7 +577,7 @@ public class cgeo extends AbstractActivity {
if (app == null) {
return;
}
- if (cleanupRunning == true) {
+ if (cleanupRunning) {
return;
}
@@ -611,7 +611,7 @@ public class cgeo extends AbstractActivity {
if (geo == null) {
return;
}
- if (addressObtaining == true) {
+ if (addressObtaining) {
return;
}
addressObtaining = true;
diff --git a/src/cgeo/geocaching/cgeoapplication.java b/src/cgeo/geocaching/cgeoapplication.java
index 2560728..0e3750a 100644
--- a/src/cgeo/geocaching/cgeoapplication.java
+++ b/src/cgeo/geocaching/cgeoapplication.java
@@ -185,7 +185,7 @@ public class cgeoapplication extends Application {
}
public void cleanDatabase(boolean more) {
- if (databaseCleaned == true) {
+ if (databaseCleaned) {
return;
}
@@ -343,7 +343,7 @@ public class cgeoapplication extends Application {
}
cgCache cache = null;
- if (cachesCache.containsKey(geocode) == true) {
+ if (cachesCache.containsKey(geocode)) {
cache = cachesCache.get(geocode);
} else {
if (storage == null) {
@@ -351,7 +351,7 @@ public class cgeoapplication extends Application {
}
cache = storage.loadCache(geocode, null, loadA, loadW, loadS, loadL, loadI, loadO);
- if (cache != null && cache.detailed == true && loadA == true && loadW == true && loadS == true && loadL == true && loadI == true) {
+ if (cache != null && cache.detailed && loadA && loadW && loadS && loadL && loadI) {
putCacheInCache(cache);
}
}
@@ -371,7 +371,7 @@ public class cgeoapplication extends Application {
}
public void removeCacheFromCache(String geocode) {
- if (geocode != null && cachesCache.containsKey(geocode) == true) {
+ if (geocode != null && cachesCache.containsKey(geocode)) {
cachesCache.remove(geocode);
}
}
@@ -381,7 +381,7 @@ public class cgeoapplication extends Application {
return;
}
- if (cachesCache.containsKey(cache.geocode) == true) {
+ if (cachesCache.containsKey(cache.geocode)) {
cachesCache.remove(cache.geocode);
}
@@ -750,7 +750,7 @@ public class cgeoapplication extends Application {
status = storage.saveCache(mergedCache);
}
- if (status == true) {
+ if (status) {
search.addGeocode(cache.geocode);
}
diff --git a/src/cgeo/geocaching/cgeoauth.java b/src/cgeo/geocaching/cgeoauth.java
index 8f1aa01..505c10f 100644
--- a/src/cgeo/geocaching/cgeoauth.java
+++ b/src/cgeo/geocaching/cgeoauth.java
@@ -41,7 +41,7 @@ public class cgeoauth extends AbstractActivity {
@Override
public void handleMessage(Message msg) {
- if (requestTokenDialog != null && requestTokenDialog.isShowing() == true) {
+ if (requestTokenDialog != null && requestTokenDialog.isShowing()) {
requestTokenDialog.dismiss();
}
@@ -64,7 +64,7 @@ public class cgeoauth extends AbstractActivity {
@Override
public void handleMessage(Message msg) {
- if (changeTokensDialog != null && changeTokensDialog.isShowing() == true) {
+ if (changeTokensDialog != null && changeTokensDialog.isShowing()) {
changeTokensDialog.dismiss();
}
@@ -187,11 +187,11 @@ public class cgeoauth extends AbstractActivity {
if (line != null && line.length() > 0) {
final Matcher paramsMatcher1 = paramsPattern1.matcher(line);
- if (paramsMatcher1.find() == true && paramsMatcher1.groupCount() > 0) {
+ if (paramsMatcher1.find() && paramsMatcher1.groupCount() > 0) {
OAtoken = paramsMatcher1.group(1).toString();
}
final Matcher paramsMatcher2 = paramsPattern2.matcher(line);
- if (paramsMatcher2.find() == true && paramsMatcher2.groupCount() > 0) {
+ if (paramsMatcher2.find() && paramsMatcher2.groupCount() > 0) {
OAtokenSecret = paramsMatcher2.group(1).toString();
}
@@ -295,11 +295,11 @@ public class cgeoauth extends AbstractActivity {
OAtokenSecret = "";
final Matcher paramsMatcher1 = paramsPattern1.matcher(line);
- if (paramsMatcher1.find() == true && paramsMatcher1.groupCount() > 0) {
+ if (paramsMatcher1.find() && paramsMatcher1.groupCount() > 0) {
OAtoken = paramsMatcher1.group(1).toString();
}
final Matcher paramsMatcher2 = paramsPattern2.matcher(line);
- if (paramsMatcher2.find() == true && paramsMatcher2.groupCount() > 0) {
+ if (paramsMatcher2.find() && paramsMatcher2.groupCount() > 0) {
OAtokenSecret = paramsMatcher2.group(1).toString();
}
diff --git a/src/cgeo/geocaching/cgeocaches.java b/src/cgeo/geocaching/cgeocaches.java
index 9e2f2f3..f5e4144 100644
--- a/src/cgeo/geocaching/cgeocaches.java
+++ b/src/cgeo/geocaching/cgeocaches.java
@@ -193,7 +193,7 @@ public class cgeocaches extends AbstractListActivity {
}
}
- if (cacheList != null && app.getError(searchId) != null && app.getError(searchId).equalsIgnoreCase(cgBase.errorRetrieve.get(-7)) == true) {
+ if (cacheList != null && app.getError(searchId) != null && app.getError(searchId).equalsIgnoreCase(cgBase.errorRetrieve.get(-7))) {
AlertDialog.Builder dialog = new AlertDialog.Builder(cgeocaches.this);
dialog.setTitle(res.getString(R.string.license));
dialog.setMessage(res.getString(R.string.err_license));
@@ -551,7 +551,7 @@ public class cgeocaches extends AbstractListActivity {
Thread threadPure;
cgSearchThread thread;
- if (type.equals("offline") == true) {
+ if (type.equals("offline")) {
listId = settings.getLastList();
if (listId <= 0) {
listId = 1;
@@ -567,7 +567,7 @@ public class cgeocaches extends AbstractListActivity {
threadPure = new geocachesLoadByOffline(loadCachesHandler, latitude, longitude, listId);
threadPure.start();
- } else if (type.equals("history") == true) {
+ } else if (type.equals("history")) {
if (adapter != null) {
adapter.setHistoric(true);
}
@@ -579,7 +579,7 @@ public class cgeocaches extends AbstractListActivity {
threadPure = new geocachesLoadByHistory(loadCachesHandler);
threadPure.start();
- } else if (type.equals("nearest") == true) {
+ } else if (type.equals("nearest")) {
action = "pending";
title = res.getString(R.string.caches_nearby);
setTitle(title);
@@ -589,7 +589,7 @@ public class cgeocaches extends AbstractListActivity {
thread = new geocachesLoadByCoords(loadCachesHandler, latitude, longitude, cachetype);
thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread));
thread.start();
- } else if (type.equals("coordinate") == true) {
+ } else if (type.equals("coordinate")) {
action = "planning";
title = cgBase.formatCoordinate(latitude, res.getString(R.string.search_lat), true) + " | " + cgBase.formatCoordinate(longitude, res.getString(R.string.search_lon), true);
setTitle(title);
@@ -599,7 +599,7 @@ public class cgeocaches extends AbstractListActivity {
thread = new geocachesLoadByCoords(loadCachesHandler, latitude, longitude, cachetype);
thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread));
thread.start();
- } else if (type.equals("keyword") == true) {
+ } else if (type.equals("keyword")) {
title = keyword;
setTitle(title);
showProgress(true);
@@ -608,7 +608,7 @@ public class cgeocaches extends AbstractListActivity {
thread = new geocachesLoadByKeyword(loadCachesHandler, keyword, cachetype);
thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread));
thread.start();
- } else if (type.equals("address") == true) {
+ } else if (type.equals("address")) {
action = "planning";
if (address != null && address.length() > 0) {
title = address;
@@ -625,7 +625,7 @@ public class cgeocaches extends AbstractListActivity {
thread = new geocachesLoadByCoords(loadCachesHandler, latitude, longitude, cachetype);
thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread));
thread.start();
- } else if (type.equals("username") == true) {
+ } else if (type.equals("username")) {
title = username;
setTitle(title);
showProgress(true);
@@ -634,7 +634,7 @@ public class cgeocaches extends AbstractListActivity {
thread = new geocachesLoadByUserName(loadCachesHandler, username, cachetype);
thread.setRecaptchaHandler(new cgSearchHandler(this, res, thread));
thread.start();
- } else if (type.equals("owner") == true) {
+ } else if (type.equals("owner")) {
title = username;
setTitle(title);
showProgress(true);
@@ -797,7 +797,7 @@ public class cgeocaches extends AbstractListActivity {
super.onPrepareOptionsMenu(menu);
try {
- if (adapter != null && adapter.getSelectMode() == true) {
+ if (adapter != null && adapter.getSelectMode()) {
menu.findItem(MENU_SWITCH_SELECT_MODE).setTitle(res.getString(R.string.caches_select_mode_exit));
menu.findItem(MENU_INVERT_SELECTION).setVisible(true);
} else {
@@ -805,7 +805,7 @@ public class cgeocaches extends AbstractListActivity {
menu.findItem(MENU_INVERT_SELECTION).setVisible(false);
}
- if (type != null && type.equals("offline") == true) { // only offline list
+ if (type != null && type.equals("offline")) { // only offline list
if (adapter != null && adapter.getChecked() > 0) {
menu.findItem(MENU_DROP_CACHES).setTitle(res.getString(R.string.caches_drop_selected) + " (" + adapter.getChecked() + ")");
} else {
@@ -1224,9 +1224,9 @@ public class cgeocaches extends AbstractListActivity {
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (adapter != null) {
- if (adapter.resetChecks() == true) {
+ if (adapter.resetChecks()) {
return true;
- } else if (adapter.getSelectMode() == true) {
+ } else if (adapter.getSelectMode()) {
adapter.setSelectMode(false, true);
return true;
}
@@ -1906,7 +1906,7 @@ public class cgeocaches extends AbstractListActivity {
}
try {
- if (needToStop == true) {
+ if (needToStop) {
Log.i(cgSettings.tag, "Stopped storing process.");
break;
}
@@ -1925,7 +1925,7 @@ public class cgeocaches extends AbstractListActivity {
}
}
- if (needToStop == true) {
+ if (needToStop) {
Log.i(cgSettings.tag, "Stopped storing process.");
break;
}
@@ -2080,7 +2080,7 @@ public class cgeocaches extends AbstractListActivity {
}
try {
- if (needToStop == true) {
+ if (needToStop) {
Log.i(cgSettings.tag, "Stopped dropping process.");
break;
}
@@ -2131,7 +2131,7 @@ public class cgeocaches extends AbstractListActivity {
}
try {
- if (needToStop == true) {
+ if (needToStop) {
Log.i(cgSettings.tag, "Stopped removing process.");
break;
}
@@ -2201,7 +2201,7 @@ public class cgeocaches extends AbstractListActivity {
}
try {
- if (needToStop == true)
+ if (needToStop)
{
Log.i(cgSettings.tag, "Stopped exporting process.");
break;
@@ -2382,7 +2382,7 @@ public class cgeocaches extends AbstractListActivity {
if (checked > 0) {
final ArrayList<cgCache> cacheListTemp = new ArrayList<cgCache>(cacheList);
for (cgCache cache : cacheListTemp) {
- if (cache.statusChecked != false) {
+ if (cache.statusChecked) {
app.moveToList(cache.geocode, listId);
}
}
@@ -2454,7 +2454,7 @@ public class cgeocaches extends AbstractListActivity {
}
public void goMap(View view) {
- if (searchId == null || searchId == 0 || cacheList == null || cacheList.isEmpty() == true) {
+ if (searchId == null || searchId == 0 || cacheList == null || cacheList.isEmpty()) {
showToast(res.getString(R.string.warn_no_cache_coord));
return;
@@ -2468,9 +2468,9 @@ public class cgeocaches extends AbstractListActivity {
}
public void goManual(View view) {
- if (type != null && type.equals("offline") == true) {
+ if (type != null && type.equals("offline")) {
ActivityMixin.goManual(this, "c:geo-stored");
- } else if (type != null && type.equals("history") == true) {
+ } else if (type != null && type.equals("history")) {
ActivityMixin.goManual(this, "c:geo-history");
} else {
ActivityMixin.goManual(this, "c:geo-nearby");
diff --git a/src/cgeo/geocaching/cgeodetail.java b/src/cgeo/geocaching/cgeodetail.java
index c9d60b0..dae8511 100644
--- a/src/cgeo/geocaching/cgeodetail.java
+++ b/src/cgeo/geocaching/cgeodetail.java
@@ -294,7 +294,7 @@ public class cgeodetail extends AbstractActivity {
Log.i(cgSettings.tag, "Opening URI: " + uriHost + uriPath);
}
- if (uriHost.contains("geocaching.com") == true) {
+ if (uriHost.contains("geocaching.com")) {
geocode = uri.getQueryParameter("wp");
guid = uri.getQueryParameter("guid");
@@ -309,8 +309,8 @@ public class cgeodetail extends AbstractActivity {
finish();
return;
}
- } else if (uriHost.contains("coord.info") == true) {
- if (uriPath != null && uriPath.startsWith("/gc") == true) {
+ } else if (uriHost.contains("coord.info")) {
+ if (uriPath != null && uriPath.startsWith("/gc")) {
geocode = uriPath.substring(1).toUpperCase();
} else {
showToast(res.getString(R.string.err_detail_open));
@@ -469,7 +469,7 @@ public class cgeodetail extends AbstractActivity {
if (cache != null && cache.canBeAddedToCalendar()) {
menu.add(1, 11, 0, res.getString(R.string.cache_menu_event)).setIcon(android.R.drawable.ic_menu_agenda); // add event to calendar
}
- if (settings.isLogin() == true) {
+ if (settings.isLogin()) {
menu.add(1, 3, 0, res.getString(R.string.cache_menu_visit)).setIcon(android.R.drawable.ic_menu_agenda); // log visit
}
@@ -604,7 +604,7 @@ public class cgeodetail extends AbstractActivity {
// actionbar icon, default myster<
String typeId = "mystery";
- if (cache.type != null && gcIcons.containsKey(cache.type) == true) { // cache icon
+ if (cache.type != null && gcIcons.containsKey(cache.type)) { // cache icon
typeId = cache.type;
}
((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds((Drawable) getResources().getDrawable(gcIcons.get(typeId)), null, null, null);
@@ -632,7 +632,7 @@ public class cgeodetail extends AbstractActivity {
size = "";
}
- if (cgBase.cacheTypesInv.containsKey(cache.type) == true) { // cache icon
+ if (cgBase.cacheTypesInv.containsKey(cache.type)) { // cache icon
itemValue.setText(cgBase.cacheTypesInv.get(cache.type) + size);
} else {
itemValue.setText(cgBase.cacheTypesInv.get("mystery") + size);
@@ -649,7 +649,7 @@ public class cgeodetail extends AbstractActivity {
detailsList.addView(itemLayout);
// cache state
- if (cache.logOffline == true || cache.archived == true || cache.disabled == true || cache.members == true || cache.found == true) {
+ if (cache.logOffline || cache.archived || cache.disabled || cache.members || cache.found) {
itemLayout = (RelativeLayout) inflater.inflate(R.layout.cache_item, null);
itemName = (TextView) itemLayout.findViewById(R.id.name);
itemValue = (TextView) itemLayout.findViewById(R.id.value);
@@ -657,31 +657,31 @@ public class cgeodetail extends AbstractActivity {
itemName.setText(res.getString(R.string.cache_status));
StringBuilder state = new StringBuilder();
- if (cache.logOffline == true) {
+ if (cache.logOffline) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_offline_log));
}
- if (cache.found == true) {
+ if (cache.found) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_found));
}
- if (cache.archived == true) {
+ if (cache.archived) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_archived));
}
- if (cache.disabled == true) {
+ if (cache.disabled) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_disabled));
}
- if (cache.members == true) {
+ if (cache.members) {
if (state.length() > 0) {
state.append(", ");
}
@@ -761,7 +761,7 @@ public class cgeodetail extends AbstractActivity {
itemName = (TextView) itemLayout.findViewById(R.id.name);
itemValue = (TextView) itemLayout.findViewById(R.id.value);
- if (cache.type != null && (cache.type.equalsIgnoreCase("event") == true || cache.type.equalsIgnoreCase("mega") == true || cache.type.equalsIgnoreCase("cito") == true)) {
+ if (cache.type != null && (cache.type.equalsIgnoreCase("event") || cache.type.equalsIgnoreCase("mega") || cache.type.equalsIgnoreCase("cito"))) {
itemName.setText(res.getString(R.string.cache_event));
} else {
itemName.setText(res.getString(R.string.cache_hidden));
@@ -907,7 +907,7 @@ public class cgeodetail extends AbstractActivity {
}
// cache long desc
- if (longDescDisplayed == true) {
+ if (longDescDisplayed) {
if (longDesc == null && cache != null && cache.description != null) {
longDesc = Html.fromHtml(cache.description.trim(), new cgHtmlImg(this, geocode, true, cache.reason, false), null);
}
@@ -1139,7 +1139,7 @@ public class cgeodetail extends AbstractActivity {
((TextView) rowView.findViewById(R.id.added)).setText(base.formatShortDate(log.date));
}
- if (cgBase.logTypes1.containsKey(log.type) == true) {
+ if (cgBase.logTypes1.containsKey(log.type)) {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(log.type));
} else {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(4)); // note if type is unknown
@@ -1419,7 +1419,7 @@ public class cgeodetail extends AbstractActivity {
if (calId > 0 && calName != null) {
calendars.put(calId, calName);
}
- } while (cursor.moveToNext() == true);
+ } while (cursor.moveToNext());
}
}
@@ -1437,7 +1437,7 @@ public class cgeodetail extends AbstractActivity {
}
private void addToCalendarFn(int index) {
- if (calendars == null || calendars.isEmpty() == true) {
+ if (calendars == null || calendars.isEmpty()) {
return;
}
@@ -1577,7 +1577,7 @@ public class cgeodetail extends AbstractActivity {
}
private void showSpoilers() {
- if (cache == null || cache.spoilers == null || cache.spoilers.isEmpty() == true) {
+ if (cache == null || cache.spoilers == null || cache.spoilers.isEmpty()) {
showToast(res.getString(R.string.err_detail_no_spoiler));
}
@@ -1654,11 +1654,11 @@ public class cgeodetail extends AbstractActivity {
private class storeCache implements View.OnClickListener {
public void onClick(View arg0) {
- if (dropDialog != null && dropDialog.isShowing() == true) {
+ if (dropDialog != null && dropDialog.isShowing()) {
showToast(res.getString(R.string.err_detail_still_removing));
return;
}
- if (refreshDialog != null && refreshDialog.isShowing() == true) {
+ if (refreshDialog != null && refreshDialog.isShowing()) {
showToast(res.getString(R.string.err_detail_still_refreshing));
return;
}
@@ -1677,11 +1677,11 @@ public class cgeodetail extends AbstractActivity {
private class refreshCache implements View.OnClickListener {
public void onClick(View arg0) {
- if (dropDialog != null && dropDialog.isShowing() == true) {
+ if (dropDialog != null && dropDialog.isShowing()) {
showToast(res.getString(R.string.err_detail_still_removing));
return;
}
- if (storeDialog != null && storeDialog.isShowing() == true) {
+ if (storeDialog != null && storeDialog.isShowing()) {
showToast(res.getString(R.string.err_detail_still_saving));
return;
}
@@ -1736,11 +1736,11 @@ public class cgeodetail extends AbstractActivity {
private class dropCache implements View.OnClickListener {
public void onClick(View arg0) {
- if (storeDialog != null && storeDialog.isShowing() == true) {
+ if (storeDialog != null && storeDialog.isShowing()) {
showToast(res.getString(R.string.err_detail_still_saving));
return;
}
- if (refreshDialog != null && refreshDialog.isShowing() == true) {
+ if (refreshDialog != null && refreshDialog.isShowing()) {
showToast(res.getString(R.string.err_detail_still_refreshing));
return;
}
@@ -1771,7 +1771,7 @@ public class cgeodetail extends AbstractActivity {
*/
private abstract class AbstractWatchlistClickListener implements View.OnClickListener {
public void doExecute(int titleId, int messageId, Thread thread) {
- if (watchlistDialog != null && watchlistDialog.isShowing() == true) {
+ if (watchlistDialog != null && watchlistDialog.isShowing()) {
showToast(res.getString(R.string.err_watchlist_still_managing));
return;
}
diff --git a/src/cgeo/geocaching/cgeoimages.java b/src/cgeo/geocaching/cgeoimages.java
index 09dd637..ff55b5c 100644
--- a/src/cgeo/geocaching/cgeoimages.java
+++ b/src/cgeo/geocaching/cgeoimages.java
@@ -69,7 +69,7 @@ public class cgeoimages extends AbstractActivity {
waitDialog.dismiss();
}
- if (app.isOffline(geocode, null) == true) {
+ if (app.isOffline(geocode, null)) {
offline = 1;
if ((img_type == LOG_IMAGE) && (settings.storelogimages == false)) {
offline = 0;
@@ -184,7 +184,7 @@ public class cgeoimages extends AbstractActivity {
break;
case LOG_IMAGE:
load_process_string = res.getString(R.string.cache_log_images_loading);
- if (settings.storelogimages == true) {
+ if (settings.storelogimages) {
save = true;
} else {
save = false;
diff --git a/src/cgeo/geocaching/cgeoinit.java b/src/cgeo/geocaching/cgeoinit.java
index 2a7c988..81b7144 100644
--- a/src/cgeo/geocaching/cgeoinit.java
+++ b/src/cgeo/geocaching/cgeoinit.java
@@ -36,14 +36,14 @@ public class cgeoinit extends AbstractActivity {
@Override
public void handleMessage(Message msg) {
try {
- if (loginDialog != null && loginDialog.isShowing() == true) {
+ if (loginDialog != null && loginDialog.isShowing()) {
loginDialog.dismiss();
}
if (msg.what == 1) {
helpDialog(res.getString(R.string.init_login_popup), res.getString(R.string.init_login_popup_ok));
} else {
- if (cgBase.errorRetrieve.containsKey(msg.what) == true) {
+ if (cgBase.errorRetrieve.containsKey(msg.what)) {
helpDialog(res.getString(R.string.init_login_popup),
res.getString(R.string.init_login_popup_failed_reason) + " " + cgBase.errorRetrieve.get(msg.what) + ".");
} else {
@@ -56,7 +56,7 @@ public class cgeoinit extends AbstractActivity {
Log.e(cgSettings.tag, "cgeoinit.logInHandler: " + e.toString());
}
- if (loginDialog != null && loginDialog.isShowing() == true) {
+ if (loginDialog != null && loginDialog.isShowing()) {
loginDialog.dismiss();
}
@@ -69,7 +69,7 @@ public class cgeoinit extends AbstractActivity {
@Override
public void handleMessage(Message msg) {
try {
- if (webDialog != null && webDialog.isShowing() == true) {
+ if (webDialog != null && webDialog.isShowing()) {
webDialog.dismiss();
}
@@ -84,7 +84,7 @@ public class cgeoinit extends AbstractActivity {
Log.e(cgSettings.tag, "cgeoinit.webHandler: " + e.toString());
}
- if (webDialog != null && webDialog.isShowing() == true) {
+ if (webDialog != null && webDialog.isShowing()) {
webDialog.dismiss();
}
@@ -159,7 +159,7 @@ public class cgeoinit extends AbstractActivity {
((EditText) findViewById(R.id.passvote)).setText("");
status = saveValues();
- if (status == true) {
+ if (status) {
showToast(res.getString(R.string.init_cleared));
} else {
showToast(res.getString(R.string.err_init_cleared));
@@ -508,7 +508,7 @@ public class cgeoinit extends AbstractActivity {
public void onClick(View arg0) {
CheckBox twitterButton = (CheckBox) findViewById(R.id.twitter_option);
- if (twitterButton.isChecked() == true) {
+ if (twitterButton.isChecked()) {
settings.reloadTwitterTokens();
SharedPreferences.Editor edit = prefs.edit();
diff --git a/src/cgeo/geocaching/cgeopoint.java b/src/cgeo/geocaching/cgeopoint.java
index 40ceaf8..4ef0213 100644
--- a/src/cgeo/geocaching/cgeopoint.java
+++ b/src/cgeo/geocaching/cgeopoint.java
@@ -260,7 +260,7 @@ public class cgeopoint extends AbstractActivity {
}
});
- if (prefs.contains("anylatitude") == true && prefs.contains("anylongitude") == true) {
+ if (prefs.contains("anylatitude") && prefs.contains("anylongitude")) {
latitudeEdit.setText(cgBase.formatCoordinate(Double.valueOf(prefs.getFloat("anylatitude", 0f)), "lat", true));
longitudeEdit.setText(cgBase.formatCoordinate(Double.valueOf(prefs.getFloat("anylongitude", 0f)), "lon", true));
}
@@ -543,15 +543,15 @@ public class cgeopoint extends AbstractActivity {
Matcher matcherD = patternD.matcher(distanceText);
Matcher matcherE = patternE.matcher(distanceText);
- if (matcherA.find() == true && matcherA.groupCount() > 0) {
+ if (matcherA.find() && matcherA.groupCount() > 0) {
distance = (new Double(matcherA.group(1))) * 0.001;
- } else if (matcherB.find() == true && matcherB.groupCount() > 0) {
+ } else if (matcherB.find() && matcherB.groupCount() > 0) {
distance = new Double(matcherB.group(1));
- } else if (matcherC.find() == true && matcherC.groupCount() > 0) {
+ } else if (matcherC.find() && matcherC.groupCount() > 0) {
distance = (new Double(matcherC.group(1))) * 0.0003048;
- } else if (matcherD.find() == true && matcherD.groupCount() > 0) {
+ } else if (matcherD.find() && matcherD.groupCount() > 0) {
distance = (new Double(matcherD.group(1))) * 0.0009144;
- } else if (matcherE.find() == true && matcherE.groupCount() > 0) {
+ } else if (matcherE.find() && matcherE.groupCount() > 0) {
distance = (new Double(matcherE.group(1))) * 1.609344;
} else {
try {
@@ -598,7 +598,7 @@ public class cgeopoint extends AbstractActivity {
}
private void saveCoords(Double latitude, Double longitude) {
- if (changed == true && latitude == null || longitude == null) {
+ if (changed && latitude == null || longitude == null) {
SharedPreferences.Editor edit = prefs.edit();
edit.putFloat("anylatitude", latitude.floatValue());
diff --git a/src/cgeo/geocaching/cgeopopup.java b/src/cgeo/geocaching/cgeopopup.java
index aaaf130..868cc9a 100644
--- a/src/cgeo/geocaching/cgeopopup.java
+++ b/src/cgeo/geocaching/cgeopopup.java
@@ -156,7 +156,7 @@ public class cgeopopup extends AbstractActivity {
menu.findItem(5).setVisible(false);
}
- if (fromDetail == false && settings.isLogin() == true) {
+ if (fromDetail == false && settings.isLogin()) {
menu.findItem(6).setEnabled(true);
} else {
menu.findItem(6).setEnabled(false);
@@ -254,7 +254,7 @@ public class cgeopopup extends AbstractActivity {
detailsList.removeAllViews();
// actionbar icon
- if (cache.type != null && gcIcons.containsKey(cache.type) == true) { // cache icon
+ if (cache.type != null && gcIcons.containsKey(cache.type)) { // cache icon
((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds((Drawable) getResources().getDrawable(gcIcons.get(cache.type)), null, null, null);
} else { // unknown cache type, "mystery" icon
((TextView) findViewById(R.id.actionbar_title)).setCompoundDrawablesWithIntrinsicBounds((Drawable) getResources().getDrawable(gcIcons.get("mystery")), null, null, null);
@@ -266,7 +266,7 @@ public class cgeopopup extends AbstractActivity {
itemValue = (TextView) itemLayout.findViewById(R.id.value);
itemName.setText(res.getString(R.string.cache_type));
- if (cgBase.cacheTypesInv.containsKey(cache.type) == true) { // cache icon
+ if (cgBase.cacheTypesInv.containsKey(cache.type)) { // cache icon
if (cache.size != null && cache.size.length() > 0) {
itemValue.setText(cgBase.cacheTypesInv.get(cache.type) + " (" + cache.size + ")");
} else {
@@ -291,7 +291,7 @@ public class cgeopopup extends AbstractActivity {
detailsList.addView(itemLayout);
// cache state
- if (cache.archived == true || cache.disabled == true || cache.members == true || cache.found == true) {
+ if (cache.archived || cache.disabled || cache.members || cache.found) {
itemLayout = (RelativeLayout) inflater.inflate(R.layout.cache_item, null);
itemName = (TextView) itemLayout.findViewById(R.id.name);
itemValue = (TextView) itemLayout.findViewById(R.id.value);
@@ -299,25 +299,25 @@ public class cgeopopup extends AbstractActivity {
itemName.setText(res.getString(R.string.cache_status));
StringBuilder state = new StringBuilder();
- if (cache.found == true) {
+ if (cache.found) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_found));
}
- if (cache.archived == true) {
+ if (cache.archived) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_archived));
}
- if (cache.disabled == true) {
+ if (cache.disabled) {
if (state.length() > 0) {
state.append(", ");
}
state.append(res.getString(R.string.cache_status_disabled));
}
- if (cache.members == true) {
+ if (cache.members) {
if (state.length() > 0) {
state.append(", ");
}
@@ -587,7 +587,7 @@ public class cgeopopup extends AbstractActivity {
private class storeCache implements View.OnClickListener {
public void onClick(View arg0) {
- if (dropDialog != null && dropDialog.isShowing() == true) {
+ if (dropDialog != null && dropDialog.isShowing()) {
showToast("Still removing this cache.");
return;
}
@@ -616,7 +616,7 @@ public class cgeopopup extends AbstractActivity {
private class dropCache implements View.OnClickListener {
public void onClick(View arg0) {
- if (storeDialog != null && storeDialog.isShowing() == true) {
+ if (storeDialog != null && storeDialog.isShowing()) {
showToast("Still saving this cache.");
return;
}
diff --git a/src/cgeo/geocaching/cgeosmaps.java b/src/cgeo/geocaching/cgeosmaps.java
index c09ea29..35d09d0 100644
--- a/src/cgeo/geocaching/cgeosmaps.java
+++ b/src/cgeo/geocaching/cgeosmaps.java
@@ -122,7 +122,7 @@ public class cgeosmaps extends AbstractActivity {
}
}
- if (maps.isEmpty() == true) {
+ if (maps.isEmpty()) {
for (int level = 1; level <= 5; level++) {
try {
Bitmap image = BitmapFactory.decodeFile(cgSettings.getStorageSec() + geocode + "/map_" + level);
diff --git a/src/cgeo/geocaching/cgeotouch.java b/src/cgeo/geocaching/cgeotouch.java
index ee66ac3..67e5125 100644
--- a/src/cgeo/geocaching/cgeotouch.java
+++ b/src/cgeo/geocaching/cgeotouch.java
@@ -431,7 +431,7 @@ public class cgeotouch extends cgLogForm {
if (
status == 1 && settings.twitter == 1 &&
settings.tokenPublic != null && settings.tokenPublic.length() > 0 && settings.tokenSecret != null && settings.tokenSecret.length() > 0 &&
- tweetCheck.isChecked() == true && tweetBox.getVisibility() == View.VISIBLE
+ tweetCheck.isChecked() && tweetBox.getVisibility() == View.VISIBLE
) {
cgBase.postTweetTrackable(app, settings, geocode);
}
diff --git a/src/cgeo/geocaching/cgeotrackable.java b/src/cgeo/geocaching/cgeotrackable.java
index a222320..71db66d 100644
--- a/src/cgeo/geocaching/cgeotrackable.java
+++ b/src/cgeo/geocaching/cgeotrackable.java
@@ -326,7 +326,7 @@ public class cgeotrackable extends AbstractActivity {
// try to get data from URI
if (geocode == null && guid == null && id == null && uri != null) {
String uriHost = uri.getHost().toLowerCase();
- if (uriHost.contains("geocaching.com") == true) {
+ if (uriHost.contains("geocaching.com")) {
geocode = uri.getQueryParameter("tracker");
guid = uri.getQueryParameter("guid");
id = uri.getQueryParameter("id");
@@ -348,9 +348,9 @@ public class cgeotrackable extends AbstractActivity {
finish();
return;
}
- } else if (uriHost.contains("coord.info") == true) {
+ } else if (uriHost.contains("coord.info")) {
String uriPath = uri.getPath().toLowerCase();
- if (uriPath != null && uriPath.startsWith("/tb") == true) {
+ if (uriPath != null && uriPath.startsWith("/tb")) {
geocode = uriPath.substring(1).toUpperCase();
guid = null;
id = null;
@@ -529,7 +529,7 @@ public class cgeotrackable extends AbstractActivity {
}
- if (cgBase.logTypes1.containsKey(log.type) == true) {
+ if (cgBase.logTypes1.containsKey(log.type)) {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(log.type));
} else {
((TextView) rowView.findViewById(R.id.type)).setText(cgBase.logTypes1.get(4)); // note if type is unknown
diff --git a/src/cgeo/geocaching/cgeovisit.java b/src/cgeo/geocaching/cgeovisit.java
index b0a5c88..b2eec53 100644
--- a/src/cgeo/geocaching/cgeovisit.java
+++ b/src/cgeo/geocaching/cgeovisit.java
@@ -60,7 +60,7 @@ public class cgeovisit extends cgLogForm {
private Handler showProgressHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
- if (progressBar == true) {
+ if (progressBar) {
showProgress(true);
}
}
@@ -392,7 +392,7 @@ public class cgeovisit extends cgLogForm {
addText.append("\n");
}
- if (settings.getSignature().contains("[NUMBER]") == true) {
+ if (settings.getSignature().contains("[NUMBER]")) {
final HashMap<String, String> params = new HashMap<String, String>();
final String page = base.request(false, "www.geocaching.com", "/my/", "GET", params, false, false, false).getData();
int current = cgBase.parseFindCount(page);
@@ -554,7 +554,7 @@ public class cgeovisit extends cgLogForm {
types.add(cgBase.LOG_NEEDS_ARCHIVE);
types.add(cgBase.LOG_NEEDS_MAINTENANCE);
}
- if (cache.owner.equalsIgnoreCase(settings.getUsername()) == true) {
+ if (cache.owner.equalsIgnoreCase(settings.getUsername())) {
types.add(cgBase.LOG_OWNER_MAINTENANCE);
types.add(cgBase.LOG_TEMP_DISABLE_LISTING);
types.add(cgBase.LOG_ENABLE_LISTING);
@@ -570,7 +570,7 @@ public class cgeovisit extends cgLogForm {
typeSelected = log.type;
date.setTime(new Date(log.date));
text = log.log;
- if (typeSelected == cgBase.LOG_FOUND_IT && settings.isGCvoteLogin() == true) {
+ if (typeSelected == cgBase.LOG_FOUND_IT && settings.isGCvoteLogin()) {
if (post == null) {
post = (Button) findViewById(R.id.post);
}
@@ -584,7 +584,7 @@ public class cgeovisit extends cgLogForm {
}
if (types.contains(typeSelected) == false) {
- if (alreadyFound == true) {
+ if (alreadyFound) {
typeSelected = cgBase.LOG_NOTE;
} else {
typeSelected = types.get(0);
@@ -685,7 +685,7 @@ public class cgeovisit extends cgLogForm {
post = (Button) findViewById(R.id.post);
}
- if (type == cgBase.LOG_FOUND_IT && settings.isGCvoteLogin() == true) {
+ if (type == cgBase.LOG_FOUND_IT && settings.isGCvoteLogin()) {
if (rating == 0) {
post.setText(res.getString(R.string.log_post_no_rate));
} else {
@@ -731,7 +731,7 @@ public class cgeovisit extends cgLogForm {
}
save.setOnClickListener(new saveListener());
- if (status == true) {
+ if (status) {
showToast(res.getString(R.string.info_log_saved));
app.saveVisitDate(geocode);
} else {
@@ -745,7 +745,7 @@ public class cgeovisit extends cgLogForm {
public void onClick(View arg0) {
app.clearLogOffline(geocode);
- if (alreadyFound == true) {
+ if (alreadyFound) {
typeSelected = cgBase.LOG_NOTE;
} else {
typeSelected = types.get(0);
@@ -891,12 +891,12 @@ public class cgeovisit extends cgLogForm {
if (
status == 1 && typeSelected == cgBase.LOG_FOUND_IT && settings.twitter == 1
&& settings.tokenPublic != null && settings.tokenPublic.length() > 0 && settings.tokenSecret != null
- && settings.tokenSecret.length() > 0 && tweetCheck.isChecked() == true && tweetBox.getVisibility() == View.VISIBLE
+ && settings.tokenSecret.length() > 0 && tweetCheck.isChecked() && tweetBox.getVisibility() == View.VISIBLE
) {
cgBase.postTweetCache(app, settings, geocode);
}
- if (status == 1 && typeSelected == cgBase.LOG_FOUND_IT && settings.isGCvoteLogin() == true) {
+ if (status == 1 && typeSelected == cgBase.LOG_FOUND_IT && settings.isGCvoteLogin()) {
setRating(cache.guid, rating);
}
diff --git a/src/cgeo/geocaching/cgeowaypoint.java b/src/cgeo/geocaching/cgeowaypoint.java
index 138bf7e..068ade1 100644
--- a/src/cgeo/geocaching/cgeowaypoint.java
+++ b/src/cgeo/geocaching/cgeowaypoint.java
@@ -91,7 +91,7 @@ public class cgeowaypoint extends AbstractActivity {
buttonEdit.setOnClickListener(new editWaypointListener(waypoint.id));
Button buttonDelete = (Button) findViewById(R.id.delete);
- if (waypoint.type != null && waypoint.type.equalsIgnoreCase("own") == true) {
+ if (waypoint.type != null && waypoint.type.equalsIgnoreCase("own")) {
buttonDelete.setOnClickListener(new deleteWaypointListener(waypoint.id));
buttonDelete.setVisibility(View.VISIBLE);
}
diff --git a/src/cgeo/geocaching/cgeowaypointadd.java b/src/cgeo/geocaching/cgeowaypointadd.java
index 2da4faf..36ac5c3 100644
--- a/src/cgeo/geocaching/cgeowaypointadd.java
+++ b/src/cgeo/geocaching/cgeowaypointadd.java
@@ -303,15 +303,15 @@ public class cgeowaypointadd extends AbstractActivity {
Matcher matcherD = patternD.matcher(distanceText);
Matcher matcherE = patternE.matcher(distanceText);
- if (matcherA.find() == true && matcherA.groupCount() > 0) {
+ if (matcherA.find() && matcherA.groupCount() > 0) {
distance = (new Double(matcherA.group(1))) * 0.001;
- } else if (matcherB.find() == true && matcherB.groupCount() > 0) {
+ } else if (matcherB.find() && matcherB.groupCount() > 0) {
distance = new Double(matcherB.group(1));
- } else if (matcherC.find() == true && matcherC.groupCount() > 0) {
+ } else if (matcherC.find() && matcherC.groupCount() > 0) {
distance = (new Double(matcherC.group(1))) * 0.0003048;
- } else if (matcherD.find() == true && matcherD.groupCount() > 0) {
+ } else if (matcherD.find() && matcherD.groupCount() > 0) {
distance = (new Double(matcherD.group(1))) * 0.0009144;
- } else if (matcherE.find() == true && matcherE.groupCount() > 0) {
+ } else if (matcherE.find() && matcherE.groupCount() > 0) {
distance = (new Double(matcherE.group(1))) * 1.609344;
} else {
try {
@@ -372,7 +372,7 @@ public class cgeowaypointadd extends AbstractActivity {
waypoint.longitudeString = cgBase.formatCoordinate(coords.get(1), "lon", true);
waypoint.note = note;
- if (app.saveOwnWaypoint(id, geocode, waypoint) == true) {
+ if (app.saveOwnWaypoint(id, geocode, waypoint)) {
app.removeCacheFromCache(geocode);
finish();
diff --git a/src/cgeo/geocaching/mapcommon/cgMapOverlay.java b/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
index b7d2141..80eba5a 100644
--- a/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
+++ b/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
@@ -173,14 +173,14 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
CacheOverlayItemImpl item = items.get(index);
cgCoord coordinate = item.getCoord();
- if (coordinate.type != null && coordinate.type.equalsIgnoreCase("cache") == true && coordinate.geocode != null && coordinate.geocode.length() > 0) {
+ if (coordinate.type != null && coordinate.type.equalsIgnoreCase("cache") && coordinate.geocode != null && coordinate.geocode.length() > 0) {
Intent popupIntent = new Intent(context, cgeopopup.class);
popupIntent.putExtra("fromdetail", fromDetail);
popupIntent.putExtra("geocode", coordinate.geocode);
context.startActivity(popupIntent);
- } else if (coordinate.type != null && coordinate.type.equalsIgnoreCase("waypoint") == true && coordinate.id != null && coordinate.id > 0) {
+ } else if (coordinate.type != null && coordinate.type.equalsIgnoreCase("waypoint") && coordinate.id != null && coordinate.id > 0) {
Intent popupIntent = new Intent(context, cgeowaypoint.class);
popupIntent.putExtra("waypoint", coordinate.id);
@@ -240,7 +240,7 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
dialog.setTitle("cache");
String cacheType;
- if (cgBase.cacheTypesInv.containsKey(coordinate.typeSpec) == true) {
+ if (cgBase.cacheTypesInv.containsKey(coordinate.typeSpec)) {
cacheType = cgBase.cacheTypesInv.get(coordinate.typeSpec);
} else {
cacheType = cgBase.cacheTypesInv.get("mystery");
@@ -280,7 +280,7 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
dialog.setTitle("waypoint");
String waypointType;
- if (cgBase.cacheTypesInv.containsKey(coordinate.typeSpec) == true) {
+ if (cgBase.cacheTypesInv.containsKey(coordinate.typeSpec)) {
waypointType = cgBase.waypointTypes.get(coordinate.typeSpec);
} else {
waypointType = cgBase.waypointTypes.get("waypoint");
diff --git a/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java b/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java
index 86fcf7c..f2ba50d 100644
--- a/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java
+++ b/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java
@@ -79,7 +79,7 @@ public class cgUsersOverlay extends ItemizedOverlayBase implements OverlayBase {
action = "Looking around";
} else if (user.action.equalsIgnoreCase("tweeting")) {
action = "Tweeting";
- } else if (matcherGeocode.find() == true) {
+ } else if (matcherGeocode.find()) {
if (matcherGeocode.group(1) != null) {
geocode = matcherGeocode.group(1).trim().toUpperCase();
}
@@ -94,11 +94,11 @@ public class cgUsersOverlay extends ItemizedOverlayBase implements OverlayBase {
// set icon
int icon = -1;
- if (user.client.equalsIgnoreCase("c:geo") == true) {
+ if (user.client.equalsIgnoreCase("c:geo")) {
icon = R.drawable.client_cgeo;
- } else if (user.client.equalsIgnoreCase("preCaching") == true) {
+ } else if (user.client.equalsIgnoreCase("preCaching")) {
icon = R.drawable.client_precaching;
- } else if (user.client.equalsIgnoreCase("Handy Geocaching") == true) {
+ } else if (user.client.equalsIgnoreCase("Handy Geocaching")) {
icon = R.drawable.client_handygeocaching;
}
diff --git a/src/cgeo/geocaching/mapcommon/cgeomap.java b/src/cgeo/geocaching/mapcommon/cgeomap.java
index 56a1678..2c6edb2 100644
--- a/src/cgeo/geocaching/mapcommon/cgeomap.java
+++ b/src/cgeo/geocaching/mapcommon/cgeomap.java
@@ -139,7 +139,7 @@ public class cgeomap extends MapBase {
// set title
final StringBuilder title = new StringBuilder();
- if (live == true) {
+ if (live) {
title.append(res.getString(R.string.map_live));
} else {
title.append(res.getString(R.string.map_map));
@@ -755,7 +755,7 @@ public class cgeomap extends MapBase {
}
if (geo.latitudeNow != null && geo.longitudeNow != null) {
- if (followMyLocation == true) {
+ if (followMyLocation) {
myLocationInMiddle();
} else {
// move blue arrow
@@ -1580,7 +1580,7 @@ public class cgeomap extends MapBase {
for (String geocode : geocodes) {
try {
- if (stop == true) {
+ if (stop) {
break;
}
@@ -1598,7 +1598,7 @@ public class cgeomap extends MapBase {
}
}
- if (stop == true) {
+ if (stop) {
Log.i(cgSettings.tag, "Stopped storing process.");
break;
@@ -1733,13 +1733,13 @@ public class cgeomap extends MapBase {
}
if (status == null) {
- if (followMyLocation == true) {
+ if (followMyLocation) {
myLocSwitch.setImageResource(R.drawable.my_location_on);
} else {
myLocSwitch.setImageResource(R.drawable.my_location_off);
}
} else {
- if (status == true) {
+ if (status) {
myLocSwitch.setImageResource(R.drawable.my_location_on);
} else {
myLocSwitch.setImageResource(R.drawable.my_location_off);
@@ -1757,7 +1757,7 @@ public class cgeomap extends MapBase {
myLocSwitch = (ImageView) activity.findViewById(R.id.my_position);
}
- if (followMyLocation == true) {
+ if (followMyLocation) {
followMyLocation = false;
myLocSwitch.setImageResource(R.drawable.my_location_off);