From 4e608d3c5c1edeedc30aa4052ad20cd8d2ad1504 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 25 Mar 2020 11:57:49 +0100 Subject: [PATCH] Fix #6201 - problems without restart of app for 10 days --- .../PerformLiveUpdateAsyncTask.java | 1 - .../resources/IncrementalChangesManager.java | 20 ++++++++++--------- .../plus/srtmplugin/HillshadeLayer.java | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java index 85f33191d6..0b6201b6b8 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/PerformLiveUpdateAsyncTask.java @@ -69,7 +69,6 @@ public class PerformLiveUpdateAsyncTask @Override protected void onPostExecute(IncrementalChangesManager.IncrementalUpdateList result) { - LOG.debug("onPostExecute"); if (context instanceof AbstractDownloadActivity) { AbstractDownloadActivity activity = (AbstractDownloadActivity) context; activity.setSupportProgressBarIndeterminateVisibility(false); diff --git a/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java b/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java index 5aa9c24112..2f5ba258f0 100644 --- a/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/IncrementalChangesManager.java @@ -198,17 +198,19 @@ public class IncrementalChangesManager { public List getItemsForUpdate() { Iterator it = updateByMonth.values().iterator(); List ll = new ArrayList(); - while(it.hasNext()) { + while (it.hasNext()) { IncrementalUpdateGroupByMonth n = it.next(); - if(it.hasNext()) { - if(!n.isMonthUpdateApplicable()) { - return null; + if (it.hasNext()) { + if (!n.isMonthUpdateApplicable()) { + return null; } ll.addAll(n.getMonthUpdate()); } else { - if(n.isDayUpdateApplicable() && isPreferrableLimitForDayUpdates(n.monthYearPart, n.getDayUpdates())) { + // it causes problem when person doesn't restart application for 10 days so updates stop working + // && isPreferrableLimitForDayUpdates(n.monthYearPart, n.getDayUpdates()) + if (n.isDayUpdateApplicable() ) { ll.addAll(n.getDayUpdates()); - } else if(n.isMonthUpdateApplicable()) { + } else if (n.isMonthUpdateApplicable()) { ll.addAll(n.getMonthUpdate()); } else { return null; @@ -220,16 +222,16 @@ public class IncrementalChangesManager { public void addUpdate(IncrementalUpdate iu) { String dtMonth = iu.date.substring(0, 5); - if(!updateByMonth.containsKey(dtMonth)) { + if (!updateByMonth.containsKey(dtMonth)) { IncrementalUpdateGroupByMonth iubm = new IncrementalUpdateGroupByMonth(dtMonth); updateByMonth.put(dtMonth, iubm); } IncrementalUpdateGroupByMonth mm = updateByMonth.get(dtMonth); - if(iu.isMonth()) { + if (iu.isMonth()) { mm.monthUpdate = iu; } else { mm.dayUpdates.add(iu); - } + } } } diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeLayer.java b/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeLayer.java index bc6091eff9..7f194c16ec 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeLayer.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/HillshadeLayer.java @@ -40,12 +40,13 @@ public class HillshadeLayer extends MapTileLayer { private final static int MAX_TRANSPARENCY_ALPHA = 20; private QuadTree indexedResources = new QuadTree(new QuadRect(0, 0, 1 << (ZOOM_BOUNDARY+1), 1 << (ZOOM_BOUNDARY+1)), 8, 0.55f); + private final int defaultAlpha; public HillshadeLayer(MapActivity activity, SRTMPlugin srtmPlugin) { super(false); final OsmandApplication app = activity.getMyApplication(); indexHillshadeFiles(app); - setAlpha(DEFAULT_ALPHA); + setAlpha(defaultAlpha); setMap(createTileSource(activity)); }