Change description text; add functionality for reload button

This commit is contained in:
Alexander Sytnyk 2017-06-27 15:01:55 +03:00
parent 0757860f61
commit bc3a601f4e
4 changed files with 20 additions and 2 deletions

View file

@ -20,7 +20,7 @@
<string name="mapillary_menu_edit_text_hint">Type user name</string> <string name="mapillary_menu_edit_text_hint">Type user name</string>
<string name="mapillary_menu_descr_username">View images added by a certain user.</string> <string name="mapillary_menu_descr_username">View images added by a certain user.</string>
<string name="mapillary_menu_title_username">Username</string> <string name="mapillary_menu_title_username">Username</string>
<string name="mapillary_menu_filter_description">You can filter images by the name of the user or by the date.</string> <string name="mapillary_menu_filter_description">You can filter images by the name of the user or by the date, filter apply only for close zoom.</string>
<string name="map_widget_ruler_control_first_mode">Two point ruler</string> <string name="map_widget_ruler_control_first_mode">Two point ruler</string>
<string name="map_widget_ruler_control_second_mode">Radius ruler</string> <string name="map_widget_ruler_control_second_mode">Radius ruler</string>
<string name="shared_string_permissions">Permissions</string> <string name="shared_string_permissions">Permissions</string>

View file

@ -24,11 +24,13 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.map.TileSourceManager;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.resources.ResourceManager;
import net.osmand.plus.views.controls.DelayAutoCompleteTextView; import net.osmand.plus.views.controls.DelayAutoCompleteTextView;
import java.text.DateFormat; import java.text.DateFormat;
@ -97,7 +99,10 @@ public class MapillaryFiltersFragment extends BaseOsmAndFragment {
reloadTile.setOnClickListener(new View.OnClickListener() { reloadTile.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
ResourceManager manager = getMyApplication().getResourceManager();
manager.clearCacheAndTile(TileSourceManager.getMapillaryVectorSource());
manager.clearCacheAndTile(TileSourceManager.getMapillaryRasterSource());
plugin.updateLayers(mapActivity.getMapView(), mapActivity);
} }
}); });

View file

@ -5,6 +5,7 @@ import android.content.Context;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteException;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.support.annotation.NonNull;
import android.text.format.DateFormat; import android.text.format.DateFormat;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.WindowManager; import android.view.WindowManager;
@ -336,6 +337,14 @@ public class ResourceManager {
return cache != null && cache.getTileForMapSync(file, map, x, y, zoom, loadFromInternetIfNeeded) != null; 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 //////////////////////////////////////////////// ////////////////////////////////////////////// Working with indexes ////////////////////////////////////////////////

View file

@ -224,6 +224,10 @@ public abstract class TilesCache<T> {
} }
} }
protected synchronized void clearTileCache(String tileId) {
cache.remove(tileId);
}
public synchronized T get(String key) { public synchronized T get(String key) {
return cache.get(key); return cache.get(key);
} }