Limit listing all files only to "Wikivoyage"

This commit is contained in:
Dima-1 2021-02-16 20:39:19 +02:00
parent 3f976cec15
commit fcc8297cc6
2 changed files with 11 additions and 6 deletions

View file

@ -40,22 +40,22 @@ public class DownloadResources extends DownloadResourceGroup {
private Map<String, String> indexFileNames = new LinkedHashMap<>();
private Map<String, String> indexActivatedFileNames = new LinkedHashMap<>();
private List<IndexItem> rawResources;
private Map<WorldRegion, List<IndexItem> > groupByRegion;
private Map<WorldRegion, List<IndexItem>> groupByRegion;
private List<IndexItem> itemsToUpdate = new ArrayList<>();
public static final String WORLD_SEAMARKS_KEY = "world_seamarks";
public static final String WORLD_SEAMARKS_NAME = "World_seamarks";
public static final String WORLD_SEAMARKS_OLD_KEY = "world_seamarks_basemap";
public static final String WORLD_SEAMARKS_OLD_NAME = "World_seamarks_basemap";
public static final String WIKIVOYAGE_FILE_FILTER = "wikivoyage";
private static final Log LOG = PlatformUtil.getLog(DownloadResources.class);
public DownloadResources(OsmandApplication app) {
super(null, DownloadResourceGroupType.WORLD, "");
this.region = app.getRegions().getWorldRegion();
this.app = app;
}
public List<IndexItem> getItemsToUpdate() {
return itemsToUpdate;
}
@ -365,7 +365,9 @@ public class DownloadResources extends DownloadResourceGroup {
continue;
}
if (ii.getType() == DownloadActivityType.TRAVEL_FILE) {
wikivoyageMaps.addItem(ii);
if (ii.getFileName().contains(WIKIVOYAGE_FILE_FILTER)) {
wikivoyageMaps.addItem(ii);
}
continue;
}
String basename = ii.getBasename().toLowerCase();

View file

@ -46,6 +46,7 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import static net.osmand.plus.download.DownloadResources.WIKIVOYAGE_FILE_FILTER;
import static net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity.*;
public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEvents, TravelLocalDataHelper.Listener {
@ -403,7 +404,9 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
List<IndexItem> allWikivoyageItems = app.getDownloadThread().getIndexes().getWikivoyageItems();
if (allWikivoyageItems != null) {
for (IndexItem item : allWikivoyageItems) {
if (!item.isDownloaded() && !mainItems.contains(item)) {
if (!item.isDownloaded()
&& !mainItems.contains(item)
&& item.getFileName().contains(WIKIVOYAGE_FILE_FILTER)) {
mainItems.add(item);
}
}