Prevent ConcurrentModificationException

This commit is contained in:
Alex Sytnyk 2018-10-11 11:36:34 +03:00
parent 3b09293e9f
commit 1d5de834f1
2 changed files with 6 additions and 2 deletions

View file

@ -50,6 +50,7 @@ public class FavouritesDbHelper {
protected static final String HIDDEN = "HIDDEN";
private static final String DELIMETER = "__";
private boolean favoritesLoaded;
public FavouritesDbHelper(OsmandApplication context) {
this.context = context;
@ -91,12 +92,15 @@ public class FavouritesDbHelper {
saveCurrentPointsIntoFile();
}
favouritesUpdated();
favoritesLoaded = true;
}
private void favouritesUpdated() {
}
public boolean isFavoritesLoaded() {
return favoritesLoaded;
}
private boolean merge(Map<String, FavouritePoint> source, Map<String, FavouritePoint> destination) {
boolean changed = false;

View file

@ -108,7 +108,7 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.
@Override
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
cache.clear();
if (this.settings.SHOW_FAVORITES.get()) {
if (this.settings.SHOW_FAVORITES.get() && favorites.isFavoritesLoaded()) {
if (tileBox.getZoom() >= startZoom) {
float iconSize = FavoriteImageDrawable.getOrCreate(view.getContext(), 0,
true).getIntrinsicWidth() * 3 / 2.5f;