diff options
| author | blafoo <github@blafoo.de> | 2011-08-31 23:16:30 +0200 |
|---|---|---|
| committer | blafoo <github@blafoo.de> | 2011-08-31 23:16:30 +0200 |
| commit | 6dd358bd3d9d526b44fd2d9552ded0a3d4bc510c (patch) | |
| tree | 78350ad763f9e1fdae020732ab0be115f3b8269c /src/cgeo/geocaching/mapcommon | |
| parent | 971bb0dc1d2db6d8c4ba974b68100a8c3d90f9ab (diff) | |
| parent | 18ff53c1cd02c2b9c477a299b632465cd78241ff (diff) | |
| download | cgeo-6dd358bd3d9d526b44fd2d9552ded0a3d4bc510c.zip cgeo-6dd358bd3d9d526b44fd2d9552ded0a3d4bc510c.tar.gz cgeo-6dd358bd3d9d526b44fd2d9552ded0a3d4bc510c.tar.bz2 | |
Merge remote-tracking branch 'upstream/master' into unittest
Conflicts:
res/values/strings.xml
src/cgeo/geocaching/cgCache.java
Diffstat (limited to 'src/cgeo/geocaching/mapcommon')
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/ItemizedOverlayBase.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/MapBase.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/cgOverlayScale.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/cgeomap.java | 65 |
4 files changed, 30 insertions, 41 deletions
diff --git a/src/cgeo/geocaching/mapcommon/ItemizedOverlayBase.java b/src/cgeo/geocaching/mapcommon/ItemizedOverlayBase.java index 4e0379c..99bf2fd 100644 --- a/src/cgeo/geocaching/mapcommon/ItemizedOverlayBase.java +++ b/src/cgeo/geocaching/mapcommon/ItemizedOverlayBase.java @@ -20,7 +20,7 @@ public abstract class ItemizedOverlayBase implements OverlayBase { private ItemizedOverlayImpl ovlImpl; - public ItemizedOverlayBase(ItemizedOverlayImpl ovlImplIn) { + protected ItemizedOverlayBase(ItemizedOverlayImpl ovlImplIn) { ovlImpl = ovlImplIn; } diff --git a/src/cgeo/geocaching/mapcommon/MapBase.java b/src/cgeo/geocaching/mapcommon/MapBase.java index 1f967a0..1f2d769 100644 --- a/src/cgeo/geocaching/mapcommon/MapBase.java +++ b/src/cgeo/geocaching/mapcommon/MapBase.java @@ -18,7 +18,7 @@ public abstract class MapBase { ActivityImpl mapActivity; - public MapBase(ActivityImpl activity) { + protected MapBase(ActivityImpl activity) { mapActivity = activity; } diff --git a/src/cgeo/geocaching/mapcommon/cgOverlayScale.java b/src/cgeo/geocaching/mapcommon/cgOverlayScale.java index b8d6f09..cb73c75 100644 --- a/src/cgeo/geocaching/mapcommon/cgOverlayScale.java +++ b/src/cgeo/geocaching/mapcommon/cgOverlayScale.java @@ -21,7 +21,7 @@ public class cgOverlayScale implements OverlayBase { private Paint scale = null; private Paint scaleShadow = null; private BlurMaskFilter blur = null; - private float pixelDensity = 0l; + private float pixelDensity = 0L; private double pixels = 0d; private int bottom = 0; private double distance = 0d; diff --git a/src/cgeo/geocaching/mapcommon/cgeomap.java b/src/cgeo/geocaching/mapcommon/cgeomap.java index 14bb462..845dd8f 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; @@ -102,8 +102,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; @@ -120,7 +120,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 @@ -146,10 +146,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()); @@ -309,7 +308,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) { @@ -747,7 +746,7 @@ public class cgeomap extends MapBase { try { boolean repaintRequired = false; - + if (overlayMyLoc == null && mapView != null) { overlayMyLoc = mapView.createAddPositionOverlay(activity, settings); } @@ -772,11 +771,11 @@ public class cgeomap extends MapBase { } repaintRequired = true; } - + if (repaintRequired) { mapView.repaintRequired(overlayMyLoc); } - + } catch (Exception e) { Log.w(cgSettings.tag, "Failed to update location."); } @@ -943,7 +942,7 @@ public class cgeomap extends MapBase { } catch (Exception e) { Log.w(cgSettings.tag, "cgeomap.LoadTimer.run: " + e.toString()); } - }; + } } } @@ -1025,7 +1024,7 @@ public class cgeomap extends MapBase { } catch (Exception e) { Log.w(cgSettings.tag, "cgeomap.LoadUsersTimer.run: " + e.toString()); } - }; + } } } @@ -1081,24 +1080,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++; + } } } @@ -1281,7 +1270,7 @@ public class cgeomap extends MapBase { coordinates.add(coord); item = settings.getMapFactory().getCacheOverlayItem(coord, cacheOne.type); - icon = cgBase.getIcon(true, cacheOne.type, cacheOne.own, cacheOne.found, cacheOne.disabled || cacheOne.archived); + icon = cgBase.getMarkerIcon(true, cacheOne.type, cacheOne.own, cacheOne.found, cacheOne.disabled || cacheOne.archived); pin = null; if (iconsCache.containsKey(icon)) { @@ -1325,7 +1314,7 @@ public class cgeomap extends MapBase { coordinates.add(coord); item = settings.getMapFactory().getCacheOverlayItem(coord, null); - icon = cgBase.getIcon(false, oneWaypoint.type, false, false, false); + icon = cgBase.getMarkerIcon(false, oneWaypoint.type, false, false, false); if (iconsCache.containsKey(icon)) { pin = iconsCache.get(icon); } else { @@ -1481,7 +1470,7 @@ public class cgeomap extends MapBase { coordinates.add(coord); CacheOverlayItemImpl item = settings.getMapFactory().getCacheOverlayItem(coord, null); - final int icon = cgBase.getIcon(false, waypointTypeIntent, false, false, false); + final int icon = cgBase.getMarkerIcon(false, waypointTypeIntent, false, false, false); Drawable pin = null; if (iconsCache.containsKey(icon)) { pin = iconsCache.get(icon); @@ -1509,10 +1498,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; @@ -1551,7 +1540,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; |
