diff options
Diffstat (limited to 'src/cgeo/geocaching/mapcommon/cgeomap.java')
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/cgeomap.java | 59 |
1 files changed, 24 insertions, 35 deletions
diff --git a/src/cgeo/geocaching/mapcommon/cgeomap.java b/src/cgeo/geocaching/mapcommon/cgeomap.java index 9360899..9574661 100644 --- a/src/cgeo/geocaching/mapcommon/cgeomap.java +++ b/src/cgeo/geocaching/mapcommon/cgeomap.java @@ -28,13 +28,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; @@ -101,8 +101,8 @@ public class cgeomap extends MapBase { private UsersThread usersThread = null; private DisplayUsersThread displayUsersThread = null; private LoadDetails loadDetailsThread = null; - private volatile long loadThreadRun = 0l; - private volatile long usersThreadRun = 0l; + private volatile long loadThreadRun = 0L; + private volatile long usersThreadRun = 0L; private volatile boolean downloaded = false; // overlays private cgMapOverlay overlayCaches = null; @@ -119,7 +119,7 @@ public class cgeomap extends MapBase { private ProgressDialog waitDialog = null; private int detailTotal = 0; private int detailProgress = 0; - private Long detailProgressTime = 0l; + private Long detailProgressTime = 0L; // views private ImageView myLocSwitch = null; // other things @@ -145,10 +145,9 @@ public class cgeomap extends MapBase { } if (caches != null && cachesCnt > 0) { - title.append(" "); - title.append("["); + title.append(" ["); title.append(caches.size()); - title.append("]"); + title.append(']'); } ActivityMixin.setTitle(activity, title.toString()); @@ -308,7 +307,7 @@ public class cgeomap extends MapBase { waypointTypeIntent = extras.getString("wpttype"); mapStateIntent = extras.getIntArray("mapstate"); - if (searchIdIntent == 0l) { + if (searchIdIntent == 0L) { searchIdIntent = null; } if (latitudeIntent == 0.0) { @@ -746,7 +745,7 @@ public class cgeomap extends MapBase { try { boolean repaintRequired = false; - + if (overlayMyLoc == null && mapView != null) { overlayMyLoc = mapView.createAddPositionOverlay(activity, settings); } @@ -771,11 +770,11 @@ public class cgeomap extends MapBase { } repaintRequired = true; } - + if (repaintRequired) { mapView.repaintRequired(overlayMyLoc); } - + } catch (Exception e) { Log.w(cgSettings.tag, "Failed to update location."); } @@ -942,7 +941,7 @@ public class cgeomap extends MapBase { } catch (Exception e) { Log.w(cgSettings.tag, "cgeomap.LoadTimer.run: " + e.toString()); } - }; + } } } @@ -1024,7 +1023,7 @@ public class cgeomap extends MapBase { } catch (Exception e) { Log.w(cgSettings.tag, "cgeomap.LoadUsersTimer.run: " + e.toString()); } - }; + } } } @@ -1080,24 +1079,14 @@ public class cgeomap extends MapBase { //if in live map and stored caches are found / disables are also shown. if (live && settings.maplive >= 1) { - // I know code is crude, but temporary fix - int i = 0; - boolean excludeMine = settings.excludeMine > 0; - boolean excludeDisabled = settings.excludeDisabled > 0; - - while (i < caches.size()) - { - boolean remove = false; - if ((caches.get(i).found) && (excludeMine)) - remove = true; - if ((caches.get(i).own) && (excludeMine)) - remove = true; - if ((caches.get(i).disabled) && (excludeDisabled)) - remove = true; - if (remove) + final boolean excludeMine = settings.excludeMine > 0; + final boolean excludeDisabled = settings.excludeDisabled > 0; + + for (int i = caches.size() - 1; i >= 0; i--) { + cgCache cache = caches.get(i); + if ((cache.found && excludeMine) || (cache.own && excludeMine) || (cache.disabled && excludeDisabled)) { caches.remove(i); - else - i++; + } } } @@ -1508,10 +1497,10 @@ public class cgeomap extends MapBase { protected boolean working = true; protected boolean stop = false; - protected long centerLat = 0l; - protected long centerLon = 0l; - protected long spanLat = 0l; - protected long spanLon = 0l; + protected long centerLat = 0L; + protected long centerLon = 0L; + protected long spanLat = 0L; + protected long spanLon = 0L; public DoThread(long centerLatIn, long centerLonIn, long spanLatIn, long spanLonIn) { centerLat = centerLatIn; @@ -1550,7 +1539,7 @@ public class cgeomap extends MapBase { private Handler handler = null; private ArrayList<String> geocodes = null; private volatile boolean stop = false; - private long last = 0l; + private long last = 0L; public LoadDetails(Handler handlerIn, ArrayList<String> geocodesIn) { handler = handlerIn; |
