From a0e52f355fd5492ed58787e0bf46b58675eabd3c Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 12 Apr 2021 19:10:02 +0300 Subject: [PATCH] Update bitmap cache --- .../src/net/osmand/plus/resources/AsyncLoadingThread.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/resources/AsyncLoadingThread.java b/OsmAnd/src/net/osmand/plus/resources/AsyncLoadingThread.java index eccd49f16a..8808b04e7b 100644 --- a/OsmAnd/src/net/osmand/plus/resources/AsyncLoadingThread.java +++ b/OsmAnd/src/net/osmand/plus/resources/AsyncLoadingThread.java @@ -41,9 +41,11 @@ public class AsyncLoadingThread extends Thread { while (true) { try { updateBitmapTilesCache(); + int cacheCounter = 0; boolean tileLoaded = false; boolean mapLoaded = false; while (!requests.isEmpty()) { + cacheCounter++; Object req = requests.pop(); if (req instanceof TileLoadDownloadRequest) { TileLoadDownloadRequest r = (TileLoadDownloadRequest) req; @@ -58,6 +60,10 @@ public class AsyncLoadingThread extends Thread { } } } + if (cacheCounter == 10) { + cacheCounter = 0; + updateBitmapTilesCache(); + } } if (tileLoaded || mapLoaded) { // use downloader callback