Add display travel obf for developer version only

This commit is contained in:
Dima-1 2020-12-09 10:16:10 +02:00
parent 094b8e04e0
commit 5c71d5181d
2 changed files with 10 additions and 4 deletions

View file

@ -12,6 +12,7 @@ import net.osmand.map.TileSourceManager;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.Version;
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
import net.osmand.plus.voice.JSMediaCommandPlayerImpl;
import net.osmand.plus.voice.JSTTSCommandPlayerImpl;
@ -316,8 +317,9 @@ public class LocalIndexHelper {
private void loadTravelData(File mapPath, List<LocalIndexInfo> result, AbstractLoadLocalIndexTask loadTask) {
if (mapPath.canRead()) {
for (File mapFile : listFilesSorted(mapPath)) {
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT) ||
mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT)) {
if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT)
|| (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT)
&& Version.isDeveloperVersion(app))) { //todo remove when .travel.obf will be used in production
LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.TRAVEL_DATA, mapFile, false, app);
updateDescription(info);
result.add(info);

View file

@ -291,9 +291,13 @@ public class DownloadActivityType {
}
public IndexItem parseIndexItem(Context ctx, XmlPullParser parser) {
public IndexItem parseIndexItem(OsmandApplication ctx, XmlPullParser parser) {
if (TRAVEL_FILE == this && !Version.isDeveloperVersion(ctx)) {
//todo remove "if" when .travel.obf will be used in production
return null;
}
String name = parser.getAttributeValue(null, "name"); //$NON-NLS-1$
if(!isAccepted(name)) {
if (!isAccepted(name)) {
return null;
}
String size = parser.getAttributeValue(null, "size"); //$NON-NLS-1$