From 254014728b70235b5bf198d349a3f83b5d362472 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 13 Mar 2018 18:54:20 +0200 Subject: [PATCH 1/5] Add wptCategoryNames to GPXTrackAnalysis --- .../src/net/osmand/util/Algorithms.java | 24 +++++++- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 56 ++++++++++++++++--- OsmAnd/src/net/osmand/plus/GPXUtilities.java | 34 ++++++++--- .../editors/SelectCategoryDialogFragment.java | 6 +- 4 files changed, 101 insertions(+), 19 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/util/Algorithms.java b/OsmAnd-java/src/net/osmand/util/Algorithms.java index 32a01eb452..c6303810ae 100644 --- a/OsmAnd-java/src/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/net/osmand/util/Algorithms.java @@ -2,7 +2,6 @@ package net.osmand.util; import net.osmand.IProgress; import net.osmand.PlatformUtil; -import net.osmand.binary.BinaryMapIndexReader; import org.apache.commons.logging.Log; @@ -22,6 +21,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; @@ -177,6 +177,28 @@ public class Algorithms { return ""; } + public static List decodeCollection(String s) { + if (isEmpty(s)) { + return Collections.emptyList(); + } + return Arrays.asList(s.split(CHAR_TOSPLIT + "")); + } + + public static String encodeCollection(Collection collection) { + if (collection != null) { + Iterator it = collection.iterator(); + StringBuilder sb = new StringBuilder(); + while (it.hasNext()) { + sb.append(it.next()); + if (it.hasNext()) { + sb.append(CHAR_TOSPLIT); + } + } + return sb.toString(); + } + return ""; + } + public static int findFirstNumberEndIndex(String value) { int i = 0; boolean valid = false; diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index a037e31a65..4d9ca952c6 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -1,5 +1,7 @@ package net.osmand.plus; +import android.annotation.SuppressLint; +import android.os.AsyncTask; import android.support.annotation.Nullable; import net.osmand.IndexConstants; @@ -10,12 +12,13 @@ import net.osmand.util.Algorithms; import java.io.File; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; public class GPXDatabase { private static final String DB_NAME = "gpx_database"; - private static final int DB_VERSION = 6; + private static final int DB_VERSION = 7; private static final String GPX_TABLE_NAME = "gpxTable"; private static final String GPX_COL_NAME = "fileName"; private static final String GPX_COL_DIR = "fileDir"; @@ -47,6 +50,8 @@ public class GPXDatabase { private static final String GPX_COL_API_IMPORTED = "apiImported"; + private static final String GPX_COL_WPT_CATEGORY_NAMES = "wptCategoryNames"; + public static final int GPX_SPLIT_TYPE_NO_SPLIT = -1; public static final int GPX_SPLIT_TYPE_DISTANCE = 1; public static final int GPX_SPLIT_TYPE_TIME = 2; @@ -77,7 +82,8 @@ public class GPXDatabase { GPX_COL_FILE_LAST_MODIFIED_TIME + " long, " + GPX_COL_SPLIT_TYPE + " int, " + GPX_COL_SPLIT_INTERVAL + " double, " + - GPX_COL_API_IMPORTED + " int);"; // 1 = true, 0 = false + GPX_COL_API_IMPORTED + " int, " + // 1 = true, 0 = false + GPX_COL_WPT_CATEGORY_NAMES + " TEXT);"; private static final String GPX_TABLE_SELECT = "SELECT " + GPX_COL_NAME + ", " + @@ -102,7 +108,8 @@ public class GPXDatabase { GPX_COL_FILE_LAST_MODIFIED_TIME + ", " + GPX_COL_SPLIT_TYPE + ", " + GPX_COL_SPLIT_INTERVAL + ", " + - GPX_COL_API_IMPORTED + + GPX_COL_API_IMPORTED + ", " + + GPX_COL_WPT_CATEGORY_NAMES + " FROM " + GPX_TABLE_NAME; private OsmandApplication context; @@ -244,6 +251,37 @@ public class GPXDatabase { " SET " + GPX_COL_API_IMPORTED + " = ? " + "WHERE " + GPX_COL_API_IMPORTED + " IS NULL", new Object[]{0}); } + + if (oldVersion < 7) { + db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_WPT_CATEGORY_NAMES + " TEXT"); + updateWptCategoryNames(); + } + } + + @SuppressLint("StaticFieldLeak") + private void updateWptCategoryNames() { + new AsyncTask() { + @Override + protected Void doInBackground(Void... voids) { + SQLiteConnection db = openConnection(false); + if (db != null) { + try { + for (GpxDataItem item : getItems()) { + GPXUtilities.GPXFile gpxFile = GPXUtilities.loadGPXFile(context, item.file); + String fileName = getFileName(item.file); + String fileDir = getFileDir(item.file); + db.execSQL("UPDATE " + GPX_TABLE_NAME + " SET " + + GPX_COL_WPT_CATEGORY_NAMES + " = ? " + + " WHERE " + GPX_COL_NAME + " = ? AND " + GPX_COL_DIR + " = ?", + new Object[] { Algorithms.encodeCollection(gpxFile.getWaypointCategories(true)), fileName, fileDir }); + } + } finally { + db.close(); + } + } + return null; + } + }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } private boolean updateLastModifiedTime(GpxDataItem item) { @@ -382,11 +420,12 @@ public class GPXDatabase { } if (a != null) { db.execSQL( - "INSERT INTO " + GPX_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT INTO " + GPX_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new Object[]{ fileName, fileDir, a.totalDistance, a.totalTracks, a.startTime, a.endTime, a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown, a.avgElevation, a.minElevation, a.maxElevation, a.maxSpeed, a.avgSpeed, a.points, a.wptPoints, - color, item.file.lastModified(), item.splitType, item.splitInterval, item.apiImported ? 1 : 0}); + color, item.file.lastModified(), item.splitType, item.splitInterval, item.apiImported ? 1 : 0, + Algorithms.encodeCollection(item.analysis.wptCategoryNames)}); } else { db.execSQL("INSERT INTO " + GPX_TABLE_NAME + "(" + GPX_COL_NAME + ", " + @@ -424,13 +463,14 @@ public class GPXDatabase { GPX_COL_AVG_SPEED + " = ?, " + GPX_COL_POINTS + " = ?, " + GPX_COL_WPT_POINTS + " = ?, " + - GPX_COL_FILE_LAST_MODIFIED_TIME + " = ? " + + GPX_COL_FILE_LAST_MODIFIED_TIME + " = ?, " + + GPX_COL_WPT_CATEGORY_NAMES + " = ? " + " WHERE " + GPX_COL_NAME + " = ? AND " + GPX_COL_DIR + " = ?", new Object[]{ a.totalDistance, a.totalTracks, a.startTime, a.endTime, a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown, a.avgElevation, a.minElevation, a.maxElevation, a.maxSpeed, a.avgSpeed, a.points, a.wptPoints, item.file.lastModified(), - fileName, fileDir }); + Algorithms.encodeCollection(a.wptCategoryNames), fileName, fileDir }); } finally { db.close(); } @@ -463,6 +503,7 @@ public class GPXDatabase { int splitType = (int)query.getInt(20); double splitInterval = query.getDouble(21); boolean apiImported = query.getInt(22) == 1; + String wptCategoryNames = query.getString(23); GPXTrackAnalysis a = new GPXTrackAnalysis(); a.totalDistance = totalDistance; @@ -482,6 +523,7 @@ public class GPXDatabase { a.avgSpeed = avgSpeed; a.points = points; a.wptPoints = wptPoints; + a.wptCategoryNames = new HashSet<>(Algorithms.decodeCollection(wptCategoryNames)); File dir; if (!Algorithms.isEmpty(fileDir)) { diff --git a/OsmAnd/src/net/osmand/plus/GPXUtilities.java b/OsmAnd/src/net/osmand/plus/GPXUtilities.java index 307de185fc..977c15c434 100644 --- a/OsmAnd/src/net/osmand/plus/GPXUtilities.java +++ b/OsmAnd/src/net/osmand/plus/GPXUtilities.java @@ -42,10 +42,13 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Set; import java.util.Stack; import java.util.TimeZone; @@ -287,6 +290,8 @@ public class GPXUtilities { public int points; public int wptPoints = 0; + public Set wptCategoryNames; + public double metricEnd; public double secondaryMetricEnd; public WptPt locationStart; @@ -787,6 +792,22 @@ public class GPXUtilities { return Collections.unmodifiableList(points); } + public Map> getPointsByCategories() { + Map> res = new HashMap<>(); + for (WptPt pt : points) { + String category = pt.category == null ? "" : pt.category; + List list = res.get(category); + if (list != null) { + list.add(pt); + } else { + list = new ArrayList<>(); + list.add(pt); + res.put(category, list); + } + } + return res; + } + public boolean isPointsEmpty() { return points.isEmpty(); } @@ -868,6 +889,7 @@ public class GPXUtilities { public GPXTrackAnalysis getAnalysis(long fileTimestamp) { GPXTrackAnalysis g = new GPXTrackAnalysis(); g.wptPoints = points.size(); + g.wptCategoryNames = getWaypointCategories(true); List splitSegments = new ArrayList(); for (int i = 0; i < tracks.size(); i++) { Track subtrack = tracks.get(i); @@ -1167,14 +1189,12 @@ public class GPXUtilities { return count; } - public List getWaypointCategories() { - List categories = new ArrayList<>(); + public Set getWaypointCategories(boolean withDefaultCategory) { + Set categories = new HashSet<>(); for (WptPt pt : points) { - String category = pt.category; - if (!TextUtils.isEmpty(category)) { - if (!categories.contains(category)) { - categories.add(category); - } + String category = pt.category == null ? "" : pt.category; + if (withDefaultCategory || !TextUtils.isEmpty(category)) { + categories.add(category); } } return categories; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java index 87ed37f512..fd0bfa8233 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/SelectCategoryDialogFragment.java @@ -20,11 +20,9 @@ import net.osmand.plus.IconsCache; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.quickaction.QuickAction; -import net.osmand.plus.quickaction.QuickActionFactory; -import net.osmand.plus.quickaction.QuickActionRegistry; import java.util.List; +import java.util.Set; import static android.util.TypedValue.COMPLEX_UNIT_DIP; @@ -69,7 +67,7 @@ public class SelectCategoryDialogFragment extends DialogFragment { final FavouritesDbHelper helper = ((OsmandApplication) getActivity().getApplication()).getFavorites(); if (gpxFile != null) { - List categories = gpxFile.getWaypointCategories(); + Set categories = gpxFile.getWaypointCategories(false); for (final String category : categories) { addCategory(ll, category, 0); } From c2489ff440ea6690d016a4fe18c74266165776b3 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 14 Mar 2018 12:39:56 +0200 Subject: [PATCH 2/5] Make methods for encoding to string and decoding from string for sets, not collections --- .../src/net/osmand/util/Algorithms.java | 21 ++++++++----------- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 9 ++++---- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/util/Algorithms.java b/OsmAnd-java/src/net/osmand/util/Algorithms.java index c6303810ae..8f1bae7cbf 100644 --- a/OsmAnd-java/src/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/net/osmand/util/Algorithms.java @@ -20,11 +20,12 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; /** @@ -177,22 +178,18 @@ public class Algorithms { return ""; } - public static List decodeCollection(String s) { + public static Set decodeStringSet(String s) { if (isEmpty(s)) { - return Collections.emptyList(); + return Collections.emptySet(); } - return Arrays.asList(s.split(CHAR_TOSPLIT + "")); + return new HashSet<>(Arrays.asList(s.split(CHAR_TOSPLIT + ""))); } - public static String encodeCollection(Collection collection) { - if (collection != null) { - Iterator it = collection.iterator(); + public static String encodeStringSet(Set set) { + if (set != null) { StringBuilder sb = new StringBuilder(); - while (it.hasNext()) { - sb.append(it.next()); - if (it.hasNext()) { - sb.append(CHAR_TOSPLIT); - } + for (String s : set) { + sb.append(s).append(CHAR_TOSPLIT); } return sb.toString(); } diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index 4d9ca952c6..983d09fba6 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -12,7 +12,6 @@ import net.osmand.util.Algorithms; import java.io.File; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; public class GPXDatabase { @@ -273,7 +272,7 @@ public class GPXDatabase { db.execSQL("UPDATE " + GPX_TABLE_NAME + " SET " + GPX_COL_WPT_CATEGORY_NAMES + " = ? " + " WHERE " + GPX_COL_NAME + " = ? AND " + GPX_COL_DIR + " = ?", - new Object[] { Algorithms.encodeCollection(gpxFile.getWaypointCategories(true)), fileName, fileDir }); + new Object[] { Algorithms.encodeStringSet(gpxFile.getWaypointCategories(true)), fileName, fileDir }); } } finally { db.close(); @@ -425,7 +424,7 @@ public class GPXDatabase { a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown, a.avgElevation, a.minElevation, a.maxElevation, a.maxSpeed, a.avgSpeed, a.points, a.wptPoints, color, item.file.lastModified(), item.splitType, item.splitInterval, item.apiImported ? 1 : 0, - Algorithms.encodeCollection(item.analysis.wptCategoryNames)}); + Algorithms.encodeStringSet(item.analysis.wptCategoryNames)}); } else { db.execSQL("INSERT INTO " + GPX_TABLE_NAME + "(" + GPX_COL_NAME + ", " + @@ -470,7 +469,7 @@ public class GPXDatabase { a.timeSpan, a.timeMoving, a.totalDistanceMoving, a.diffElevationUp, a.diffElevationDown, a.avgElevation, a.minElevation, a.maxElevation, a.maxSpeed, a.avgSpeed, a.points, a.wptPoints, item.file.lastModified(), - Algorithms.encodeCollection(a.wptCategoryNames), fileName, fileDir }); + Algorithms.encodeStringSet(a.wptCategoryNames), fileName, fileDir }); } finally { db.close(); } @@ -523,7 +522,7 @@ public class GPXDatabase { a.avgSpeed = avgSpeed; a.points = points; a.wptPoints = wptPoints; - a.wptCategoryNames = new HashSet<>(Algorithms.decodeCollection(wptCategoryNames)); + a.wptCategoryNames = Algorithms.decodeStringSet(wptCategoryNames); File dir; if (!Algorithms.isEmpty(fileDir)) { From 7f31a6861b5e807a7dc257efc72eeea514c38431 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 14 Mar 2018 13:27:37 +0200 Subject: [PATCH 3/5] Make updating wpt category names lazy --- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 29 ------------------- ...dTracksGroupBottomSheetDialogFragment.java | 5 +++- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index 983d09fba6..88de874cfe 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -1,7 +1,5 @@ package net.osmand.plus; -import android.annotation.SuppressLint; -import android.os.AsyncTask; import android.support.annotation.Nullable; import net.osmand.IndexConstants; @@ -253,36 +251,9 @@ public class GPXDatabase { if (oldVersion < 7) { db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_WPT_CATEGORY_NAMES + " TEXT"); - updateWptCategoryNames(); } } - @SuppressLint("StaticFieldLeak") - private void updateWptCategoryNames() { - new AsyncTask() { - @Override - protected Void doInBackground(Void... voids) { - SQLiteConnection db = openConnection(false); - if (db != null) { - try { - for (GpxDataItem item : getItems()) { - GPXUtilities.GPXFile gpxFile = GPXUtilities.loadGPXFile(context, item.file); - String fileName = getFileName(item.file); - String fileDir = getFileDir(item.file); - db.execSQL("UPDATE " + GPX_TABLE_NAME + " SET " + - GPX_COL_WPT_CATEGORY_NAMES + " = ? " + - " WHERE " + GPX_COL_NAME + " = ? AND " + GPX_COL_DIR + " = ?", - new Object[] { Algorithms.encodeStringSet(gpxFile.getWaypointCategories(true)), fileName, fileDir }); - } - } finally { - db.close(); - } - } - return null; - } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); - } - private boolean updateLastModifiedTime(GpxDataItem item) { SQLiteConnection db = openConnection(false); if (db != null) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java index d8feb5906e..7f84546256 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java @@ -124,7 +124,10 @@ public class AddTracksGroupBottomSheetDialogFragment extends AddGroupBottomSheet processGPXFolder(gpxFile, sub); } else if (gpxFile.isFile() && gpxFile.getName().toLowerCase().endsWith(".gpx")) { GpxDataItem item = processedDataFiles.get(gpxFile); - if (item == null || item.getFileLastModifiedTime() != gpxFile.lastModified()) { + if (item == null + || item.getFileLastModifiedTime() != gpxFile.lastModified() + || item.getAnalysis().wptCategoryNames == null + || (item.getAnalysis().wptPoints > 0 && item.getAnalysis().wptCategoryNames.isEmpty())) { GPXFile f = GPXUtilities.loadGPXFile(app, gpxFile); GPXTrackAnalysis analysis = f.getAnalysis(gpxFile.lastModified()); if (item == null) { From 52d01bfbc3742457f37606ed4b71ec202a1ce994 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 14 Mar 2018 14:22:17 +0200 Subject: [PATCH 4/5] Leave field "wptCategoryNames" null if is null in the DB --- OsmAnd/src/net/osmand/plus/GPXDatabase.java | 4 +++- .../mapmarkers/AddTracksGroupBottomSheetDialogFragment.java | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/GPXDatabase.java b/OsmAnd/src/net/osmand/plus/GPXDatabase.java index 88de874cfe..25f9350007 100644 --- a/OsmAnd/src/net/osmand/plus/GPXDatabase.java +++ b/OsmAnd/src/net/osmand/plus/GPXDatabase.java @@ -493,7 +493,9 @@ public class GPXDatabase { a.avgSpeed = avgSpeed; a.points = points; a.wptPoints = wptPoints; - a.wptCategoryNames = Algorithms.decodeStringSet(wptCategoryNames); + if (wptCategoryNames != null) { + a.wptCategoryNames = Algorithms.decodeStringSet(wptCategoryNames); + } File dir; if (!Algorithms.isEmpty(fileDir)) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java index 7f84546256..639f243c10 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/AddTracksGroupBottomSheetDialogFragment.java @@ -126,8 +126,7 @@ public class AddTracksGroupBottomSheetDialogFragment extends AddGroupBottomSheet GpxDataItem item = processedDataFiles.get(gpxFile); if (item == null || item.getFileLastModifiedTime() != gpxFile.lastModified() - || item.getAnalysis().wptCategoryNames == null - || (item.getAnalysis().wptPoints > 0 && item.getAnalysis().wptCategoryNames.isEmpty())) { + || item.getAnalysis().wptCategoryNames == null) { GPXFile f = GPXUtilities.loadGPXFile(app, gpxFile); GPXTrackAnalysis analysis = f.getAnalysis(gpxFile.lastModified()); if (item == null) { From 0cd8278637f469c10bdafbfff623222de89ac6dc Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 14 Mar 2018 14:42:41 +0200 Subject: [PATCH 5/5] Add updating of wptCategoryNames to AvailableGPXFragment --- OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index dd72e26959..b0919f094b 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -1582,7 +1582,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment { processGPXFolder(gpxFile, sub); } else if (gpxFile.isFile() && gpxFile.getName().toLowerCase().endsWith(".gpx")) { GpxDataItem item = processedDataFiles.get(gpxFile); - if (item == null || item.getFileLastModifiedTime() != gpxFile.lastModified()) { + if (item == null + || item.getFileLastModifiedTime() != gpxFile.lastModified() + || item.getAnalysis().wptCategoryNames == null) { GPXFile f = GPXUtilities.loadGPXFile(app, gpxFile); GPXTrackAnalysis analysis = f.getAnalysis(gpxFile.lastModified()); if (item == null) {