From bc3a601f4ef96291a1514138c96b7d0abdd780cb Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Tue, 27 Jun 2017 15:01:55 +0300 Subject: [PATCH] Change description text; add functionality for reload button --- OsmAnd/res/values/strings.xml | 2 +- .../osmand/plus/mapillary/MapillaryFiltersFragment.java | 7 ++++++- .../src/net/osmand/plus/resources/ResourceManager.java | 9 +++++++++ OsmAnd/src/net/osmand/plus/resources/TilesCache.java | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 501c1f4f30..eed69b3495 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -20,7 +20,7 @@ Type user name View images added by a certain user. Username - You can filter images by the name of the user or by the date. + You can filter images by the name of the user or by the date, filter apply only for close zoom. Two point ruler Radius ruler Permissions diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryFiltersFragment.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryFiltersFragment.java index b7ee384679..1a893db9a6 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryFiltersFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryFiltersFragment.java @@ -24,11 +24,13 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import net.osmand.map.TileSourceManager; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.BaseOsmAndFragment; +import net.osmand.plus.resources.ResourceManager; import net.osmand.plus.views.controls.DelayAutoCompleteTextView; import java.text.DateFormat; @@ -97,7 +99,10 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment { reloadTile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - + ResourceManager manager = getMyApplication().getResourceManager(); + manager.clearCacheAndTile(TileSourceManager.getMapillaryVectorSource()); + manager.clearCacheAndTile(TileSourceManager.getMapillaryRasterSource()); + plugin.updateLayers(mapActivity.getMapView(), mapActivity); } }); diff --git a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java index efe1a43476..b339b1c17c 100644 --- a/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java +++ b/OsmAnd/src/net/osmand/plus/resources/ResourceManager.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.res.AssetManager; import android.database.sqlite.SQLiteException; import android.os.HandlerThread; +import android.support.annotation.NonNull; import android.text.format.DateFormat; import android.util.DisplayMetrics; import android.view.WindowManager; @@ -336,6 +337,14 @@ public class ResourceManager { return cache != null && cache.getTileForMapSync(file, map, x, y, zoom, loadFromInternetIfNeeded) != null; } + public void clearCacheAndTile(@NonNull ITileSource map) { + String path = dirWithTiles.getAbsolutePath() + "/" + map.getName(); + map.clearTiles(path); + TilesCache cache = getTilesCache(map); + if (cache != null) { + cache.clearTileCache(map.getName()); + } + } ////////////////////////////////////////////// Working with indexes //////////////////////////////////////////////// diff --git a/OsmAnd/src/net/osmand/plus/resources/TilesCache.java b/OsmAnd/src/net/osmand/plus/resources/TilesCache.java index cf608a8979..f346e84940 100644 --- a/OsmAnd/src/net/osmand/plus/resources/TilesCache.java +++ b/OsmAnd/src/net/osmand/plus/resources/TilesCache.java @@ -224,6 +224,10 @@ public abstract class TilesCache { } } + protected synchronized void clearTileCache(String tileId) { + cache.remove(tileId); + } + public synchronized T get(String key) { return cache.get(key); }