Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-08-01 22:45:50 +02:00
commit 04bee061b7
3 changed files with 13 additions and 8 deletions

View file

@ -154,6 +154,7 @@ public class ApplicationMode {
private int arrivalDistance = 90; private int arrivalDistance = 90;
private int bearingIcon = R.drawable.map_pedestrian_bearing; private int bearingIcon = R.drawable.map_pedestrian_bearing;
private int locationIcon = R.drawable.map_pedestrian_location; private int locationIcon = R.drawable.map_pedestrian_location;
private static StateChangedListener<String> listener;
private ApplicationMode(int key, String stringKey) { private ApplicationMode(int key, String stringKey) {
this.key = key; this.key = key;
@ -162,14 +163,14 @@ public class ApplicationMode {
public static List<ApplicationMode> values(OsmandSettings settings) { public static List<ApplicationMode> values(OsmandSettings settings) {
if (cachedFilteredValues.isEmpty()) { if (cachedFilteredValues.isEmpty()) {
if (!listenerRegistered) { if (listener == null) {
settings.AVAILABLE_APP_MODES.addListener(new StateChangedListener<String>() { listener = new StateChangedListener<String>() {
@Override @Override
public void stateChanged(String change) { public void stateChanged(String change) {
cachedFilteredValues = new ArrayList<ApplicationMode>(); cachedFilteredValues = new ArrayList<ApplicationMode>();
} }
}); };
listenerRegistered = true; settings.AVAILABLE_APP_MODES.addListener(listener);
} }
String available = settings.AVAILABLE_APP_MODES.get(); String available = settings.AVAILABLE_APP_MODES.get();
cachedFilteredValues = new ArrayList<ApplicationMode>(); cachedFilteredValues = new ArrayList<ApplicationMode>();

View file

@ -47,6 +47,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
private MapTileLayer overlayLayer; private MapTileLayer overlayLayer;
private MapTileLayer underlayLayer; private MapTileLayer underlayLayer;
private StateChangedListener<Integer> overlayLayerListener;
public OsmandRasterMapsPlugin(OsmandApplication app) { public OsmandRasterMapsPlugin(OsmandApplication app) {
this.app = app; this.app = app;
@ -84,13 +85,14 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
underlayLayer = new MapTileLayer(false); underlayLayer = new MapTileLayer(false);
// mapView.addLayer(underlayLayer, -0.5f); // mapView.addLayer(underlayLayer, -0.5f);
overlayLayer = new MapTileLayer(false); overlayLayer = new MapTileLayer(false);
// mapView.addLayer(overlayLayer, 0.7f); overlayLayerListener = new StateChangedListener<Integer>() {
settings.MAP_OVERLAY_TRANSPARENCY.addListener(new StateChangedListener<Integer>() {
@Override @Override
public void stateChanged(Integer change) { public void stateChanged(Integer change) {
overlayLayer.setAlpha(change); overlayLayer.setAlpha(change);
} }
}); };
// mapView.addLayer(overlayLayer, 0.7f);
settings.MAP_OVERLAY_TRANSPARENCY.addListener(overlayLayerListener);
} }
@Override @Override

View file

@ -45,6 +45,7 @@ public class IncrementalChangesManager {
for (String month : list) { for (String month : list) {
RegionUpdate ru = regionUpdateFiles.monthUpdates.get(month); RegionUpdate ru = regionUpdateFiles.monthUpdates.get(month);
if (ru.obfCreated < dateCreated) { if (ru.obfCreated < dateCreated) {
log.info("Delete overlapping month update " + ru.file.getName());
resourceManager.closeFile(ru.file.getName()); resourceManager.closeFile(ru.file.getName());
regionUpdateFiles.monthUpdates.remove(month); regionUpdateFiles.monthUpdates.remove(month);
ru.file.delete(); ru.file.delete();
@ -60,6 +61,7 @@ public class IncrementalChangesManager {
while (it.hasNext()) { while (it.hasNext()) {
RegionUpdate ru = it.next(); RegionUpdate ru = it.next();
if (ru.obfCreated < dateCreated || (monthRu != null && ru.obfCreated < monthRu.obfCreated)) { if (ru.obfCreated < dateCreated || (monthRu != null && ru.obfCreated < monthRu.obfCreated)) {
log.info("Delete overlapping day update " + ru.file.getName());
resourceManager.closeFile(ru.file.getName()); resourceManager.closeFile(ru.file.getName());
it.remove(); it.remove();
ru.file.delete(); ru.file.delete();
@ -122,7 +124,7 @@ public class IncrementalChangesManager {
if(date.endsWith("00")) { if(date.endsWith("00")) {
monthUpdates.put(monthYear, ru); monthUpdates.put(monthYear, ru);
} else { } else {
if (!dayUpdates.containsKey(date)) { if (!dayUpdates.containsKey(monthYear)) {
dayUpdates.put(monthYear, new ArrayList<IncrementalChangesManager.RegionUpdate>()); dayUpdates.put(monthYear, new ArrayList<IncrementalChangesManager.RegionUpdate>());
} }
dayUpdates.get(monthYear).add(ru); dayUpdates.get(monthYear).add(ru);