aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/mapcommon
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgeo/geocaching/mapcommon')
-rw-r--r--src/cgeo/geocaching/mapcommon/cgMapOverlay.java6
-rw-r--r--src/cgeo/geocaching/mapcommon/cgUsersOverlay.java4
-rw-r--r--src/cgeo/geocaching/mapcommon/cgeomap.java7
3 files changed, 11 insertions, 6 deletions
diff --git a/src/cgeo/geocaching/mapcommon/cgMapOverlay.java b/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
index d3f7c00..2b8406e 100644
--- a/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
+++ b/src/cgeo/geocaching/mapcommon/cgMapOverlay.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.mapcommon;
import java.util.ArrayList;
+import org.apache.commons.lang3.StringUtils;
+
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
@@ -10,9 +12,9 @@ import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
+import android.graphics.Paint.Style;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Point;
-import android.graphics.Paint.Style;
import android.location.Location;
import android.text.Html;
import android.util.Log;
@@ -199,7 +201,7 @@ public class cgMapOverlay extends ItemizedOverlayBase implements OverlayBase {
cgCoord coordinate = item.getCoord();
- if (coordinate.type != null && coordinate.type.equalsIgnoreCase("cache") && coordinate.geocode != null && coordinate.geocode.length() > 0) {
+ if (coordinate.type != null && coordinate.type.equalsIgnoreCase("cache") && StringUtils.isNotBlank(coordinate.geocode)) {
Intent popupIntent = new Intent(context, cgeopopup.class);
popupIntent.putExtra("fromdetail", fromDetail);
diff --git a/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java b/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java
index f2ba50d..60439be 100644
--- a/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java
+++ b/src/cgeo/geocaching/mapcommon/cgUsersOverlay.java
@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
+
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -109,7 +111,7 @@ public class cgUsersOverlay extends ItemizedOverlayBase implements OverlayBase {
dialog.setTitle(user.username);
dialog.setMessage(action);
dialog.setCancelable(true);
- if (geocode != null && geocode.length() > 0) {
+ if (StringUtils.isNotBlank(geocode)) {
dialog.setPositiveButton(geocode + "?", new cacheDetails(geocode));
}
dialog.setNeutralButton("Dismiss", new DialogInterface.OnClickListener() {
diff --git a/src/cgeo/geocaching/mapcommon/cgeomap.java b/src/cgeo/geocaching/mapcommon/cgeomap.java
index 22ea40b..7d7d51e 100644
--- a/src/cgeo/geocaching/mapcommon/cgeomap.java
+++ b/src/cgeo/geocaching/mapcommon/cgeomap.java
@@ -29,13 +29,13 @@ import cgeo.geocaching.cgCoord;
import cgeo.geocaching.cgDirection;
import cgeo.geocaching.cgGeo;
import cgeo.geocaching.cgSettings;
+import cgeo.geocaching.cgSettings.mapSourceEnum;
import cgeo.geocaching.cgUpdateDir;
import cgeo.geocaching.cgUpdateLoc;
import cgeo.geocaching.cgUser;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
-import cgeo.geocaching.cgSettings.mapSourceEnum;
import cgeo.geocaching.mapinterfaces.ActivityImpl;
import cgeo.geocaching.mapinterfaces.CacheOverlayItemImpl;
import cgeo.geocaching.mapinterfaces.GeoPointImpl;
@@ -43,6 +43,7 @@ import cgeo.geocaching.mapinterfaces.MapControllerImpl;
import cgeo.geocaching.mapinterfaces.MapFactory;
import cgeo.geocaching.mapinterfaces.MapViewImpl;
import cgeo.geocaching.mapinterfaces.UserOverlayItemImpl;
+import cgeo.geocaching.utils.CollectionUtils;
public class cgeomap extends MapBase {
@@ -505,7 +506,7 @@ public class cgeomap extends MapBase {
}
item = menu.findItem(MENU_STORE_CACHES); // store loaded
- if (live && !isLoading() && app.getNotOfflineCount(searchId) > 0 && caches != null && caches.size() > 0) {
+ if (live && !isLoading() && app.getNotOfflineCount(searchId) > 0 && CollectionUtils.isNotEmpty(caches)) {
item.setEnabled(true);
} else {
item.setEnabled(false);
@@ -562,7 +563,7 @@ public class cgeomap extends MapBase {
ArrayList<cgCache> cachesProtected = new ArrayList<cgCache>(caches);
try {
- if (cachesProtected.size() > 0) {
+ if (CollectionUtils.isNotEmpty(cachesProtected)) {
final GeoPointImpl mapCenter = mapView.getMapViewCenter();
final int mapCenterLat = mapCenter.getLatitudeE6();
final int mapCenterLon = mapCenter.getLongitudeE6();