Create JsonUtils and remove duplicate gpx constant
This commit is contained in:
parent
bc5dbc1270
commit
0e63df1080
27 changed files with 174 additions and 142 deletions
78
OsmAnd/src/net/osmand/JsonUtils.java
Normal file
78
OsmAnd/src/net/osmand/JsonUtils.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package net.osmand;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class JsonUtils {
|
||||
|
||||
public static String getLocalizedResFromMap(Context ctx, Map<String, String> localizedMap, String defVal) {
|
||||
if (!Algorithms.isEmpty(localizedMap)) {
|
||||
Configuration config = ctx.getResources().getConfiguration();
|
||||
String lang = config.locale.getLanguage();
|
||||
String name = localizedMap.get(lang);
|
||||
if (Algorithms.isEmpty(name)) {
|
||||
name = localizedMap.get("");
|
||||
}
|
||||
if (!Algorithms.isEmpty(name)) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return defVal;
|
||||
}
|
||||
|
||||
public static List<String> jsonArrayToList(String key, JSONObject json) throws JSONException {
|
||||
List<String> items = new ArrayList<>();
|
||||
JSONArray jsonArray = json.optJSONArray(key);
|
||||
if (jsonArray != null) {
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
items.add(jsonArray.getString(i));
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public static Map<String, String> getLocalizedMapFromJson(String key, JSONObject json) throws JSONException {
|
||||
Map<String, String> localizedMap = new HashMap<>();
|
||||
JSONObject jsonObject = json.optJSONObject(key);
|
||||
if (jsonObject != null) {
|
||||
for (Iterator<String> it = jsonObject.keys(); it.hasNext(); ) {
|
||||
String localeKey = it.next();
|
||||
String name = jsonObject.getString(localeKey);
|
||||
localizedMap.put(localeKey, name);
|
||||
}
|
||||
}
|
||||
return localizedMap;
|
||||
}
|
||||
|
||||
public static void writeStringListToJson(String key, JSONObject json, List<String> items) throws JSONException {
|
||||
if (!Algorithms.isEmpty(items)) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (String render : items) {
|
||||
jsonArray.put(render);
|
||||
}
|
||||
json.put(key, jsonArray);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeLocalizedMapToJson(String jsonKey, JSONObject json, Map<String, String> map) throws JSONException {
|
||||
if (!Algorithms.isEmpty(map)) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
jsonObject.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
json.put(jsonKey, jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
package net.osmand.plus;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
|
@ -10,6 +8,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.JsonUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.map.ITileSource;
|
||||
|
@ -83,12 +82,12 @@ public class CustomOsmandPlugin extends OsmandPlugin {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return getLocalizedResFromMap(app, names, app.getString(R.string.custom_osmand_plugin));
|
||||
return JsonUtils.getLocalizedResFromMap(app, names, app.getString(R.string.custom_osmand_plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return getLocalizedResFromMap(app, descriptions, null);
|
||||
return JsonUtils.getLocalizedResFromMap(app, descriptions, null);
|
||||
}
|
||||
|
||||
public String getResourceDirName() {
|
||||
|
@ -310,10 +309,10 @@ public class CustomOsmandPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
public void readAdditionalDataFromJson(JSONObject json) throws JSONException {
|
||||
iconNames = getLocalizedMapFromJson("icon", json);
|
||||
imageNames = getLocalizedMapFromJson("image", json);
|
||||
names = getLocalizedMapFromJson("name", json);
|
||||
descriptions = getLocalizedMapFromJson("description", json);
|
||||
iconNames = JsonUtils.getLocalizedMapFromJson("icon", json);
|
||||
imageNames = JsonUtils.getLocalizedMapFromJson("image", json);
|
||||
names = JsonUtils.getLocalizedMapFromJson("name", json);
|
||||
descriptions = JsonUtils.getLocalizedMapFromJson("description", json);
|
||||
|
||||
JSONArray regionsJson = json.optJSONArray("regionsJson");
|
||||
if (regionsJson != null) {
|
||||
|
@ -322,10 +321,10 @@ public class CustomOsmandPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
public void writeAdditionalDataToJson(JSONObject json) throws JSONException {
|
||||
writeLocalizedMapToJson("icon", json, iconNames);
|
||||
writeLocalizedMapToJson("image", json, imageNames);
|
||||
writeLocalizedMapToJson("name", json, names);
|
||||
writeLocalizedMapToJson("description", json, descriptions);
|
||||
JsonUtils.writeLocalizedMapToJson("icon", json, iconNames);
|
||||
JsonUtils.writeLocalizedMapToJson("image", json, imageNames);
|
||||
JsonUtils.writeLocalizedMapToJson("name", json, names);
|
||||
JsonUtils.writeLocalizedMapToJson("description", json, descriptions);
|
||||
|
||||
JSONArray regionsJson = new JSONArray();
|
||||
for (WorldRegion region : getFlatCustomRegions()) {
|
||||
|
@ -352,14 +351,14 @@ public class CustomOsmandPlugin extends OsmandPlugin {
|
|||
}
|
||||
|
||||
public void readDependentFilesFromJson(JSONObject json) throws JSONException {
|
||||
rendererNames = jsonArrayToList("rendererNames", json);
|
||||
routerNames = jsonArrayToList("routerNames", json);
|
||||
rendererNames = JsonUtils.jsonArrayToList("rendererNames", json);
|
||||
routerNames = JsonUtils.jsonArrayToList("routerNames", json);
|
||||
resourceDirName = json.optString("pluginResDir");
|
||||
}
|
||||
|
||||
public void writeDependentFilesJson(JSONObject json) throws JSONException {
|
||||
writeStringListToJson("rendererNames", json, rendererNames);
|
||||
writeStringListToJson("routerNames", json, routerNames);
|
||||
JsonUtils.writeStringListToJson("rendererNames", json, rendererNames);
|
||||
JsonUtils.writeStringListToJson("routerNames", json, routerNames);
|
||||
|
||||
json.put("pluginResDir", resourceDirName);
|
||||
}
|
||||
|
@ -427,7 +426,7 @@ public class CustomOsmandPlugin extends OsmandPlugin {
|
|||
try {
|
||||
return DownloadResources.findIndexItemsAt(app, latLon, type);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOG.error(e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
@ -436,65 +435,6 @@ public class CustomOsmandPlugin extends OsmandPlugin {
|
|||
return DownloadResources.findIndexItemsAt(app, names, type, false, limit);
|
||||
}
|
||||
|
||||
public static String getLocalizedResFromMap(Context ctx, Map<String, String> localizedMap, String defVal) {
|
||||
if (!Algorithms.isEmpty(localizedMap)) {
|
||||
Configuration config = ctx.getResources().getConfiguration();
|
||||
String lang = config.locale.getLanguage();
|
||||
String name = localizedMap.get(lang);
|
||||
if (Algorithms.isEmpty(name)) {
|
||||
name = localizedMap.get("");
|
||||
}
|
||||
if (!Algorithms.isEmpty(name)) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return defVal;
|
||||
}
|
||||
|
||||
public static List<String> jsonArrayToList(String key, JSONObject json) throws JSONException {
|
||||
List<String> items = new ArrayList<>();
|
||||
JSONArray jsonArray = json.optJSONArray(key);
|
||||
if (jsonArray != null) {
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
items.add(jsonArray.getString(i));
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public static Map<String, String> getLocalizedMapFromJson(String key, JSONObject json) throws JSONException {
|
||||
Map<String, String> localizedMap = new HashMap<>();
|
||||
JSONObject jsonObject = json.optJSONObject(key);
|
||||
if (jsonObject != null) {
|
||||
for (Iterator<String> it = jsonObject.keys(); it.hasNext(); ) {
|
||||
String localeKey = it.next();
|
||||
String name = jsonObject.getString(localeKey);
|
||||
localizedMap.put(localeKey, name);
|
||||
}
|
||||
}
|
||||
return localizedMap;
|
||||
}
|
||||
|
||||
public static void writeStringListToJson(String key, JSONObject json, List<String> items) throws JSONException {
|
||||
if (!Algorithms.isEmpty(items)) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
for (String render : items) {
|
||||
jsonArray.put(render);
|
||||
}
|
||||
json.put(key, jsonArray);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeLocalizedMapToJson(String jsonKey, JSONObject json, Map<String, String> map) throws JSONException {
|
||||
if (!Algorithms.isEmpty(map)) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
jsonObject.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
json.put(jsonKey, jsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
public interface PluginItemsListener {
|
||||
|
||||
void onItemsRemoved();
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus;
|
|||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import net.osmand.JsonUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.map.WorldRegion;
|
||||
import net.osmand.plus.download.CustomIndexItem;
|
||||
|
@ -78,7 +79,7 @@ public class CustomRegion extends WorldRegion {
|
|||
region.parentPath = path.substring(0, index);
|
||||
}
|
||||
|
||||
region.names = CustomOsmandPlugin.getLocalizedMapFromJson("name", object);
|
||||
region.names = JsonUtils.getLocalizedMapFromJson("name", object);
|
||||
if (!Algorithms.isEmpty(region.names)) {
|
||||
region.regionName = region.names.get("");
|
||||
region.regionNameEn = region.names.get("");
|
||||
|
@ -86,8 +87,8 @@ public class CustomRegion extends WorldRegion {
|
|||
region.regionNameLocale = region.names.get("");
|
||||
}
|
||||
|
||||
region.icons = CustomOsmandPlugin.getLocalizedMapFromJson("icon", object);
|
||||
region.headers = CustomOsmandPlugin.getLocalizedMapFromJson("header", object);
|
||||
region.icons = JsonUtils.getLocalizedMapFromJson("icon", object);
|
||||
region.headers = JsonUtils.getLocalizedMapFromJson("header", object);
|
||||
|
||||
region.headerButton = object.optString("header-button", null);
|
||||
region.downloadItemsJson = object.optJSONArray("items");
|
||||
|
@ -119,10 +120,10 @@ public class CustomRegion extends WorldRegion {
|
|||
String downloadUrl = itemJson.optString("downloadurl");
|
||||
String size = new DecimalFormat("#.#").format(containerSize / (1024f * 1024f));
|
||||
|
||||
List<String> descrImageUrl = CustomOsmandPlugin.jsonArrayToList("image-description-url", itemJson);
|
||||
Map<String, String> indexNames = CustomOsmandPlugin.getLocalizedMapFromJson("name", itemJson);
|
||||
Map<String, String> descriptions = CustomOsmandPlugin.getLocalizedMapFromJson("description", itemJson);
|
||||
Map<String, String> webButtonText = CustomOsmandPlugin.getLocalizedMapFromJson("web-button-text", itemJson);
|
||||
List<String> descrImageUrl = JsonUtils.jsonArrayToList("image-description-url", itemJson);
|
||||
Map<String, String> indexNames = JsonUtils.getLocalizedMapFromJson("name", itemJson);
|
||||
Map<String, String> descriptions = JsonUtils.getLocalizedMapFromJson("description", itemJson);
|
||||
Map<String, String> webButtonText = JsonUtils.getLocalizedMapFromJson("web-button-text", itemJson);
|
||||
|
||||
DownloadActivityType type = DownloadActivityType.getIndexType(indexType);
|
||||
if (type != null) {
|
||||
|
@ -161,9 +162,9 @@ public class CustomRegion extends WorldRegion {
|
|||
jsonObject.putOpt("subfolder", subfolder);
|
||||
jsonObject.putOpt("header-button", headerButton);
|
||||
|
||||
CustomOsmandPlugin.writeLocalizedMapToJson("name", jsonObject, names);
|
||||
CustomOsmandPlugin.writeLocalizedMapToJson("icon", jsonObject, icons);
|
||||
CustomOsmandPlugin.writeLocalizedMapToJson("header", jsonObject, headers);
|
||||
JsonUtils.writeLocalizedMapToJson("name", jsonObject, names);
|
||||
JsonUtils.writeLocalizedMapToJson("icon", jsonObject, icons);
|
||||
JsonUtils.writeLocalizedMapToJson("header", jsonObject, headers);
|
||||
|
||||
jsonObject.putOpt("items", downloadItemsJson);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.osmand.GPXUtilities.Track;
|
|||
import net.osmand.GPXUtilities.TrkSegment;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IProgress;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
|
@ -241,7 +242,7 @@ public class GpxSelectionHelper {
|
|||
if (i >= 0) {
|
||||
name = name.substring(i + 1);
|
||||
}
|
||||
if (name.toLowerCase().endsWith(".gpx")) {
|
||||
if (name.toLowerCase().endsWith(IndexConstants.GPX_FILE_EXT)) {
|
||||
name = name.substring(0, name.length() - 4);
|
||||
}
|
||||
name = name.replace('_', ' ');
|
||||
|
|
|
@ -1009,10 +1009,10 @@ public class MapMarkersHelper {
|
|||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
File fout = new File(dir, fileName + ".gpx");
|
||||
File fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
fout = new File(dir, fileName + "_" + (++ind) + ".gpx");
|
||||
fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT);
|
||||
}
|
||||
GPXFile file = new GPXFile(Version.getFullVersion(ctx));
|
||||
for (MapMarker marker : mapMarkers) {
|
||||
|
|
|
@ -83,6 +83,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.IndexConstants.GPX_FILE_EXT;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
||||
|
@ -111,7 +112,6 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_S
|
|||
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CHOSEN_PROFILE_TAG;
|
||||
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CONTROL_BUTTON_TAG;
|
||||
import static net.osmand.plus.ContextMenuAdapter.PROFILES_NORMAL_PROFILE_TAG;
|
||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||
|
||||
|
||||
public class MapActivityActions implements DialogProvider {
|
||||
|
@ -282,8 +282,8 @@ public class MapActivityActions implements DialogProvider {
|
|||
fileDir.mkdirs();
|
||||
File toSave = fileDir;
|
||||
if (name.length() > 0) {
|
||||
if (!name.endsWith(GPX_SUFFIX)) {
|
||||
name += GPX_SUFFIX;
|
||||
if (!name.endsWith(GPX_FILE_EXT)) {
|
||||
name += GPX_FILE_EXT;
|
||||
}
|
||||
toSave = new File(fileDir, name);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
if (params.length > 0) {
|
||||
File file = params[0];
|
||||
String fileName = file.getName();
|
||||
GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName.substring(0,fileName.length()-GPX_SUFFIX.length()));
|
||||
GPXFile gpx = app.getRoutingHelper().generateGPXFileWithRoute(fileName.substring(0,fileName.length()-GPX_FILE_EXT.length()));
|
||||
GPXUtilities.writeGpxFile(file, gpx);
|
||||
return app.getString(R.string.route_successfully_saved_at, file.getName());
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.text.format.DateFormat;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
|
@ -209,7 +210,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
// save file
|
||||
for (final String f : data.keySet()) {
|
||||
log.debug("Filename: " + f);
|
||||
File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$
|
||||
File fout = new File(dir, f + IndexConstants.GPX_FILE_EXT);
|
||||
if (!data.get(f).isEmpty()) {
|
||||
WptPt pt = data.get(f).findPointToShow();
|
||||
String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$
|
||||
|
@ -227,10 +228,10 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
|||
}
|
||||
}
|
||||
filenames.add(fileName);
|
||||
fout = new File(dir, fileName + ".gpx"); //$NON-NLS-1$
|
||||
fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
fout = new File(dir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import net.osmand.GPXUtilities;
|
|||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.TrkSegment;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
|
@ -92,7 +93,7 @@ public class TrackActivity extends TabActivity {
|
|||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
if (file != null) {
|
||||
String fn = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
|
||||
String fn = file.getName().replace(IndexConstants.GPX_FILE_EXT, "").replace("/", " ").replace("_", " ");
|
||||
actionBar.setTitle(fn);
|
||||
} else {
|
||||
actionBar.setTitle(getString(R.string.shared_string_currently_recording_track));
|
||||
|
|
|
@ -4,8 +4,8 @@ import android.content.Context;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import net.osmand.JsonUtils;
|
||||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.CustomOsmandPlugin;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class CustomIndexItem extends IndexItem {
|
|||
@Override
|
||||
public String getVisibleName(Context ctx, OsmandRegions osmandRegions, boolean includingParent) {
|
||||
String name = super.getVisibleName(ctx, osmandRegions, includingParent);
|
||||
return CustomOsmandPlugin.getLocalizedResFromMap(ctx, names, name);
|
||||
return JsonUtils.getLocalizedResFromMap(ctx, names, name);
|
||||
}
|
||||
|
||||
public List<String> getDescriptionImageUrl() {
|
||||
|
@ -82,7 +82,7 @@ public class CustomIndexItem extends IndexItem {
|
|||
|
||||
public String getLocalizedDescription(Context ctx) {
|
||||
String description = super.getDescription();
|
||||
return CustomOsmandPlugin.getLocalizedResFromMap(ctx, descriptions, description);
|
||||
return JsonUtils.getLocalizedResFromMap(ctx, descriptions, description);
|
||||
}
|
||||
|
||||
public String getWebUrl() {
|
||||
|
@ -90,7 +90,7 @@ public class CustomIndexItem extends IndexItem {
|
|||
}
|
||||
|
||||
public String getWebButtonText(Context ctx) {
|
||||
return CustomOsmandPlugin.getLocalizedResFromMap(ctx, webButtonTexts, null);
|
||||
return JsonUtils.getLocalizedResFromMap(ctx, webButtonTexts, null);
|
||||
}
|
||||
|
||||
public static class CustomIndexItemBuilder {
|
||||
|
|
|
@ -144,7 +144,7 @@ public class DownloadActivityType {
|
|||
} else if (GPX_FILE == this) {
|
||||
return fileName.endsWith(IndexConstants.GPX_FILE_EXT);
|
||||
} else if (SQLITE_FILE == this) {
|
||||
return fileName.endsWith(IndexConstants.GPX_FILE_EXT);
|
||||
return fileName.endsWith(IndexConstants.SQLITE_EXT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import static com.github.mikephil.charting.components.XAxis.XAxisPosition.BOTTOM;
|
||||
import static net.osmand.IndexConstants.GPX_FILE_EXT;
|
||||
import static net.osmand.binary.RouteDataObject.HEIGHT_UNDEFINED;
|
||||
import static net.osmand.plus.OsmAndFormatter.FEET_IN_ONE_METER;
|
||||
import static net.osmand.plus.OsmAndFormatter.METERS_IN_KILOMETER;
|
||||
|
@ -307,8 +308,8 @@ public class GpxUiHelper {
|
|||
|
||||
public static String getGpxTitle(String fileName) {
|
||||
String s = fileName;
|
||||
if (s.toLowerCase().endsWith(".gpx")) {
|
||||
s = s.substring(0, s.length() - ".gpx".length());
|
||||
if (s.toLowerCase().endsWith(GPX_FILE_EXT)) {
|
||||
s = s.substring(0, s.length() - GPX_FILE_EXT.length());
|
||||
}
|
||||
s = s.replace('_', ' ');
|
||||
return s;
|
||||
|
@ -901,7 +902,7 @@ public class GpxUiHelper {
|
|||
File[] files = dir.listFiles();
|
||||
if (files != null) {
|
||||
for (File f : files) {
|
||||
if (f.getName().toLowerCase().endsWith(".gpx")) { //$NON-NLS-1$
|
||||
if (f.getName().toLowerCase().endsWith(GPX_FILE_EXT)) {
|
||||
list.add(new GPXInfo(absolutePath ? f.getAbsolutePath() :
|
||||
parent + f.getName(), f.lastModified(), f.length()));
|
||||
} else if (f.isDirectory()) {
|
||||
|
|
|
@ -84,6 +84,7 @@ import java.util.Map;
|
|||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
import static net.osmand.IndexConstants.GPX_FILE_EXT;
|
||||
import static net.osmand.IndexConstants.OSMAND_SETTINGS_FILE_EXT;
|
||||
import static net.osmand.IndexConstants.RENDERER_INDEX_EXT;
|
||||
import static net.osmand.IndexConstants.ROUTING_FILE_EXT;
|
||||
|
@ -99,7 +100,7 @@ public class ImportHelper {
|
|||
public final static Log log = PlatformUtil.getLog(ImportHelper.class);
|
||||
public static final String KML_SUFFIX = ".kml";
|
||||
public static final String KMZ_SUFFIX = ".kmz";
|
||||
public static final String GPX_SUFFIX = ".gpx";
|
||||
|
||||
private final AppCompatActivity activity;
|
||||
private final OsmandApplication app;
|
||||
private final OsmandMapTileView mapView;
|
||||
|
@ -146,8 +147,8 @@ public class ImportHelper {
|
|||
boolean isOsmandSubdir = isSubDirectory(app.getAppPath(IndexConstants.GPX_INDEX_DIR), new File(contentUri.getPath()));
|
||||
if (!isOsmandSubdir && name != null) {
|
||||
String nameLC = name.toLowerCase();
|
||||
if (nameLC.endsWith(GPX_SUFFIX)) {
|
||||
name = name.substring(0, name.length() - 4) + GPX_SUFFIX;
|
||||
if (nameLC.endsWith(GPX_FILE_EXT)) {
|
||||
name = name.substring(0, name.length() - 4) + GPX_FILE_EXT;
|
||||
handleGpxImport(contentUri, name, true, useImportDir);
|
||||
return true;
|
||||
} else if (nameLC.endsWith(KML_SUFFIX)) {
|
||||
|
@ -1046,14 +1047,14 @@ public class ImportHelper {
|
|||
private File getFileToSave(final String fileName, final File importDir, final WptPt pt) {
|
||||
final StringBuilder builder = new StringBuilder(fileName);
|
||||
if ("".equals(fileName)) {
|
||||
builder.append("import_").append(new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time))).append(GPX_SUFFIX); //$NON-NLS-1$
|
||||
builder.append("import_").append(new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time))).append(GPX_FILE_EXT); //$NON-NLS-1$
|
||||
}
|
||||
if (fileName.endsWith(KML_SUFFIX)) {
|
||||
builder.replace(builder.length() - KML_SUFFIX.length(), builder.length(), GPX_SUFFIX);
|
||||
builder.replace(builder.length() - KML_SUFFIX.length(), builder.length(), GPX_FILE_EXT);
|
||||
} else if (fileName.endsWith(KMZ_SUFFIX)) {
|
||||
builder.replace(builder.length() - KMZ_SUFFIX.length(), builder.length(), GPX_SUFFIX);
|
||||
} else if (!fileName.endsWith(GPX_SUFFIX)) {
|
||||
builder.append(GPX_SUFFIX);
|
||||
builder.replace(builder.length() - KMZ_SUFFIX.length(), builder.length(), GPX_FILE_EXT);
|
||||
} else if (!fileName.endsWith(GPX_FILE_EXT)) {
|
||||
builder.append(GPX_FILE_EXT);
|
||||
}
|
||||
return new File(importDir, builder.toString());
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import androidx.core.content.ContextCompat;
|
|||
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
|
@ -113,7 +114,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
|
|||
if (points.size() > 0) {
|
||||
String title = view.getContext().getString(R.string.context_menu_points_of_group);
|
||||
File file = new File(gpx.path);
|
||||
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
|
||||
String gpxName = file.getName().replace(IndexConstants.GPX_FILE_EXT, "").replace("/", " ").replace("_", " ");
|
||||
int color = getPointColor(wpt, getFileColor(selectedGpxFile));
|
||||
buildRow(view, app.getUIUtilities().getPaintedIcon(R.drawable.ic_type_waypoints_group, color), null, title, 0, gpxName,
|
||||
true, getCollapsableWaypointsView(view.getContext(), true, gpx, wpt),
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
|
@ -115,7 +116,7 @@ public class WptPtMenuController extends MenuController {
|
|||
sb.append(", ");
|
||||
if (selectedGpxFile != null) {
|
||||
File file = new File(selectedGpxFile.getGpxFile().path);
|
||||
String gpxName = file.getName().replace(".gpx", "").replace("/", " ").replace("_", " ");
|
||||
String gpxName = file.getName().replace(IndexConstants.GPX_FILE_EXT, "").replace("/", " ").replace("_", " ");
|
||||
sb.append(gpxName);
|
||||
}
|
||||
return sb.toString();
|
||||
|
|
|
@ -172,7 +172,7 @@ public class AddTracksGroupBottomSheetDialogFragment extends AddGroupBottomSheet
|
|||
String sub = gpxSubfolder.length() == 0 ?
|
||||
gpxFile.getName() : gpxSubfolder + "/" + gpxFile.getName();
|
||||
processGPXFolder(gpxFile, sub);
|
||||
} else if (gpxFile.isFile() && gpxFile.getName().toLowerCase().endsWith(".gpx")) {
|
||||
} else if (gpxFile.isFile() && gpxFile.getName().toLowerCase().endsWith(IndexConstants.GPX_FILE_EXT)) {
|
||||
GpxDataItem item = dbHelper.getItem(gpxFile, gpxDataItemCallback);
|
||||
publishProgress(item);
|
||||
}
|
||||
|
|
|
@ -1494,10 +1494,10 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
|
|||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
File fout = new File(dir, fileName + ".gpx");
|
||||
File fout = new File(dir, fileName + IndexConstants.GPX_FILE_EXT);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
fout = new File(dir, fileName + "_" + (++ind) + ".gpx");
|
||||
fout = new File(dir, fileName + "_" + (++ind) + IndexConstants.GPX_FILE_EXT);
|
||||
}
|
||||
GPXUtilities.writeGpxFile(fout, gpx);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.osmand.plus.widgets.OsmandTextFieldBoxes;
|
|||
import java.io.File;
|
||||
import java.util.Date;
|
||||
|
||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||
import static net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.ADDED_POINTS_NUMBER_KEY;
|
||||
|
||||
public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragment {
|
||||
|
@ -98,11 +97,11 @@ public class SaveAsTrackBottomSheetDialogFragment extends BottomSheetDialogFragm
|
|||
Date date = new Date();
|
||||
final String suggestedName = app.getString(R.string.markers) + "_" + DateFormat.format("yyyy-MM-dd", date).toString();
|
||||
String displayedName = suggestedName;
|
||||
File fout = new File(dir, suggestedName + GPX_SUFFIX);
|
||||
File fout = new File(dir, suggestedName + IndexConstants.GPX_FILE_EXT);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
displayedName = suggestedName + "_" + (++ind);
|
||||
fout = new File(dir, displayedName + GPX_SUFFIX);
|
||||
fout = new File(dir, displayedName + IndexConstants.GPX_FILE_EXT);
|
||||
}
|
||||
final EditText nameEditText = (EditText) mainView.findViewById(R.id.name_edit_text);
|
||||
nameEditText.setText(displayedName);
|
||||
|
|
|
@ -10,6 +10,7 @@ import androidx.annotation.Nullable;
|
|||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
|
@ -161,7 +162,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
|
|||
|
||||
private String getGpxName(GPXFile gpxFile) {
|
||||
return new File(gpxFile.path).getName()
|
||||
.replace(".gpx", "")
|
||||
.replace(IndexConstants.GPX_FILE_EXT, "")
|
||||
.replace("/", " ")
|
||||
.replace("_", " ");
|
||||
}
|
||||
|
|
|
@ -404,7 +404,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
if (groupName.equals("")) {
|
||||
groupName = app.getString(R.string.shared_string_favorites);
|
||||
} else if (group.getType() == MapMarkersGroup.GPX_TYPE) {
|
||||
groupName = groupName.replace(".gpx", "").replace("/", " ").replace("_", " ");
|
||||
groupName = groupName.replace(IndexConstants.GPX_FILE_EXT, "").replace("/", " ").replace("_", " ");
|
||||
}
|
||||
if (group.isDisabled()) {
|
||||
headerString = groupName;
|
||||
|
|
|
@ -7,6 +7,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import net.osmand.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.GPXDatabase.GpxDataItem;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
|
@ -33,7 +34,7 @@ public class TracksGroupsAdapter extends GroupsAdapter {
|
|||
GpxDataItem gpx = getItem(position);
|
||||
MapMarkersGroupViewHolder markersGroupViewHolder = (MapMarkersGroupViewHolder) holder;
|
||||
markersGroupViewHolder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_polygom_dark));
|
||||
markersGroupViewHolder.name.setText(gpx.getFile().getName().replace(".gpx", "").replace("/", " ").replace("_", " "));
|
||||
markersGroupViewHolder.name.setText(gpx.getFile().getName().replace(IndexConstants.GPX_FILE_EXT, "").replace("/", " ").replace("_", " "));
|
||||
GPXTrackAnalysis analysis = gpx.getAnalysis();
|
||||
markersGroupViewHolder.numberCount.setText(analysis != null ? String.valueOf(analysis.wptPoints) : "");
|
||||
String description = getDescription(gpx);
|
||||
|
|
|
@ -81,7 +81,8 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||
import static net.osmand.IndexConstants.GPX_FILE_EXT;
|
||||
|
||||
|
||||
public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||
|
||||
|
@ -1171,11 +1172,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
|
||||
final String suggestedName = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
String displayedName = suggestedName;
|
||||
File fout = new File(dir, suggestedName + GPX_SUFFIX);
|
||||
File fout = new File(dir, suggestedName + GPX_FILE_EXT);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
displayedName = suggestedName + "_" + (++ind);
|
||||
fout = new File(dir, displayedName + GPX_SUFFIX);
|
||||
fout = new File(dir, displayedName + GPX_FILE_EXT);
|
||||
}
|
||||
nameEt.setText(displayedName);
|
||||
nameEt.setSelection(displayedName.length());
|
||||
|
@ -1188,12 +1189,12 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final String name = nameEt.getText().toString();
|
||||
String fileName = name + GPX_SUFFIX;
|
||||
String fileName = name + GPX_FILE_EXT;
|
||||
if (textChanged[0]) {
|
||||
File fout = new File(dir, fileName);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
fileName = name + "_" + (++ind) + GPX_SUFFIX;
|
||||
fileName = name + "_" + (++ind) + GPX_FILE_EXT;
|
||||
fout = new File(dir, fileName);
|
||||
}
|
||||
}
|
||||
|
@ -1217,7 +1218,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (new File(dir, editable.toString() + GPX_SUFFIX).exists()) {
|
||||
if (new File(dir, editable.toString() + GPX_FILE_EXT).exists()) {
|
||||
warningTextView.setVisibility(View.VISIBLE);
|
||||
warningTextView.setText(R.string.file_with_name_already_exists);
|
||||
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);
|
||||
|
@ -1277,7 +1278,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
TrkSegment after = editingCtx.getAfterTrkSegmentLine();
|
||||
if (gpx == null) {
|
||||
toSave = new File(dir, fileName);
|
||||
String trackName = fileName.substring(0, fileName.length() - GPX_SUFFIX.length());
|
||||
String trackName = fileName.substring(0, fileName.length() - GPX_FILE_EXT.length());
|
||||
GPXFile gpx = new GPXFile(Version.getFullVersion(activity.getMyApplication()));
|
||||
if (measurementLayer != null) {
|
||||
if (saveType == SaveType.LINE) {
|
||||
|
@ -1534,11 +1535,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (showOnMapToggle.isChecked()) {
|
||||
final String name = new SimpleDateFormat("yyyy-MM-dd_HH-mm_EEE", Locale.US).format(new Date());
|
||||
String fileName = name + GPX_SUFFIX;
|
||||
String fileName = name + GPX_FILE_EXT;
|
||||
File fout = new File(dir, fileName);
|
||||
int ind = 1;
|
||||
while (fout.exists()) {
|
||||
fileName = name + "_" + (++ind) + GPX_SUFFIX;
|
||||
fileName = name + "_" + (++ind) + GPX_FILE_EXT;
|
||||
fout = new File(dir, fileName);
|
||||
}
|
||||
saveNewGpx(dir, fileName, true, SaveType.LINE, true);
|
||||
|
|
|
@ -25,6 +25,7 @@ import androidx.fragment.app.FragmentManager;
|
|||
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
|
@ -74,7 +75,7 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment {
|
|||
}
|
||||
|
||||
Context ctx = requireContext();
|
||||
file = new File(app.getAppCustomization().getTracksDir(), savedGpxName + ".gpx");
|
||||
file = new File(app.getAppCustomization().getTracksDir(), savedGpxName + IndexConstants.GPX_FILE_EXT);
|
||||
final boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
final int textPrimaryColor = nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light;
|
||||
View mainView = UiUtilities.getInflater(ctx, nightMode).inflate(R.layout.fragment_on_save_current_track, container);
|
||||
|
@ -175,7 +176,7 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment {
|
|||
return null;
|
||||
}
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
File savedFile = new File(app.getAppCustomization().getTracksDir(), new File(savedGpxDir, savedGpxName + ".gpx").getPath());
|
||||
File savedFile = new File(app.getAppCustomization().getTracksDir(), new File(savedGpxDir, savedGpxName + IndexConstants.GPX_FILE_EXT).getPath());
|
||||
if (savedGpxName.equalsIgnoreCase(newGpxName)) {
|
||||
return savedFile;
|
||||
}
|
||||
|
@ -183,7 +184,7 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment {
|
|||
Toast.makeText(app, R.string.empty_filename, Toast.LENGTH_LONG).show();
|
||||
return null;
|
||||
}
|
||||
return LocalIndexesFragment.renameGpxFile(app, savedFile, newGpxName + ".gpx", true, null);
|
||||
return LocalIndexesFragment.renameGpxFile(app, savedFile, newGpxName + IndexConstants.GPX_FILE_EXT, true, null);
|
||||
}
|
||||
|
||||
private void showOnMap(File f, boolean animated) {
|
||||
|
|
|
@ -978,7 +978,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
|||
String sub = gpxSubfolder.length() == 0 ? gpxFile.getName() : gpxSubfolder + "/"
|
||||
+ gpxFile.getName();
|
||||
loadGPXFolder(gpxFile, result, loadTask, progress, sub);
|
||||
} else if (gpxFile.isFile() && gpxFile.getName().toLowerCase().endsWith(".gpx")) {
|
||||
} else if (gpxFile.isFile() && gpxFile.getName().toLowerCase().endsWith(IndexConstants.GPX_FILE_EXT)) {
|
||||
GpxInfo info = new GpxInfo();
|
||||
info.subfolder = gpxSubfolder;
|
||||
info.file = gpxFile;
|
||||
|
@ -1233,7 +1233,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement
|
|||
v.findViewById(R.id.group_divider).setVisibility(View.VISIBLE);
|
||||
|
||||
StringBuilder t = new StringBuilder();
|
||||
String groupName = group.replaceAll("_", " ").replace(".gpx", "");
|
||||
String groupName = group.replaceAll("_", " ").replace(IndexConstants.GPX_FILE_EXT, "");
|
||||
if (groupName.length() == 0) {
|
||||
groupName = getString(R.string.shared_string_tracks);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import net.osmand.Collator;
|
|||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.OsmAndCollator;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -1269,7 +1270,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
|
|||
dir.mkdir();
|
||||
}
|
||||
for (final String f : files.keySet()) {
|
||||
File fout = new File(dir, f + ".gpx");
|
||||
File fout = new File(dir, f + IndexConstants.GPX_FILE_EXT);
|
||||
GPXUtilities.writeGpxFile(fout, gpx);
|
||||
}
|
||||
return shouldClearPath;
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.GPXUtilities.WptPt;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.edit.Entity;
|
||||
import net.osmand.osm.edit.Node;
|
||||
|
@ -800,7 +801,7 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo
|
|||
} else {
|
||||
sb.append("osm_modification");
|
||||
}
|
||||
sb.append(oscFile ? ".osc" : ".gpx");
|
||||
sb.append(oscFile ? ".osc" : IndexConstants.GPX_FILE_EXT);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ public class DataStorageHelper {
|
|||
|
||||
tracksMemory = DataStorageMemoryItem.builder()
|
||||
.setKey(TRACKS_MEMORY)
|
||||
// .setExtensions(".gpx", ".gpx.bz2")
|
||||
// .setExtensions(IndexConstants.GPX_FILE_EXT, ".gpx.bz2")
|
||||
.setDirectories(
|
||||
new Directory(app.getAppPath(IndexConstants.GPX_INDEX_DIR).getAbsolutePath(), true, EXTENSIONS, false))
|
||||
.createItem();
|
||||
|
|
|
@ -633,7 +633,8 @@ public class TravelDbHelper {
|
|||
}
|
||||
|
||||
public String getGPXName(TravelArticle article) {
|
||||
return article.getTitle().replace('/', '_').replace('\'', '_').replace('\"', '_') + ".gpx";
|
||||
return article.getTitle().replace('/', '_').replace('\'', '_')
|
||||
.replace('\"', '_') + IndexConstants.GPX_FILE_EXT;
|
||||
}
|
||||
|
||||
public File createGpxFile(TravelArticle article) {
|
||||
|
|
Loading…
Reference in a new issue