diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index dc262a8b1b..5209a248b3 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -11,6 +11,7 @@
Thx - Hardy
-->
+ Markers history
OsmAnd Live subscription is on hold
OsmAnd Live subscription has been paused
OsmAnd Live subscription has been expired
diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java
index ec3a9c1e10..de3f073bdc 100644
--- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java
+++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java
@@ -55,8 +55,8 @@ import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.GPXDatabase.GpxDataItem;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.SQLiteTileSource;
diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java
index 58690a9a3b..b172d08242 100644
--- a/OsmAnd/src/net/osmand/plus/AppInitializer.java
+++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java
@@ -41,6 +41,7 @@ import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.inapp.InAppPurchaseHelperImpl;
import net.osmand.plus.liveupdates.LiveUpdatesHelper;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.monitoring.LiveMonitoringHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.poi.PoiFiltersHelper;
diff --git a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
index 22beca7cbe..c1db6114bc 100644
--- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
+++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java
@@ -16,7 +16,8 @@ import net.osmand.PlatformUtil;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
import net.osmand.util.Algorithms;
diff --git a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java
index 923bbe646a..2651e7b988 100644
--- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java
+++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java
@@ -23,7 +23,8 @@ import net.osmand.PlatformUtil;
import net.osmand.StateChangedListener;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXDatabase.GpxDataItem;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetAxisType;
diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
index b57d94dc3a..539db520ae 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
@@ -63,6 +63,7 @@ import net.osmand.plus.helpers.enums.MetricsConstants;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.monitoring.LiveMonitoringHelper;
import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.quickaction.QuickActionRegistry;
diff --git a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java
index 4b2079a573..001868e7b4 100644
--- a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java
@@ -27,8 +27,8 @@ import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
index b1a625d27e..866503f477 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
@@ -41,7 +41,7 @@ import net.osmand.data.PointDescription;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
-import net.osmand.plus.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.backend.OsmandSettings;
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 80a7ae8c4f..9dfe4f46d1 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -67,8 +67,8 @@ import net.osmand.plus.AppInitializer;
import net.osmand.plus.AppInitializer.AppInitializeListener;
import net.osmand.plus.AppInitializer.InitEvents;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
-import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.OnDismissDialogFragmentListener;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndLocationSimulation;
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
index 294b382ca4..08fef7dd77 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java
@@ -39,8 +39,8 @@ import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.ContextMenuItem.ItemBuilder;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java
index 601fb62909..9c6c6c2e7e 100644
--- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java
@@ -13,8 +13,8 @@ import net.osmand.data.LatLon;
import net.osmand.data.RotatedTileBox;
import net.osmand.map.IMapLocationListener;
import net.osmand.map.WorldRegion;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
@@ -88,7 +88,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
@Override
- public void onMapMarkerChanged(MapMarkersHelper.MapMarker mapMarker) {
+ public void onMapMarkerChanged(MapMarker mapMarker) {
}
@Override
diff --git a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java
index 91d9a6f255..6222663a00 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java
@@ -31,8 +31,8 @@ import net.osmand.data.PointDescription;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
diff --git a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java
index 9e5aaa5254..a07584eb79 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java
@@ -11,7 +11,7 @@ import net.osmand.PlatformUtil;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.map.TileSourceManager;
-import net.osmand.plus.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
@@ -207,7 +207,7 @@ public class IntentHelper {
if (intent.hasExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS)) {
Bundle openMapMarkersGroupsExtra = intent.getBundleExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS);
if (openMapMarkersGroupsExtra != null) {
- MapMarkersDialogFragment.showInstance(mapActivity, openMapMarkersGroupsExtra.getString(MapMarkersHelper.MapMarkersGroup.MARKERS_SYNC_GROUP_ID));
+ MapMarkersDialogFragment.showInstance(mapActivity, openMapMarkersGroupsExtra.getString(MapMarkersGroup.MARKERS_SYNC_GROUP_ID));
}
mapActivity.setIntent(null);
}
diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java
index 37bbbfda1a..a90247e644 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java
@@ -10,7 +10,7 @@ import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
index 226216be06..1bb1e1146e 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java
@@ -25,8 +25,8 @@ import net.osmand.data.TransportStop;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
-import net.osmand.plus.MapMarkersHelper.MapMarkerChangedListener;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
index 55fc56b3b8..d2c1cf155a 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java
@@ -32,7 +32,7 @@ import net.osmand.data.TransportStop;
import net.osmand.map.OsmandRegions;
import net.osmand.map.WorldRegion;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java
index 06ade3cc26..aa65a39e90 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java
@@ -12,7 +12,7 @@ import net.osmand.data.TransportStop;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiFilter;
import net.osmand.osm.PoiType;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
index 9659ecd40b..84ced6c613 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java
@@ -14,8 +14,8 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.TransportStop;
import net.osmand.plus.FavouritesDbHelper;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
index b8f5789d47..29bc7c01aa 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java
@@ -11,8 +11,8 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import net.osmand.data.PointDescription;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java
index 3c1ce7d9f4..f436fb03fb 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java
@@ -11,8 +11,8 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.PointImageDrawable;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditor.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditor.java
index b90cd2c334..ca97d1679f 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditor.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditor.java
@@ -2,7 +2,7 @@ package net.osmand.plus.mapcontextmenu.editors;
import androidx.annotation.NonNull;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.activities.MapActivity;
public class MapMarkerEditor extends PointEditor {
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditorFragment.java
index ac0f69e37f..e580edd6eb 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditorFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/MapMarkerEditorFragment.java
@@ -14,7 +14,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import net.osmand.data.PointDescription;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java
index 26062bafc4..eaf3cc994b 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java
@@ -17,8 +17,8 @@ import net.osmand.GPXUtilities.WptPt;
import net.osmand.data.LatLon;
import net.osmand.data.WptLocationPoint;
import net.osmand.plus.GpxSelectionHelper;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
index 92d6368a04..c973009798 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java
@@ -20,8 +20,8 @@ import net.osmand.data.FavouritePoint.BackgroundType;
import net.osmand.data.LatLon;
import net.osmand.data.WptLocationPoint;
import net.osmand.plus.GpxSelectionHelper;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java
new file mode 100644
index 0000000000..aef2f28afd
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java
@@ -0,0 +1,24 @@
+package net.osmand.plus.mapmarkers;
+
+import androidx.annotation.DrawableRes;
+
+public class CategoriesSubHeader {
+
+ @DrawableRes
+ private int iconRes;
+ private MapMarkersGroup group;
+
+ public CategoriesSubHeader(int iconRes, MapMarkersGroup group) {
+ this.iconRes = iconRes;
+ this.group = group;
+ }
+
+ @DrawableRes
+ public int getIconRes() {
+ return iconRes;
+ }
+
+ public MapMarkersGroup getGroup() {
+ return group;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
index aef217f347..09eef3d06c 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java
@@ -63,7 +63,6 @@ import net.osmand.GPXUtilities.WptPt;
import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.plus.GpxSelectionHelper;
-import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
@@ -79,7 +78,6 @@ import net.osmand.plus.mapmarkers.CoordinateInputFormats.DDM;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.DMS;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
import net.osmand.plus.mapmarkers.adapters.CoordinateInputAdapter;
-import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.widgets.EditTextEx;
import net.osmand.util.Algorithms;
import net.osmand.util.LocationParser;
@@ -171,7 +169,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
private void syncGpx(GPXFile gpxFile) {
MapMarkersHelper helper = getMyApplication().getMapMarkersHelper();
- MapMarkersHelper.MapMarkersGroup group = helper.getMarkersGroup(gpxFile);
+ MapMarkersGroup group = helper.getMarkersGroup(gpxFile);
if (group != null) {
helper.runSynchronization(group);
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java b/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java
new file mode 100644
index 0000000000..c5c97a1c2e
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java
@@ -0,0 +1,24 @@
+package net.osmand.plus.mapmarkers;
+
+import androidx.annotation.DrawableRes;
+
+public class GroupHeader {
+
+ @DrawableRes
+ private int iconRes;
+ private MapMarkersGroup group;
+
+ public GroupHeader(int iconRes, MapMarkersGroup group) {
+ this.iconRes = iconRes;
+ this.group = group;
+ }
+
+ @DrawableRes
+ public int getIconRes() {
+ return iconRes;
+ }
+
+ public MapMarkersGroup getGroup() {
+ return group;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java
index a1a3eaf82b..a1cb1cafe6 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java
@@ -3,7 +3,6 @@ package net.osmand.plus.mapmarkers;
import android.os.Bundle;
import android.view.View;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java
new file mode 100644
index 0000000000..498c36f93c
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java
@@ -0,0 +1,149 @@
+package net.osmand.plus.mapmarkers;
+
+import android.content.Context;
+
+import androidx.annotation.ColorInt;
+import androidx.core.content.ContextCompat;
+
+import net.osmand.GPXUtilities.WptPt;
+import net.osmand.data.FavouritePoint;
+import net.osmand.data.LatLon;
+import net.osmand.data.LocationPoint;
+import net.osmand.data.PointDescription;
+import net.osmand.plus.R;
+import net.osmand.util.Algorithms;
+
+import static net.osmand.data.PointDescription.POINT_TYPE_MAP_MARKER;
+
+public class MapMarker implements LocationPoint {
+
+ private static int[] colors;
+
+ public String id;
+ public LatLon point;
+ private PointDescription pointDescription;
+ public int colorIndex;
+ public int index;
+ public boolean history;
+ public boolean selected;
+ public int dist;
+ public long creationDate;
+ public long visitedDate;
+ public String nextKey;
+ public String groupKey;
+ public String groupName;
+ public WptPt wptPt;
+ public FavouritePoint favouritePoint;
+ public String mapObjectName;
+
+ public MapMarker(LatLon point, PointDescription name, int colorIndex, boolean selected, int index) {
+ this.point = point;
+ this.pointDescription = name;
+ this.colorIndex = colorIndex;
+ this.selected = selected;
+ this.index = index;
+ }
+
+ public int getType() {
+ return favouritePoint == null ?
+ (wptPt == null ? MapMarkersGroup.ANY_TYPE : MapMarkersGroup.GPX_TYPE) :
+ MapMarkersGroup.FAVORITES_TYPE;
+ }
+
+ public PointDescription getPointDescription(Context ctx) {
+ return new PointDescription(POINT_TYPE_MAP_MARKER, ctx.getString(R.string.map_marker), getOnlyName());
+ }
+
+ public String getName(Context ctx) {
+ String name;
+ PointDescription pd = getPointDescription(ctx);
+ if (Algorithms.isEmpty(pd.getName())) {
+ name = pd.getTypeName();
+ } else {
+ name = pd.getName();
+ }
+ return name;
+ }
+
+ public PointDescription getOriginalPointDescription() {
+ return pointDescription;
+ }
+
+ public void setOriginalPointDescription(PointDescription pointDescription) {
+ this.pointDescription = pointDescription;
+ }
+
+ public String getOnlyName() {
+ return pointDescription == null ? "" : pointDescription.getName();
+ }
+
+ public double getLatitude() {
+ return point.getLatitude();
+ }
+
+ public double getLongitude() {
+ return point.getLongitude();
+ }
+
+ @Override
+ public int getColor() {
+ return 0;
+ }
+
+ @Override
+ public boolean isVisible() {
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ MapMarker mapMarker = (MapMarker) o;
+
+ return colorIndex == mapMarker.colorIndex && point.equals(mapMarker.point);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = point.hashCode();
+ result = 31 * result + colorIndex;
+ return result;
+ }
+
+ private static final int[] colorsIds = new int[] {
+ R.color.marker_blue,
+ R.color.marker_green,
+ R.color.marker_orange,
+ R.color.marker_red,
+ R.color.marker_yellow,
+ R.color.marker_teal,
+ R.color.marker_purple
+ };
+
+ public static int[] getColors(Context context) {
+ if (colors != null) {
+ return colors;
+ }
+ colors = new int[colorsIds.length];
+ for (int i = 0; i < colorsIds.length; i++) {
+ colors[i] = ContextCompat.getColor(context, colorsIds[i]);
+ }
+ return colors;
+ }
+
+ public static int getColorId(int colorIndex) {
+ return (colorIndex >= 0 && colorIndex < colorsIds.length) ? colorsIds[colorIndex] : colorsIds[0];
+ }
+
+ public static int getColorIndex(Context context, @ColorInt int color) {
+ int[] colors = getColors(context);
+ for (int i = 0; i < colors.length; i++) {
+ if (color == colors[i]) {
+ return i;
+ }
+ }
+ return 0;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java
index 993c5c1d93..cd723e7d7c 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java
@@ -15,7 +15,6 @@ import androidx.annotation.Nullable;
import net.osmand.AndroidUtils;
import net.osmand.data.LatLon;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java
index b893fbe5c8..d59dad4346 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java
@@ -21,7 +21,6 @@ import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.WptLocationPoint;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java
index d3c1c37705..0b2ba5ab0c 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java
@@ -4,8 +4,6 @@ import androidx.annotation.Nullable;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
@@ -13,7 +11,6 @@ import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.util.Algorithms;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
index e84f7cbfc4..2a50192d03 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
@@ -29,9 +29,8 @@ import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.LockableViewPager;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef;
-import net.osmand.plus.MapMarkersHelper.OnGroupSyncedListener;
+import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersSortByDef;
+import net.osmand.plus.mapmarkers.MapMarkersHelper.OnGroupSyncedListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@@ -430,7 +429,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
public void moveAllToHistoryOnClick() {
if (mapActivity != null) {
final MapMarkersHelper helper = mapActivity.getMyApplication().getMapMarkersHelper();
- final List markers = new ArrayList<>(helper.getMapMarkers());
+ final List markers = new ArrayList<>(helper.getMapMarkers());
helper.moveAllActiveMarkersToHistory();
if (viewPager.getCurrentItem() == ACTIVE_MARKERS_POSITION) {
activeFragment.updateAdapter();
@@ -482,7 +481,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
@Override
public void saveGpx(final String fileName) {
- final String gpxPath = mapActivity.getMyApplication().getMapMarkersHelper().generateGpx(fileName);
+ final String gpxPath = mapActivity.getMyApplication().getMapMarkersHelper().saveMarkersToFile(fileName);
snackbar = Snackbar.make(viewPager, String.format(getString(R.string.shared_string_file_is_saved), fileName) + ".", Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_show, new View.OnClickListener() {
@Override
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java
new file mode 100644
index 0000000000..2a97af91c8
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java
@@ -0,0 +1,183 @@
+package net.osmand.plus.mapmarkers;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.osmand.plus.wikivoyage.data.TravelArticle;
+import net.osmand.util.Algorithms;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+public class MapMarkersGroup {
+
+ public static final int ANY_TYPE = -1;
+ public static final int FAVORITES_TYPE = 0;
+ public static final int GPX_TYPE = 1;
+
+ public static final String MARKERS_SYNC_GROUP_ID = "markers_sync_group_id";
+
+ private String id;
+ private String name;
+ private int type = ANY_TYPE;
+ private Set wptCategories;
+ private long creationDate;
+ private boolean disabled;
+ private boolean visible = true;
+ private boolean wasShown = false;
+ private boolean visibleUntilRestart;
+ private List markers = new ArrayList<>();
+ private TravelArticle wikivoyageArticle;
+ // TODO should be removed from this class:
+ private GroupHeader header;
+ private CategoriesSubHeader categoriesSubHeader;
+ private ShowHideHistoryButton showHideHistoryButton;
+
+ public MapMarkersGroup() {
+
+ }
+
+ public MapMarkersGroup(@NonNull String id, @NonNull String name, int type) {
+ this.id = id;
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getGpxPath() {
+ return id;
+ }
+
+ public TravelArticle getWikivoyageArticle() {
+ return wikivoyageArticle;
+ }
+
+ public long getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(long creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public void setMarkers(List markers) {
+ this.markers = markers;
+ }
+
+ public void setHeader(GroupHeader header) {
+ this.header = header;
+ }
+
+ public void setCategoriesSubHeader(CategoriesSubHeader categoriesSubHeader) {
+ this.categoriesSubHeader = categoriesSubHeader;
+ }
+
+ public void setShowHideHistoryButton(ShowHideHistoryButton showHideHistoryButton) {
+ this.showHideHistoryButton = showHideHistoryButton;
+ }
+
+ public boolean isWasShown() {
+ return wasShown;
+ }
+
+ public boolean isVisibleUntilRestart() {
+ return visibleUntilRestart;
+ }
+
+ public void setWikivoyageArticle(TravelArticle wikivoyageArticle) {
+ this.wikivoyageArticle = wikivoyageArticle;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setWptCategories(Set wptCategories) {
+ this.wptCategories = wptCategories;
+ }
+
+ public Set getWptCategories() {
+ return wptCategories;
+ }
+
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public boolean wasShown() {
+ return wasShown;
+ }
+
+ public void setWasShown(boolean wasShown) {
+ this.wasShown = wasShown;
+ }
+
+ public void setVisibleUntilRestart(boolean visibleUntilRestart) {
+ this.visibleUntilRestart = visibleUntilRestart;
+ }
+
+ public List getMarkers() {
+ return markers;
+ }
+
+ public GroupHeader getGroupHeader() {
+ return header;
+ }
+
+ public CategoriesSubHeader getCategoriesSubHeader() {
+ return categoriesSubHeader;
+ }
+
+ public ShowHideHistoryButton getShowHideHistoryButton() {
+ return showHideHistoryButton;
+ }
+
+ @Nullable
+ public String getWptCategoriesString() {
+ if (wptCategories != null) {
+ return Algorithms.encodeStringSet(wptCategories);
+ }
+ return null;
+ }
+
+ public List getActiveMarkers() {
+ List markers = new ArrayList<>(this.markers);
+ List activeMarkers = new ArrayList<>(markers.size());
+ for (MapMarker marker : markers) {
+ if (!marker.history) {
+ activeMarkers.add(marker);
+ }
+ }
+ return activeMarkers;
+ }
+
+ public List getHistoryMarkers() {
+ List historyMarkers = new ArrayList<>();
+ for (MapMarker marker : markers) {
+ if (marker.history) {
+ historyMarkers.add(marker);
+ }
+ }
+ return historyMarkers;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java
index 5d368b7580..df071bf5b9 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java
@@ -28,7 +28,6 @@ import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.WptLocationPoint;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java
similarity index 79%
rename from OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
rename to OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java
index c168047ba9..b0a13d8e44 100644
--- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java
@@ -1,6 +1,5 @@
-package net.osmand.plus;
+package net.osmand.plus.mapmarkers;
-import android.content.Context;
import android.os.AsyncTask;
import androidx.annotation.IntDef;
@@ -16,13 +15,16 @@ import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
-import net.osmand.data.LocationPoint;
import net.osmand.data.PointDescription;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
+import net.osmand.plus.GPXDatabase;
+import net.osmand.plus.GeocodingLookupService;
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
+import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
-import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
-import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.plus.Version;
import net.osmand.plus.wikivoyage.data.TravelArticle;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.util.Algorithms;
@@ -57,6 +59,9 @@ public class MapMarkersHelper {
public static final int BY_DATE_ADDED_ASC = 4;
+ public static final String VISITED_DATE = "visited_date";
+ public static final String CREATION_DATE = "creation_date";
+
private static final Log LOG = PlatformUtil.getLog(MapMarkersHelper.class);
@Retention(RetentionPolicy.SOURCE)
@@ -148,12 +153,12 @@ public class MapMarkersHelper {
if (group == null) {
if (noGroup == null) {
noGroup = new MapMarkersGroup();
- noGroup.creationDate = Long.MAX_VALUE;
+ noGroup.setCreationDate(Long.MAX_VALUE);
}
noGroup.getMarkers().add(marker);
} else {
- if (marker.creationDate < group.creationDate) {
- group.creationDate = marker.creationDate;
+ if (marker.creationDate < group.getCreationDate()) {
+ group.setCreationDate(marker.creationDate);
}
group.getMarkers().add(marker);
}
@@ -190,16 +195,17 @@ public class MapMarkersHelper {
}
private void lookupAddress(final MapMarker mapMarker) {
- if (mapMarker != null && mapMarker.pointDescription.isSearchingAddress(ctx)) {
+ if (mapMarker != null && mapMarker.getOriginalPointDescription().isSearchingAddress(ctx)) {
cancelPointAddressRequests(mapMarker.point);
AddressLookupRequest lookupRequest = new AddressLookupRequest(mapMarker.point,
new GeocodingLookupService.OnAddressLookupResult() {
@Override
public void geocodingDone(String address) {
+ PointDescription pointDescription = mapMarker.getOriginalPointDescription();
if (Algorithms.isEmpty(address)) {
- mapMarker.pointDescription.setName(PointDescription.getAddressNotFoundStr(ctx));
+ pointDescription.setName(PointDescription.getAddressNotFoundStr(ctx));
} else {
- mapMarker.pointDescription.setName(address);
+ pointDescription.setName(address);
}
markersDbHelper.updateMarker(mapMarker);
refreshMarker(mapMarker);
@@ -291,7 +297,6 @@ public class MapMarkersHelper {
});
}
-
public void runSynchronization(final @NonNull MapMarkersGroup group) {
ctx.runInUIThread(new Runnable() {
@Override
@@ -301,19 +306,17 @@ public class MapMarkersHelper {
});
}
-
public MapMarkersGroup getMarkersGroup(GPXFile gpx) {
- if(gpx == null || gpx.path == null) {
+ if (gpx == null || gpx.path == null) {
return null;
}
return getMapMarkerGroupById(getMarkerGroupId(new File(gpx.path)), MapMarkersGroup.GPX_TYPE);
}
-
+
public MapMarkersGroup getMarkersGroup(FavoriteGroup favGroup) {
return getMapMarkerGroupById(getMarkerGroupId(favGroup), MapMarkersGroup.FAVORITES_TYPE);
}
-
public MapMarkersGroup addOrEnableGpxGroup(@NonNull File file) {
updateGpxShowAsMarkers(file);
MapMarkersGroup gr = getMapMarkerGroupById(getMarkerGroupId(file), MapMarkersGroup.GPX_TYPE);
@@ -324,7 +327,7 @@ public class MapMarkersHelper {
enableGroup(gr);
return gr;
}
-
+
public MapMarkersGroup addOrEnableGroup(@NonNull GPXFile file) {
updateGpxShowAsMarkers(new File(file.path));
MapMarkersGroup gr = getMarkersGroup(file);
@@ -336,7 +339,6 @@ public class MapMarkersHelper {
return gr;
}
-
public MapMarkersGroup addOrEnableGroup(@NonNull FavoriteGroup group) {
MapMarkersGroup gr = getMarkersGroup(group);
if (gr == null) {
@@ -346,10 +348,10 @@ public class MapMarkersHelper {
enableGroup(gr);
return gr;
}
-
+
public void enableGroup(@NonNull MapMarkersGroup gr) {
// check if group doesn't exist internally
- if(!mapMarkersGroups.contains(gr)) {
+ if (!mapMarkersGroups.contains(gr)) {
addGroupInternally(gr);
}
if (gr.isDisabled()) {
@@ -393,14 +395,14 @@ public class MapMarkersHelper {
String id = group.getId();
if (id != null) {
markersDbHelper.updateGroupDisabled(id, disabled);
- group.disabled = disabled;
+ group.setDisabled(disabled);
}
}
public void updateGroupWptCategories(@NonNull MapMarkersGroup group, Set wptCategories) {
String id = group.getId();
if (id != null) {
- group.wptCategories = wptCategories;
+ group.setWptCategories(wptCategories);
if (wptCategories != null) {
markersDbHelper.updateGroupCategories(id, group.getWptCategoriesString());
}
@@ -412,7 +414,7 @@ public class MapMarkersHelper {
markersDbHelper.removeActiveMarkersFromGroup(group.getId());
removeFromMapMarkersList(group.getActiveMarkers());
if (updateGroup) {
- group.markers = group.getHistoryMarkers();
+ group.setMarkers(group.getHistoryMarkers());
updateGroup(group);
}
reorderActiveMarkersIfNeeded();
@@ -435,12 +437,12 @@ public class MapMarkersHelper {
ShowHideHistoryButton showHideHistoryButton = mapMarkersGroup.getShowHideHistoryButton();
if (showHideHistoryButton != null) {
if (historyMarkersCount == 0) {
- mapMarkersGroup.showHideHistoryButton = null;
+ mapMarkersGroup.setShowHideHistoryButton(null);
}
} else if (historyMarkersCount > 0) {
showHideHistoryButton = new ShowHideHistoryButton();
showHideHistoryButton.showHistory = false;
- mapMarkersGroup.showHideHistoryButton = showHideHistoryButton;
+ mapMarkersGroup.setShowHideHistoryButton(showHideHistoryButton);
}
}
@@ -460,10 +462,8 @@ public class MapMarkersHelper {
sortMarkers(mapMarkersGroup.getMarkers(), false, BY_DATE_ADDED_DESC);
}
} else {
- mapMarkersGroup = new MapMarkersGroup();
- mapMarkersGroup.id = marker.groupKey;
- mapMarkersGroup.name = marker.groupName;
- mapMarkersGroup.creationDate = Long.MAX_VALUE;
+ mapMarkersGroup = new MapMarkersGroup(marker.groupKey, marker.groupName, MapMarkersGroup.ANY_TYPE);
+ mapMarkersGroup.setCreationDate(Long.MAX_VALUE);
mapMarkersGroup.getMarkers().add(marker);
addToGroupsList(mapMarkersGroup);
sortGroups();
@@ -473,18 +473,19 @@ public class MapMarkersHelper {
}
private void createHeadersInGroup(@NonNull MapMarkersGroup group) {
- GroupHeader header = new GroupHeader();
- CategoriesSubHeader categoriesSubHeader = new CategoriesSubHeader();
int type = group.getType();
+ int headerIconId = 0;
+ int subHeaderIconId = 0;
if (type != -1) {
- header.iconRes = type == MapMarkersGroup.FAVORITES_TYPE
+ headerIconId = type == MapMarkersGroup.FAVORITES_TYPE
? R.drawable.ic_action_favorite : R.drawable.ic_action_polygom_dark;
- categoriesSubHeader.iconRes = R.drawable.ic_action_filter;
+ subHeaderIconId = R.drawable.ic_action_filter;
}
- header.group = group;
- categoriesSubHeader.group = group;
- group.header = header;
- group.categoriesSubHeader = categoriesSubHeader;
+ GroupHeader header = new GroupHeader(headerIconId, group);
+ CategoriesSubHeader categoriesSubHeader = new CategoriesSubHeader(subHeaderIconId, group);
+
+ group.setHeader(header);
+ group.setCategoriesSubHeader(categoriesSubHeader);
}
private void removeMarkerFromGroup(MapMarker marker) {
@@ -502,8 +503,8 @@ public class MapMarkersHelper {
Collections.sort(mapMarkersGroups, new Comparator() {
@Override
public int compare(MapMarkersGroup group1, MapMarkersGroup group2) {
- long t1 = group1.creationDate;
- long t2 = group2.creationDate;
+ long t1 = group1.getCreationDate();
+ long t2 = group2.getCreationDate();
return (t1 > t2) ? -1 : ((t1 == t2) ? 0 : 1);
}
});
@@ -515,7 +516,7 @@ public class MapMarkersHelper {
for (MapMarkersGroup group : mapMarkersGroups) {
if ((id == null && group.getId() == null)
|| (group.getId() != null && group.getId().equals(id))) {
- if(type == MapMarkersGroup.ANY_TYPE || type == group.type) {
+ if (type == MapMarkersGroup.ANY_TYPE || type == group.getType()) {
return group;
}
}
@@ -528,7 +529,7 @@ public class MapMarkersHelper {
Algorithms.getFileNameWithoutExtension(fl.getName()),
MapMarkersGroup.GPX_TYPE);
}
-
+
private MapMarkersGroup createFavMarkerGroup(FavoriteGroup favGroup) {
return new MapMarkersGroup(favGroup.getName(), favGroup.getName(), MapMarkersGroup.FAVORITES_TYPE);
}
@@ -536,11 +537,11 @@ public class MapMarkersHelper {
private String getMarkerGroupId(File gpx) {
return gpx.getAbsolutePath();
}
-
+
private String getMarkerGroupId(FavoriteGroup group) {
return group.getName();
}
-
+
@NonNull
public List getGroupsForDisplayedGpx() {
List res = new ArrayList<>();
@@ -549,28 +550,28 @@ public class MapMarkersHelper {
MapMarkersGroup search = getMarkersGroup(selected.getGpxFile());
if (search == null && selected.getGpxFile() != null && selected.getGpxFile().path != null) {
MapMarkersGroup group = createGPXMarkerGroup(new File(selected.getGpxFile().path));
- group.disabled = true;
+ group.setDisabled(true);
createHeadersInGroup(group);
res.add(group);
}
}
return res;
}
-
+
@NonNull
public List getGroupsForSavedArticlesTravelBook() {
List res = new ArrayList<>();
TravelDbHelper travelDbHelper = ctx.getTravelDbHelper();
- if(travelDbHelper.getSelectedTravelBook() != null) {
+ if (travelDbHelper.getSelectedTravelBook() != null) {
List savedArticles = travelDbHelper.getLocalDataHelper().getSavedArticles();
for (TravelArticle art : savedArticles) {
String gpxName = travelDbHelper.getGPXName(art);
File path = ctx.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
- LOG.debug("Article group " + path.getAbsolutePath() + " " + path.exists()) ;
+ LOG.debug("Article group " + path.getAbsolutePath() + " " + path.exists());
MapMarkersGroup search = getMapMarkerGroupById(getMarkerGroupId(path), MapMarkersGroup.GPX_TYPE);
if (search == null) {
MapMarkersGroup group = createGPXMarkerGroup(path);
- group.disabled = true;
+ group.setDisabled(true);
createHeadersInGroup(group);
res.add(group);
}
@@ -1004,7 +1005,8 @@ public class MapMarkersHelper {
});
}
- public String generateGpx(String fileName) {
+ public String saveMarkersToFile(String fileName) {
+ GPXFile gpxFile = generateGpx();
String dirName = IndexConstants.GPX_INDEX_DIR + IndexConstants.MAP_MARKERS_INDEX_DIR;
File dir = ctx.getAppPath(dirName);
if (!dir.exists()) {
@@ -1012,18 +1014,54 @@ public class MapMarkersHelper {
}
String uniqueFileName = FileUtils.createUniqueFileName(ctx, fileName, dirName, IndexConstants.GPX_FILE_EXT);
File fout = new File(dir, uniqueFileName + IndexConstants.GPX_FILE_EXT);
+ GPXUtilities.writeGpxFile(fout, gpxFile);
- GPXFile file = new GPXFile(Version.getFullVersion(ctx));
- for (MapMarker marker : mapMarkers) {
+ return fout.getAbsolutePath();
+ }
+
+ public GPXFile generateGpx() {
+ return generateGpx(mapMarkers, false);
+ }
+
+ public GPXFile generateGpx(List markers, boolean completeBackup) {
+ GPXFile gpxFile = new GPXFile(Version.getFullVersion(ctx));
+ for (MapMarker marker : markers) {
WptPt wpt = new WptPt();
wpt.lat = marker.getLatitude();
wpt.lon = marker.getLongitude();
- wpt.setColor(ctx.getResources().getColor(MapMarker.getColorId(marker.colorIndex)));
wpt.name = marker.getOnlyName();
- file.addPoint(wpt);
+ wpt.setColor(ContextCompat.getColor(ctx, MapMarker.getColorId(marker.colorIndex)));
+ if (completeBackup) {
+ if (marker.creationDate != 0) {
+ wpt.getExtensionsToWrite().put(CREATION_DATE, String.valueOf(marker.creationDate));
+ }
+ if (marker.visitedDate != 0) {
+ wpt.getExtensionsToWrite().put(VISITED_DATE, String.valueOf(marker.visitedDate));
+ }
+ }
+ gpxFile.addPoint(wpt);
}
- GPXUtilities.writeGpxFile(fout, file);
- return fout.getAbsolutePath();
+ return gpxFile;
+ }
+
+ public List readMarkersFromGpx(GPXFile gpxFile, boolean history) {
+ List mapMarkers = new ArrayList<>();
+ for (WptPt point : gpxFile.getPoints()) {
+ LatLon latLon = new LatLon(point.lat, point.lon);
+ int colorIndex = MapMarker.getColorIndex(ctx, point.getColor());
+ PointDescription name = new PointDescription(PointDescription.POINT_TYPE_LOCATION, point.name);
+
+ MapMarker marker = new MapMarker(latLon, name, colorIndex, false, 0);
+
+ String visitedDateStr = point.getExtensionsToRead().get(VISITED_DATE);
+ String creationDateStr = point.getExtensionsToRead().get(CREATION_DATE);
+ marker.visitedDate = Algorithms.parseLongSilently(visitedDateStr, 0);
+ marker.creationDate = Algorithms.parseLongSilently(creationDateStr, 0);
+ marker.nextKey = history ? MapMarkersDbHelper.HISTORY_NEXT_VALUE : MapMarkersDbHelper.TAIL_NEXT_VALUE;
+
+ mapMarkers.add(marker);
+ }
+ return mapMarkers;
}
// ---------------------------------------------------------------------------------------------
@@ -1155,7 +1193,7 @@ public class MapMarkersHelper {
if (favGroup == null) {
return;
}
- group.visible = favGroup.isVisible();
+ group.setVisible(favGroup.isVisible());
if (!group.isVisible() || group.isDisabled()) {
removeGroupActiveMarkers(group, true);
return;
@@ -1175,17 +1213,17 @@ public class MapMarkersHelper {
String gpxPath = group.getId();
SelectedGpxFile selectedGpxFile = gpxHelper.getSelectedFileByPath(gpxPath);
GPXFile gpx = selectedGpxFile == null ? null : selectedGpxFile.getGpxFile();
- group.visible = gpx != null || group.visibleUntilRestart;
+ group.setVisible(gpx != null || group.isVisibleUntilRestart());
if (gpx == null || group.isDisabled()) {
removeGroupActiveMarkers(group, true);
return;
}
- boolean addAll = group.wptCategories == null || group.wptCategories.isEmpty();
+ boolean addAll = group.getWptCategories() == null || group.getWptCategories().isEmpty();
List gpxPoints = new ArrayList<>(gpx.getPoints());
for (WptPt pt : gpxPoints) {
- if (addAll || group.wptCategories.contains(pt.category)
- || (pt.category == null && group.wptCategories.contains(""))) {
+ if (addAll || group.getWptCategories().contains(pt.category)
+ || (pt.category == null && group.getWptCategories().contains(""))) {
addNewMarkerIfNeeded(group, groupMarkers, new LatLon(pt.lat, pt.lon), pt.name, null, pt);
}
}
@@ -1208,295 +1246,4 @@ public class MapMarkersHelper {
}
}
}
-
- public static class MapMarkersGroup {
-
- public static final int ANY_TYPE = -1;
- public static final int FAVORITES_TYPE = 0;
- public static final int GPX_TYPE = 1;
-
- public static final String MARKERS_SYNC_GROUP_ID = "markers_sync_group_id";
-
- private String id;
- private String name;
- private int type = -1;
- private Set wptCategories;
- private long creationDate;
- private boolean disabled;
- private boolean visible = true;
- private boolean wasShown = false;
- private boolean visibleUntilRestart;
- private List markers = new ArrayList<>();
- private TravelArticle wikivoyageArticle;
- // TODO should be removed from this class:
- private GroupHeader header;
- private CategoriesSubHeader categoriesSubHeader;
- private ShowHideHistoryButton showHideHistoryButton;
-
- public MapMarkersGroup() {
-
- }
-
- public MapMarkersGroup(@NonNull String id, @NonNull String name, int type) {
- this.id = id;
- this.name = name;
- this.type = type;
- }
-
- public String getId() {
- return id;
- }
-
- public String getGpxPath() {
- return id;
- }
-
- public TravelArticle getWikivoyageArticle() {
- return wikivoyageArticle;
- }
-
- public void setWikivoyageArticle(TravelArticle wikivoyageArticle) {
- this.wikivoyageArticle = wikivoyageArticle;
- }
-
- public String getName() {
- return name;
- }
-
- public int getType() {
- return type;
- }
-
- public void setWptCategories(Set wptCategories) {
- this.wptCategories = wptCategories;
- }
-
- public Set getWptCategories() {
- return wptCategories;
- }
-
- public boolean isDisabled() {
- return disabled;
- }
-
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
-
- public boolean isVisible() {
- return visible;
- }
-
- public boolean wasShown() {
- return wasShown;
- }
-
- public void setWasShown(boolean wasShown) {
- this.wasShown = wasShown;
- }
-
- public void setVisibleUntilRestart(boolean visibleUntilRestart) {
- this.visibleUntilRestart = visibleUntilRestart;
- }
-
- public List getMarkers() {
- return markers;
- }
-
- public GroupHeader getGroupHeader() {
- return header;
- }
-
- public CategoriesSubHeader getCategoriesSubHeader() {
- return categoriesSubHeader;
- }
-
- public ShowHideHistoryButton getShowHideHistoryButton() {
- return showHideHistoryButton;
- }
-
- @Nullable
- public String getWptCategoriesString() {
- if (wptCategories != null) {
- return Algorithms.encodeStringSet(wptCategories);
- }
- return null;
- }
-
- public List getActiveMarkers() {
- List markers = new ArrayList<>(this.markers);
- List activeMarkers = new ArrayList<>(markers.size());
- for (MapMarker marker : markers) {
- if (!marker.history) {
- activeMarkers.add(marker);
- }
- }
- return activeMarkers;
- }
-
- public List getHistoryMarkers() {
- List historyMarkers = new ArrayList<>();
- for (MapMarker marker : markers) {
- if (marker.history) {
- historyMarkers.add(marker);
- }
- }
- return historyMarkers;
- }
- }
-
- public static class ShowHideHistoryButton {
- public boolean showHistory;
- }
-
- public static class GroupHeader {
- private int iconRes;
- private MapMarkersGroup group;
-
- public int getIconRes() {
- return iconRes;
- }
-
- public MapMarkersGroup getGroup() {
- return group;
- }
- }
-
- public static class CategoriesSubHeader {
- private int iconRes;
- private MapMarkersGroup group;
-
- public int getIconRes() {
- return iconRes;
- }
-
- public MapMarkersGroup getGroup() {
- return group;
- }
- }
-
- public static class MapMarker implements LocationPoint {
- private static int[] colors;
-
- public String id;
- public LatLon point;
- private PointDescription pointDescription;
- public int colorIndex;
- public int index;
- public boolean history;
- public boolean selected;
- public int dist;
- public long creationDate;
- public long visitedDate;
- public String nextKey;
- public String groupKey;
- public String groupName;
- public WptPt wptPt;
- public FavouritePoint favouritePoint;
- public String mapObjectName;
-
- public MapMarker(LatLon point, PointDescription name, int colorIndex, boolean selected, int index) {
- this.point = point;
- this.pointDescription = name;
- this.colorIndex = colorIndex;
- this.selected = selected;
- this.index = index;
- }
-
- public int getType() {
- return favouritePoint == null ?
- (wptPt == null ? MapMarkersGroup.ANY_TYPE : MapMarkersGroup.GPX_TYPE) :
- MapMarkersGroup.FAVORITES_TYPE;
- }
-
- public PointDescription getPointDescription(Context ctx) {
- return new PointDescription(POINT_TYPE_MAP_MARKER, ctx.getString(R.string.map_marker), getOnlyName());
- }
-
- public String getName(Context ctx) {
- String name;
- PointDescription pd = getPointDescription(ctx);
- if (Algorithms.isEmpty(pd.getName())) {
- name = pd.getTypeName();
- } else {
- name = pd.getName();
- }
- return name;
- }
-
- public PointDescription getOriginalPointDescription() {
- return pointDescription;
- }
-
- public void setOriginalPointDescription(PointDescription pointDescription) {
- this.pointDescription = pointDescription;
- }
-
- public String getOnlyName() {
- return pointDescription == null ? "" : pointDescription.getName();
- }
-
- public double getLatitude() {
- return point.getLatitude();
- }
-
- public double getLongitude() {
- return point.getLongitude();
- }
-
- @Override
- public int getColor() {
- return 0;
- }
-
- @Override
- public boolean isVisible() {
- return false;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- MapMarker mapMarker = (MapMarker) o;
-
- return colorIndex == mapMarker.colorIndex && point.equals(mapMarker.point);
- }
-
- @Override
- public int hashCode() {
- int result = point.hashCode();
- result = 31 * result + colorIndex;
- return result;
- }
-
- private static final int[] colorsIds = new int[]{
- R.color.marker_blue,
- R.color.marker_green,
- R.color.marker_orange,
- R.color.marker_red,
- R.color.marker_yellow,
- R.color.marker_teal,
- R.color.marker_purple
- };
-
- public static int[] getColors(Context context) {
- if (colors != null) {
- return colors;
- }
- colors = new int[colorsIds.length];
- for (int i = 0; i < colorsIds.length; i++) {
- colors[i] = ContextCompat.getColor(context, colorsIds[i]);
- }
- return colors;
- }
-
- public static int getColorId(int colorIndex) {
- return (colorIndex >= 0 && colorIndex < colorsIds.length) ? colorsIds[colorIndex] : colorsIds[0];
- }
- }
-
-
-
-}
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java
index a472dbf3a7..c631e3d3e7 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java
@@ -20,8 +20,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java
index 025205cbca..622fa39542 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java
@@ -7,7 +7,6 @@ import net.osmand.data.LatLon;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt;
-import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.routing.RouteCalculationParams;
import net.osmand.plus.routing.RouteCalculationResult;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java
index 7239b76fcc..8e16b708b1 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/OrderByBottomSheetDialogFragment.java
@@ -4,8 +4,7 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef;
+import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersSortByDef;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
index 60399c3872..3e0842710c 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java
@@ -39,8 +39,6 @@ import net.osmand.TspAnt;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java
index 0052bf655e..d676372223 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java
@@ -13,8 +13,6 @@ 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;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/ShowHideHistoryButton.java b/OsmAnd/src/net/osmand/plus/mapmarkers/ShowHideHistoryButton.java
new file mode 100644
index 0000000000..b21b656299
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/ShowHideHistoryButton.java
@@ -0,0 +1,5 @@
+package net.osmand.plus.mapmarkers;
+
+public class ShowHideHistoryButton {
+ public boolean showHistory;
+}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
index 4b6eee036b..c1e85387b3 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
@@ -13,9 +13,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import net.osmand.data.LatLon;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@@ -215,7 +214,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter
return ctx.getString(R.string.shared_string_favorites);
}
- @NonNull
- public String getDefaultFileName() {
- return getName() + getDefaultFileExtension();
- }
-
@NonNull
public String getDefaultFileExtension() {
return GPX_FILE_EXT;
@@ -177,21 +169,9 @@ public class FavoritesSettingsItem extends CollectionSettingsItem
@Nullable
@Override
- SettingsItemWriter getWriter() {
- return new SettingsItemWriter(this) {
-
- @Override
- public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException {
- List favourites = getPointsFromGroups(items);
- GPXFile gpxFile = favoritesHelper.asGpxFile(favourites);
- Exception error = GPXUtilities.writeGpx(new OutputStreamWriter(outputStream, "UTF-8"), gpxFile);
- if (error != null) {
- warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType())));
- SettingsHelper.LOG.error("Failed write to gpx file", error);
- return false;
- }
- return true;
- }
- };
+ SettingsItemWriter extends SettingsItem> getWriter() {
+ List favourites = getPointsFromGroups(items);
+ GPXFile gpxFile = favoritesHelper.asGpxFile(favourites);
+ return getGpxWriter(gpxFile);
}
}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java
new file mode 100644
index 0000000000..a07aeb07ea
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java
@@ -0,0 +1,160 @@
+package net.osmand.plus.settings.backend.backup;
+
+import android.content.Context;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.osmand.GPXUtilities;
+import net.osmand.GPXUtilities.GPXFile;
+import net.osmand.data.PointDescription;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.settings.backend.ExportSettingsType;
+import net.osmand.util.Algorithms;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import static net.osmand.IndexConstants.GPX_FILE_EXT;
+
+public class HistoryMarkersSettingsItem extends CollectionSettingsItem {
+
+ private MapMarkersHelper markersHelper;
+
+ public HistoryMarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
+ super(app, null, items);
+ }
+
+ public HistoryMarkersSettingsItem(@NonNull OsmandApplication app, @Nullable HistoryMarkersSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem, items);
+ }
+
+ HistoryMarkersSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
+ super(app, json);
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ markersHelper = app.getMapMarkersHelper();
+ existingItems = new ArrayList<>(markersHelper.getMapMarkersHistory());
+ }
+
+ @NonNull
+ @Override
+ public SettingsItemType getType() {
+ return SettingsItemType.HISTORY_MARKERS;
+ }
+
+ @NonNull
+ @Override
+ public String getName() {
+ return "history_markers";
+ }
+
+ @NonNull
+ @Override
+ public String getPublicName(@NonNull Context ctx) {
+ return ctx.getString(R.string.markers_history);
+ }
+
+ @NonNull
+ public String getDefaultFileExtension() {
+ return GPX_FILE_EXT;
+ }
+
+ @Override
+ public void apply() {
+ List newItems = getNewItems();
+ if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
+ appliedItems = new ArrayList<>(newItems);
+
+ for (MapMarker duplicate : duplicateItems) {
+ if (shouldReplace) {
+ MapMarker existingMarker = markersHelper.getMapMarker(duplicate.point);
+ markersHelper.removeMarker(existingMarker);
+ }
+ appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
+ }
+
+ for (MapMarker marker : appliedItems) {
+ markersHelper.moveMapMarkerToHistory(marker);
+ }
+ }
+ }
+
+ @Override
+ public boolean isDuplicate(@NonNull MapMarker mapMarker) {
+ for (MapMarker marker : existingItems) {
+ if (marker.equals(mapMarker)
+ && Algorithms.objectEquals(marker.getOriginalPointDescription(), mapMarker.getOriginalPointDescription())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldReadOnCollecting() {
+ return true;
+ }
+
+ @NonNull
+ @Override
+ public MapMarker renameItem(@NonNull MapMarker item) {
+ int number = 0;
+ while (true) {
+ number++;
+ String name = item.getOnlyName() + "_" + number;
+ PointDescription description = new PointDescription(PointDescription.POINT_TYPE_LOCATION, name);
+ MapMarker renamedMarker = new MapMarker(item.point, description, item.getColor(), item.selected, item.index);
+ if (!isDuplicate(renamedMarker)) {
+ renamedMarker.nextKey = MapMarkersDbHelper.HISTORY_NEXT_VALUE;
+ return renamedMarker;
+ }
+ }
+ }
+
+ public MapMarkersGroup getMarkersGroup() {
+ String name = app.getString(R.string.markers_history);
+ String groupId = ExportSettingsType.HISTORY_MARKERS.name();
+ MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE);
+ markersGroup.setMarkers(items);
+ return markersGroup;
+ }
+
+ @Nullable
+ @Override
+ SettingsItemReader getReader() {
+ return new SettingsItemReader(this) {
+
+ @Override
+ public void readFromStream(@NonNull InputStream inputStream, String entryName) throws IllegalArgumentException {
+ GPXFile gpxFile = GPXUtilities.loadGPXFile(inputStream);
+ if (gpxFile.error != null) {
+ warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType())));
+ SettingsHelper.LOG.error("Failed read gpx file", gpxFile.error);
+ } else {
+ List mapMarkers = markersHelper.readMarkersFromGpx(gpxFile, true);
+ items.addAll(mapMarkers);
+ }
+ }
+ };
+ }
+
+ @Nullable
+ @Override
+ SettingsItemWriter extends SettingsItem> getWriter() {
+ GPXFile gpxFile = markersHelper.generateGpx(items, true);
+ return getGpxWriter(gpxFile);
+ }
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java
new file mode 100644
index 0000000000..3fea648619
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java
@@ -0,0 +1,160 @@
+package net.osmand.plus.settings.backend.backup;
+
+import android.content.Context;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import net.osmand.GPXUtilities;
+import net.osmand.GPXUtilities.GPXFile;
+import net.osmand.data.PointDescription;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.settings.backend.ExportSettingsType;
+import net.osmand.util.Algorithms;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import static net.osmand.IndexConstants.GPX_FILE_EXT;
+
+public class MarkersSettingsItem extends CollectionSettingsItem {
+
+ private MapMarkersHelper markersHelper;
+
+ public MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List items) {
+ super(app, null, items);
+ }
+
+ public MarkersSettingsItem(@NonNull OsmandApplication app, @Nullable MarkersSettingsItem baseItem, @NonNull List items) {
+ super(app, baseItem, items);
+ }
+
+ MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException {
+ super(app, json);
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ markersHelper = app.getMapMarkersHelper();
+ existingItems = new ArrayList<>(markersHelper.getMapMarkers());
+ }
+
+ @NonNull
+ @Override
+ public SettingsItemType getType() {
+ return SettingsItemType.ACTIVE_MARKERS;
+ }
+
+ @NonNull
+ @Override
+ public String getName() {
+ return "markers";
+ }
+
+ @NonNull
+ @Override
+ public String getPublicName(@NonNull Context ctx) {
+ return ctx.getString(R.string.map_markers);
+ }
+
+ @NonNull
+ public String getDefaultFileExtension() {
+ return GPX_FILE_EXT;
+ }
+
+ @Override
+ public void apply() {
+ List newItems = getNewItems();
+ if (!newItems.isEmpty() || !duplicateItems.isEmpty()) {
+ appliedItems = new ArrayList<>(newItems);
+
+ for (MapMarker duplicate : duplicateItems) {
+ if (shouldReplace) {
+ MapMarker existingMarker = markersHelper.getMapMarker(duplicate.point);
+ markersHelper.removeMarker(existingMarker);
+ }
+ appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate));
+ }
+
+ for (MapMarker marker : appliedItems) {
+ markersHelper.addMarker(marker);
+ }
+ }
+ }
+
+ @Override
+ public boolean isDuplicate(@NonNull MapMarker mapMarker) {
+ for (MapMarker marker : existingItems) {
+ if (marker.equals(mapMarker)
+ && Algorithms.objectEquals(marker.getOriginalPointDescription(), mapMarker.getOriginalPointDescription())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldReadOnCollecting() {
+ return true;
+ }
+
+ @NonNull
+ @Override
+ public MapMarker renameItem(@NonNull MapMarker item) {
+ int number = 0;
+ while (true) {
+ number++;
+ String name = item.getOnlyName() + "_" + number;
+ PointDescription description = new PointDescription(PointDescription.POINT_TYPE_LOCATION, name);
+ MapMarker renamedMarker = new MapMarker(item.point, description, item.getColor(), item.selected, item.index);
+ if (!isDuplicate(renamedMarker)) {
+ renamedMarker.nextKey = MapMarkersDbHelper.TAIL_NEXT_VALUE;
+ return renamedMarker;
+ }
+ }
+ }
+
+ public MapMarkersGroup getMarkersGroup() {
+ String name = app.getString(R.string.map_markers);
+ String groupId = ExportSettingsType.ACTIVE_MARKERS.name();
+ MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE);
+ markersGroup.setMarkers(items);
+ return markersGroup;
+ }
+
+ @Nullable
+ @Override
+ SettingsItemReader getReader() {
+ return new SettingsItemReader(this) {
+
+ @Override
+ public void readFromStream(@NonNull InputStream inputStream, String entryName) throws IllegalArgumentException {
+ GPXFile gpxFile = GPXUtilities.loadGPXFile(inputStream);
+ if (gpxFile.error != null) {
+ warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType())));
+ SettingsHelper.LOG.error("Failed read gpx file", gpxFile.error);
+ } else {
+ List mapMarkers = markersHelper.readMarkersFromGpx(gpxFile, false);
+ items.addAll(mapMarkers);
+ }
+ }
+ };
+ }
+
+ @Nullable
+ @Override
+ SettingsItemWriter extends SettingsItem> getWriter() {
+ GPXFile gpxFile = markersHelper.generateGpx(items, true);
+ return getGpxWriter(gpxFile);
+ }
+}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java
index 9c47589674..35f85b8ee8 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java
@@ -18,6 +18,7 @@ import net.osmand.map.TileSourceManager.TileSourceTemplate;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
+import net.osmand.plus.R;
import net.osmand.plus.SQLiteTileSource;
import net.osmand.plus.activities.LocalIndexHelper;
import net.osmand.plus.activities.LocalIndexInfo;
@@ -28,6 +29,8 @@ import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.osmedit.OpenstreetmapPoint;
import net.osmand.plus.osmedit.OsmEditingPlugin;
import net.osmand.plus.osmedit.OsmNotesPoint;
@@ -594,6 +597,22 @@ public class SettingsHelper {
if (!files.isEmpty()) {
dataList.put(ExportSettingsType.VOICE, files);
}
+ List mapMarkers = app.getMapMarkersHelper().getMapMarkers();
+ if (!mapMarkers.isEmpty()) {
+ String name = app.getString(R.string.map_markers);
+ String groupId = ExportSettingsType.ACTIVE_MARKERS.name();
+ MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE);
+ markersGroup.setMarkers(mapMarkers);
+ dataList.put(ExportSettingsType.ACTIVE_MARKERS, Collections.singletonList(markersGroup));
+ }
+ List markersHistory = app.getMapMarkersHelper().getMapMarkersHistory();
+ if (!markersHistory.isEmpty()) {
+ String name = app.getString(R.string.shared_string_history);
+ String groupId = ExportSettingsType.HISTORY_MARKERS.name();
+ MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, MapMarkersGroup.ANY_TYPE);
+ markersGroup.setMarkers(markersHistory);
+ dataList.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup));
+ }
return dataList;
}
@@ -633,6 +652,8 @@ public class SettingsHelper {
List favoriteGroups = new ArrayList<>();
List osmNotesPointList = new ArrayList<>();
List osmEditsPointList = new ArrayList<>();
+ List markersGroups = new ArrayList<>();
+ List markersHistoryGroups = new ArrayList<>();
for (Object object : data) {
if (object instanceof QuickAction) {
@@ -657,6 +678,13 @@ public class SettingsHelper {
osmEditsPointList.add((OpenstreetmapPoint) object);
} else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object);
+ } else if (object instanceof MapMarkersGroup) {
+ MapMarkersGroup markersGroup = (MapMarkersGroup) object;
+ if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
+ markersGroups.add((MapMarkersGroup) object);
+ } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
+ markersHistoryGroups.add((MapMarkersGroup) object);
+ }
}
}
if (!quickActions.isEmpty()) {
@@ -688,6 +716,20 @@ public class SettingsHelper {
if (!favoriteGroups.isEmpty()) {
settingsItems.add(new FavoritesSettingsItem(app, favoriteGroups));
}
+ if (!markersGroups.isEmpty()) {
+ List mapMarkers = new ArrayList<>();
+ for (MapMarkersGroup group : markersGroups) {
+ mapMarkers.addAll(group.getMarkers());
+ }
+ settingsItems.add(new MarkersSettingsItem(app, mapMarkers));
+ }
+ if (!markersHistoryGroups.isEmpty()) {
+ List mapMarkers = new ArrayList<>();
+ for (MapMarkersGroup group : markersHistoryGroups) {
+ mapMarkers.addAll(group.getMarkers());
+ }
+ settingsItems.add(new HistoryMarkersSettingsItem(app, mapMarkers));
+ }
return settingsItems;
}
@@ -709,6 +751,8 @@ public class SettingsHelper {
List notesPointList = new ArrayList<>();
List editsPointList = new ArrayList<>();
List favoriteGroups = new ArrayList<>();
+ List markersGroups = new ArrayList<>();
+ List markersHistoryGroups = new ArrayList<>();
for (SettingsItem item : settingsItems) {
switch (item.getType()) {
@@ -788,6 +832,14 @@ public class SettingsHelper {
FavoritesSettingsItem favoritesSettingsItem = (FavoritesSettingsItem) item;
favoriteGroups.addAll(favoritesSettingsItem.getItems());
break;
+ case ACTIVE_MARKERS:
+ MarkersSettingsItem markersSettingsItem = (MarkersSettingsItem) item;
+ markersGroups.add(markersSettingsItem.getMarkersGroup());
+ break;
+ case HISTORY_MARKERS:
+ HistoryMarkersSettingsItem historyMarkersSettingsItem = (HistoryMarkersSettingsItem) item;
+ markersHistoryGroups.add(historyMarkersSettingsItem.getMarkersGroup());
+ break;
default:
break;
}
@@ -841,6 +893,12 @@ public class SettingsHelper {
if (!voiceFilesList.isEmpty()) {
settingsToOperate.put(ExportSettingsType.VOICE, voiceFilesList);
}
+ if (!markersGroups.isEmpty()) {
+ settingsToOperate.put(ExportSettingsType.ACTIVE_MARKERS, markersGroups);
+ }
+ if (!markersGroups.isEmpty()) {
+ settingsToOperate.put(ExportSettingsType.HISTORY_MARKERS, markersHistoryGroups);
+ }
return settingsToOperate;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java
index afe776db09..8b6736bf1d 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItem.java
@@ -5,7 +5,10 @@ import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import net.osmand.GPXUtilities;
+import net.osmand.GPXUtilities.GPXFile;
import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.R;
import net.osmand.util.Algorithms;
import org.json.JSONException;
@@ -17,6 +20,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
@@ -205,6 +209,7 @@ public abstract class SettingsItem {
String s = json.toString(2);
outputStream.write(s.getBytes("UTF-8"));
} catch (JSONException e) {
+ warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType())));
SettingsHelper.LOG.error("Failed to write json to stream", e);
}
return true;
@@ -214,6 +219,22 @@ public abstract class SettingsItem {
};
}
+ @NonNull
+ SettingsItemWriter extends SettingsItem> getGpxWriter(@NonNull final GPXFile gpxFile) {
+ return new SettingsItemWriter(this) {
+ @Override
+ public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException {
+ Exception error = GPXUtilities.writeGpx(new OutputStreamWriter(outputStream, "UTF-8"), gpxFile);
+ if (error != null) {
+ warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType())));
+ SettingsHelper.LOG.error("Failed write to gpx file", error);
+ return false;
+ }
+ return true;
+ }
+ };
+ }
+
@Override
public int hashCode() {
return (getType().name() + getName()).hashCode();
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java
index bb6b68b3ce..2fed0b2645 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java
@@ -15,5 +15,7 @@ public enum SettingsItemType {
DOWNLOADS,
OSM_NOTES,
OSM_EDITS,
- FAVOURITES
+ FAVOURITES,
+ ACTIVE_MARKERS,
+ HISTORY_MARKERS
}
\ No newline at end of file
diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java
index 9669099003..5160000d0c 100644
--- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemsFactory.java
@@ -134,6 +134,12 @@ class SettingsItemsFactory {
case FAVOURITES:
item = new FavoritesSettingsItem(app, json);
break;
+ case ACTIVE_MARKERS:
+ item = new MarkersSettingsItem(app, json);
+ break;
+ case HISTORY_MARKERS:
+ item = new HistoryMarkersSettingsItem(app, json);
+ break;
}
return item;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java
index efda7de984..798b29a476 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java
@@ -14,20 +14,21 @@ import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.map.ITileSource;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
-import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
-import net.osmand.plus.helpers.FileNameTranslationHelper;
-import net.osmand.plus.helpers.GpxUiHelper;
-import net.osmand.plus.settings.backend.ApplicationMode;
-import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
+import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
+import net.osmand.plus.helpers.FileNameTranslationHelper;
+import net.osmand.plus.helpers.GpxUiHelper;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.profiles.ProfileIconColors;
import net.osmand.plus.profiles.RoutingProfileDataObject.RoutingProfilesResources;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.render.RenderingIcons;
+import net.osmand.plus.settings.backend.ApplicationMode;
+import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@@ -35,7 +36,7 @@ import org.apache.commons.logging.Log;
import java.io.File;
import java.util.List;
-import static net.osmand.plus.settings.backend.backup.FileSettingsItem.*;
+import static net.osmand.plus.settings.backend.backup.FileSettingsItem.FileSubtype;
public class DuplicatesSettingsAdapter extends RecyclerView.Adapter {
@@ -155,6 +156,10 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter ttsVoiceFilesList = new ArrayList<>();
List voiceFilesList = new ArrayList<>();
List mapFilesList = new ArrayList<>();
+ List markersGroups = new ArrayList<>();
+ List markersHistoryGroups = new ArrayList<>();
for (Object object : duplicatesList) {
if (object instanceof ApplicationMode.ApplicationModeBean) {
@@ -236,6 +240,13 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment {
osmNotesPointList.add((OsmNotesPoint) object);
} else if (object instanceof OpenstreetmapPoint) {
osmEditsPointList.add((OpenstreetmapPoint) object);
+ } else if (object instanceof MapMarkersGroup) {
+ MapMarkersGroup markersGroup = (MapMarkersGroup) object;
+ if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
+ markersGroups.add(markersGroup);
+ } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
+ markersHistoryGroups.add(markersGroup);
+ }
}
}
if (!profiles.isEmpty()) {
@@ -298,6 +309,14 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment {
duplicates.add(getString(R.string.local_indexes_cat_voice));
duplicates.addAll(voiceFilesList);
}
+ if (!markersGroups.isEmpty()) {
+ duplicates.add(getString(R.string.map_markers));
+ duplicates.addAll(markersGroups);
+ }
+ if (!markersHistoryGroups.isEmpty()) {
+ duplicates.add(getString(R.string.markers_history));
+ duplicates.addAll(markersHistoryGroups);
+ }
return duplicates;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
index f9960db436..48b8e7a6ee 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java
@@ -41,25 +41,29 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.osmedit.OpenstreetmapPoint;
import net.osmand.plus.osmedit.OsmNotesPoint;
import net.osmand.plus.poi.PoiUIFilter;
import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.plus.settings.backend.ExportSettingsType;
+import net.osmand.plus.settings.backend.backup.AvoidRoadsSettingsItem;
import net.osmand.plus.settings.backend.backup.FavoritesSettingsItem;
+import net.osmand.plus.settings.backend.backup.FileSettingsItem;
import net.osmand.plus.settings.backend.backup.GlobalSettingsItem;
+import net.osmand.plus.settings.backend.backup.HistoryMarkersSettingsItem;
+import net.osmand.plus.settings.backend.backup.MapSourcesSettingsItem;
+import net.osmand.plus.settings.backend.backup.MarkersSettingsItem;
import net.osmand.plus.settings.backend.backup.OsmEditsSettingsItem;
import net.osmand.plus.settings.backend.backup.OsmNotesSettingsItem;
-import net.osmand.plus.settings.backend.backup.SettingsHelper;
-import net.osmand.plus.settings.backend.backup.AvoidRoadsSettingsItem;
-import net.osmand.plus.settings.backend.backup.FileSettingsItem;
-import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportAsyncTask;
-import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportType;
-import net.osmand.plus.settings.backend.backup.MapSourcesSettingsItem;
import net.osmand.plus.settings.backend.backup.PoiUiFiltersSettingsItem;
import net.osmand.plus.settings.backend.backup.ProfileSettingsItem;
import net.osmand.plus.settings.backend.backup.QuickActionsSettingsItem;
+import net.osmand.plus.settings.backend.backup.SettingsHelper;
+import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportAsyncTask;
+import net.osmand.plus.settings.backend.backup.SettingsHelper.ImportType;
import net.osmand.plus.settings.backend.backup.SettingsItem;
import net.osmand.plus.settings.backend.backup.SettingsItemType;
import net.osmand.plus.widgets.TextViewEx;
@@ -436,6 +440,8 @@ public class ImportSettingsFragment extends BaseOsmAndFragment {
List osmNotesPointList = new ArrayList<>();
List osmEditsPointList = new ArrayList<>();
List favoriteGroups = new ArrayList<>();
+ List markersGroups = new ArrayList<>();
+ List markersHistoryGroups = new ArrayList<>();
for (Object object : data) {
if (object instanceof ApplicationModeBean) {
appModeBeans.add((ApplicationModeBean) object);
@@ -459,6 +465,13 @@ public class ImportSettingsFragment extends BaseOsmAndFragment {
favoriteGroups.add((FavoriteGroup) object);
} else if (object instanceof GlobalSettingsItem) {
settingsItems.add((GlobalSettingsItem) object);
+ } else if (object instanceof MapMarkersGroup) {
+ MapMarkersGroup markersGroup = (MapMarkersGroup) object;
+ if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
+ markersGroups.add((MapMarkersGroup) object);
+ } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
+ markersHistoryGroups.add((MapMarkersGroup) object);
+ }
}
}
if (!appModeBeans.isEmpty()) {
@@ -490,6 +503,23 @@ public class ImportSettingsFragment extends BaseOsmAndFragment {
FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class);
settingsItems.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups));
}
+ if (!markersGroups.isEmpty()) {
+ List mapMarkers = new ArrayList<>();
+ for (MapMarkersGroup group : markersGroups) {
+ mapMarkers.addAll(group.getMarkers());
+ }
+ MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class);
+ settingsItems.add(new MarkersSettingsItem(app, baseItem, mapMarkers));
+ }
+ if (!markersHistoryGroups.isEmpty()) {
+ List mapMarkers = new ArrayList<>();
+ for (MapMarkersGroup group : markersHistoryGroups) {
+ mapMarkers.addAll(group.getMarkers());
+ }
+ HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class);
+ settingsItems.add(new HistoryMarkersSettingsItem(app, baseItem, mapMarkers));
+ }
+
return settingsItems;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java
index 3eec01930b..9114c430b9 100644
--- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java
@@ -142,6 +142,14 @@ public class ImportedSettingsItemsAdapter extends
holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_settings, activeColorRes));
holder.title.setText(R.string.general_settings_2);
break;
+ case ACTIVE_MARKERS:
+ holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_flag, activeColorRes));
+ holder.title.setText(R.string.map_markers);
+ break;
+ case HISTORY_MARKERS:
+ holder.icon.setImageDrawable(uiUtils.getIcon(R.drawable.ic_action_flag, activeColorRes));
+ holder.title.setText(R.string.markers_history);
+ break;
}
}
diff --git a/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java
index 8cfc3025dd..9773012490 100644
--- a/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java
@@ -17,8 +17,8 @@ import net.osmand.data.QuadTree;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.base.PointImageDrawable;
diff --git a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java
index b960b643bf..c54b6afea5 100644
--- a/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java
@@ -37,9 +37,9 @@ import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
-import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapMarkersLayer.java
index 244a9efc17..5c58dadd0d 100644
--- a/OsmAnd/src/net/osmand/plus/views/layers/MapMarkersLayer.java
+++ b/OsmAnd/src/net/osmand/plus/views/layers/MapMarkersLayer.java
@@ -31,8 +31,8 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java
index 799490d949..e2b127867b 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapMarkersWidgetsFactory.java
@@ -9,8 +9,8 @@ import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.UiUtilities;
-import net.osmand.plus.MapMarkersHelper;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarkersHelper;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java
index f77bc27f36..f9ac17aa23 100644
--- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java
+++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java
@@ -12,7 +12,7 @@ import android.view.View;
import net.osmand.Location;
import net.osmand.binary.RouteDataObject;
import net.osmand.data.LatLon;
-import net.osmand.plus.MapMarkersHelper.MapMarker;
+import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmAndLocationProvider;
import net.osmand.plus.OsmandApplication;