diff --git a/OsmAnd/src/net/osmand/plus/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/ApplicationMode.java index 0a6944a6cb..db06ec6a9c 100644 --- a/OsmAnd/src/net/osmand/plus/ApplicationMode.java +++ b/OsmAnd/src/net/osmand/plus/ApplicationMode.java @@ -154,6 +154,7 @@ public class ApplicationMode { private int arrivalDistance = 90; private int bearingIcon = R.drawable.map_pedestrian_bearing; private int locationIcon = R.drawable.map_pedestrian_location; + private static StateChangedListener listener; private ApplicationMode(int key, String stringKey) { this.key = key; @@ -162,14 +163,14 @@ public class ApplicationMode { public static List values(OsmandSettings settings) { if (cachedFilteredValues.isEmpty()) { - if (!listenerRegistered) { - settings.AVAILABLE_APP_MODES.addListener(new StateChangedListener() { + if (listener == null) { + listener = new StateChangedListener() { @Override public void stateChanged(String change) { cachedFilteredValues = new ArrayList(); } - }); - listenerRegistered = true; + }; + settings.AVAILABLE_APP_MODES.addListener(listener); } String available = settings.AVAILABLE_APP_MODES.get(); cachedFilteredValues = new ArrayList(); diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java index da4a876ccc..041064578b 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -47,6 +47,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { private MapTileLayer overlayLayer; private MapTileLayer underlayLayer; + private StateChangedListener overlayLayerListener; public OsmandRasterMapsPlugin(OsmandApplication app) { this.app = app; @@ -84,13 +85,14 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { underlayLayer = new MapTileLayer(false); // mapView.addLayer(underlayLayer, -0.5f); overlayLayer = new MapTileLayer(false); - // mapView.addLayer(overlayLayer, 0.7f); - settings.MAP_OVERLAY_TRANSPARENCY.addListener(new StateChangedListener() { + overlayLayerListener = new StateChangedListener() { @Override public void stateChanged(Integer change) { overlayLayer.setAlpha(change); } - }); + }; + // mapView.addLayer(overlayLayer, 0.7f); + settings.MAP_OVERLAY_TRANSPARENCY.addListener(overlayLayerListener); } @Override diff --git a/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java b/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java index f48bdb965a..d2b461d3d0 100644 --- a/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java @@ -45,6 +45,7 @@ public class IncrementalChangesManager { for (String month : list) { RegionUpdate ru = regionUpdateFiles.monthUpdates.get(month); if (ru.obfCreated < dateCreated) { + log.info("Delete overlapping month update " + ru.file.getName()); resourceManager.closeFile(ru.file.getName()); regionUpdateFiles.monthUpdates.remove(month); ru.file.delete(); @@ -60,6 +61,7 @@ public class IncrementalChangesManager { while (it.hasNext()) { RegionUpdate ru = it.next(); if (ru.obfCreated < dateCreated || (monthRu != null && ru.obfCreated < monthRu.obfCreated)) { + log.info("Delete overlapping day update " + ru.file.getName()); resourceManager.closeFile(ru.file.getName()); it.remove(); ru.file.delete(); @@ -122,7 +124,7 @@ public class IncrementalChangesManager { if(date.endsWith("00")) { monthUpdates.put(monthYear, ru); } else { - if (!dayUpdates.containsKey(date)) { + if (!dayUpdates.containsKey(monthYear)) { dayUpdates.put(monthYear, new ArrayList()); } dayUpdates.get(monthYear).add(ru);