From 4923723adef9feb1716d6030d2e0c02ec8ab0f3b Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 3 Nov 2020 18:11:38 +0200 Subject: [PATCH 01/36] Add MarkersSettingsItem initial commit --- .../settings/backend/ExportSettingsType.java | 3 +- .../backend/backup/MarkersSettingsItem.java | 152 ++++++++++++++++++ .../backend/backup/SettingsHelper.java | 19 +++ .../backend/backup/SettingsItemType.java | 3 +- .../backend/backup/SettingsItemsFactory.java | 3 + .../fragments/DuplicatesSettingsAdapter.java | 20 ++- .../ExportImportSettingsAdapter.java | 12 ++ .../ImportedSettingsItemsAdapter.java | 4 + 8 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java index 91d5493217..a530ef5dcf 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java @@ -16,5 +16,6 @@ public enum ExportSettingsType { OFFLINE_MAPS, FAVORITES, TTS_VOICE, - VOICE + VOICE, + MARKERS } 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..0d1f9d6bb8 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -0,0 +1,152 @@ +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.plus.MapMarkersHelper; +import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; + +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +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.getMapMarkersGroups()); + } + + @NonNull + @Override + public SettingsItemType getType() { + return SettingsItemType.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 getDefaultFileName() { + return getName() + getDefaultFileExtension(); + } + + @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 (MapMarkersGroup duplicate : duplicateItems) { + if (shouldReplace) { + + } + appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate)); + } + } + } + + @Override + public boolean isDuplicate(@NonNull MapMarkersGroup markersGroup) { + String name = markersGroup.getName(); + for (MapMarkersGroup group : existingItems) { + if (group.getName().equals(name)) { + return true; + } + } + return false; + } + + @Override + public boolean shouldReadOnCollecting() { + return true; + } + + @NonNull + @Override + public MapMarkersGroup renameItem(@NonNull MapMarkersGroup item) { + return item; + } + + @Nullable + @Override + SettingsItemReader getReader() { + return new SettingsItemReader(this) { + + @Override + public void readFromStream(@NonNull InputStream inputStream, File destination) throws IOException, 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 { + Map flatGroups = new LinkedHashMap<>(); + } + } + }; + } + + @Nullable + @Override + SettingsItemWriter getWriter() { + 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; + } + }; + } +} \ 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 f3821505a2..43e8fe22c2 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -14,6 +14,7 @@ import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.map.TileSourceManager.TileSourceTemplate; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; +import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.SQLiteTileSource; @@ -552,6 +553,10 @@ public class SettingsHelper { if (!files.isEmpty()) { dataList.put(ExportSettingsType.VOICE, files); } + List markersGroups = app.getMapMarkersHelper().getMapMarkersGroups(); + if (!markersGroups.isEmpty()) { + dataList.put(ExportSettingsType.MARKERS, markersGroups); + } return dataList; } @@ -591,6 +596,7 @@ public class SettingsHelper { List favoriteGroups = new ArrayList<>(); List osmNotesPointList = new ArrayList<>(); List osmEditsPointList = new ArrayList<>(); + List markersGroups = new ArrayList<>(); for (Object object : data) { if (object instanceof QuickAction) { @@ -615,6 +621,8 @@ public class SettingsHelper { osmEditsPointList.add((OpenstreetmapPoint) object); } else if (object instanceof FavoriteGroup) { favoriteGroups.add((FavoriteGroup) object); + } else if (object instanceof MapMarkersGroup) { + markersGroups.add((MapMarkersGroup) object); } } if (!quickActions.isEmpty()) { @@ -646,6 +654,9 @@ public class SettingsHelper { if (!favoriteGroups.isEmpty()) { settingsItems.add(new FavoritesSettingsItem(app, favoriteGroups)); } + if (!markersGroups.isEmpty()) { + settingsItems.add(new MarkersSettingsItem(app, markersGroups)); + } return settingsItems; } @@ -667,6 +678,7 @@ public class SettingsHelper { List notesPointList = new ArrayList<>(); List editsPointList = new ArrayList<>(); List favoriteGroups = new ArrayList<>(); + List markersGroups = new ArrayList<>(); for (SettingsItem item : settingsItems) { switch (item.getType()) { @@ -746,6 +758,10 @@ public class SettingsHelper { FavoritesSettingsItem favoritesSettingsItem = (FavoritesSettingsItem) item; favoriteGroups.addAll(favoritesSettingsItem.getItems()); break; + case MARKERS: + MarkersSettingsItem markersSettingsItem = (MarkersSettingsItem) item; + markersGroups.addAll(markersSettingsItem.getItems()); + break; default: break; } @@ -799,6 +815,9 @@ public class SettingsHelper { if (!voiceFilesList.isEmpty()) { settingsToOperate.put(ExportSettingsType.VOICE, voiceFilesList); } + if (!markersGroups.isEmpty()) { + settingsToOperate.put(ExportSettingsType.MARKERS, markersGroups); + } return settingsToOperate; } } \ No newline at end of file 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..bc254e28ca 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,6 @@ public enum SettingsItemType { DOWNLOADS, OSM_NOTES, OSM_EDITS, - FAVOURITES + FAVOURITES, + 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..3012cc3dd8 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,9 @@ class SettingsItemsFactory { case FAVOURITES: item = new FavoritesSettingsItem(app, json); break; + case MARKERS: + item = new MarkersSettingsItem(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 d90f4b7429..58af347031 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java @@ -14,19 +14,20 @@ 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.GpxUiHelper; -import net.osmand.plus.settings.backend.ApplicationMode; -import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; +import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; 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.GpxUiHelper; 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; @@ -134,7 +135,7 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter Date: Tue, 3 Nov 2020 18:34:49 +0200 Subject: [PATCH 02/36] Move MapMarkersHelper to mapmarkers package --- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 4 ++-- OsmAnd/src/net/osmand/plus/AppInitializer.java | 1 + OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java | 3 ++- OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java | 3 ++- OsmAnd/src/net/osmand/plus/OsmandApplication.java | 1 + .../activities/EditFavoriteGroupDialogFragment.java | 4 ++-- .../osmand/plus/activities/FavoritesTreeFragment.java | 2 +- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 4 ++-- .../net/osmand/plus/activities/MapActivityActions.java | 4 ++-- .../net/osmand/plus/base/MapViewTrackingUtilities.java | 4 ++-- .../src/net/osmand/plus/helpers/ExternalApiHelper.java | 4 ++-- OsmAnd/src/net/osmand/plus/helpers/IntentHelper.java | 2 +- .../net/osmand/plus/helpers/MapMarkerDialogHelper.java | 2 +- .../net/osmand/plus/mapcontextmenu/MapContextMenu.java | 4 ++-- .../net/osmand/plus/mapcontextmenu/MenuController.java | 2 +- .../controllers/AmenityMenuController.java | 2 +- .../controllers/FavouritePointMenuController.java | 4 ++-- .../controllers/MapMarkerMenuController.java | 4 ++-- .../controllers/WptPtMenuController.java | 4 ++-- .../plus/mapcontextmenu/editors/MapMarkerEditor.java | 2 +- .../editors/MapMarkerEditorFragment.java | 2 +- .../mapcontextmenu/editors/WptPtEditorFragment.java | 4 ++-- .../mapcontextmenu/editors/WptPtEditorFragmentNew.java | 4 ++-- .../plus/mapmarkers/CoordinateInputDialogFragment.java | 2 -- .../HistoryMarkerMenuBottomSheetDialogFragment.java | 2 +- .../plus/mapmarkers/MapMarkerSelectionFragment.java | 2 +- .../plus/mapmarkers/MapMarkersActiveFragment.java | 2 +- .../net/osmand/plus/mapmarkers/MapMarkersDbHelper.java | 5 ++--- .../plus/mapmarkers/MapMarkersDialogFragment.java | 5 ++--- .../plus/mapmarkers/MapMarkersGroupsFragment.java | 2 +- .../osmand/plus/{ => mapmarkers}/MapMarkersHelper.java | 10 +++++++--- .../plus/mapmarkers/MapMarkersHistoryFragment.java | 3 +-- .../plus/mapmarkers/MarkersPlanRouteContext.java | 1 - .../mapmarkers/OrderByBottomSheetDialogFragment.java | 3 +-- .../net/osmand/plus/mapmarkers/PlanRouteFragment.java | 3 +-- .../SelectWptCategoriesBottomSheetDialogFragment.java | 3 +-- .../mapmarkers/adapters/MapMarkersActiveAdapter.java | 6 +++--- .../mapmarkers/adapters/MapMarkersGroupsAdapter.java | 10 +++++----- .../mapmarkers/adapters/MapMarkersHistoryAdapter.java | 2 +- .../mapmarkers/adapters/MapMarkersListAdapter.java | 2 +- .../plus/myplaces/EditTrackGroupDialogFragment.java | 4 ++-- .../net/osmand/plus/myplaces/TrackPointFragment.java | 4 ++-- .../AddPointBottomSheetDialog.java | 4 ++-- .../plus/routepreparationmenu/MapRouteInfoMenu.java | 2 +- .../routepreparationmenu/cards/MapMarkersCard.java | 2 +- .../settings/backend/backup/MarkersSettingsItem.java | 4 ++-- .../plus/settings/backend/backup/SettingsHelper.java | 2 +- .../settings/fragments/DuplicatesSettingsAdapter.java | 2 +- .../fragments/ExportImportSettingsAdapter.java | 2 +- .../net/osmand/plus/views/layers/FavouritesLayer.java | 4 ++-- OsmAnd/src/net/osmand/plus/views/layers/GPXLayer.java | 6 +++--- .../net/osmand/plus/views/layers/MapMarkersLayer.java | 4 ++-- .../views/mapwidgets/MapMarkersWidgetsFactory.java | 4 ++-- .../plus/views/mapwidgets/RouteInfoWidgetsFactory.java | 2 +- 54 files changed, 89 insertions(+), 90 deletions(-) rename OsmAnd/src/net/osmand/plus/{ => mapmarkers}/MapMarkersHelper.java (99%) diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index ec3a9c1e10..89b5c95828 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.MapMarkersHelper.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..0e79b30e5b 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.MapMarkersHelper.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..b4d4fa0c3b 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.MapMarkersHelper.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..63c84274c6 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.MapMarkersHelper.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 8cb6e832c5..f9f8a81726 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.MapMarkersHelper.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..ba13014b8f 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.MapMarkersHelper.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..a0a3ef4edb 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.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener; import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener; diff --git a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java index 91d9a6f255..f6aa0f9526 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.MapMarkersHelper.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 19748b100c..baadd43208 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.MapMarkersHelper; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java index 37bbbfda1a..a46e490635 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.MapMarkersHelper.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..6d99c3cad1 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.MapMarkersHelper.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..55f6063a87 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.MapMarkersHelper.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..4f39b41773 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.MapMarkersHelper.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..4c53ded466 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.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/mapcontextmenu/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java index b8f5789d47..6ea4e701e1 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.MapMarkersHelper.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..ddf3cecb9c 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.MapMarkersHelper.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..f75c71ca4c 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.MapMarkersHelper.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..c925f95d4b 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.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/mapcontextmenu/editors/WptPtEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java index 26062bafc4..80a937087f 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.MapMarkersHelper.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..30da85d0bb 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.MapMarkersHelper.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/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index aef217f347..89ffdd389c 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; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java index a1a3eaf82b..dc1e39bd92 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/HistoryMarkerMenuBottomSheetDialogFragment.java @@ -3,7 +3,7 @@ package net.osmand.plus.mapmarkers; import android.os.Bundle; import android.view.View; -import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.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/MapMarkerSelectionFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java index 993c5c1d93..e18a54c802 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java @@ -15,7 +15,7 @@ import androidx.annotation.Nullable; import net.osmand.AndroidUtils; import net.osmand.data.LatLon; -import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.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..69ec8af5a5 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java @@ -21,7 +21,7 @@ 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.mapmarkers.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..1bdf8701b4 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDbHelper.java @@ -4,8 +4,8 @@ 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.mapmarkers.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; @@ -13,7 +13,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..6d729c4ce2 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; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java index 5d368b7580..98b9128151 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java @@ -28,7 +28,7 @@ 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.mapmarkers.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 99% rename from OsmAnd/src/net/osmand/plus/MapMarkersHelper.java rename to OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index c168047ba9..c2615538a4 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -1,4 +1,4 @@ -package net.osmand.plus; +package net.osmand.plus.mapmarkers; import android.content.Context; import android.os.AsyncTask; @@ -19,10 +19,14 @@ 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; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java index a472dbf3a7..5cc2b081ab 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java @@ -20,8 +20,7 @@ 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.mapmarkers.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..8a891f7a11 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -39,8 +39,7 @@ 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.mapmarkers.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..305d9a6b5b 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -13,8 +13,7 @@ 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.mapmarkers.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/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java index 4b6eee036b..c81dffbf63 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java @@ -13,9 +13,9 @@ 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.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java index 6b8a1b9dcd..650fb9e9e5 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersGroupsAdapter.java @@ -21,11 +21,11 @@ import net.osmand.IndexConstants; import net.osmand.data.LatLon; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; -import net.osmand.plus.MapMarkersHelper; -import net.osmand.plus.MapMarkersHelper.GroupHeader; -import net.osmand.plus.MapMarkersHelper.MapMarker; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; -import net.osmand.plus.MapMarkersHelper.ShowHideHistoryButton; +import net.osmand.plus.mapmarkers.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.GroupHeader; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper.ShowHideHistoryButton; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java index 024651d819..2278d0412d 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersHistoryAdapter.java @@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.snackbar.Snackbar; -import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java index 31695a085a..d01a845f68 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersListAdapter.java @@ -17,7 +17,7 @@ import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; import net.osmand.plus.GeocodingLookupService.OnAddressLookupResult; -import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; diff --git a/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java index a08674368f..7a6c117058 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/EditTrackGroupDialogFragment.java @@ -28,8 +28,8 @@ import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.WptPt; import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; -import net.osmand.plus.MapMarkersHelper; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.EditFavoriteGroupDialogFragment.FavoriteColorAdapter; diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 72526e92ba..5c2f48f7e4 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -54,8 +54,8 @@ import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; -import net.osmand.plus.MapMarkersHelper; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java index 4b2bfd6665..39ca914b7b 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java @@ -27,8 +27,8 @@ import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; 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.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 4e16226026..b070f59264 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -51,7 +51,7 @@ import net.osmand.plus.GeocodingLookupService; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; import net.osmand.plus.GeocodingLookupService.OnAddressLookupResult; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; -import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmandApplication; import net.osmand.plus.settings.backend.OsmandSettings; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/MapMarkersCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/MapMarkersCard.java index f4bbd99d8c..15bdb9af01 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/MapMarkersCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/MapMarkersCard.java @@ -14,7 +14,7 @@ import androidx.appcompat.view.ContextThemeWrapper; import net.osmand.AndroidUtils; import net.osmand.data.LatLon; -import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.MapViewTrackingUtilities; diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java index 0d1f9d6bb8..e0ee6b758e 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -7,8 +7,8 @@ import androidx.annotation.Nullable; import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; -import net.osmand.plus.MapMarkersHelper; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; 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 43e8fe22c2..176303632d 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -14,7 +14,7 @@ import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.map.TileSourceManager.TileSourceTemplate; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.SQLiteTileSource; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java index 58af347031..25d5ca9503 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java @@ -14,7 +14,7 @@ import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.map.ITileSource; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java index b695395673..eec6cde0f9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportImportSettingsAdapter.java @@ -17,7 +17,7 @@ import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.map.ITileSource; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; -import net.osmand.plus.MapMarkersHelper.MapMarkersGroup; +import net.osmand.plus.mapmarkers.MapMarkersHelper.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/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/FavouritesLayer.java index d0a1b91d8b..1093d02e0f 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.MapMarkersHelper.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 46d51bca33..4169e8da0a 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.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarkersHelper.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..a8b992ddde 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.MapMarkersHelper.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..733d23308b 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.MapMarkersHelper.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..b8e9c9e8f0 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.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndLocationProvider; import net.osmand.plus.OsmandApplication; From 7c4b28613c11633eee7212a76ec188e3ba91212f Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 3 Nov 2020 23:21:33 +0200 Subject: [PATCH 03/36] Move inner classes from MapMarkersHelper --- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 2 +- .../net/osmand/plus/FavouritesDbHelper.java | 2 +- .../net/osmand/plus/GpxSelectionHelper.java | 2 +- .../EditFavoriteGroupDialogFragment.java | 2 +- .../osmand/plus/activities/MapActivity.java | 2 +- .../plus/activities/MapActivityActions.java | 2 +- .../plus/base/MapViewTrackingUtilities.java | 4 +- .../plus/helpers/ExternalApiHelper.java | 2 +- .../net/osmand/plus/helpers/IntentHelper.java | 4 +- .../plus/helpers/MapMarkerDialogHelper.java | 2 +- .../plus/mapcontextmenu/MapContextMenu.java | 2 +- .../plus/mapcontextmenu/MenuController.java | 2 +- .../controllers/AmenityMenuController.java | 2 +- .../FavouritePointMenuController.java | 2 +- .../controllers/MapMarkerMenuController.java | 2 +- .../controllers/WptPtMenuController.java | 2 +- .../editors/MapMarkerEditor.java | 2 +- .../editors/MapMarkerEditorFragment.java | 2 +- .../editors/WptPtEditorFragment.java | 2 +- .../editors/WptPtEditorFragmentNew.java | 2 +- .../plus/mapmarkers/CategoriesSubHeader.java | 24 ++ .../CoordinateInputDialogFragment.java | 2 +- .../osmand/plus/mapmarkers/GroupHeader.java | 24 ++ ...ryMarkerMenuBottomSheetDialogFragment.java | 1 - .../net/osmand/plus/mapmarkers/MapMarker.java | 137 +++++++ .../MapMarkerSelectionFragment.java | 1 - .../mapmarkers/MapMarkersActiveFragment.java | 1 - .../plus/mapmarkers/MapMarkersDbHelper.java | 2 - .../mapmarkers/MapMarkersDialogFragment.java | 2 +- .../plus/mapmarkers/MapMarkersGroup.java | 183 +++++++++ .../mapmarkers/MapMarkersGroupsFragment.java | 1 - .../plus/mapmarkers/MapMarkersHelper.java | 380 ++---------------- .../mapmarkers/MapMarkersHistoryFragment.java | 1 - .../plus/mapmarkers/PlanRouteFragment.java | 1 - ...ptCategoriesBottomSheetDialogFragment.java | 1 - .../mapmarkers/ShowHideHistoryButton.java | 5 + .../adapters/MapMarkersActiveAdapter.java | 7 +- .../adapters/MapMarkersGroupsAdapter.java | 17 +- .../adapters/MapMarkersHistoryAdapter.java | 2 +- .../adapters/MapMarkersListAdapter.java | 2 +- .../EditTrackGroupDialogFragment.java | 2 +- .../plus/myplaces/TrackPointFragment.java | 2 +- .../AddPointBottomSheetDialog.java | 2 +- .../MapRouteInfoMenu.java | 2 +- .../cards/MapMarkersCard.java | 2 +- .../backend/backup/MarkersSettingsItem.java | 2 +- .../backend/backup/SettingsHelper.java | 2 +- .../fragments/DuplicatesSettingsAdapter.java | 2 +- .../ExportImportSettingsAdapter.java | 2 +- .../plus/views/layers/FavouritesLayer.java | 2 +- .../osmand/plus/views/layers/GPXLayer.java | 4 +- .../plus/views/layers/MapMarkersLayer.java | 2 +- .../mapwidgets/MapMarkersWidgetsFactory.java | 2 +- .../mapwidgets/RouteInfoWidgetsFactory.java | 2 +- 54 files changed, 467 insertions(+), 401 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/mapmarkers/CategoriesSubHeader.java create mode 100644 OsmAnd/src/net/osmand/plus/mapmarkers/GroupHeader.java create mode 100644 OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java create mode 100644 OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroup.java create mode 100644 OsmAnd/src/net/osmand/plus/mapmarkers/ShowHideHistoryButton.java diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 89b5c95828..de3f073bdc 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -56,7 +56,7 @@ import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +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/FavouritesDbHelper.java b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java index 0e79b30e5b..c1db6114bc 100644 --- a/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java +++ b/OsmAnd/src/net/osmand/plus/FavouritesDbHelper.java @@ -17,7 +17,7 @@ import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; +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 b4d4fa0c3b..2651e7b988 100644 --- a/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/GpxSelectionHelper.java @@ -24,7 +24,7 @@ import net.osmand.StateChangedListener; import net.osmand.data.LatLon; import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; +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/activities/EditFavoriteGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java index 63c84274c6..001868e7b4 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java @@ -28,7 +28,7 @@ import net.osmand.AndroidUtils; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; +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/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index f9f8a81726..f38012a987 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -67,7 +67,7 @@ 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.mapmarkers.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener; import net.osmand.plus.OnDismissDialogFragmentListener; import net.osmand.plus.OsmAndConstants; diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index ba13014b8f..08fef7dd77 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -40,7 +40,7 @@ import net.osmand.plus.ContextMenuAdapter.ItemClickListener; import net.osmand.plus.ContextMenuItem; import net.osmand.plus.ContextMenuItem.ItemBuilder; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +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 a0a3ef4edb..9c6c6c2e7e 100644 --- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java +++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java @@ -13,7 +13,7 @@ import net.osmand.data.LatLon; import net.osmand.data.RotatedTileBox; import net.osmand.map.IMapLocationListener; import net.osmand.map.WorldRegion; -import net.osmand.plus.mapmarkers.MapMarkersHelper; +import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener; import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndLocationProvider; @@ -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 f6aa0f9526..6222663a00 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java @@ -32,7 +32,7 @@ import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +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 baadd43208..d0d74badfe 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.mapmarkers.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 a46e490635..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.mapmarkers.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 6d99c3cad1..1bb1e1146e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -25,7 +25,7 @@ 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.mapmarkers.MapMarkersHelper.MapMarker; +import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 55f6063a87..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.mapmarkers.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 4f39b41773..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.mapmarkers.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 4c53ded466..84ced6c613 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/FavouritePointMenuController.java @@ -15,7 +15,7 @@ import net.osmand.data.PointDescription; import net.osmand.data.TransportStop; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.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/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java index 6ea4e701e1..29bc7c01aa 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java @@ -12,7 +12,7 @@ import androidx.core.content.ContextCompat; import net.osmand.data.PointDescription; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +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 ddf3cecb9c..f436fb03fb 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/WptPtMenuController.java @@ -12,7 +12,7 @@ import net.osmand.data.PointDescription; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; +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 f75c71ca4c..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.mapmarkers.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 c925f95d4b..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.mapmarkers.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 80a937087f..eaf3cc994b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java @@ -18,7 +18,7 @@ import net.osmand.data.LatLon; import net.osmand.data.WptLocationPoint; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; +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 30da85d0bb..c973009798 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragmentNew.java @@ -21,7 +21,7 @@ import net.osmand.data.LatLon; import net.osmand.data.WptLocationPoint; import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; +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 89ffdd389c..09eef3d06c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -169,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 dc1e39bd92..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.mapmarkers.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..172aea8a46 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java @@ -0,0 +1,137 @@ +package net.osmand.plus.mapmarkers; + +import android.content.Context; + +import androidx.core.content.ContextCompat; + +import net.osmand.GPXUtilities; +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 GPXUtilities.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]; + } +} diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java index e18a54c802..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.mapmarkers.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 69ec8af5a5..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.mapmarkers.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 1bdf8701b4..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.mapmarkers.MapMarkersHelper.MapMarker; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java index 6d729c4ce2..fd9f100c4b 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java @@ -429,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(); 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 98b9128151..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.mapmarkers.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/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index c2615538a4..7184c79cc1 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -1,12 +1,10 @@ package net.osmand.plus.mapmarkers; -import android.content.Context; import android.os.AsyncTask; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; import net.osmand.FileUtils; import net.osmand.GPXUtilities; @@ -16,7 +14,6 @@ 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; @@ -152,12 +149,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); } @@ -194,16 +191,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); @@ -295,7 +293,6 @@ public class MapMarkersHelper { }); } - public void runSynchronization(final @NonNull MapMarkersGroup group) { ctx.runInUIThread(new Runnable() { @Override @@ -305,19 +302,17 @@ public class MapMarkersHelper { }); } - public MapMarkersGroup getMarkersGroup(GPXFile gpx) { 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); @@ -328,7 +323,7 @@ public class MapMarkersHelper { enableGroup(gr); return gr; } - + public MapMarkersGroup addOrEnableGroup(@NonNull GPXFile file) { updateGpxShowAsMarkers(new File(file.path)); MapMarkersGroup gr = getMarkersGroup(file); @@ -340,7 +335,6 @@ public class MapMarkersHelper { return gr; } - public MapMarkersGroup addOrEnableGroup(@NonNull FavoriteGroup group) { MapMarkersGroup gr = getMarkersGroup(group); if (gr == null) { @@ -350,7 +344,7 @@ public class MapMarkersHelper { enableGroup(gr); return gr; } - + public void enableGroup(@NonNull MapMarkersGroup gr) { // check if group doesn't exist internally if(!mapMarkersGroups.contains(gr)) { @@ -397,14 +391,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()); } @@ -416,7 +410,7 @@ public class MapMarkersHelper { markersDbHelper.removeActiveMarkersFromGroup(group.getId()); removeFromMapMarkersList(group.getActiveMarkers()); if (updateGroup) { - group.markers = group.getHistoryMarkers(); + group.setMarkers(group.getHistoryMarkers()); updateGroup(group); } reorderActiveMarkersIfNeeded(); @@ -439,12 +433,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); } } @@ -464,10 +458,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(); @@ -477,18 +469,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) { @@ -506,8 +499,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); } }); @@ -519,7 +512,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; } } @@ -532,7 +525,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); } @@ -540,11 +533,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<>(); @@ -553,14 +546,14 @@ 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<>(); @@ -574,7 +567,7 @@ public class MapMarkersHelper { 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); } @@ -1159,7 +1152,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; @@ -1179,17 +1172,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); } } @@ -1212,295 +1205,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 5cc2b081ab..c631e3d3e7 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java @@ -20,7 +20,6 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.snackbar.Snackbar; -import net.osmand.plus.mapmarkers.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/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 8a891f7a11..3e0842710c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -39,7 +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.mapmarkers.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 305d9a6b5b..d676372223 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -13,7 +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.mapmarkers.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 c81dffbf63..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.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarker; -import net.osmand.plus.mapmarkers.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 Date: Sun, 8 Nov 2020 17:00:41 +0200 Subject: [PATCH 04/36] Show markers groups in import settings UI --- .../backend/backup/MarkersSettingsItem.java | 15 ++++++++------- .../fragments/ImportDuplicatesFragment.java | 8 ++++++++ .../fragments/ImportSettingsFragment.java | 9 +++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java index 10384f2d2d..99722505d0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -96,7 +96,7 @@ public class MarkersSettingsItem extends CollectionSettingsItem public boolean isDuplicate(@NonNull MapMarkersGroup markersGroup) { String name = markersGroup.getName(); for (MapMarkersGroup group : existingItems) { - if (group.getName().equals(name)) { + if (Algorithms.stringsEqual(group.getName(), name)) { return true; } } @@ -139,12 +139,13 @@ public class MarkersSettingsItem extends CollectionSettingsItem @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; -// } + GPXFile gpxFile = generateGpx(); + 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; } }; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportDuplicatesFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportDuplicatesFragment.java index 14d89803e2..c2610d06a2 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportDuplicatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportDuplicatesFragment.java @@ -32,6 +32,7 @@ import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo; +import net.osmand.plus.mapmarkers.MapMarkersGroup; import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OsmNotesPoint; import net.osmand.plus.poi.PoiUIFilter; @@ -200,6 +201,7 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { List ttsVoiceFilesList = new ArrayList<>(); List voiceFilesList = new ArrayList<>(); List mapFilesList = new ArrayList<>(); + List markersGroups = new ArrayList<>(); for (Object object : duplicatesList) { if (object instanceof ApplicationMode.ApplicationModeBean) { @@ -236,6 +238,8 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { osmNotesPointList.add((OsmNotesPoint) object); } else if (object instanceof OpenstreetmapPoint) { osmEditsPointList.add((OpenstreetmapPoint) object); + } else if (object instanceof MapMarkersGroup) { + markersGroups.add((MapMarkersGroup) object); } } if (!profiles.isEmpty()) { @@ -298,6 +302,10 @@ 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); + } 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..d7ae7eb77b 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java @@ -41,6 +41,7 @@ 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.MapMarkersGroup; import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OsmNotesPoint; import net.osmand.plus.poi.PoiUIFilter; @@ -49,6 +50,7 @@ import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.backup.FavoritesSettingsItem; import net.osmand.plus.settings.backend.backup.GlobalSettingsItem; +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; @@ -436,6 +438,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { List osmNotesPointList = new ArrayList<>(); List osmEditsPointList = new ArrayList<>(); List favoriteGroups = new ArrayList<>(); + List markersGroups = new ArrayList<>(); for (Object object : data) { if (object instanceof ApplicationModeBean) { appModeBeans.add((ApplicationModeBean) object); @@ -459,6 +462,8 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { favoriteGroups.add((FavoriteGroup) object); } else if (object instanceof GlobalSettingsItem) { settingsItems.add((GlobalSettingsItem) object); + } else if (object instanceof MapMarkersGroup) { + markersGroups.add((MapMarkersGroup) object); } } if (!appModeBeans.isEmpty()) { @@ -490,6 +495,10 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { FavoritesSettingsItem baseItem = getBaseItem(SettingsItemType.FAVOURITES, FavoritesSettingsItem.class); settingsItems.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups)); } + if (!markersGroups.isEmpty()) { + MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.MARKERS, MarkersSettingsItem.class); + settingsItems.add(new MarkersSettingsItem(app, baseItem, markersGroups)); + } return settingsItems; } From 460980a475829e74c19fa7b2e96412fb37b8b5f4 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 9 Nov 2020 10:31:17 +0200 Subject: [PATCH 05/36] Export and import markers to file --- .../mapmarkers/MapMarkersDialogFragment.java | 2 +- .../plus/mapmarkers/MapMarkersHelper.java | 42 ++++++--- .../backend/backup/MarkersSettingsItem.java | 93 +++++++++++++++++-- 3 files changed, 116 insertions(+), 21 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java index fd9f100c4b..2a50192d03 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java @@ -481,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/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index 7184c79cc1..d6d9b7cd2f 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -5,6 +5,7 @@ import android.os.AsyncTask; import androidx.annotation.IntDef; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; import net.osmand.FileUtils; import net.osmand.GPXUtilities; @@ -58,6 +59,10 @@ public class MapMarkersHelper { public static final int BY_DATE_ADDED_ASC = 4; + public static final String GROUP_NAME = "group_name"; + public static final String GROUP_TYPE = "group_type"; + public static final String MARKER_HISTORY = "marker_history"; + private static final Log LOG = PlatformUtil.getLog(MapMarkersHelper.class); @Retention(RetentionPolicy.SOURCE) @@ -303,7 +308,7 @@ 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); @@ -347,7 +352,7 @@ public class MapMarkersHelper { 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()) { @@ -558,12 +563,12 @@ public class MapMarkersHelper { 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); @@ -1001,7 +1006,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()) { @@ -1009,18 +1015,32 @@ 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) { + wpt.category = marker.groupKey; + wpt.getExtensionsToWrite().put(GROUP_NAME, marker.groupName); + wpt.getExtensionsToWrite().put(GROUP_TYPE, String.valueOf(marker.getType())); + wpt.getExtensionsToWrite().put(MARKER_HISTORY, String.valueOf(marker.history)); + } + gpxFile.addPoint(wpt); } - GPXUtilities.writeGpxFile(fout, file); - return fout.getAbsolutePath(); + return gpxFile; } // --------------------------------------------------------------------------------------------- diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java index 99722505d0..0b57280d3a 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -7,28 +7,37 @@ import androidx.annotation.Nullable; import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; -import net.osmand.plus.mapmarkers.MapMarkersHelper; -import net.osmand.plus.mapmarkers.MapMarkersGroup; +import net.osmand.GPXUtilities.WptPt; +import net.osmand.data.LatLon; +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.util.Algorithms; import org.json.JSONException; import org.json.JSONObject; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import static net.osmand.IndexConstants.GPX_FILE_EXT; +import static net.osmand.plus.mapmarkers.MapMarkersHelper.GROUP_NAME; +import static net.osmand.plus.mapmarkers.MapMarkersHelper.GROUP_TYPE; public class MarkersSettingsItem extends CollectionSettingsItem { private MapMarkersHelper markersHelper; + private Map flatGroups = new LinkedHashMap<>(); public MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { super(app, null, items); @@ -85,9 +94,20 @@ public class MarkersSettingsItem extends CollectionSettingsItem for (MapMarkersGroup duplicate : duplicateItems) { if (shouldReplace) { - + MapMarkersGroup existingGroup = markersHelper.getMapMarkerGroupById(duplicate.getId(), duplicate.getType()); + if (existingGroup != null) { + List existingMarkers = new ArrayList<>(existingGroup.getMarkers()); + for (MapMarker marker : existingMarkers) { + markersHelper.removeMarker(marker); + } + } + } + appliedItems.add(duplicate); + } + for (MapMarkersGroup markersGroup : appliedItems) { + for (MapMarker marker : markersGroup.getMarkers()) { + markersHelper.addMapMarker(marker.point, marker.getOriginalPointDescription()); } - appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate)); } } } @@ -96,7 +116,9 @@ public class MarkersSettingsItem extends CollectionSettingsItem public boolean isDuplicate(@NonNull MapMarkersGroup markersGroup) { String name = markersGroup.getName(); for (MapMarkersGroup group : existingItems) { - if (Algorithms.stringsEqual(group.getName(), name)) { + if (Algorithms.stringsEqual(group.getName(), name) + && !Algorithms.isEmpty(group.getMarkers()) + && !Algorithms.isEmpty(markersGroup.getMarkers())) { return true; } } @@ -120,18 +142,62 @@ public class MarkersSettingsItem extends CollectionSettingsItem return new SettingsItemReader(this) { @Override - public void readFromStream(@NonNull InputStream inputStream, File destination) throws IOException, IllegalArgumentException { + 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 { - Map flatGroups = new LinkedHashMap<>(); + List markerColors = getMarkersColors(); + for (WptPt point : gpxFile.getPoints()) { + LatLon latLon = new LatLon(point.lat, point.lon); + + int colorIndex = markerColors.indexOf(point.getColor()); + if (colorIndex == -1) { + colorIndex = 0; + } + + PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, point.name); + MapMarker marker = new MapMarker(latLon, pointDescription, colorIndex, false, 0); + marker.nextKey = MapMarkersDbHelper.TAIL_NEXT_VALUE; + + MapMarkersGroup group = getOrCreateGroup(point); + group.getMarkers().add(marker); + } } } }; } + private MapMarkersGroup getOrCreateGroup(WptPt point) { + MapMarkersGroup markersGroup = flatGroups.get(point.category); + if (markersGroup != null) { + return markersGroup; + } + Map extensions = point.getExtensionsToRead(); + String groupName = extensions.get(GROUP_NAME); + String groupType = extensions.get(GROUP_TYPE); + int type = Algorithms.parseIntSilently(groupType, MapMarkersGroup.ANY_TYPE); + + if (point.category != null && groupName != null) { + markersGroup = new MapMarkersGroup(point.category, groupName, type); + } else { + markersGroup = new MapMarkersGroup(); + } + flatGroups.put(markersGroup.getId(), markersGroup); + items.add(markersGroup); + + return markersGroup; + } + + private List getMarkersColors() { + List colors = new ArrayList<>(); + for (int color : MapMarker.getColors(app)) { + colors.add(color); + } + return colors; + } + @Nullable @Override SettingsItemWriter getWriter() { @@ -139,7 +205,8 @@ public class MarkersSettingsItem extends CollectionSettingsItem @Override public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException { - GPXFile gpxFile = generateGpx(); + List mapMarkers = getMarkersFromGroups(items); + GPXFile gpxFile = markersHelper.generateGpx(mapMarkers, true); 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()))); @@ -150,4 +217,12 @@ public class MarkersSettingsItem extends CollectionSettingsItem } }; } + + private List getMarkersFromGroups(List markersGroups) { + List mapMarkers = new ArrayList<>(); + for (MapMarkersGroup group : markersGroups) { + mapMarkers.addAll(group.getMarkers()); + } + return mapMarkers; + } } \ No newline at end of file From f57e0324ffb7ac5ab8c47683dfba75c578080fee Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 9 Nov 2020 11:27:21 +0200 Subject: [PATCH 06/36] Add history markers to exported file --- .../net/osmand/plus/mapmarkers/MapMarkersHelper.java | 4 ++++ .../settings/backend/backup/MarkersSettingsItem.java | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index d6d9b7cd2f..dc3a25a61e 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -62,6 +62,8 @@ public class MapMarkersHelper { public static final String GROUP_NAME = "group_name"; public static final String GROUP_TYPE = "group_type"; public static final String MARKER_HISTORY = "marker_history"; + public static final String CREATION_DATE = "creation_date"; + public static final String VISITED_DATE = "visited_date"; private static final Log LOG = PlatformUtil.getLog(MapMarkersHelper.class); @@ -1037,6 +1039,8 @@ public class MapMarkersHelper { wpt.getExtensionsToWrite().put(GROUP_NAME, marker.groupName); wpt.getExtensionsToWrite().put(GROUP_TYPE, String.valueOf(marker.getType())); wpt.getExtensionsToWrite().put(MARKER_HISTORY, String.valueOf(marker.history)); + wpt.getExtensionsToWrite().put(CREATION_DATE, String.valueOf(marker.creationDate)); + wpt.getExtensionsToWrite().put(VISITED_DATE, String.valueOf(marker.visitedDate)); } gpxFile.addPoint(wpt); } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java index 0b57280d3a..4a8026ea44 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -31,8 +31,11 @@ import java.util.List; import java.util.Map; import static net.osmand.IndexConstants.GPX_FILE_EXT; +import static net.osmand.plus.mapmarkers.MapMarkersHelper.CREATION_DATE; import static net.osmand.plus.mapmarkers.MapMarkersHelper.GROUP_NAME; import static net.osmand.plus.mapmarkers.MapMarkersHelper.GROUP_TYPE; +import static net.osmand.plus.mapmarkers.MapMarkersHelper.MARKER_HISTORY; +import static net.osmand.plus.mapmarkers.MapMarkersHelper.VISITED_DATE; public class MarkersSettingsItem extends CollectionSettingsItem { @@ -106,7 +109,7 @@ public class MarkersSettingsItem extends CollectionSettingsItem } for (MapMarkersGroup markersGroup : appliedItems) { for (MapMarker marker : markersGroup.getMarkers()) { - markersHelper.addMapMarker(marker.point, marker.getOriginalPointDescription()); + markersHelper.addMarker(marker); } } } @@ -159,6 +162,13 @@ public class MarkersSettingsItem extends CollectionSettingsItem PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, point.name); MapMarker marker = new MapMarker(latLon, pointDescription, colorIndex, false, 0); + + String historyStr = point.getExtensionsToRead().get(MARKER_HISTORY); + String creationDateStr = point.getExtensionsToRead().get(CREATION_DATE); + String visitedDateStr = point.getExtensionsToRead().get(VISITED_DATE); + marker.creationDate = Algorithms.parseLongSilently(creationDateStr, 0); + marker.visitedDate = Algorithms.parseLongSilently(visitedDateStr, 0); + marker.history = Boolean.parseBoolean(historyStr); marker.nextKey = MapMarkersDbHelper.TAIL_NEXT_VALUE; MapMarkersGroup group = getOrCreateGroup(point); From 924d15616d04cb1b7509eaa590c0dff6e0585c57 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Mon, 9 Nov 2020 17:16:49 +0200 Subject: [PATCH 07/36] Resend map, after map editing error --- .../net/osmand/telegram/TelegramService.kt | 6 ++-- .../net/osmand/telegram/TelegramSettings.kt | 34 +++++++++++++------ .../telegram/helpers/ShareLocationHelper.kt | 16 +++++---- .../osmand/telegram/helpers/TelegramHelper.kt | 2 +- .../osmand/telegram/ui/LiveNowTabFragment.kt | 3 +- .../telegram/ui/SharingStatusBottomSheet.kt | 2 +- 6 files changed, 40 insertions(+), 23 deletions(-) diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt index 4ff84ca542..ee05034cb7 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt @@ -18,7 +18,6 @@ import net.osmand.telegram.helpers.TelegramHelper import net.osmand.telegram.helpers.TelegramHelper.* import net.osmand.telegram.notifications.TelegramNotification.NotificationType import net.osmand.telegram.utils.AndroidUtils -import net.osmand.telegram.utils.OsmandLocationUtils import org.drinkless.td.libcore.telegram.TdApi import java.util.* @@ -377,7 +376,10 @@ class TelegramService : Service(), LocationListener, TelegramIncomingMessagesLis Log.d(PlatformUtil.TAG, "Send live location error: $code - $message") when (messageType) { TelegramHelper.MESSAGE_TYPE_TEXT -> shareInfo.pendingTdLibText-- - TelegramHelper.MESSAGE_TYPE_MAP -> shareInfo.pendingTdLibMap-- + TelegramHelper.MESSAGE_TYPE_MAP -> { + shareInfo.pendingTdLibMap-- + shareInfo.currentMapMessageId = -1L + } } } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt index d9ec335a0e..a6a2377118 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramSettings.kt @@ -304,27 +304,18 @@ class TelegramSettings(private val app: TelegramApplication) { fun prepareForSharingNewMessages() { shareChatsInfo.forEach { (_, shareInfo) -> - prepareForSharingNewMessages(shareInfo) + shareInfo.resetMessagesInfo() } } fun prepareForSharingNewMessages(chatsIds: List) { chatsIds.forEach { shareChatsInfo[it]?.also { shareInfo -> - prepareForSharingNewMessages(shareInfo) + shareInfo.resetMessagesInfo() } } } - fun prepareForSharingNewMessages(shareInfo: ShareChatInfo) { - shareInfo.pendingTdLibText = 0 - shareInfo.pendingTdLibMap = 0 - shareInfo.currentTextMessageId = -1L - shareInfo.currentMapMessageId = -1L - shareInfo.pendingTextMessage = false - shareInfo.pendingMapMessage = false - } - fun getChatLivePeriod(chatId: Long) = shareChatsInfo[chatId]?.livePeriod fun getChatsShareInfo() = shareChatsInfo @@ -1497,6 +1488,27 @@ class TelegramSettings(private val app: TelegramApplication) { fun isPendingMapMessagesLimitReached() = pendingTdLibMap >= MAX_MESSAGES_IN_TDLIB_PER_CHAT + fun resetMessagesInfo() { + resetTextMessageInfo() + resetMapMessageInfo() + } + + fun resetTextMessageInfo() { + pendingTdLibText = 0 + currentTextMessageId = -1L + pendingTextMessage = false + } + + fun resetMapMessageInfo() { + pendingTdLibMap = 0 + currentMapMessageId = -1L + pendingMapMessage = false + } + + fun isTextMessageIdPresent() = currentTextMessageId != -1L + + fun isMapMessageIdPresent() = currentMapMessageId != -1L + companion object { internal const val CHAT_ID_KEY = "chatId" diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt index 8aa7d29856..35a397f4f5 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/ShareLocationHelper.kt @@ -138,7 +138,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { } } if (pendingMessagesLimitReached && checkNetworkTypeAllowed) { - checkNetworkType() + updateNetworkType() } } @@ -167,7 +167,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { app.locationMessages.getBufferedTextMessagesForChat(chatId).take(MAX_MESSAGES_IN_TDLIB_PER_CHAT).forEach { if (!shareInfo.isPendingTextMessagesLimitReached()) { if (it.deviceName.isEmpty()) { - if (!shareInfo.pendingTextMessage && shareInfo.currentTextMessageId != -1L) { + if (!shareInfo.pendingTextMessage && shareInfo.isTextMessageIdPresent()) { val content = OsmandLocationUtils.getTextMessageContent(shareInfo.updateTextMessageId, it, app) app.telegramHelper.editTextLocation(shareInfo, content) app.locationMessages.removeBufferedMessage(it) @@ -180,8 +180,12 @@ class ShareLocationHelper(private val app: TelegramApplication) { app.locationMessages.getBufferedMapMessagesForChat(chatId).take(MAX_MESSAGES_IN_TDLIB_PER_CHAT).forEach { if (!shareInfo.isPendingMapMessagesLimitReached()) { if (it.deviceName.isEmpty()) { - if (!shareInfo.pendingMapMessage && shareInfo.currentMapMessageId != -1L) { - app.telegramHelper.editMapLocation(shareInfo, it) + if (!shareInfo.pendingMapMessage) { + if (shareInfo.isMapMessageIdPresent()) { + app.telegramHelper.editMapLocation(shareInfo, it) + } else { + app.telegramHelper.sendNewMapLocation(shareInfo, it) + } app.locationMessages.removeBufferedMessage(it) } } else { @@ -279,7 +283,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { } } if (pendingMessagesLimitReached) { - checkNetworkType() + updateNetworkType() } } @@ -347,7 +351,7 @@ class ShareLocationHelper(private val app: TelegramApplication) { } } - fun checkNetworkType(){ + fun updateNetworkType(){ if (app.isInternetConnectionAvailable) { val networkType = when { app.isWifiConnected -> TdApi.NetworkTypeWiFi() diff --git a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt index 704a797af2..941e4a8aa4 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/helpers/TelegramHelper.kt @@ -840,7 +840,7 @@ class TelegramHelper private constructor() { } fun stopSendingLiveLocationToChat(shareInfo: ShareChatInfo) { - if (shareInfo.currentMapMessageId != -1L && shareInfo.chatId != -1L) { + if (!shareInfo.isMapMessageIdPresent() && shareInfo.chatId != -1L) { shareInfo.lastSendMapMessageTime = (System.currentTimeMillis() / 1000).toInt() client?.send( TdApi.EditMessageLiveLocation(shareInfo.chatId, shareInfo.currentMapMessageId, null, null)) { obj -> diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt index f3391246b4..fbc3725ec1 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/LiveNowTabFragment.kt @@ -15,7 +15,6 @@ import android.widget.TextView import androidx.appcompat.widget.ListPopupWindow import androidx.fragment.app.Fragment import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView import net.osmand.Location import net.osmand.data.LatLon import net.osmand.telegram.R @@ -99,7 +98,7 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage mainView.findViewById(R.id.swipe_refresh).apply { setOnRefreshListener { - app.shareLocationHelper.checkNetworkType() + app.shareLocationHelper.updateNetworkType() app.telegramHelper.scanChatsHistory() updateList() isRefreshing = false diff --git a/OsmAnd-telegram/src/net/osmand/telegram/ui/SharingStatusBottomSheet.kt b/OsmAnd-telegram/src/net/osmand/telegram/ui/SharingStatusBottomSheet.kt index ef080fe40d..3dd9968f1c 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/ui/SharingStatusBottomSheet.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/ui/SharingStatusBottomSheet.kt @@ -72,7 +72,7 @@ class SharingStatusBottomSheet : DialogFragment() { if (sharingStatusType.canResendLocation) { if (i == 0) { setOnClickListener { - app.shareLocationHelper.checkNetworkType() + app.shareLocationHelper.updateNetworkType() app.settings.prepareForSharingNewMessages(sharingStatus.chatsIds) app.shareLocationHelper.checkAndSendBufferMessages() app.forceUpdateMyLocation() From 31f9895bb4b7e40fb834b80601df45a5b8db9dc0 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Mon, 9 Nov 2020 18:27:25 +0300 Subject: [PATCH 08/36] Fix #10112 --- OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java index 18ebc9b688..c2b961646e 100644 --- a/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java +++ b/OsmAnd-java/src/main/java/net/osmand/GPXUtilities.java @@ -71,6 +71,7 @@ public class GPXUtilities { WHITE(0xFFFFFFFF), RED(0xFFFF0000), GREEN(0xFF00FF00), + DARKGREEN(0xFF006400), BLUE(0xFF0000FF), YELLOW(0xFFFFFF00), CYAN(0xFF00FFFF), From a9c797ebd769d95e45248352a96d8aa01120c6d5 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Mon, 9 Nov 2020 19:02:19 +0300 Subject: [PATCH 09/36] Fix #5310 --- .../net/osmand/plus/views/AnimateDraggingMapThread.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java index 0323498479..3df649ea2b 100644 --- a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java +++ b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java @@ -225,6 +225,13 @@ public class AnimateDraggingMapThread { if (!stopped) { animatingMoveInThread(mMoveX, mMoveY, animationTime, notifyListener, finishAnimationCallback); + } else if (finishAnimationCallback != null) { + tileView.getApplication().runInUIThread(new Runnable() { + @Override + public void run() { + finishAnimationCallback.run(); + } + }); } if (!stopped) { tileView.setLatLonAnimate(finalLat, finalLon, notifyListener); From 47bca02ec4fa83a8e19e3cbf17b5c66317468722 Mon Sep 17 00:00:00 2001 From: Achille Martin Date: Tue, 10 Nov 2020 14:40:50 +0100 Subject: [PATCH 10/36] Added translation using Weblate (Luxembourgish) --- OsmAnd/res/values-lb/strings.xml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 OsmAnd/res/values-lb/strings.xml diff --git a/OsmAnd/res/values-lb/strings.xml b/OsmAnd/res/values-lb/strings.xml new file mode 100644 index 0000000000..a6b3daec93 --- /dev/null +++ b/OsmAnd/res/values-lb/strings.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file From 29ee78dddc23b7bf1b520a58d8f6300cd902b135 Mon Sep 17 00:00:00 2001 From: ssantos Date: Sun, 8 Nov 2020 17:06:19 +0000 Subject: [PATCH 11/36] Translated using Weblate (Portuguese) Currently translated at 100.0% (3530 of 3530 strings) --- OsmAnd/res/values-pt/strings.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OsmAnd/res/values-pt/strings.xml b/OsmAnd/res/values-pt/strings.xml index 79de04a245..4c09d5f26f 100644 --- a/OsmAnd/res/values-pt/strings.xml +++ b/OsmAnd/res/values-pt/strings.xml @@ -3950,4 +3950,9 @@ Emergência Viagem Deve adicionar pelo menos dois pontos. + Gerir a assinatura + Há um problema com a sua assinatura. Clique no botão para ir às definições de assinatura do Google Play para corrigir o seu método de pagamento. + A assinatura do OsmAnd Live expirou + A assinatura do OsmAnd Live foi pausada + A assinatura do OsmAnd Live está em espera \ No newline at end of file From 6814ff196bb15908cfaf40fbfc2aeab739a2b668 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 8 Nov 2020 15:58:02 +0000 Subject: [PATCH 12/36] Translated using Weblate (German) Currently translated at 99.9% (3529 of 3530 strings) --- OsmAnd/res/values-de/strings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml index ef1285f3f1..997d1f8b5b 100644 --- a/OsmAnd/res/values-de/strings.xml +++ b/OsmAnd/res/values-de/strings.xml @@ -3950,4 +3950,10 @@ Symbole Lokale Karten Spezial + Sie müssen mindestens zwei Punkte hinzufügen. + Abonnement verwalten + Es gibt ein Problem mit Ihrem Abonnement. Klicken Sie auf die Schaltfläche, um zu den Einstellungen des Google Play Abonnements zu gelangen und Ihre Zahlungsmethode zu überprüfen. + OsmAnd Live Abonnement ist abgelaufen + OsmAnd Live Abonnement wurde ausgesetzt + OsmAnd Live Abonnement liegt auf Eis \ No newline at end of file From 0e737306c5fd2da3993f1526aee4f35940aac92e Mon Sep 17 00:00:00 2001 From: Athoss Date: Sun, 8 Nov 2020 14:53:25 +0000 Subject: [PATCH 13/36] Translated using Weblate (Hungarian) Currently translated at 99.8% (3525 of 3530 strings) --- OsmAnd/res/values-hu/strings.xml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/values-hu/strings.xml b/OsmAnd/res/values-hu/strings.xml index d82ea8991b..59663098d2 100644 --- a/OsmAnd/res/values-hu/strings.xml +++ b/OsmAnd/res/values-hu/strings.xml @@ -239,7 +239,7 @@ Rátéttérkép kiválasztása A térkép már telepítve van, a beállítások frissülnek. (Csempés) térkép kiválasztása telepítéshez vagy frissítéshez. - Nem lehet végrehajtani a műveletet internetkapcsolat nélkül. + A műveletet nem lehetséges internetkapcsolat nélkül végrehajtani. További telepítése… Raszteres térképek használata ezen nagyítási szint alatt. Legkisebb vektoros nagyítási szint @@ -1228,7 +1228,7 @@ Mented az adatokat GPX fájlként, vagy importálod az útpontokat a „Kedvencek”-be? Megosztás OsmAndból megosztott kedvencek - Nem találhatók letöltések, ellenőrizd az internetkapcsolatot. + Nem találhatók letöltések, ellenőrizze az internetkapcsolatot. Először egy hosszú koppintással adjon meg egy GPX-fájlt. Nyomvonal kijelölése Rendezés távolság szerint @@ -1370,7 +1370,7 @@ Frissítések Letöltés Helyi - A letöltés nem lehetséges, ellenőrizd az internet-kapcsolatot. + A letöltés nem lehetséges, ellenőrizze az internetkapcsolatot. Bezárás Minden fájl naprakész OpenGL megjelenítő használata @@ -2493,9 +2493,9 @@ A csoport összes pontja Nyitva ekkortól: Nyitva eddig: - Bezár ekkor: - Kinyit ekkor: - Kinyit ekkor: + Ekkor zár: + Ekkor nyit: + Ekkor nyit: További műveletek GPX fájl a kijelölt jegyzetek koordinátáival és adataival. GPX fájl az összes jegyzet koordinátáival és adataival. @@ -3939,4 +3939,5 @@ MGRS Az OsmAnd a NATO által is használt MGRS (Military Grid Reference System) koordinátákat alkamazza, amely hasonlít az UTM-formátumhoz. Legalább két pontot kell hozzáadnia. + Előfizetés kezelése \ No newline at end of file From db3780489f12e3cc34fb10f55936067c26059b3f Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Sun, 8 Nov 2020 17:19:16 +0000 Subject: [PATCH 14/36] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3530 of 3530 strings) --- OsmAnd/res/values-uk/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 699889de13..9a18b68263 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -2038,7 +2038,7 @@ Передплата включає щогодинні, щоденні та щотижневі оновлення, а також, необмежену кількість доступних завантажень для всіх мап з усього світу. Отримати Отримати на %1$s - Отримайте необмежені завантаження для мап, а також оновлення мап частіше ніж один раз на місяць: щотижня, щодня або щогодини. + Отримайте для мап необмежені завантаження та оновлення частіше ніж раз на місяць: щотижня, щодня або щогодини. Втулок для необмеженого доступу до мап, їх оновлень та отримання відомостей з Wikipedia. Милі/метри Пропустити завантаження мап @@ -2741,8 +2741,8 @@ \nРозкажіть нам про це. Надіслати пошуковий запит? Світ - Оновлення мап: щомісячне - Оновлення мап: щогодинне + Оновлення мап: щомісячно + Оновлення мап: щогодинно Купівля в застосунку Одноразовий платіж Після покупки він буде завжди доступний для вас. @@ -3661,7 +3661,7 @@ Передплата - OsmAnd Live OsmAnd покупки Довідник умовних позначень мапи. - Оплату буде здійснено з рахунку, прив\'язаного до вашого облікового запису Google Play, під час підтвердженні придбання. + Оплату буде здійснено під час підтвердження придбання з пов\'язаного з вашим обліковим записом Google Play рахунку. \n \nПередплата продовжується автоматично, якщо ви не скасуєте її до дати продовження. З вашого рахунку буде стягуватися плата за період продовження (щомісяця/щотримісяці/щорік) разово в день продовження. \n From bee18f9b9adef24150d805fc7b62b656c1303073 Mon Sep 17 00:00:00 2001 From: WaldiS Date: Mon, 9 Nov 2020 17:35:05 +0000 Subject: [PATCH 15/36] Translated using Weblate (Polish) Currently translated at 99.5% (3515 of 3530 strings) --- OsmAnd/res/values-pl/strings.xml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values-pl/strings.xml b/OsmAnd/res/values-pl/strings.xml index 9914cd72e6..49300cabce 100644 --- a/OsmAnd/res/values-pl/strings.xml +++ b/OsmAnd/res/values-pl/strings.xml @@ -3837,9 +3837,7 @@ Cała trasa zostanie ponownie wyznaczona przy użyciu wybranego profilu. Tylko następny segment zostanie przeliczony przy użyciu wybranego profilu. Wybierz sposób łączenia punktów, za pomocą linii prostej, lub oblicz trasę między nimi w sposób określony poniżej. - Aby skorzystać z tej opcji, OsmAnd musi przyciągnąć ślad do dróg mapy. -\n -\nW następnym kroku należy wybrać profil nawigacji w celu wykrycia dozwolonych dróg i odległości progowej w celu przybliżenia śledzenia drogi. + Następnie przyciągnij trasę do najbliższej dozwolonej drogi za pomocą jednego z profili nawigacji, aby skorzystać z tej opcji. Zdjęcia z poziomu ulicy Czy na pewno chcesz odrzucić wszystkie zmiany w zaplanowanej trasie, zamykając ją\? W przypadku odwrotnego kierunku @@ -3945,7 +3943,7 @@ Mapy lokalne Luka Udogodnienie - Specjalne + Specjalny Transport Usługi Symbole @@ -3956,4 +3954,8 @@ Zarządzaj subskrypcją Subskrypcja OsmAnd Live wygasła Subskrypcja OsmAnd Live została wstrzymana + Do jazdy skuterem śnieżnym z wyznaczonymi drogami i torami. + Należy dodać co najmniej dwa punkty. + Wystąpił problem z Twoją subskrypcją. Kliknij przycisk, aby przejść do ustawień subskrypcji Google Play i naprawić metodę płatności. + Subskrypcja OsmAnd Live jest wstrzymana \ No newline at end of file From 93e8b7939efda6237a7d88262a7d4fb65cf641d8 Mon Sep 17 00:00:00 2001 From: abdullah abdulrhman Date: Sun, 8 Nov 2020 11:02:06 +0000 Subject: [PATCH 16/36] Translated using Weblate (Arabic) Currently translated at 100.0% (3530 of 3530 strings) --- OsmAnd/res/values-ar/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OsmAnd/res/values-ar/strings.xml b/OsmAnd/res/values-ar/strings.xml index b0694fc934..68aee33373 100644 --- a/OsmAnd/res/values-ar/strings.xml +++ b/OsmAnd/res/values-ar/strings.xml @@ -3117,7 +3117,7 @@ يستخدم أوسماند تنسيق UTM وهو مشابه ولكن غير مطابق لتنسيق UTM الناتو. مثال معيار الإحداثيات - فتح رمز الموقع + رمز الموقع المفتوح (OLC) سيتم تطبيق التنسيق المحدد في كل أنحاء التطبيق. يتم تحديد هذا الاعداد بشكل افتراضي للأوضاع: %s تغيير الإعدادات @@ -3658,15 +3658,15 @@ مشتريات أوسماند دليل رموز الخريطة. أوضاع الملاحة - • خرائط جديدة للمنحدرات غير المتصلة بالإنترنت + • خرائط جديدة للتضاريس توضح المنحدرات من دون الحاجة للاتصال بالإنترنت \n \n • التخصيص الكامل للمفضلات ونقاط الطرق GPX - الألوان المخصصة والأيقونات والأشكال \n \n • تخصيص ترتيب العناصر في قائمة السياق ، تكوين الخريطة ، درج \n -\n • ويكيبيديا كطبقة منفصلة في تكوين الخريطة ، حدد اللغات المطلوبة فقط +\n • عرض ويكيبيديا كطبقة منفصلة في تكوين الخريطة ، حدد اللغات المطلوبة فقط \n -\n • إنشاء مرشح / خرائط POI الخاصة بك مع مرونة تامة +\n • إنشاء مرشح / خرائط للمعالم الخاصة بك مع مرونة تامة \n \n • تمت إضافة خيارات لاستعادة إعدادات الأوضاع المخصصة \n @@ -3674,7 +3674,7 @@ \n \n • إصلاح أحجام واجهة المستخدم على الأجهزة اللوحية \n -\n • إصلاح الخلل مع RTL +\n • إصلاح الخلل مع اللغات التي تكتب من اليمين \n \n إستئناف @@ -3683,7 +3683,7 @@ إظهار وسائل النقل العام إظهار/إخفاء وسائل النقل العام زر لإظهار أو إخفاء وسائل النقل العام على الخريطة. - إنشاء /تحرير POI + إنشاء /تحرير موضع مكان مكان الموقف إضافة / تحرير المفضلة استعادة ترتيب العناصر الافتراضية From 130414afa942ba7625839e28ad4dde579de73b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Kotr=C4=8D?= Date: Mon, 9 Nov 2020 14:53:42 +0000 Subject: [PATCH 17/36] Translated using Weblate (Czech) Currently translated at 81.9% (2892 of 3530 strings) --- OsmAnd/res/values-cs/strings.xml | 74 ++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/OsmAnd/res/values-cs/strings.xml b/OsmAnd/res/values-cs/strings.xml index 5c5a1a7d25..28f2745e80 100644 --- a/OsmAnd/res/values-cs/strings.xml +++ b/OsmAnd/res/values-cs/strings.xml @@ -3654,4 +3654,78 @@ Zobrazená oblast: %1$s x %2$s Nechat obrazovku zapnutou Nechat obrazovku vypnutou Dále, pro použití této možnosti připojte vaši stopu k nejbližší povolené cestě s některým z vašich navigačních profilů. + Použít systémový časový limit obrazovky + \"Obnovit do základního nastavení\" nastaví výchozí pořadí. + Kopírovat souřadnice + • Profily: nyní můžete změnit pořadí, nastavit ikonu pro mapu, změnit všechna nastavení základních profilů a resetovat je zpět do výchozího stavu +\n +\n • V navigaci přibylo číslo výjezdu +\n +\n • Přepracovaná nastavení modulů +\n +\n • Přepracovaná obrazovka nastavení pro rychlý přístup ke všem profilům +\n +\n • Přidaná možnost kopírovat nastavení z jiného profilu +\n +\n • Přidaná možnost skrýt nebo změnit pořadí kategorií bodů zájmu při hledání +\n +\n • Zpřesněné umístění ikon bodů zájmu na mapě +\n +\n • Přidané údaje o východu a západu slunce v nastavení mapy +\n +\n • Přidané ikony Domov a Práce na mapě +\n +\n • Přidaná podpora pro víceřádkové popisy v nastavení +\n +\n • Přidaná správná transliterace v mapě Japonska +\n +\n • Přidaná mapa Antarktidy +\n +\n + Vymazat zaznamenaná data + Přímo k bodu + Nastavte počet položek v \"Úvodním panelu\", \"Nastavení mapy\" a \"Kontextovém menu\". +\n +\nVypněte nepoužívané moduly, abyste skryli jejich ovládací prvky. %1$s. + Položky v úvodním panelu a kontextovém menu + Nastavení uživatelského rozhraní + Úvodní panel + Skrýt veřejnou dopravu + Zobrazit veřejnou dopravu + Zobrazit/skrýt veřejnou dopravu + Tlačítko pro zobrazení nebo skrytí veřejné dopravy na mapě. + Vytvořit / upravit bod zájmu + Parkovací místa + Přidat / upravit oblíbený bod + Obnovit výchozí pořadí položek + Zpět k úpravám + Tlačítko akce přepne mezi zvolenými profily. + Přidat profil + Změnit profil aplikace + Nebyly nalezeny žádné vhodné profily. + Přehledová mapa světa (detailní) + Nepodporovaný typ + Zadejte šířku svého vozidla, na trase mohou být omezení pro široká vozidla. + Zadejte výšku svého vozidla, na trase mohou být omezení pro vysoká vozidla. + Zadejte hmotnost svého vozidla, na trase mohou být omezení pro těžká vozidla. + Zadejte délku svého vozidla, na trase mohou být omezení pro dlouhá vozidla. + GPX nemá správný tvar pro OsmAnd, kontaktujte prosím podporu pro další přezkoumání. + Vždy + Ovládání obrazovky + Vypne obrazovku po uplynutí systémového časového limitu. + Použít systémový časový limit obrazovky + Zvolte možnosti probuzení obrazovky (při zamykání zařízení se ujistěte, že je OsmAnd na popředí): + Každý navigační pokyn zapne obrazovku. + Navigační pokyny + Vypnuto. Vyžaduje \"Nechat obrazovku zapnutou\" pod \"Časový limit obrazovky po probuzení\". + Stisknutím tlačítka napájení zapnete obrazovku s aplikací OsmAnd na zamčené obrazovce. + Tlačítko napájení + Senzor přiblížení + Zvolte časový limit vypnutí obrazovky po probuzení (\"%1$s\" znamená bez časového limitu.) + Musíte přidat aspoň dva body. + Spravovat předplatné + S vaším předplatným je problém. Klikněte na tlačítko pro přechod do nastavení předplatného v Google Play a opravte způsob platby. + Předplatné OsmAnd Live skončilo + Předplatné OsmAnd Live je pozastaveno + Předplatné OsmAnd Live je zablokované \ No newline at end of file From 0f57503911fa760216d59982a9ba86c8b826970d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1ns?= Date: Sun, 8 Nov 2020 23:50:41 +0000 Subject: [PATCH 18/36] Translated using Weblate (Galician) Currently translated at 100.0% (3530 of 3530 strings) --- OsmAnd/res/values-gl/strings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/res/values-gl/strings.xml b/OsmAnd/res/values-gl/strings.xml index e422eecf62..2bff3c9301 100644 --- a/OsmAnd/res/values-gl/strings.xml +++ b/OsmAnd/res/values-gl/strings.xml @@ -3971,4 +3971,10 @@ Lon %2$s Deporte Emerxencia Viaxe + Tes que engadir polo menos dous puntos. + Xestionar subscrición + Hai un problema coa túa subscrición. Preme no botón para ir ós axustes de subscrición da Google Play e corrixir o teu método de pagamento. + A subscrición do OsmAnd Live expirou + A subscrición do OsmAnd Live foi detida + A subscrición do OsmAnd Live está en espera \ No newline at end of file From 6310e3c7451bcd72d5cd9417e69833f5c828e39d Mon Sep 17 00:00:00 2001 From: WaldiS Date: Mon, 9 Nov 2020 17:37:22 +0000 Subject: [PATCH 19/36] Translated using Weblate (Polish) Currently translated at 99.7% (3822 of 3830 strings) --- OsmAnd/res/values-pl/phrases.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values-pl/phrases.xml b/OsmAnd/res/values-pl/phrases.xml index 20c67e111f..d048d53fdb 100644 --- a/OsmAnd/res/values-pl/phrases.xml +++ b/OsmAnd/res/values-pl/phrases.xml @@ -3562,10 +3562,10 @@ Zagrożenie Radioterapia Usunięty obiekt - н/к - н/к* + n/c + n/c* 1A - 1А* + 1A* 1B 1B* 2A @@ -3817,7 +3817,7 @@ Poziom wody: poniżej średniego poziomu wody Poziom wody: obmywający falami Poziom wody: pokrywający - Dostęp do Internetu dla klientów + Dostęp do Internetu: klienci Ssanie Pod ciśnieniem Woda podziemna From 55562d3072d360eb29595ccce4861485ce9bb074 Mon Sep 17 00:00:00 2001 From: Ajeje Brazorf Date: Sun, 8 Nov 2020 18:40:09 +0000 Subject: [PATCH 20/36] Translated using Weblate (Sardinian) Currently translated at 99.6% (3817 of 3830 strings) --- OsmAnd/res/values-sc/phrases.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-sc/phrases.xml b/OsmAnd/res/values-sc/phrases.xml index 2c62c095ff..7e589f3ab7 100644 --- a/OsmAnd/res/values-sc/phrases.xml +++ b/OsmAnd/res/values-sc/phrases.xml @@ -3845,4 +3845,5 @@ Cabannas Cobertura Puntu GPX + Torre ràdar \ No newline at end of file From 5d8d84a3d87f1bf142e51692043d66898ca924a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1ns?= Date: Sun, 8 Nov 2020 23:50:58 +0000 Subject: [PATCH 21/36] Translated using Weblate (Galician) Currently translated at 100.0% (3830 of 3830 strings) --- OsmAnd/res/values-gl/phrases.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/res/values-gl/phrases.xml b/OsmAnd/res/values-gl/phrases.xml index b377d6ec35..fece900054 100644 --- a/OsmAnd/res/values-gl/phrases.xml +++ b/OsmAnd/res/values-gl/phrases.xml @@ -3842,4 +3842,5 @@ Pendellos Terrazo Punto GPX + Torre de radar \ No newline at end of file From f737df035a4a0c27866f864a2c1f49c03de013c8 Mon Sep 17 00:00:00 2001 From: Franco Date: Sun, 8 Nov 2020 17:29:35 +0000 Subject: [PATCH 22/36] Translated using Weblate (Spanish (Argentina)) Currently translated at 99.9% (3529 of 3530 strings) --- OsmAnd/res/values-es-rAR/strings.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index f052206422..6358e33bbe 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -3952,4 +3952,9 @@ MGRS OsmAnd usa MGRS, similar al formato UTM de la OTAN. Debes añadir al menos dos puntos. + Gestionar suscripción + Hay un problema con la suscripción. Pulsa el botón para ir a los ajustes de la suscripción de Google Play y corregir el método de pago. + La suscripción a OsmAnd Live ha caducado + La suscripción a OsmAnd Live se ha pausado + La suscripción a OsmAnd Live está en espera \ No newline at end of file From 62af03f85c561054a287a9792e13f725d2d8c54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Priit=20J=C3=B5er=C3=BC=C3=BCt?= Date: Mon, 9 Nov 2020 16:52:10 +0000 Subject: [PATCH 23/36] Translated using Weblate (Estonian) Currently translated at 99.2% (3505 of 3530 strings) --- OsmAnd/res/values-et/strings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml index f1fbad6379..8e43c4142f 100644 --- a/OsmAnd/res/values-et/strings.xml +++ b/OsmAnd/res/values-et/strings.xml @@ -3798,4 +3798,10 @@ OsmAnd kasutab MGRS-vormingut, mis on sarnane NATO UTM-vormingule. MGRS MGRS + Graafiku joonistamiseks pead lisama vähemalt kaks punkti. + OsmAnd Live tellimus on ootel + OsmAnd Live tellimus on peatatud + OsmAnd Live tellimus on aegunud + Sinu tellimusega on üks pisikene segadus. Selleks et Google Play seadistuses makseviisi parandada, palun klõpsi seda nuppu. + Halda tellimusi \ No newline at end of file From 0db0a82b2e2e795e6a7ec02f283e8ef719dc2710 Mon Sep 17 00:00:00 2001 From: Verdulo Date: Sun, 8 Nov 2020 12:45:52 +0000 Subject: [PATCH 24/36] Translated using Weblate (Esperanto) Currently translated at 99.9% (3529 of 3530 strings) --- OsmAnd/res/values-eo/strings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OsmAnd/res/values-eo/strings.xml b/OsmAnd/res/values-eo/strings.xml index 93ff65c8f2..f6594182cd 100644 --- a/OsmAnd/res/values-eo/strings.xml +++ b/OsmAnd/res/values-eo/strings.xml @@ -3946,4 +3946,10 @@ MGRS MGRS OsmAnd uzas MGRS, kiu estas simila al la formo UTM NATO. + Aldonu almenaŭ du punktojn. + Administri abonon + Okazis problemo pri via abono. Premu la butonon por iri al agordoj pri abonoj ĉe Google Play por korekti vian pagmanieron. + Abono OsmAnd Live senvalidiĝis + Abono OsmAnd Live estas paŭziigita + Abono OsmAnd Live estas ĉesigita \ No newline at end of file From 64ac78366fbe4004d4f081efffa5a59457953f91 Mon Sep 17 00:00:00 2001 From: abdullah abdulrhman Date: Tue, 10 Nov 2020 10:03:59 +0000 Subject: [PATCH 25/36] Translated using Weblate (Arabic) Currently translated at 43.4% (1664 of 3830 strings) --- OsmAnd/res/values-ar/phrases.xml | 367 ++++++++++++++++--------------- 1 file changed, 188 insertions(+), 179 deletions(-) diff --git a/OsmAnd/res/values-ar/phrases.xml b/OsmAnd/res/values-ar/phrases.xml index ea7008244a..3a9d249731 100644 --- a/OsmAnd/res/values-ar/phrases.xml +++ b/OsmAnd/res/values-ar/phrases.xml @@ -3,12 +3,12 @@ متجر نقل شخصي نقل عام - مركز صحّيّ + الرعاية الصحية مكتب نادي مطعم و مقهى ماليّة - ويكيبيديا + ويكيبديا متجر شوكلاته متجر قهوة مجمّع @@ -18,32 +18,32 @@ متجر هواتف نقّالة متجر درّاجات ناريّة طوارئ - النقل - محطة بنزين + وسائل النقل + محطة وقود نقل جوي نقل بحري من صنع الإنسان - الإمداد بالمياه + إمدادات المياه الطاقة الاتصالات - استخدام الأراضي - التعليم - الإدارية - الرياضة + الأراضي المستخدمة + تعليم + إداري + رياضة السياحة معالم سياحية - الوصول إلى شبكة الإنترنت + الوصول إلى الإنترنت المواد الغذائية الخدمات الحرف اليدوية - الطبيعية - العسكرية - المحددة من قبل المستخدم + طبيعة + عسكري + محددة من قبل المستخدم موقع الكتابات القديمة - مخبزة + مخبز محل الخمور متجر الجبن - متجر + بقالة - متجر صغير سوبر ماركت متجر المعكرونة متجر تحف @@ -58,25 +58,25 @@ الحد الأدنى للسن تربية الأحياء المائية محطة الضخ - عائق طريق - متجر وسوبرماركت - دراجات نقل - مخزن المزرعة + عوائق الطريق + متجر صغير وسووبر ماركت + نقل الدراجات + متجر المزرعة أماكن الإقامة أوقات الفراغ تربية الأحياء المائية: بلح البحر تربية الأحياء المائية: الأسماك تربية الأحياء المائية: الجمبري - مسارات المشي + مسارات المشي الخلوي متجر شاي متجر الحلويات آلة بيع متجر حقائب - متجر أفرشة + متجر مفارش متجر سجاد صيدلية ملابس أطفال - متجر الأحذية + متجر أحذية متجر شموع متجر كمبيوتر متجر الأقمشة @@ -91,26 +91,26 @@ دكان الهدايا متجر عام متجر اغراض الحدائق - متجر الغاز المسال + متجر الغاز السائل متجر مجوهرات - متجر ألأعشاب + محل عطارة معدات الصيد متجر الديكور الداخلي متجر الموسيقى معدات الموسيقى أغدية عضوية - متجر أغراض الكلاب - متجر الدهان - متجر ألألعاب + متجر الحيوانات الأليفة + متجر الدهانات + متجر ألعاب موقف سيارات موقف دراجات نارية مدخل موقف سيارات موقف دراجات هوائية تذاكر موقف السيارات تذاكر موقف سيارات و تذاكر للنقل العام - محل للمشروبات + متجر مرطبات صيدلية - مدرسة تعليم السياقة + مدرسة تعليم القيادة مدرسة نوع المبنى : مسجد مستشفى @@ -118,10 +118,10 @@ نوع العمل الفني : نافورة نجار سباك - تاجر سيارات - تصليح السيارات + معرض سيارات + ورشة تصليح السيارات خراطيش الطابعة - بطاريات السيارات + بطاريات سيارات سيارات موقع خاص للقوافل الإسم الدولي @@ -132,9 +132,9 @@ الإسم البديل الإسم الرسمي قرية - مدينة + مدينة صغيرة موقع إنترنت - هاتف النجدة + هاتف الطوارئ هواتف نقالة الهاتف قسائم تعبئة الهاتف @@ -142,23 +142,23 @@ طفاية حريق خرطوم إطفاء الحريق متجر الألعاب النارية - مطب + مطب خفيف مقهى مقهى إنترنت فندق جامعة قطار - النقل الجوي - نقاط شبكة التنزه/ركوب الدراجات - قوانين المرور جارية المفعول + النقل المعلق بالكيابل + مجموعة نقاط المشي الخلوي \"الهايكنق\"/ركوب الدراجات + كمائن و مراصد المرور بنية المواصلات - صرف القمامة + مكب النفايات بحري - أطعمة لذيذة - بقالة خضراء + محل أطعمة مستوردة + متجر خضروات متجر مأكولات بحرية - متجر الحلويات - ردهة مثلجات + متجر حلويات + ركن المثلجات متجر ألبان متجر نبيذ متجر كتب @@ -166,7 +166,7 @@ متجرفنون سلع أطفال متجر أزياء - متجر جمعيات خيرية + متجر خيري متجر ملابس محل نسخ متجر ستائر @@ -175,11 +175,11 @@ متجر لوازم الطيران الحر مركز الحديقة محل زجاج - متجر لواحق الحاسوب + متجر ملحقات الحاسوب محطة القطارات - أثاث مطبخ + أثاث المطبخ متجر جلود - إمدادات طبية + مستلزمات طبية بائع جرائد طبيب العيون متجر صور @@ -187,22 +187,22 @@ متجر بضائع الغوص سلع رياضية متجر هاي فاي - متجر في الهواء الطلق + متجر أدوات التنزه والرحلات طول خزان ماء قنصلية شرفية متجر تقنيات الراديو - متجر موائد + متجر أدوات المائدة بيع التذاكر متجر تبغ - محطة تجارية - مخزن إطارات + مبسط تجاري + متجر الاطارات متجر مكانس كهربائية متجر متنوع متجر فيديوتاك متجر متعدد الأقسام متجر إلكترونيات - متجر طاقة + متجر أدوات طاقة قطع غيار السيارات ألعاب نماذج مقياس @@ -214,13 +214,13 @@ صنبور مياه الإطفاء سلة حصى محطة إسعاف - منفذ طوارئ - فورد + نقطة وصول الطوارئ + مجرى الماء على الطريق فحص المركبات غسيل السيارات محطة بنزين: بترول، ديزل، غاز ديزل - ديزل جي تي أل + ديزل GTL ديزل حيوي أوكتان 80 أوكتان 91 @@ -241,11 +241,11 @@ محطة شحن هواء مضغوط كراجات - موقف النقل العمومي + موقف النقل العام موقف حافلات موقف حافلات - مكان توقف وسائل النقل العمومي - محطة النقل العمومي + مكان توقف وسائل النقل العام + محطة النقل العام محطة حافلات منصة سكك حديدية محطة سكك حديدية @@ -260,7 +260,7 @@ المنارة تأجير دراجات جدار مدينة - مدينة + مدينة كبيرة باب مدينة محكمة مطعم @@ -269,10 +269,10 @@ مبنى حلاق مرحاض; حمام - مطب + مطب قوي ممر الراجلين مكتب بريد - خزان مياه عمودي + برج مياه جسر حوض سباحة مولد طاقة @@ -316,8 +316,8 @@ نفق سكك حديدية وادي خياط - مُحَوِّل الطريق السيار - موقف ترامواي + تقاطع الطريق السريع + توقف الترام كتب أحذية ألومنيوم @@ -327,7 +327,7 @@ مصابيح منخفضة الطاقة أنابيب ضوء النيون معدن - عناصر كهربائية + أغراض الكترونية سلع بيضاء زيت الطهي زيت المحرك @@ -342,14 +342,14 @@ زيت مستعمل زجاجات صفائح معدنية - رقاقة معدنية + ورق قصدير مكتب التوظيف مكتب البحوث مكتب تكنولوجيا المعلومات مكتب جرائد مكتب مهندس معماري وكالة إعلانات - مؤسسة تربوية + مؤسسة تعليمية ستوديو مكتب شؤون دينية مكتب منظمة @@ -368,7 +368,7 @@ نوع المصعد لـ: كلب، قط نوع المصعد لـ: حصان طائرات تاريخية - متجرعسل + متجر عسل بالمصعد بدون مصعد مكتب التخييم @@ -426,107 +426,107 @@ مصدر المياه طريقة الدفع الصوت - نوع + النوع خدمة خدمة ذاتية - نوع - محطة مترو الإنفاق - نوع + النوع + محطة مترو + النوع تدفئة مضخة - نوع - نوع - نوع + النوع + النوع + النوع التخصص - نوع - الديانة - الطائفة - نوع - مخيم الكشافة - نوع + النوع + الدين + المذهب + النوع + مخيم كشافة + النوع صعوبة الطريق - رسوم + الرسوم التدخين - الوجبات الجاهزة + الطلب الخارجي كوكتيلات - نوع + النوع النفايات المقبولة - نوع + النوع موسمي خصائص المياه التخصص الصحي نوع التدليك - الخيام + خيام غسالة - البيوت المتنقلة - الإمداد بالطاقة + كارفان (مقطورة متنقلة) + مصدر الطاقة النظام الطبي نوع الوقود (افيا) إضافي نوع البيع - نوع + النوع نوع - موقع - رصيف ذوي الاحتياجات - بدون فرش + الموقع + مسار الرصيف البارز (للمكفوفين) + فرش آلي مغطى نقل البضائع - دراجات النقل - تعيين + دراجات التنقل + الصفة العاصمة - استغناء + استلام خاصية تصنيف النجوم المحتويات - إضافي + اضافية الريف نوع - جلوس في الهواء الطلق - التسليم + جلوس في الخارج + التوصيل مصنع الجعة مصغر خدمة موقد سطح العري - النظام الغذائي + حمية صحن نوع الدفع (نقل) - نوع + النوع نوع الوقود قيادة - سق عبر + مسار طلبات السيارة الفئة المستهدفة هواء مضغوط مكنسة كهربائية مميزة - محل وراقة + قرطاسية وأدوات مكتبية مستحضرات التجميل متجر الساعات متجر التوابل ممر جبلي مراقبة الحدود - وسادة سرعة + مطبات مركبات صغيرة غاز البترول المسال محطة وقود الطائرات محطة بنزين للقوارب - موقف ترامواي - رادار + موقف الترام + رادار سرعة تقاطع - مساحة للإستراحة - أشغال المياه + منطقة استراحة + أعمال المياه حوض سفن - محطة مياه الصرف الصحي + محطة الصرف الصحي سد طاحونة مائية محطة فرعية محول - محطة للطاقة + محطة توليد الطاقة صندوق البريد هاتف برج التبريد - إعادة التدوير - مركز لإعادة التدوير + إعادة تدوير + مركز إعادة التدوير حاوية زجاج ورق @@ -542,30 +542,30 @@ التعبئة والتغليف البلاستيكي جرائد كرتون - الورق المقوى - المجلات + ورق مقوى + مجلات تغليف ورقي أجهزة صغيرة - الخشب + خشب تتراباك - الطلاء - الأدوية - السماد العضوي + طلاء + أدوية + سماد عضوي أشجار عيد الميلاد - المصابيح الكهربائية - ألواح رقائقيه - النفايات الحيوانية + مصابيح كهربائية + ألواح خشبية - بلاكاش + نفايات حيوانية حفاضات الأطفال دراجات هوائية - مطمرة نفايات - النفايات النووية + مكب نفايات + نفايات نووية سلة المهملات مساحة تجارية - كروم + حقل عنب مزرعة - المرج + مرعى أو مرج قناة - المراقبة + مراقبة مرصد فلكي صاري @@ -586,21 +586,21 @@ الجمارك البلد نعم - قرية صغيرة + قرية صغيرة - هجرة بيت معزول ضاحية حي مزرعة الإسعافات الأولية - الطب البيطري + بيطري مصحة - الطب البديل + طب بديل بنك دم مركز طبي قابلة - أخصائي العلاج الطبيعي + أخصائي علاج طبيعي طبيب الأرجل - الطبيب النفساني + معالج نفسي إعادة التأهيل مرفق طبي طب الأطفال @@ -659,34 +659,34 @@ سفينة تاريخية نصب تذكاري حديقة الحيوانات - زيارة منزلية + الزيارة المنزلية أدوات مساعدة للسمع لوازم السفن والقوارب متجر ستائر متجر الدرجات الرباعية - سوق + سوق مباسط متجر لوازم المسبح متجر لوازم الفنون والحرف لوازم دينية - رفش اطفاء النار + أداة/مكنسة اطفاء النار معبر حجري بوابة بوابة برافعة كشك طريق مدفوع - مطب طريق تحذيري - جدول السرعة + مطب تحذيري + مطب مرتفع وطويل اشارة توقف ضوئية إطارات - نقل وقود الديزل + ديزل HGV استوديو صور قاطرة متجر السجائر الإلكترونية - متجر البضائع الجافة - سلسلة كبح السرعة - مكان وقوف المارة + متجر الأغذية المجففة + مهدئ السرعة + جزيرة مرورية غاز طبيعي مضغوط زيت نباتي - منحدر مركبة + جسر صيانة سيارات موقف حافلات حاجز سكة حديدية مركبة كهربائية @@ -807,10 +807,10 @@ سوق عيد الميلاد متجر عيد الميلاد شجرة عيد الميلاد - هياكل الإستعجالات + البنية التحتية للطوارئ متجر الأدوات المنزلية - احتياطي مياه الحرائق - ممهل + احتياطي مياه إطفاء الحرائق + منعطف صناعي محطة المطار بوابة الصعود نادي الفنون @@ -823,7 +823,7 @@ نادي الشطرنج نادي قدامى المحاربين نادي الصيد - أخصائي في معالجة الكلام + معالج النطق نحات إسكافي مبلط @@ -1393,11 +1393,11 @@ التجارة العادلة : لا يوجد منتجات التجارة العادلة فقط منطقة محمية - مقهى + كافتيريا الخدمات نوع الدراجة النارية موحد - نوع + النوع محطة Aerialway رافعة بالكرسي رافعة T @@ -1407,48 +1407,48 @@ رافعة مختلطة رافعة سحب رافعة سحب - بئر + بئر ماء صنبور - قفل البوابة + حوض نقل القوارب سدّ غاطس - حائل الأمواج + كاسر الأمواج مِرطَم مَوج كبينة توزيع الأسلاك عمود كهربائي برج جرس - مبدلة الخدمات الهاتفية + مقسم الهاتف فلين الستايروفوم بوليستر لوح جصي - ثلاجة ومجمد + ثلاجة وفريزر أثاث - صرف القمامة + مكب النفايات منطقة سكك حديدية - بيع أراضي بالتجزئة + منطقة محلات بيع بالتجزئة مقلع بستان - حوض + أرض حوضية رصيف بحري رافعة بناء الاتجاه: الكل الاتجاه: مخرج - مسار زحلقة - الحيوانات مسموح بها + مسار الزحلقة + الحيوانات المسموح بها الغرض الوجهة: مدخل - قوارب مستأجرة + قوارب مأجرة بئر نفط شبكات الكريكيت كلية مرفق اجتماعي - ربع + ربع (مجموع مربعات سكنية) موضع دار تمريض - اختصاصي السمع - أخصائي العلاج الوظيفي - طبيب العيون + أخصائي سمع + أخصائي علاج مهني + طبيب عيون ناشر ملعب غولف حلبة تزلج @@ -1456,7 +1456,7 @@ مضمار سباق الرماية دائرة دوران - نقطة دوران في مجرى مائي + نقطة دوران في المياة محمية أرض صناعية سابقة حقل أخضر @@ -1482,7 +1482,7 @@ ميدان معركة نوع إمدادات المياه تنقية المياه - نقطة دراسة استقصائية + نقطة الاستطلاع رسوم الموقف نوع الخريطة: شارع محطة شحن @@ -1491,20 +1491,20 @@ شقة مركز الدفع تحويل أموال - حالة التشغيل + الحالة التشغيلية الوصول إلى مكان المياه أسلوب التسلق - موصل + مقبس كهرباء مخرج CHAdeMO مخرج نوع 2 - خدمة سيارات + خدمة السيارات النوع الجليدي نوع نقطة التفتيش الشراء بالجملة النوع كتب - له دلالة - المخصصات + إشارة + أراضي مخصصات شاكتيزم مكان لمراقبة الطيور طريق تجاوز @@ -1624,15 +1624,15 @@ مصدر الطاقة: الكتلة الحيوية موقع Reddit اصطف واركب - فئة الصعوبة + تصنيف الصعوبة تسلق الصخور نعم منفذ للحافلة مدخل دراجات نارية - مدخل معاقين - سحب نقدي - عربة منزل متنقل - مدخل منازل متنقلة + مدخل المعاقين + السحب النقدي + مدخل المنزل المتنقل + مدخل الكارفان مدخل دراجة جليد مخرج Schuko مخرج CEE أزرق @@ -1644,10 +1644,10 @@ التوجيه مخزون الثلج كرة - المخصصات + أراضي مخصصات مكتب السجل المدني - مستودع بنكر - متشدد + غرفة تحميل + صلب برج الرفع الجوي الوقود: الفحم الوقود: فحم @@ -1655,16 +1655,25 @@ سائل عادم الديزل وقود الطائرات النفاثة A-1 أوتوجاز - 100 لتر وقود + وقود 100LL وقود 91UL - سهم + السهم الاهتزاز الضغط فيديو - رسالة قصيرة + رسالة SMS الحالة النوع الهواء الطلق النوع - دخول مركبات البضائع الخفيفة + مدخل مركبات البضائع الخفيفة + الأجهزة الكهربائية الصغيرة + طريق إخلاء + لوحة المغادرة + إعادة تعبئة مياه الشرب + مدخل HGV + مدخل الدراجة النارية + مدخل الدراجة + مدخل المقطورة + نوع 2 مخرج combo \ No newline at end of file From 2c78f4f0bfc35ffdc06d316c2b6f20a8f62b04a2 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Sun, 8 Nov 2020 02:17:31 +0000 Subject: [PATCH 26/36] Translated using Weblate (Chinese (Traditional)) Currently translated at 100.0% (3530 of 3530 strings) --- OsmAnd/res/values-zh-rTW/strings.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OsmAnd/res/values-zh-rTW/strings.xml b/OsmAnd/res/values-zh-rTW/strings.xml index cfb72a0443..b45f168453 100644 --- a/OsmAnd/res/values-zh-rTW/strings.xml +++ b/OsmAnd/res/values-zh-rTW/strings.xml @@ -3943,4 +3943,9 @@ MGRS OsmAnd 使用 MGRS,其類似於 UTM NATO 格式。 您必須新增至少兩個點。 + 管理訂閱 + 您的訂閱似乎有點問題。點擊按鈕以跳到 Google Play 訂閱設定以修復您的付款方式。 + OsmAnd Live 訂閱已過期 + OsmAnd Live 訂閱已暫停 + OsmAnd Live 訂閱已暫停 \ No newline at end of file From a672849cdb407d3bbf5038f5c4898d2907891ec6 Mon Sep 17 00:00:00 2001 From: Ldm Public Date: Tue, 10 Nov 2020 15:21:02 +0000 Subject: [PATCH 27/36] Translated using Weblate (French) Currently translated at 99.8% (3533 of 3537 strings) --- OsmAnd/res/values-fr/strings.xml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-fr/strings.xml b/OsmAnd/res/values-fr/strings.xml index cb2623e4f9..21bd7fbc55 100644 --- a/OsmAnd/res/values-fr/strings.xml +++ b/OsmAnd/res/values-fr/strings.xml @@ -51,7 +51,7 @@ Paramètres globaux de l\'application Votre identifiant OSM Nécessaire pour les contributions à openstreetmap.org. - Votre mot de passe OSM + Mot de passe Mode arrière-plan OsmAnd s\'exécute en arrière-plan, écran éteint. Téléchargez une carte vectorielle hors-ligne pour ce lieu (depuis « Paramètres » > « Gérer les cartes ») ou utilisez le greffon « cartes en ligne ». @@ -3926,5 +3926,15 @@ OsmAnd utilise le système de référence MDRS de l\'OTAN dérivé des formats UTM et UPS. MGRS MGRS - Vous devez ajouter, au moins, deux points. + Vous devez, au moins, ajouter deux points. + L\'abonnement OsmAnd Live est en attente + L’abonnement OsmAnd Live a expiré + L\'abonnement OsmAnd Live a été suspendu + Se connecter à OpenStreetMap + Se connecter à OpenStreetMap.org + Se connecter avec OpenStreetMap + Identifiant + Utiliser un identifiant et un mot de passe + Compte + Gérer l\'abonnement \ No newline at end of file From 86c0bb75477139bba512b3f7aff2649f00a1ecc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Tue, 10 Nov 2020 15:46:46 +0000 Subject: [PATCH 28/36] Translated using Weblate (Turkish) Currently translated at 100.0% (3537 of 3537 strings) --- OsmAnd/res/values-tr/strings.xml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-tr/strings.xml b/OsmAnd/res/values-tr/strings.xml index 12d01ce727..3a664f5aaa 100644 --- a/OsmAnd/res/values-tr/strings.xml +++ b/OsmAnd/res/values-tr/strings.xml @@ -261,7 +261,7 @@ Wikipedia (çevrim dışı) Kullanıcı tanımlı Öntanımlı profil - OSM şifreniz + Parola İndirme için yeterli yer yok: %1$s MB (free: %2$s). Animasyonu durdur Animasyonu başlat @@ -3382,9 +3382,9 @@ Rotanın yeniden hesaplanması Duyuru Kullanıcı adı ve parola - Bu ayarlar tüm profiller için geçerlidir. + Bu eklenti ayarları geneldir ve tüm profiller için geçerlidir OSM düzenleme - Karşıya yüklenmemiş tüm düzenlemelerinizi veya osm hatalarınızı %1$s içinde görüntüleyebilirsiniz. Yüklenen noktalar OsmAnd\'de gösterilmez. + Yüklenmemiş tüm düzenlemelerinizi veya OSM hatalarınızı %1$s\'de görüntüleyebilirsiniz. Karşıya yüklenen noktalar OsmAnd\'da gösterilmez. OSM Navigasyon sırasında veya harekete halindeyken gösterilen simge. Dinlenme anında gösterilen simge. @@ -3903,4 +3903,18 @@ Acil Seyahat En az iki nokta eklemelisiniz. + OpenStreetMap\'te oturum aç + OpenStreetMap.org\'da oturum aç + OpenStreetMap ile giriş yap + Yenilikleri veya değişiklikleri karşıya yüklemek için oturum açmanız gerekir. +\n +\nGüvenli OAuth yöntemini kullanarak oturum açabilir veya kullanıcı adı ve parolanızı kullanabilirsiniz. + Kullanıcı adı ve parola kullan + Kullanıcı adı + Hesap + Aboneliği yönet + Aboneliğinizle ilgili bir sorun var. Ödeme yönteminizi düzeltmek üzere Google Play abonelik ayarlarına gitmek için düğmeye tıklayın. + OsmAnd Live aboneliğinin süresi doldu + OsmAnd Live aboneliği duraklatıldı + OsmAnd Live aboneliği beklemede \ No newline at end of file From b87cefd8c325afc3a1b1adf86f824d5e86ac2a48 Mon Sep 17 00:00:00 2001 From: Ihor Hordiichuk Date: Tue, 10 Nov 2020 20:18:03 +0000 Subject: [PATCH 29/36] Translated using Weblate (Ukrainian) Currently translated at 100.0% (3537 of 3537 strings) --- OsmAnd/res/values-uk/strings.xml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-uk/strings.xml b/OsmAnd/res/values-uk/strings.xml index 9a18b68263..96a5a994c9 100644 --- a/OsmAnd/res/values-uk/strings.xml +++ b/OsmAnd/res/values-uk/strings.xml @@ -3425,9 +3425,9 @@ Перерахунок маршруту Оголошення Ім\'я користувача і пароль - Ці налаштування стосуються всіх профілів. + Ці налаштування втулка стосуються всіх профілів OSM-правлення - Ви можете переглянути всі не завантажені зміни або помилки в OSM в %1$s. Завантажені точки не відображаються в OsmAnd. + Ви можете переглянути всі вивантажені зміни або вади OSM у %1$s. Вивантажені точки не показано в OsmAnd. OSM Значок відображається під час навігації чи переміщення. Значок показано в спокої. @@ -3949,4 +3949,13 @@ Термін дії передплати OsmAnd Live закінчився Передплату OsmAnd Live зупинено Передплата OsmAnd Live на утриманні + Увійти до OpenStreetMap.org + Увійти до OpenStreetMap.org + Увійти за допомогою OpenStreetMap + Увійдіть, щоб вивантажити нові або внесені зміни. +\n +\nВи можете увійти, за допомогою безпечного методу OAuth, або скористатися своїм ім\'ям та паролем. + Використовувати ім\'я і пароль + Обліковий запис + Ім\'я користувача \ No newline at end of file From e4b622851b43eb04124c42903eea3873d0ed5538 Mon Sep 17 00:00:00 2001 From: Yaron Shahrabani Date: Tue, 10 Nov 2020 16:06:27 +0000 Subject: [PATCH 30/36] Translated using Weblate (Hebrew) Currently translated at 99.8% (3531 of 3537 strings) --- OsmAnd/res/values-iw/strings.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values-iw/strings.xml b/OsmAnd/res/values-iw/strings.xml index b27a8291d6..9fe092ba76 100644 --- a/OsmAnd/res/values-iw/strings.xml +++ b/OsmAnd/res/values-iw/strings.xml @@ -303,7 +303,7 @@ הגדרות יישומים כלליות שם המשתמש שלך ב־OSM נדרש לטובת שליחת נתונים אל openstreetmap.org. - הססמה שלך ב־OSM + ססמה מצב רקע OsmAnd פועל ברקע בזמן שהמסך כבוי. אין די מקום כדי להוריד %1$s מ״ב (פנויים: %2$s). @@ -3951,4 +3951,14 @@ ב־OsmAnd נעשה שימוש ב־MGRS, שדומה לתצורת UTM NATO. MGRS MGRS + עליך להוסיף שתי נקודות לפחות. + כניסה ל־OpenStreetMap + כניסה ל־OpenStreetMap.org + כניסה עם OpenStreetMap + להשתמש בשם כניסה וססמה + חשבון + כניסה + ניהול מינוי + תוקף המינוי ל־OsmAnd Live פג + המינוי ל־OsmAnd Live הושהה \ No newline at end of file From 1b39cf9eb08ab714a2b3f4f367c76503f2b11d44 Mon Sep 17 00:00:00 2001 From: Zmicer Turok Date: Tue, 10 Nov 2020 18:02:55 +0000 Subject: [PATCH 31/36] Translated using Weblate (Belarusian) Currently translated at 99.0% (3504 of 3537 strings) --- OsmAnd/res/values-be/strings.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 3d0aa6103d..cd41fe3d60 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -562,7 +562,7 @@ Агульныя налады праграмы Вашае імя карыстальніка OSM Патрэбна для падачы ў openstreetmap.org. - Ваш пароль OSM + Пароль Фонавы рэжым OsmAnd працуе ў фоне з адключаным экранам. Не стае вольнага месца для спампоўвання %1$s МБ (вольна: %2$s). @@ -905,7 +905,7 @@ Запампоўванне… Нічога не знойдзена Пошук… - Пошук адрасу… + Пошук адраса… Сеціўны пошук праз OSM Nominatim Сеціўны пошук: горад, вуліца, дом Пазасеціўны пошук @@ -3478,7 +3478,7 @@ Фотанататкі Пераразлік маршруту Імя карыстальніка і пароль - Гэтыя алады распаўсюджваюцца на ўсе профілі. + Гэтыя налады ўбудовы распаўсюджваюцца на ўсе профілі Рэдагаванне OSM OSM Значок будзе паказвацца падчас навігацыі або руху. From 275f508ce414ee484f2ded66487daf98847190ce Mon Sep 17 00:00:00 2001 From: Franco Date: Tue, 10 Nov 2020 16:20:58 +0000 Subject: [PATCH 32/36] Translated using Weblate (Spanish (Argentina)) Currently translated at 99.9% (3536 of 3537 strings) --- OsmAnd/res/values-es-rAR/strings.xml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-es-rAR/strings.xml b/OsmAnd/res/values-es-rAR/strings.xml index 6358e33bbe..87ae4731c0 100644 --- a/OsmAnd/res/values-es-rAR/strings.xml +++ b/OsmAnd/res/values-es-rAR/strings.xml @@ -1033,7 +1033,7 @@ Ajustes globales de la aplicación Nombre de usuario de OSM Necesario para envíos a OpenStreetMap.org. - Contraseña de OSM + Contraseña Modo reposo OsmAnd se ejecuta en modo reposo con la pantalla apagada. Sin espacio suficiente para descargar %1$s MB (disponible: %2$s). @@ -3430,7 +3430,7 @@ Recálculo de la ruta Anunciar Nombre de usuario y contraseña - Estos ajustes se aplican a todos los perfiles. + Los ajustes de este complemento son globales y se aplican a todos los perfiles Edición de OSM Puedes ver todas tus ediciones no subidas o errores de OSM en «%1$s». Los puntos subidos no se muestran en OsmAnd. OSM @@ -3957,4 +3957,13 @@ La suscripción a OsmAnd Live ha caducado La suscripción a OsmAnd Live se ha pausado La suscripción a OsmAnd Live está en espera + Ingresar con OpenStreetMap + Iniciar sesión en OpenStreetMap + Ingresar a OpenStreetMap.org + Necesitas iniciar sesión para subir cambios nuevos o modificados. +\n +\nPuedes ingresar usando el método seguro de OAuth o usar el nombre de usuario y contraseña. + Utilice nombre de usuario y contraseña + Cuenta + Iniciar sesión \ No newline at end of file From 1a650bcaf88415bfc2a57dc3c4c6bb585351f0b0 Mon Sep 17 00:00:00 2001 From: Eduardo Addad de Oliveira Date: Tue, 10 Nov 2020 15:56:58 +0000 Subject: [PATCH 33/36] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (3537 of 3537 strings) --- OsmAnd/res/values-pt-rBR/strings.xml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/OsmAnd/res/values-pt-rBR/strings.xml b/OsmAnd/res/values-pt-rBR/strings.xml index ac13cb04f5..af75050e02 100644 --- a/OsmAnd/res/values-pt-rBR/strings.xml +++ b/OsmAnd/res/values-pt-rBR/strings.xml @@ -1020,7 +1020,7 @@ Configurações globais do aplicativo Seu nome de usuário OSM Necessário para envios ao openstreetmap.org. - Sua senha do OSM + Senha Modo em segundo plano OsmAnd é executado em segundo plano com a tela desligada. Atrasado @@ -3421,9 +3421,9 @@ Recálculo da rota Anunciar Usuário e senha - Essas configurações se aplicam a todos os perfis. + Essas configurações de plug-in são globais e se aplicam a todos os perfis Edição OSM - Você pode ver todos os erros de osm do editor carregado em %1$s. Os pontos enviados não são exibidos no OsmAnd. + Você pode ver todas as suas edições descarregadas ou erros do OSM em %1$s. Os pontos carregados não aparecem no OsmAnd. OSM Ícone mostrado ao navegar ou mover. Ícone mostrado em repouso. @@ -3947,4 +3947,14 @@ A assinatura do OsmAnd Live expirou A assinatura do OsmAnd Live foi pausada A assinatura do OsmAnd Live está em espera + Diferença + Entrar para OpenStreetMap + Entrar com OpenStreetMap.org + Entrar com OpenStreetMap + Você precisa entrar para enviar alterações novas ou modificadas. +\n +\nVocê pode entrar usando o método OAuth seguro ou usar sua entrada e senha. + Usar a entrada e senha + Conta + Entrar \ No newline at end of file From ea492715f6c13372e1b10fcd286a4a574fb5f520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Priit=20J=C3=B5er=C3=BC=C3=BCt?= Date: Tue, 10 Nov 2020 20:35:02 +0000 Subject: [PATCH 34/36] Translated using Weblate (Estonian) Currently translated at 99.2% (3510 of 3537 strings) --- OsmAnd/res/values-et/strings.xml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values-et/strings.xml b/OsmAnd/res/values-et/strings.xml index 8e43c4142f..c6bb81ed40 100644 --- a/OsmAnd/res/values-et/strings.xml +++ b/OsmAnd/res/values-et/strings.xml @@ -1943,7 +1943,7 @@ Seadista ekraan ja rakenduse üldised seaded. Rakenduse üldised seaded Sinu OSM kasutajanimi - Sinu OSM salasõna + Salasõna Taustarežiim OsmAnd töötab taustal, ekraan välja lülitatud. Kas laeme alla {0} fail(i)\? @@ -3358,7 +3358,7 @@ Teekonna ümberarvutamine Teata Kasutajanimi ja salasõna - Need seaded rakenduvad kõikidele profiilidele. + Need seaded on üldised ja rakenduvad kõikidele profiilidele OSM\'i andmete muutmine Kõiki üleslaadimata muudatusi või OSM vigu saad vaadata menüüs %1$s. Üleslaaditud punkte OsmAnd ei kuva. OSM @@ -3804,4 +3804,11 @@ OsmAnd Live tellimus on aegunud Sinu tellimusega on üks pisikene segadus. Selleks et Google Play seadistuses makseviisi parandada, palun klõpsi seda nuppu. Halda tellimusi + Logi sisse OpenStreetMapi kasutajakontoga + Kasutajanimi + Pruugi kasutajanime ja salasõna + Täienduste või muudatuste üleslaadimiseks pead sisse logima. +\n +\nSa võid selleks kasutada mõnd turvalust OAuth võimalust või oma kasutajanime ning salasõna. + Kasutajakonto \ No newline at end of file From 2a303bc33a7d2c5807f4784f036eab610ff36570 Mon Sep 17 00:00:00 2001 From: abdullah abdulrhman Date: Tue, 10 Nov 2020 16:52:23 +0000 Subject: [PATCH 35/36] Translated using Weblate (Arabic) Currently translated at 43.4% (1666 of 3830 strings) --- OsmAnd/res/values-ar/phrases.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OsmAnd/res/values-ar/phrases.xml b/OsmAnd/res/values-ar/phrases.xml index 3a9d249731..9fe161678e 100644 --- a/OsmAnd/res/values-ar/phrases.xml +++ b/OsmAnd/res/values-ar/phrases.xml @@ -277,7 +277,7 @@ حوض سباحة مولد طاقة قمة جبلية - كرة القدم + كرة قدم بنك شركة تأمين أطباء @@ -648,7 +648,7 @@ تزلج سباحة تنس الطاولة - كرة المضرب + تنس الكرة الطائرة متحف موقع أثري @@ -658,7 +658,7 @@ أطلال تاريخية سفينة تاريخية نصب تذكاري - حديقة الحيوانات + حديقة حيوانات الزيارة المنزلية أدوات مساعدة للسمع لوازم السفن والقوارب @@ -772,10 +772,10 @@ منزلق مائي سكن بيت ضيافة - نزل + شقة نزل صغير كوخ بجبال الألب - تشاليه + شاليه شقة كوخ بري مقصورة @@ -1676,4 +1676,6 @@ مدخل الدراجة مدخل المقطورة نوع 2 مخرج combo + حديقه + حوض سمك \ No newline at end of file From 24a3d8fd53a15151981b20ff102d08a6f756f3cc Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 11 Nov 2020 03:15:17 +0200 Subject: [PATCH 36/36] Export markers and markers history to separate files --- OsmAnd/res/values/strings.xml | 1 + .../net/osmand/plus/mapmarkers/MapMarker.java | 20 ++- .../plus/mapmarkers/MapMarkersHelper.java | 37 ++-- .../settings/backend/ExportSettingsType.java | 3 +- .../backend/backup/FavoritesSettingsItem.java | 28 +-- .../backup/HistoryMarkersSettingsItem.java | 160 +++++++++++++++++ .../backend/backup/MarkersSettingsItem.java | 164 +++++------------- .../backend/backup/SettingsHelper.java | 57 +++++- .../settings/backend/backup/SettingsItem.java | 21 +++ .../backend/backup/SettingsItemType.java | 3 +- .../backend/backup/SettingsItemsFactory.java | 5 +- .../fragments/DuplicatesSettingsAdapter.java | 16 +- .../ExportImportSettingsAdapter.java | 18 +- .../fragments/ImportDuplicatesFragment.java | 15 +- .../fragments/ImportSettingsFragment.java | 39 ++++- .../ImportedSettingsItemsAdapter.java | 6 +- 16 files changed, 389 insertions(+), 204 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/settings/backend/backup/HistoryMarkersSettingsItem.java 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/plus/mapmarkers/MapMarker.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java index 172aea8a46..498c36f93c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarker.java @@ -2,9 +2,10 @@ package net.osmand.plus.mapmarkers; import android.content.Context; +import androidx.annotation.ColorInt; import androidx.core.content.ContextCompat; -import net.osmand.GPXUtilities; +import net.osmand.GPXUtilities.WptPt; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; import net.osmand.data.LocationPoint; @@ -15,6 +16,7 @@ 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; @@ -30,7 +32,7 @@ public class MapMarker implements LocationPoint { public String nextKey; public String groupKey; public String groupName; - public GPXUtilities.WptPt wptPt; + public WptPt wptPt; public FavouritePoint favouritePoint; public String mapObjectName; @@ -45,7 +47,7 @@ public class MapMarker implements LocationPoint { public int getType() { return favouritePoint == null ? (wptPt == null ? MapMarkersGroup.ANY_TYPE : MapMarkersGroup.GPX_TYPE) : - MapMarkersGroup.FAVORITES_TYPE; + MapMarkersGroup.FAVORITES_TYPE; } public PointDescription getPointDescription(Context ctx) { @@ -110,7 +112,7 @@ public class MapMarker implements LocationPoint { return result; } - private static final int[] colorsIds = new int[]{ + private static final int[] colorsIds = new int[] { R.color.marker_blue, R.color.marker_green, R.color.marker_orange, @@ -134,4 +136,14 @@ public class MapMarker implements LocationPoint { 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/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java index dc3a25a61e..b0a13d8e44 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHelper.java @@ -59,11 +59,8 @@ public class MapMarkersHelper { public static final int BY_DATE_ADDED_ASC = 4; - public static final String GROUP_NAME = "group_name"; - public static final String GROUP_TYPE = "group_type"; - public static final String MARKER_HISTORY = "marker_history"; - public static final String CREATION_DATE = "creation_date"; 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); @@ -1035,18 +1032,38 @@ public class MapMarkersHelper { wpt.name = marker.getOnlyName(); wpt.setColor(ContextCompat.getColor(ctx, MapMarker.getColorId(marker.colorIndex))); if (completeBackup) { - wpt.category = marker.groupKey; - wpt.getExtensionsToWrite().put(GROUP_NAME, marker.groupName); - wpt.getExtensionsToWrite().put(GROUP_TYPE, String.valueOf(marker.getType())); - wpt.getExtensionsToWrite().put(MARKER_HISTORY, String.valueOf(marker.history)); - wpt.getExtensionsToWrite().put(CREATION_DATE, String.valueOf(marker.creationDate)); - wpt.getExtensionsToWrite().put(VISITED_DATE, String.valueOf(marker.visitedDate)); + 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); } 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; + } + // --------------------------------------------------------------------------------------------- // accessors to active markers: diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java index a530ef5dcf..3dcb680b06 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ExportSettingsType.java @@ -17,5 +17,6 @@ public enum ExportSettingsType { FAVORITES, TTS_VOICE, VOICE, - MARKERS + ACTIVE_MARKERS, + HISTORY_MARKERS } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java index 817ec38a49..acb96be110 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/FavoritesSettingsItem.java @@ -16,10 +16,7 @@ import net.osmand.plus.R; import org.json.JSONException; import org.json.JSONObject; -import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -69,11 +66,6 @@ public class FavoritesSettingsItem extends CollectionSettingsItem 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 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 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 index 4a8026ea44..3fea648619 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/MarkersSettingsItem.java @@ -7,8 +7,6 @@ import androidx.annotation.Nullable; import net.osmand.GPXUtilities; import net.osmand.GPXUtilities.GPXFile; -import net.osmand.GPXUtilities.WptPt; -import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -16,37 +14,27 @@ 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.IOException; import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; import java.util.ArrayList; -import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import static net.osmand.IndexConstants.GPX_FILE_EXT; -import static net.osmand.plus.mapmarkers.MapMarkersHelper.CREATION_DATE; -import static net.osmand.plus.mapmarkers.MapMarkersHelper.GROUP_NAME; -import static net.osmand.plus.mapmarkers.MapMarkersHelper.GROUP_TYPE; -import static net.osmand.plus.mapmarkers.MapMarkersHelper.MARKER_HISTORY; -import static net.osmand.plus.mapmarkers.MapMarkersHelper.VISITED_DATE; -public class MarkersSettingsItem extends CollectionSettingsItem { +public class MarkersSettingsItem extends CollectionSettingsItem { private MapMarkersHelper markersHelper; - private Map flatGroups = new LinkedHashMap<>(); - public MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { + public MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { super(app, null, items); } - public MarkersSettingsItem(@NonNull OsmandApplication app, @Nullable MarkersSettingsItem baseItem, @NonNull List items) { + public MarkersSettingsItem(@NonNull OsmandApplication app, @Nullable MarkersSettingsItem baseItem, @NonNull List items) { super(app, baseItem, items); } @@ -58,13 +46,13 @@ public class MarkersSettingsItem extends CollectionSettingsItem protected void init() { super.init(); markersHelper = app.getMapMarkersHelper(); - existingItems = new ArrayList<>(markersHelper.getMapMarkersGroups()); + existingItems = new ArrayList<>(markersHelper.getMapMarkers()); } @NonNull @Override public SettingsItemType getType() { - return SettingsItemType.MARKERS; + return SettingsItemType.ACTIVE_MARKERS; } @NonNull @@ -79,11 +67,6 @@ public class MarkersSettingsItem extends CollectionSettingsItem return ctx.getString(R.string.map_markers); } - @NonNull - public String getDefaultFileName() { - return getName() + getDefaultFileExtension(); - } - @NonNull public String getDefaultFileExtension() { return GPX_FILE_EXT; @@ -91,37 +74,29 @@ public class MarkersSettingsItem extends CollectionSettingsItem @Override public void apply() { - List newItems = getNewItems(); + List newItems = getNewItems(); if (!newItems.isEmpty() || !duplicateItems.isEmpty()) { appliedItems = new ArrayList<>(newItems); - for (MapMarkersGroup duplicate : duplicateItems) { + for (MapMarker duplicate : duplicateItems) { if (shouldReplace) { - MapMarkersGroup existingGroup = markersHelper.getMapMarkerGroupById(duplicate.getId(), duplicate.getType()); - if (existingGroup != null) { - List existingMarkers = new ArrayList<>(existingGroup.getMarkers()); - for (MapMarker marker : existingMarkers) { - markersHelper.removeMarker(marker); - } - } + MapMarker existingMarker = markersHelper.getMapMarker(duplicate.point); + markersHelper.removeMarker(existingMarker); } - appliedItems.add(duplicate); + appliedItems.add(shouldReplace ? duplicate : renameItem(duplicate)); } - for (MapMarkersGroup markersGroup : appliedItems) { - for (MapMarker marker : markersGroup.getMarkers()) { - markersHelper.addMarker(marker); - } + + for (MapMarker marker : appliedItems) { + markersHelper.addMarker(marker); } } } @Override - public boolean isDuplicate(@NonNull MapMarkersGroup markersGroup) { - String name = markersGroup.getName(); - for (MapMarkersGroup group : existingItems) { - if (Algorithms.stringsEqual(group.getName(), name) - && !Algorithms.isEmpty(group.getMarkers()) - && !Algorithms.isEmpty(markersGroup.getMarkers())) { + public boolean isDuplicate(@NonNull MapMarker mapMarker) { + for (MapMarker marker : existingItems) { + if (marker.equals(mapMarker) + && Algorithms.objectEquals(marker.getOriginalPointDescription(), mapMarker.getOriginalPointDescription())) { return true; } } @@ -135,8 +110,26 @@ public class MarkersSettingsItem extends CollectionSettingsItem @NonNull @Override - public MapMarkersGroup renameItem(@NonNull MapMarkersGroup item) { - return item; + 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 @@ -151,88 +144,17 @@ public class MarkersSettingsItem extends CollectionSettingsItem warnings.add(app.getString(R.string.settings_item_read_error, String.valueOf(getType()))); SettingsHelper.LOG.error("Failed read gpx file", gpxFile.error); } else { - List markerColors = getMarkersColors(); - for (WptPt point : gpxFile.getPoints()) { - LatLon latLon = new LatLon(point.lat, point.lon); - - int colorIndex = markerColors.indexOf(point.getColor()); - if (colorIndex == -1) { - colorIndex = 0; - } - - PointDescription pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, point.name); - MapMarker marker = new MapMarker(latLon, pointDescription, colorIndex, false, 0); - - String historyStr = point.getExtensionsToRead().get(MARKER_HISTORY); - String creationDateStr = point.getExtensionsToRead().get(CREATION_DATE); - String visitedDateStr = point.getExtensionsToRead().get(VISITED_DATE); - marker.creationDate = Algorithms.parseLongSilently(creationDateStr, 0); - marker.visitedDate = Algorithms.parseLongSilently(visitedDateStr, 0); - marker.history = Boolean.parseBoolean(historyStr); - marker.nextKey = MapMarkersDbHelper.TAIL_NEXT_VALUE; - - MapMarkersGroup group = getOrCreateGroup(point); - group.getMarkers().add(marker); - } + List mapMarkers = markersHelper.readMarkersFromGpx(gpxFile, false); + items.addAll(mapMarkers); } } }; } - private MapMarkersGroup getOrCreateGroup(WptPt point) { - MapMarkersGroup markersGroup = flatGroups.get(point.category); - if (markersGroup != null) { - return markersGroup; - } - Map extensions = point.getExtensionsToRead(); - String groupName = extensions.get(GROUP_NAME); - String groupType = extensions.get(GROUP_TYPE); - int type = Algorithms.parseIntSilently(groupType, MapMarkersGroup.ANY_TYPE); - - if (point.category != null && groupName != null) { - markersGroup = new MapMarkersGroup(point.category, groupName, type); - } else { - markersGroup = new MapMarkersGroup(); - } - flatGroups.put(markersGroup.getId(), markersGroup); - items.add(markersGroup); - - return markersGroup; - } - - private List getMarkersColors() { - List colors = new ArrayList<>(); - for (int color : MapMarker.getColors(app)) { - colors.add(color); - } - return colors; - } - @Nullable @Override - SettingsItemWriter getWriter() { - return new SettingsItemWriter(this) { - - @Override - public boolean writeToStream(@NonNull OutputStream outputStream) throws IOException { - List mapMarkers = getMarkersFromGroups(items); - GPXFile gpxFile = markersHelper.generateGpx(mapMarkers, true); - 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; - } - }; - } - - private List getMarkersFromGroups(List markersGroups) { - List mapMarkers = new ArrayList<>(); - for (MapMarkersGroup group : markersGroups) { - mapMarkers.addAll(group.getMarkers()); - } - return mapMarkers; + SettingsItemWriter 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 be32a12370..35f85b8ee8 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsHelper.java @@ -16,9 +16,9 @@ import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.map.TileSourceManager.TileSourceTemplate; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; -import net.osmand.plus.mapmarkers.MapMarkersGroup; 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; @@ -29,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; @@ -595,9 +597,21 @@ public class SettingsHelper { if (!files.isEmpty()) { dataList.put(ExportSettingsType.VOICE, files); } - List markersGroups = app.getMapMarkersHelper().getMapMarkersGroups(); - if (!markersGroups.isEmpty()) { - dataList.put(ExportSettingsType.MARKERS, markersGroups); + 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; } @@ -639,6 +653,7 @@ public class SettingsHelper { List osmNotesPointList = new ArrayList<>(); List osmEditsPointList = new ArrayList<>(); List markersGroups = new ArrayList<>(); + List markersHistoryGroups = new ArrayList<>(); for (Object object : data) { if (object instanceof QuickAction) { @@ -664,7 +679,12 @@ public class SettingsHelper { } else if (object instanceof FavoriteGroup) { favoriteGroups.add((FavoriteGroup) object); } else if (object instanceof MapMarkersGroup) { - markersGroups.add((MapMarkersGroup) object); + 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()) { @@ -697,7 +717,18 @@ public class SettingsHelper { settingsItems.add(new FavoritesSettingsItem(app, favoriteGroups)); } if (!markersGroups.isEmpty()) { - settingsItems.add(new MarkersSettingsItem(app, markersGroups)); + 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; } @@ -721,6 +752,7 @@ public class SettingsHelper { List editsPointList = new ArrayList<>(); List favoriteGroups = new ArrayList<>(); List markersGroups = new ArrayList<>(); + List markersHistoryGroups = new ArrayList<>(); for (SettingsItem item : settingsItems) { switch (item.getType()) { @@ -800,9 +832,13 @@ public class SettingsHelper { FavoritesSettingsItem favoritesSettingsItem = (FavoritesSettingsItem) item; favoriteGroups.addAll(favoritesSettingsItem.getItems()); break; - case MARKERS: + case ACTIVE_MARKERS: MarkersSettingsItem markersSettingsItem = (MarkersSettingsItem) item; - markersGroups.addAll(markersSettingsItem.getItems()); + markersGroups.add(markersSettingsItem.getMarkersGroup()); + break; + case HISTORY_MARKERS: + HistoryMarkersSettingsItem historyMarkersSettingsItem = (HistoryMarkersSettingsItem) item; + markersHistoryGroups.add(historyMarkersSettingsItem.getMarkersGroup()); break; default: break; @@ -858,7 +894,10 @@ public class SettingsHelper { settingsToOperate.put(ExportSettingsType.VOICE, voiceFilesList); } if (!markersGroups.isEmpty()) { - settingsToOperate.put(ExportSettingsType.MARKERS, markersGroups); + 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 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 bc254e28ca..2fed0b2645 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/backup/SettingsItemType.java @@ -16,5 +16,6 @@ public enum SettingsItemType { OSM_NOTES, OSM_EDITS, FAVOURITES, - MARKERS + 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 3012cc3dd8..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,9 +134,12 @@ class SettingsItemsFactory { case FAVOURITES: item = new FavoritesSettingsItem(app, json); break; - case MARKERS: + 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 12f491e21a..798b29a476 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/DuplicatesSettingsAdapter.java @@ -14,18 +14,14 @@ 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.mapmarkers.MapMarkersGroup; 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; @@ -40,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 { @@ -162,11 +158,7 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter voiceFilesList = new ArrayList<>(); List mapFilesList = new ArrayList<>(); List markersGroups = new ArrayList<>(); + List markersHistoryGroups = new ArrayList<>(); for (Object object : duplicatesList) { if (object instanceof ApplicationMode.ApplicationModeBean) { @@ -239,7 +241,12 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { } else if (object instanceof OpenstreetmapPoint) { osmEditsPointList.add((OpenstreetmapPoint) object); } else if (object instanceof MapMarkersGroup) { - markersGroups.add((MapMarkersGroup) object); + 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()) { @@ -306,6 +313,10 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment { 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 d7ae7eb77b..48b8e7a6ee 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportSettingsFragment.java @@ -41,6 +41,7 @@ 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; @@ -48,20 +49,21 @@ 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; @@ -439,6 +441,7 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { 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); @@ -463,7 +466,12 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { } else if (object instanceof GlobalSettingsItem) { settingsItems.add((GlobalSettingsItem) object); } else if (object instanceof MapMarkersGroup) { - markersGroups.add((MapMarkersGroup) object); + 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()) { @@ -496,9 +504,22 @@ public class ImportSettingsFragment extends BaseOsmAndFragment { settingsItems.add(new FavoritesSettingsItem(app, baseItem, favoriteGroups)); } if (!markersGroups.isEmpty()) { - MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.MARKERS, MarkersSettingsItem.class); - settingsItems.add(new MarkersSettingsItem(app, baseItem, markersGroups)); + 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 fd8bc5a781..9114c430b9 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ImportedSettingsItemsAdapter.java @@ -142,10 +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 MARKERS: + 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; } }