diff options
Diffstat (limited to 'src/cgeo/geocaching/apps/cache/navi/LocusApp.java')
| -rw-r--r-- | src/cgeo/geocaching/apps/cache/navi/LocusApp.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/src/cgeo/geocaching/apps/cache/navi/LocusApp.java index 2b4baf4..208ff93 100644 --- a/src/cgeo/geocaching/apps/cache/navi/LocusApp.java +++ b/src/cgeo/geocaching/apps/cache/navi/LocusApp.java @@ -4,6 +4,8 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.util.ArrayList; +import org.apache.commons.lang3.StringUtils; + import android.app.Activity; import android.content.Intent; import android.content.res.Resources; @@ -15,6 +17,7 @@ import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.apps.AbstractLocusApp; +import cgeo.geocaching.utils.CollectionUtils; class LocusApp extends AbstractLocusApp implements NavigationApp { @@ -83,22 +86,18 @@ class LocusApp extends AbstractLocusApp implements NavigationApp { } // name - if (cache != null && cache.name != null - && cache.name.length() > 0) { + if (cache != null && StringUtils.isNotBlank(cache.name)) { dos.writeUTF(cache.name); - } else if (waypoint != null && waypoint.name != null - && waypoint.name.length() > 0) { + } else if (waypoint != null && StringUtils.isNotBlank(waypoint.name)) { dos.writeUTF(waypoint.name); } else { dos.writeUTF(""); } // description - if (cache != null && cache.geocode != null - && cache.geocode.length() > 0) { + if (cache != null && StringUtils.isNotBlank(cache.geocode)) { dos.writeUTF(cache.geocode.toUpperCase()); - } else if (waypoint != null && waypoint.lookup != null - && waypoint.lookup.length() > 0) { + } else if (waypoint != null && StringUtils.isNotBlank(waypoint.lookup)) { dos.writeUTF(waypoint.lookup.toUpperCase()); } else { dos.writeUTF(""); @@ -106,8 +105,7 @@ class LocusApp extends AbstractLocusApp implements NavigationApp { // additional data :: keyword, button title, package, activity, // data name, data content - if (cache != null && cache.geocode != null - && cache.geocode.length() > 0) { + if (cache != null && StringUtils.isNotBlank(cache.geocode)) { dos.writeUTF("intent;c:geo;cgeo.geocaching;cgeo.geocaching.cgeodetail;geocode;" + cache.geocode); } else if (waypoint != null && waypoint.id != null @@ -132,7 +130,7 @@ class LocusApp extends AbstractLocusApp implements NavigationApp { } // cache waypoints - if (waypoints != null && waypoints.isEmpty() == false) { + if (CollectionUtils.isNotEmpty(waypoints)) { for (cgWaypoint wp : waypoints) { if (wp == null || wp.latitude == null || wp.longitude == null) { @@ -159,14 +157,14 @@ class LocusApp extends AbstractLocusApp implements NavigationApp { } // name - if (wp.lookup != null && wp.lookup.length() > 0) { + if (StringUtils.isNotBlank(wp.lookup)) { dos.writeUTF(wp.lookup.toUpperCase()); } else { dos.writeUTF(""); } // description - if (wp.name != null && wp.name.length() > 0) { + if (StringUtils.isNotBlank(wp.name)) { dos.writeUTF(wp.name); } else { dos.writeUTF(""); |
