diff options
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 0ddaa75..19e4697 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -1631,12 +1631,15 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto .append(cache.getListId() > 0) .toHashCode(); - final LayerDrawable ldFromCache = overlaysCache.get(hashcode); - if (ldFromCache != null) { - item.setMarker(ldFromCache); - return item; + LayerDrawable drawable = overlaysCache.get(hashcode); + if (drawable == null) { + drawable = createCacheItem(cache, hashcode); } + item.setMarker(drawable); + return item; + } + private LayerDrawable createCacheItem(final Geocache cache, final int hashcode) { // Set initial capacities to the maximum of layers and insets to avoid dynamic reallocation final ArrayList<Drawable> layers = new ArrayList<Drawable>(9); final ArrayList<int[]> insets = new ArrayList<int[]>(8); @@ -1690,9 +1693,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } overlaysCache.put(hashcode, ld); - - item.setMarker(ld); - return item; + return ld; } private CachesOverlayItemImpl getWaypointItem(final Waypoint waypoint) { |
