Fix #6201 - problems without restart of app for 10 days

This commit is contained in:
Victor Shcherb 2020-03-25 11:57:49 +01:00
parent 01ea4253bf
commit 4e608d3c5c
3 changed files with 13 additions and 11 deletions

View file

@ -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);

View file

@ -198,17 +198,19 @@ public class IncrementalChangesManager {
public List<IncrementalUpdate> getItemsForUpdate() {
Iterator<IncrementalUpdateGroupByMonth> it = updateByMonth.values().iterator();
List<IncrementalUpdate> ll = new ArrayList<IncrementalUpdate>();
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);
}
}
}
}

View file

@ -40,12 +40,13 @@ public class HillshadeLayer extends MapTileLayer {
private final static int MAX_TRANSPARENCY_ALPHA = 20;
private QuadTree<String> indexedResources = new QuadTree<String>(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));
}