diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-09 12:15:53 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-09 12:15:55 +0200 |
| commit | 992df11aa2c82f8dbfdabd39eff065cbe75f6df1 (patch) | |
| tree | 3747cce96b68b605b2be1107b94218bf2f84f6c0 /main | |
| parent | 57074a76937412d57d0260449edee47e016bc510 (diff) | |
| download | cgeo-992df11aa2c82f8dbfdabd39eff065cbe75f6df1.zip cgeo-992df11aa2c82f8dbfdabd39eff065cbe75f6df1.tar.gz cgeo-992df11aa2c82f8dbfdabd39eff065cbe75f6df1.tar.bz2 | |
Use isEmpty() and isNotEmpty() from CollectionUtils
Diffstat (limited to 'main')
| -rw-r--r-- | main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgCache.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgCacheListAdapter.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 32 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoaddresses.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoapplication.java | 82 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeodetail.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeoimages.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/GCConnector.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/files/FileList.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 9 |
14 files changed, 80 insertions, 90 deletions
diff --git a/main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java b/main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java index 69a5e5b..6897f95 100644 --- a/main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java +++ b/main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java @@ -4,6 +4,8 @@ import menion.android.locus.addon.publiclib.geoData.PointsData; import menion.android.locus.addon.publiclib.utils.DataCursor; import menion.android.locus.addon.publiclib.utils.DataStorage; +import org.apache.commons.collections.CollectionUtils; + import android.content.ContentProvider; import android.content.ContentValues; import android.database.Cursor; @@ -24,7 +26,7 @@ public class LocusDataStorageProvider extends ContentProvider { DataCursor cursor = new DataCursor(new String[] { "data" }); ArrayList<PointsData> data = DataStorage.getData(); - if (data == null || data.size() == 0) { + if (CollectionUtils.isEmpty(data)) { return cursor; } diff --git a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java index c08122a..e4afc31 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java @@ -4,6 +4,8 @@ import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.apps.AbstractLocusApp; +import org.apache.commons.collections.CollectionUtils; + import android.app.Activity; import android.content.res.Resources; @@ -25,7 +27,7 @@ class LocusCacheListApp extends AbstractLocusApp implements CacheListApp { @Override public boolean invoke(cgGeo geo, List<cgCache> cacheList, Activity activity, Resources res, final UUID searchId) { - if (cacheList == null || cacheList.isEmpty()) + if (CollectionUtils.isEmpty(cacheList)) return false; showInLocus((List<? extends Object>) cacheList, false, activity); diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index bf48eaa..d79c96d 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -2189,7 +2189,7 @@ public class cgBase { } final cgCacheWrap caches = parseSearch(thread, url, page, showCaptcha); - if (caches == null || caches.cacheList == null || caches.cacheList.isEmpty()) { + if (caches == null || CollectionUtils.isEmpty(caches.cacheList)) { Log.e(Settings.tag, "cgeoBase.searchByNextPage: No cache parsed"); return searchId; } @@ -2281,7 +2281,7 @@ public class cgBase { } final cgCacheWrap caches = parseSearch(thread, fullUri, page, showCaptcha); - if (caches == null || caches.cacheList == null || caches.cacheList.isEmpty()) { + if (caches == null || CollectionUtils.isEmpty(caches.cacheList)) { Log.e(Settings.tag, "cgeoBase.searchByAny: No cache parsed"); } @@ -2355,7 +2355,7 @@ public class cgBase { } final cgCacheWrap caches = parseMapJSON(Uri.parse(uri).buildUpon().encodedQuery(params).build().toString(), page); - if (caches == null || caches.cacheList == null || caches.cacheList.isEmpty()) { + if (caches == null || CollectionUtils.isEmpty(caches.cacheList)) { Log.e(Settings.tag, "cgeoBase.searchByViewport: No cache parsed"); } @@ -2563,7 +2563,7 @@ public class cgBase { "ctl00$ContentBody$LogBookPanel1$LogButton", "Submit Log Entry", "ctl00$ContentBody$uxVistOtherListingGC", ""); setViewstates(viewstates, params); - if (trackables != null && !trackables.isEmpty()) { // we have some trackables to proceed + if (CollectionUtils.isNotEmpty(trackables)) { // we have some trackables to proceed final StringBuilder hdnSelected = new StringBuilder(); for (cgTrackableLog tb : trackables) { @@ -2617,7 +2617,7 @@ public class cgBase { params.put("ctl00$ContentBody$LogBookPanel1$btnConfirm", "Yes"); params.put("ctl00$ContentBody$LogBookPanel1$uxLogInfo", logInfo); params.put("ctl00$ContentBody$uxVistOtherListingGC", ""); - if (trackables != null && !trackables.isEmpty()) { // we have some trackables to proceed + if (CollectionUtils.isNotEmpty(trackables)) { // we have some trackables to proceed final StringBuilder hdnSelected = new StringBuilder(); for (cgTrackableLog tb : trackables) { diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index 210f5e6..9bc8b38 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -6,6 +6,7 @@ import cgeo.geocaching.connector.IConnector; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.geopoint.Geopoint; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import android.app.Activity; @@ -205,7 +206,7 @@ public class cgCache implements ICache { inventory = other.inventory; inventoryItems = other.inventoryItems; } - if (logs == null || logs.isEmpty()) { // keep last known logs if none + if (CollectionUtils.isEmpty(logs)) { // keep last known logs if none logs = other.logs; } } diff --git a/main/src/cgeo/geocaching/cgCacheListAdapter.java b/main/src/cgeo/geocaching/cgCacheListAdapter.java index e7ac796..bd4b653 100644 --- a/main/src/cgeo/geocaching/cgCacheListAdapter.java +++ b/main/src/cgeo/geocaching/cgCacheListAdapter.java @@ -240,7 +240,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { } public void forceSort(final Geopoint coordsIn) { - if (list == null || list.isEmpty() || !sort) { + if (CollectionUtils.isEmpty(list) || !sort) { return; } @@ -268,7 +268,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { coords = coordsIn; - if (list != null && !list.isEmpty() && (System.currentTimeMillis() - lastSort) > 1000 && sort) { + if (CollectionUtils.isNotEmpty(list) && (System.currentTimeMillis() - lastSort) > 1000 && sort) { try { if (statComparator != null) { Collections.sort(list, statComparator); diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index a7e2c22..0b35822 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -1267,7 +1267,7 @@ public class cgData { } } - if (cache.logCounts != null && !cache.logCounts.isEmpty()) { + if (MapUtils.isNotEmpty(cache.logCounts)) { if (!saveLogCount(cache.geocode, cache.logCounts)) { statusOk = false; } @@ -1809,7 +1809,7 @@ public class cgData { } List<cgCache> caches = loadCaches(geocodes, null, null, null, null, null, loadA, loadW, loadS, loadL, loadI, loadO); - if (caches != null && !caches.isEmpty()) { + if (CollectionUtils.isNotEmpty(caches)) { return caches.get(0); } @@ -1934,9 +1934,13 @@ public class cgData { //Extracted Method cgCache cache = createCacheFromDatabaseContent(cursor); + // FIXME: in the following code (and similar blocks below), the + // cache.attributes entity probably does not need to be preserved, + // and the resolution of the "if" statement could be simply + // cache.attributes = attributes if (loadA) { - List<String> attributes = loadAttributes(cache.geocode); - if (attributes != null && !attributes.isEmpty()) { + final List<String> attributes = loadAttributes(cache.geocode); + if (CollectionUtils.isNotEmpty(attributes)) { if (cache.attributes == null) { cache.attributes = new ArrayList<String>(); } else { @@ -1947,8 +1951,8 @@ public class cgData { } if (loadW) { - List<cgWaypoint> waypoints = loadWaypoints(cache.geocode); - if (waypoints != null && !waypoints.isEmpty()) { + final List<cgWaypoint> waypoints = loadWaypoints(cache.geocode); + if (CollectionUtils.isNotEmpty(waypoints)) { if (cache.waypoints == null) { cache.waypoints = new ArrayList<cgWaypoint>(); } else { @@ -1959,8 +1963,8 @@ public class cgData { } if (loadS) { - List<cgImage> spoilers = loadSpoilers(cache.geocode); - if (spoilers != null && !spoilers.isEmpty()) { + final List<cgImage> spoilers = loadSpoilers(cache.geocode); + if (CollectionUtils.isNotEmpty(spoilers)) { if (cache.spoilers == null) { cache.spoilers = new ArrayList<cgImage>(); } else { @@ -1971,8 +1975,8 @@ public class cgData { } if (loadL) { - List<cgLog> logs = loadLogs(cache.geocode); - if (logs != null && !logs.isEmpty()) { + final List<cgLog> logs = loadLogs(cache.geocode); + if (CollectionUtils.isNotEmpty(logs)) { if (cache.logs == null) { cache.logs = new ArrayList<cgLog>(); } else { @@ -1980,16 +1984,16 @@ public class cgData { } cache.logs.addAll(logs); } - Map<Integer, Integer> logCounts = loadLogCounts(cache.geocode); - if (logCounts != null && !logCounts.isEmpty()) { + final Map<Integer, Integer> logCounts = loadLogCounts(cache.geocode); + if (MapUtils.isNotEmpty(logCounts)) { cache.logCounts.clear(); cache.logCounts.putAll(logCounts); } } if (loadI) { - List<cgTrackable> inventory = loadInventory(cache.geocode); - if (inventory != null && !inventory.isEmpty()) { + final List<cgTrackable> inventory = loadInventory(cache.geocode); + if (CollectionUtils.isNotEmpty(inventory)) { if (cache.inventory == null) { cache.inventory = new ArrayList<cgTrackable>(); } else { diff --git a/main/src/cgeo/geocaching/cgeoaddresses.java b/main/src/cgeo/geocaching/cgeoaddresses.java index 2f6762b..8cf68fe 100644 --- a/main/src/cgeo/geocaching/cgeoaddresses.java +++ b/main/src/cgeo/geocaching/cgeoaddresses.java @@ -2,6 +2,8 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; +import org.apache.commons.collections.CollectionUtils; + import android.app.ProgressDialog; import android.location.Address; import android.location.Geocoder; @@ -71,7 +73,7 @@ public class cgeoaddresses extends AbstractActivity { addList = (LinearLayout) findViewById(R.id.address_list); } - if (addresses == null || addresses.isEmpty()) { + if (CollectionUtils.isEmpty(addresses)) { showToast(res.getString(R.string.err_search_address_no_match)); finish(); return; diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java index e3ba0a2..7e91a01 100644 --- a/main/src/cgeo/geocaching/cgeoapplication.java +++ b/main/src/cgeo/geocaching/cgeoapplication.java @@ -3,6 +3,7 @@ package cgeo.geocaching; import cgeo.geocaching.enumerations.StatusCode; import cgeo.geocaching.geopoint.Geopoint; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import android.app.Application; @@ -401,8 +402,8 @@ public class cgeoapplication extends Application { return getBounds(geocodeList); } - public List<Object> getBounds(List<String> geocodes) { - if (geocodes == null || geocodes.isEmpty()) { + public List<Object> getBounds(final List<String> geocodes) { + if (CollectionUtils.isEmpty(geocodes)) { return null; } @@ -459,78 +460,51 @@ public class cgeoapplication extends Application { return cachesOut; } - public cgSearch getBatchOfStoredCaches(boolean detailedOnly, final Geopoint coords, String cachetype, int list) { - cgSearch search = new cgSearch(); - - List<String> geocodes = getStorage().loadBatchOfStoredGeocodes(detailedOnly, coords, cachetype, list); - if (geocodes != null && !geocodes.isEmpty()) { - for (String gccode : geocodes) { + /** + * Create new search and register it + * + * @param geocodes + * the list of geocodes to search for + * @return the newly created search, which has been added to the list of searches + */ + private cgSearch createNewSearch(final List<String> geocodes) { + final cgSearch search = new cgSearch(); + if (CollectionUtils.isNotEmpty(geocodes)) { + for (final String gccode : geocodes) { search.addGeocode(gccode); } } searches.put(search.getCurrentId(), search); - return search; } + public cgSearch getBatchOfStoredCaches(boolean detailedOnly, final Geopoint coords, String cachetype, int list) { + final List<String> geocodes = getStorage().loadBatchOfStoredGeocodes(detailedOnly, coords, cachetype, list); + return createNewSearch(geocodes); + } + public List<cgDestination> getHistoryOfSearchedLocations() { return getStorage().loadHistoryOfSearchedLocations(); } public cgSearch getHistoryOfCaches(boolean detailedOnly, String cachetype) { - cgSearch search = new cgSearch(); - - List<String> geocodes = getStorage().loadBatchOfHistoricGeocodes(detailedOnly, cachetype); - if (geocodes != null && !geocodes.isEmpty()) { - for (String gccode : geocodes) { - search.addGeocode(gccode); - } - } - searches.put(search.getCurrentId(), search); - - return search; + final List<String> geocodes = getStorage().loadBatchOfHistoricGeocodes(detailedOnly, cachetype); + return createNewSearch(geocodes); } public UUID getCachedInViewport(Long centerLat, Long centerLon, Long spanLat, Long spanLon, String cachetype) { - cgSearch search = new cgSearch(); - - List<String> geocodes = getStorage().getCachedInViewport(centerLat, centerLon, spanLat, spanLon, cachetype); - if (geocodes != null && !geocodes.isEmpty()) { - for (String gccode : geocodes) { - search.addGeocode(gccode); - } - } - searches.put(search.getCurrentId(), search); - - return search.getCurrentId(); + final List<String> geocodes = getStorage().getCachedInViewport(centerLat, centerLon, spanLat, spanLon, cachetype); + return createNewSearch(geocodes).getCurrentId(); } public UUID getStoredInViewport(Long centerLat, Long centerLon, Long spanLat, Long spanLon, String cachetype) { - cgSearch search = new cgSearch(); - - List<String> geocodes = getStorage().getStoredInViewport(centerLat, centerLon, spanLat, spanLon, cachetype); - if (geocodes != null && !geocodes.isEmpty()) { - for (String gccode : geocodes) { - search.addGeocode(gccode); - } - } - searches.put(search.getCurrentId(), search); - - return search.getCurrentId(); + final List<String> geocodes = getStorage().getStoredInViewport(centerLat, centerLon, spanLat, spanLon, cachetype); + return createNewSearch(geocodes).getCurrentId(); } public UUID getOfflineAll(String cachetype) { - cgSearch search = new cgSearch(); - - List<String> geocodes = getStorage().getOfflineAll(cachetype); - if (geocodes != null && !geocodes.isEmpty()) { - for (String gccode : geocodes) { - search.addGeocode(gccode); - } - } - searches.put(search.getCurrentId(), search); - - return search.getCurrentId(); + final List<String> geocodes = getStorage().getOfflineAll(cachetype); + return createNewSearch(geocodes).getCurrentId(); } public int getAllStoredCachesCount(boolean detailedOnly, String cachetype, Integer list) { @@ -606,7 +580,7 @@ public class cgeoapplication extends Application { } public UUID addSearch(final cgSearch search, final List<cgCache> cacheList, final boolean newItem, final int reason) { - if (cacheList == null || cacheList.isEmpty()) { + if (CollectionUtils.isEmpty(cacheList)) { return null; } diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index 1cd8817..78c0a1f 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -2552,7 +2552,7 @@ public class cgeocaches extends AbstractListActivity { private void removeList() { // if there are no caches on this list, don't bother the user with questions. // there is no harm in deleting the list, he could recreate it easily - if (cacheList != null && cacheList.isEmpty()) { + if (CollectionUtils.isEmpty(cacheList)) { removeListInternal(); return; } diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java index 933fffc..faee29e 100644 --- a/main/src/cgeo/geocaching/cgeodetail.java +++ b/main/src/cgeo/geocaching/cgeodetail.java @@ -10,6 +10,7 @@ import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.utils.CryptUtils; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import android.app.AlertDialog; @@ -1246,7 +1247,7 @@ public class cgeodetail extends AbstractActivity { // add LogImages LinearLayout logLayout = (LinearLayout) rowView.findViewById(R.id.log_layout); - if ((log.logImages != null) && (!log.logImages.isEmpty())) { + if (CollectionUtils.isNotEmpty(log.logImages)) { final ArrayList<cgImage> logImages = new ArrayList<cgImage>(log.logImages); @@ -1501,7 +1502,7 @@ public class cgeodetail extends AbstractActivity { } private void addToCalendarFn(int index) { - if (calendars == null || calendars.isEmpty()) { + if (MapUtils.isEmpty(calendars)) { return; } @@ -1604,7 +1605,7 @@ public class cgeodetail extends AbstractActivity { } private void showSpoilers() { - if (cache == null || cache.spoilers == null || cache.spoilers.isEmpty()) { + if (cache == null || CollectionUtils.isEmpty(cache.spoilers)) { showToast(res.getString(R.string.err_detail_no_spoiler)); } diff --git a/main/src/cgeo/geocaching/cgeoimages.java b/main/src/cgeo/geocaching/cgeoimages.java index 9f9a2ce..df5578c 100644 --- a/main/src/cgeo/geocaching/cgeoimages.java +++ b/main/src/cgeo/geocaching/cgeoimages.java @@ -3,6 +3,7 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.files.LocalStorage; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import android.app.ProgressDialog; @@ -178,7 +179,7 @@ public class cgeoimages extends AbstractActivity { } final ArrayList<cgImage> images = extras.getParcelableArrayList("images"); - if (images == null || images.isEmpty()) { + if (CollectionUtils.isEmpty(images)) { showToast(res.getString(R.string.warn_load_images)); finish(); return; diff --git a/main/src/cgeo/geocaching/connector/GCConnector.java b/main/src/cgeo/geocaching/connector/GCConnector.java index f65b944..7699a74 100644 --- a/main/src/cgeo/geocaching/connector/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/GCConnector.java @@ -9,6 +9,7 @@ import cgeo.geocaching.cgCacheWrap; import cgeo.geocaching.cgSearch; import cgeo.geocaching.cgeoapplication; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import android.os.Handler; @@ -110,7 +111,7 @@ public class GCConnector extends AbstractConnector implements IConnector { final cgCacheWrap caches = base.parseCache(page, reason, handler); - if (caches == null || caches.cacheList == null || caches.cacheList.isEmpty()) { + if (caches == null || CollectionUtils.isEmpty(caches.cacheList)) { if (caches != null && caches.error != null) { search.error = caches.error; } diff --git a/main/src/cgeo/geocaching/files/FileList.java b/main/src/cgeo/geocaching/files/FileList.java index 770e749..2f810ea 100644 --- a/main/src/cgeo/geocaching/files/FileList.java +++ b/main/src/cgeo/geocaching/files/FileList.java @@ -4,6 +4,7 @@ import cgeo.geocaching.R; import cgeo.geocaching.Settings; import cgeo.geocaching.activity.AbstractListActivity; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -42,7 +43,7 @@ public abstract class FileList<T extends ArrayAdapter<File>> extends AbstractLis @Override public void handleMessage(Message msg) { try { - if (files == null || files.isEmpty()) { + if (CollectionUtils.isEmpty(files)) { if (waitDialog != null) { waitDialog.dismiss(); } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 481ae62..96b70d5 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -24,6 +24,7 @@ import cgeo.geocaching.maps.interfaces.MapViewImpl; import cgeo.geocaching.maps.interfaces.OnDragListener; import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import android.app.Activity; @@ -573,7 +574,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory searchId = null; searchIdIntent = null; } else if (id == MENU_STORE_CACHES) { - if (live && !isLoading() && caches != null && !caches.isEmpty()) { + if (live && !isLoading() && CollectionUtils.isNotEmpty(caches)) { final List<String> geocodes = new ArrayList<String>(); List<cgCache> cachesProtected = new ArrayList<cgCache>(caches); @@ -909,7 +910,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory moved = true; } else if (((Math.abs(spanLatitudeNow - spanLatitude) > 50) || (Math.abs(spanLongitudeNow - spanLongitude) > 50) || // changed zoom (Math.abs(centerLatitudeNow - centerLatitude) > (spanLatitudeNow / 4)) || (Math.abs(centerLongitudeNow - centerLongitude) > (spanLongitudeNow / 4)) // map moved - ) && (cachesCnt <= 0 || caches == null || caches.isEmpty() + ) && (cachesCnt <= 0 || CollectionUtils.isEmpty(caches) || !cgBase.isInViewPort(centerLatitude, centerLongitude, centerLatitudeNow, centerLongitudeNow, spanLatitude, spanLongitude, spanLatitudeNow, spanLongitudeNow))) { moved = true; } @@ -1450,7 +1451,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory stop = false; working = true; - if (mapView == null || users == null || users.isEmpty()) { + if (mapView == null || CollectionUtils.isEmpty(users)) { return; } @@ -1599,7 +1600,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory @Override public void run() { - if (geocodes == null || geocodes.isEmpty()) { + if (CollectionUtils.isEmpty(geocodes)) { return; } |
