diff options
| author | Gerald Barker <geraldbarker@gmail.com> | 2011-09-02 23:19:51 +0100 |
|---|---|---|
| committer | Gerald Barker <geraldbarker@gmail.com> | 2011-09-02 23:19:51 +0100 |
| commit | 53936c7ee6654a525075b03e1b4c8ddbfbcd4ef5 (patch) | |
| tree | 41154be6daecad1b4483223d72920e0a290024ef /src/cgeo/geocaching/cgCacheListAdapter.java | |
| parent | afbe8c5164e1157e38e0f8c4b28942cbd9fe3d41 (diff) | |
| download | cgeo-53936c7ee6654a525075b03e1b4c8ddbfbcd4ef5.zip cgeo-53936c7ee6654a525075b03e1b4c8ddbfbcd4ef5.tar.gz cgeo-53936c7ee6654a525075b03e1b4c8ddbfbcd4ef5.tar.bz2 | |
First commit of Apache Commons String & Date functions and required, and
refactor of code to use them.
Diffstat (limited to 'src/cgeo/geocaching/cgCacheListAdapter.java')
| -rw-r--r-- | src/cgeo/geocaching/cgCacheListAdapter.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cgeo/geocaching/cgCacheListAdapter.java b/src/cgeo/geocaching/cgCacheListAdapter.java index 64bf3ea..c2d9e52 100644 --- a/src/cgeo/geocaching/cgCacheListAdapter.java +++ b/src/cgeo/geocaching/cgCacheListAdapter.java @@ -6,6 +6,8 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; +import org.apache.commons.lang3.StringUtils; + import android.app.Activity; import android.content.Intent; import android.content.res.Resources; @@ -35,6 +37,7 @@ import cgeo.geocaching.filter.cgFilter; import cgeo.geocaching.sorting.CacheComparator; import cgeo.geocaching.sorting.DistanceComparator; import cgeo.geocaching.sorting.VisitComparator; +import cgeo.geocaching.utils.CollectionUtils; public class cgCacheListAdapter extends ArrayAdapter<cgCache> { @@ -297,13 +300,13 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { lastSort = System.currentTimeMillis(); } - if (distances != null && distances.size() > 0) { + if (CollectionUtils.isNotEmpty(distances)) { for (cgDistanceView distance : distances) { distance.update(latitudeIn, longitudeIn); } } - if (compasses != null && compasses.size() > 0) { + if (CollectionUtils.isNotEmpty(compasses)) { for (cgCompassMini compass : compasses) { compass.updateCoords(latitudeIn, longitudeIn); } @@ -317,7 +320,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { azimuth = azimuthIn; - if (compasses != null && compasses.size() > 0) { + if (CollectionUtils.isNotEmpty(compasses)) { for (cgCompassMini compass : compasses) { compass.updateAzimuth(azimuth); } @@ -595,7 +598,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { if (cache.geocode != null && cache.geocode.length() > 0) { cacheInfo.append(cache.geocode); } - if (cache.size != null && cache.size.length() > 0) { + if (StringUtils.isNotBlank(cache.size)) { if (cacheInfo.length() > 0) { cacheInfo.append(" | "); } |
