Update bitmap cache

This commit is contained in:
Vitaliy 2021-04-12 19:10:02 +03:00
parent 5773a4ca13
commit a0e52f355f

View file

@ -41,9 +41,11 @@ public class AsyncLoadingThread extends Thread {
while (true) { while (true) {
try { try {
updateBitmapTilesCache(); updateBitmapTilesCache();
int cacheCounter = 0;
boolean tileLoaded = false; boolean tileLoaded = false;
boolean mapLoaded = false; boolean mapLoaded = false;
while (!requests.isEmpty()) { while (!requests.isEmpty()) {
cacheCounter++;
Object req = requests.pop(); Object req = requests.pop();
if (req instanceof TileLoadDownloadRequest) { if (req instanceof TileLoadDownloadRequest) {
TileLoadDownloadRequest r = (TileLoadDownloadRequest) req; TileLoadDownloadRequest r = (TileLoadDownloadRequest) req;
@ -58,6 +60,10 @@ public class AsyncLoadingThread extends Thread {
} }
} }
} }
if (cacheCounter == 10) {
cacheCounter = 0;
updateBitmapTilesCache();
}
} }
if (tileLoaded || mapLoaded) { if (tileLoaded || mapLoaded) {
// use downloader callback // use downloader callback