Revert renaming

This commit is contained in:
Vitaliy 2021-04-22 12:47:26 +03:00
parent ec03c40c1b
commit a2b6faf94a
56 changed files with 367 additions and 367 deletions

View file

@ -71,7 +71,7 @@ import net.osmand.plus.helpers.LockHelper;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.other.IContextMenuButtonListener; import net.osmand.plus.mapcontextmenu.other.IContextMenuButtonListener;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.myplaces.TrackBitmapDrawer; import net.osmand.plus.myplaces.TrackBitmapDrawer;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
@ -1061,7 +1061,7 @@ public class OsmandAidlApi {
boolean addMapMarker(String name, double latitude, double longitude) { boolean addMapMarker(String name, double latitude, double longitude) {
PointDescription pd = new PointDescription( PointDescription pd = new PointDescription(
PointDescription.POINT_TYPE_MAP_MARKER, name != null ? name : ""); PointDescription.POINT_TYPE_MAP_MARKER, name != null ? name : "");
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
markersHelper.addMapMarker(new LatLon(latitude, longitude), pd); markersHelper.addMapMarker(new LatLon(latitude, longitude), pd);
refreshMap(); refreshMap();
return true; return true;
@ -1069,7 +1069,7 @@ public class OsmandAidlApi {
boolean removeMapMarker(String name, double latitude, double longitude, boolean ignoreCoordinates) { boolean removeMapMarker(String name, double latitude, double longitude, boolean ignoreCoordinates) {
LatLon latLon = new LatLon(latitude, longitude); LatLon latLon = new LatLon(latitude, longitude);
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<MapMarker> mapMarkers = markersHelper.getMapMarkers(); List<MapMarker> mapMarkers = markersHelper.getMapMarkers();
for (MapMarker m : mapMarkers) { for (MapMarker m : mapMarkers) {
if (m.getOnlyName().equals(name)) { if (m.getOnlyName().equals(name)) {
@ -1085,7 +1085,7 @@ public class OsmandAidlApi {
boolean removeAllActiveMapMarkers() { boolean removeAllActiveMapMarkers() {
boolean refreshNeeded = false; boolean refreshNeeded = false;
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<MapMarker> mapMarkers = markersHelper.getMapMarkers(); List<MapMarker> mapMarkers = markersHelper.getMapMarkers();
for (MapMarker m : mapMarkers) { for (MapMarker m : mapMarkers) {
markersHelper.moveMapMarkerToHistory(m); markersHelper.moveMapMarkerToHistory(m);
@ -1101,7 +1101,7 @@ public class OsmandAidlApi {
boolean updateMapMarker(String prevName, LatLon prevLatLon, String newName, LatLon newLatLon, boolean ignoreCoordinates) { boolean updateMapMarker(String prevName, LatLon prevLatLon, String newName, LatLon newLatLon, boolean ignoreCoordinates) {
LatLon latLon = new LatLon(prevLatLon.getLatitude(), prevLatLon.getLongitude()); LatLon latLon = new LatLon(prevLatLon.getLatitude(), prevLatLon.getLongitude());
LatLon latLonNew = new LatLon(newLatLon.getLatitude(), newLatLon.getLongitude()); LatLon latLonNew = new LatLon(newLatLon.getLatitude(), newLatLon.getLongitude());
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<MapMarker> mapMarkers = markersHelper.getMapMarkers(); List<MapMarker> mapMarkers = markersHelper.getMapMarkers();
for (MapMarker m : mapMarkers) { for (MapMarker m : mapMarkers) {
if (m.getOnlyName().equals(prevName)) { if (m.getOnlyName().equals(prevName)) {

View file

@ -42,7 +42,7 @@ import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.inapp.InAppPurchaseHelperImpl; import net.osmand.plus.inapp.InAppPurchaseHelperImpl;
import net.osmand.plus.liveupdates.LiveUpdatesHelper; import net.osmand.plus.liveupdates.LiveUpdatesHelper;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.monitoring.LiveMonitoringHelper; import net.osmand.plus.monitoring.LiveMonitoringHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.onlinerouting.OnlineRoutingHelper; import net.osmand.plus.onlinerouting.OnlineRoutingHelper;
@ -458,7 +458,7 @@ public class AppInitializer implements IProgress {
app.geocodingLookupService = startupInit(new GeocodingLookupService(app), GeocodingLookupService.class); app.geocodingLookupService = startupInit(new GeocodingLookupService(app), GeocodingLookupService.class);
app.targetPointsHelper = startupInit(new TargetPointsHelper(app), TargetPointsHelper.class); app.targetPointsHelper = startupInit(new TargetPointsHelper(app), TargetPointsHelper.class);
app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class); app.mapMarkersDbHelper = startupInit(new MapMarkersDbHelper(app), MapMarkersDbHelper.class);
app.itineraryHelper = startupInit(new ItineraryHelper(app), ItineraryHelper.class); app.mapMarkersHelper = startupInit(new MapMarkersHelper(app), MapMarkersHelper.class);
app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class); app.searchUICore = startupInit(new QuickSearchHelper(app), QuickSearchHelper.class);
app.mapViewTrackingUtilities = startupInit(new MapViewTrackingUtilities(app), MapViewTrackingUtilities.class); app.mapViewTrackingUtilities = startupInit(new MapViewTrackingUtilities(app), MapViewTrackingUtilities.class);
@ -685,7 +685,7 @@ public class AppInitializer implements IProgress {
// restore backuped favorites to normal file // restore backuped favorites to normal file
restoreBackupForFavoritesFiles(); restoreBackupForFavoritesFiles();
notifyEvent(InitEvents.RESTORE_BACKUPS); notifyEvent(InitEvents.RESTORE_BACKUPS);
app.itineraryHelper.syncAllGroupsAsync(); app.mapMarkersHelper.syncAllGroupsAsync();
app.searchUICore.initSearchUICore(); app.searchUICore.initSearchUICore();
checkLiveUpdatesAlerts(); checkLiveUpdatesAlerts();

View file

@ -19,8 +19,8 @@ import net.osmand.data.LatLon;
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest; import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection; import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
@ -281,16 +281,16 @@ public class FavouritesDbHelper {
} }
private void runSyncWithMarkers(FavoriteGroup favGroup) { private void runSyncWithMarkers(FavoriteGroup favGroup) {
ItineraryHelper helper = context.getItineraryHelper(); MapMarkersHelper helper = context.getMapMarkersHelper();
ItineraryGroup group = helper.getMarkersGroup(favGroup); MapMarkersGroup group = helper.getMarkersGroup(favGroup);
if (group != null) { if (group != null) {
helper.runSynchronization(group); helper.runSynchronization(group);
} }
} }
private boolean removeFromMarkers(FavoriteGroup favGroup) { private boolean removeFromMarkers(FavoriteGroup favGroup) {
ItineraryHelper helper = context.getItineraryHelper(); MapMarkersHelper helper = context.getMapMarkersHelper();
ItineraryGroup group = helper.getMarkersGroup(favGroup); MapMarkersGroup group = helper.getMarkersGroup(favGroup);
if (group != null) { if (group != null) {
helper.removeMarkersGroup(group); helper.removeMarkersGroup(group);
return true; return true;
@ -299,7 +299,7 @@ public class FavouritesDbHelper {
} }
private void addToMarkers(FavoriteGroup favGroup) { private void addToMarkers(FavoriteGroup favGroup) {
ItineraryHelper helper = context.getItineraryHelper(); MapMarkersHelper helper = context.getMapMarkersHelper();
helper.addOrEnableGroup(favGroup); helper.addOrEnableGroup(favGroup);
} }

View file

@ -30,8 +30,8 @@ import net.osmand.plus.helpers.GpxUiHelper.GPXDataSetType;
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.helpers.enums.MetricsConstants; import net.osmand.plus.helpers.enums.MetricsConstants;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder; import net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder;
import net.osmand.plus.track.GpxSplitType; import net.osmand.plus.track.GpxSplitType;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -798,7 +798,7 @@ public class GpxSelectionHelper {
boolean addToHistory) { boolean addToHistory) {
GpxDataItem dataItem = app.getGpxDbHelper().getItem(new File(gpx.path)); GpxDataItem dataItem = app.getGpxDbHelper().getItem(new File(gpx.path));
if (canAddToMarkers && show && dataItem != null && dataItem.isShowAsMarkers()) { if (canAddToMarkers && show && dataItem != null && dataItem.isShowAsMarkers()) {
app.getItineraryHelper().addOrEnableGroup(gpx); app.getMapMarkersHelper().addOrEnableGroup(gpx);
} }
return selectGpxFile(gpx, dataItem, show, notShowNavigationDialog, syncGroup, selectedByUser, addToHistory); return selectGpxFile(gpx, dataItem, show, notShowNavigationDialog, syncGroup, selectedByUser, addToHistory);
} }
@ -825,10 +825,10 @@ public class GpxSelectionHelper {
} }
private void syncGpxWithMarkers(GPXFile gpxFile) { private void syncGpxWithMarkers(GPXFile gpxFile) {
ItineraryHelper itineraryHelper = app.getItineraryHelper(); MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
ItineraryGroup group = itineraryHelper.getMarkersGroup(gpxFile); MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
itineraryHelper.runSynchronization(group); mapMarkersHelper.runSynchronization(group);
} }
} }

View file

@ -68,7 +68,7 @@ import net.osmand.plus.helpers.enums.DrivingRegion;
import net.osmand.plus.helpers.enums.MetricsConstants; import net.osmand.plus.helpers.enums.MetricsConstants;
import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.measurementtool.MeasurementEditingContext; import net.osmand.plus.measurementtool.MeasurementEditingContext;
import net.osmand.plus.monitoring.LiveMonitoringHelper; import net.osmand.plus.monitoring.LiveMonitoringHelper;
import net.osmand.plus.onlinerouting.OnlineRoutingHelper; import net.osmand.plus.onlinerouting.OnlineRoutingHelper;
@ -147,7 +147,7 @@ public class OsmandApplication extends MultiDexApplication {
NotificationHelper notificationHelper; NotificationHelper notificationHelper;
LiveMonitoringHelper liveMonitoringHelper; LiveMonitoringHelper liveMonitoringHelper;
TargetPointsHelper targetPointsHelper; TargetPointsHelper targetPointsHelper;
ItineraryHelper itineraryHelper; MapMarkersHelper mapMarkersHelper;
MapMarkersDbHelper mapMarkersDbHelper; MapMarkersDbHelper mapMarkersDbHelper;
WaypointHelper waypointHelper; WaypointHelper waypointHelper;
RoutingOptionsHelper routingOptionsHelper; RoutingOptionsHelper routingOptionsHelper;
@ -688,8 +688,8 @@ public class OsmandApplication extends MultiDexApplication {
return targetPointsHelper; return targetPointsHelper;
} }
public ItineraryHelper getItineraryHelper() { public MapMarkersHelper getMapMarkersHelper() {
return itineraryHelper; return mapMarkersHelper;
} }
public MapMarkersDbHelper getMapMarkersDbHelper() { public MapMarkersDbHelper getMapMarkersDbHelper() {

View file

@ -27,8 +27,8 @@ import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
@ -177,9 +177,9 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
if (group.getPoints().size() > 0) { if (group.getPoints().size() > 0) {
items.add(new DividerHalfItem(getContext())); items.add(new DividerHalfItem(getContext()));
final ItineraryHelper markersHelper = app.getItineraryHelper(); final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
final FavoriteGroup favGroup = this.group; final FavoriteGroup favGroup = this.group;
final ItineraryGroup markersGr = markersHelper.getMarkersGroup(this.group); final MapMarkersGroup markersGr = markersHelper.getMarkersGroup(this.group);
final boolean synced = markersGr != null; final boolean synced = markersGr != null;
BaseBottomSheetItem markersGroupItem = new SimpleBottomSheetItem.Builder() BaseBottomSheetItem markersGroupItem = new SimpleBottomSheetItem.Builder()

View file

@ -42,7 +42,7 @@ import net.osmand.data.PointDescription;
import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup; import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.FavouritesDbHelper.FavoritesListener; import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
@ -520,7 +520,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
private void selectMapMarkersImpl() { private void selectMapMarkersImpl() {
if (getSelectedFavoritesCount() > 0) { if (getSelectedFavoritesCount() > 0) {
ItineraryHelper markersHelper = getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = getMyApplication().getMapMarkersHelper();
List<LatLon> points = new ArrayList<>(); List<LatLon> points = new ArrayList<>();
List<PointDescription> names = new ArrayList<>(); List<PointDescription> names = new ArrayList<>();
for (Map.Entry<String, Set<FavouritePoint>> entry : favoritesSelected.entrySet()) { for (Map.Entry<String, Set<FavouritePoint>> entry : favoritesSelected.entrySet()) {

View file

@ -111,7 +111,7 @@ import net.osmand.plus.mapcontextmenu.builders.cards.dialogs.ContextMenuCardDial
import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu; import net.osmand.plus.mapcontextmenu.other.DestinationReachedMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper.MapMarkerChangedListener; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.mapmarkers.fragments.PlanRouteFragment; import net.osmand.plus.mapmarkers.fragments.PlanRouteFragment;
import net.osmand.plus.measurementtool.GpxApproximationFragment; import net.osmand.plus.measurementtool.GpxApproximationFragment;
import net.osmand.plus.measurementtool.GpxData; import net.osmand.plus.measurementtool.GpxData;
@ -407,7 +407,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
if (removeFragment(PlanRouteFragment.TAG)) { if (removeFragment(PlanRouteFragment.TAG)) {
app.getItineraryHelper().getPlanRouteContext().setFragmentVisible(true); app.getMapMarkersHelper().getPlanRouteContext().setFragmentVisible(true);
} }
removeFragment(ImportGpxBottomSheetDialogFragment.TAG); removeFragment(ImportGpxBottomSheetDialogFragment.TAG);
removeFragment(AdditionalActionsBottomSheetDialogFragment.TAG); removeFragment(AdditionalActionsBottomSheetDialogFragment.TAG);
@ -450,7 +450,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
dashboardOnMap.updateLocation(true, true, false); dashboardOnMap.updateLocation(true, true, false);
} }
app.getTargetPointsHelper().lookupAddessAll(); app.getTargetPointsHelper().lookupAddessAll();
app.getItineraryHelper().lookupAddressAll(); app.getMapMarkersHelper().lookupAddressAll();
} }
if (event == InitEvents.FAVORITES_INITIALIZED) { if (event == InitEvents.FAVORITES_INITIALIZED) {
refreshMap(); refreshMap();
@ -723,7 +723,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
long tm = System.currentTimeMillis(); long tm = System.currentTimeMillis();
if (app.getItineraryHelper().getPlanRouteContext().isFragmentVisible()) { if (app.getMapMarkersHelper().getPlanRouteContext().isFragmentVisible()) {
PlanRouteFragment.showInstance(this); PlanRouteFragment.showInstance(this);
} }
@ -811,7 +811,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
} }
routingHelper.addListener(this); routingHelper.addListener(this);
app.getItineraryHelper().addListener(this); app.getMapMarkersHelper().addListener(this);
QuickSearchDialogFragment searchDialogFragment = getQuickSearchDialogFragment(); QuickSearchDialogFragment searchDialogFragment = getQuickSearchDialogFragment();
if (searchDialogFragment != null) { if (searchDialogFragment != null) {
@ -1402,7 +1402,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
pendingPause = false; pendingPause = false;
mapView.setOnDrawMapListener(null); mapView.setOnDrawMapListener(null);
cancelSplashScreenTimer(); cancelSplashScreenTimer();
app.getItineraryHelper().removeListener(this); app.getMapMarkersHelper().removeListener(this);
app.getRoutingHelper().removeListener(this); app.getRoutingHelper().removeListener(this);
app.getDownloadThread().resetUiActivity(this); app.getDownloadThread().resetUiActivity(this);
if (atlasMapRendererView != null) { if (atlasMapRendererView != null) {

View file

@ -55,7 +55,7 @@ import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment.ContextMenuItemClickListener; import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment.ContextMenuItemClickListener;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.fragments.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.fragments.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext; import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet; import net.osmand.plus.measurementtool.StartPlanRouteBottomSheet;
@ -181,7 +181,7 @@ public class MapActivityActions implements DialogProvider {
public void addMapMarker(double latitude, double longitude, PointDescription pd, @Nullable String mapObjectName) { public void addMapMarker(double latitude, double longitude, PointDescription pd, @Nullable String mapObjectName) {
ItineraryHelper markersHelper = getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = getMyApplication().getMapMarkersHelper();
markersHelper.addMapMarker(new LatLon(latitude, longitude), pd, mapObjectName); markersHelper.addMapMarker(new LatLon(latitude, longitude), pd, mapObjectName);
} }
@ -613,7 +613,7 @@ public class MapActivityActions implements DialogProvider {
} }
public ApplicationMode getRouteMode(LatLon from) { public ApplicationMode getRouteMode(LatLon from) {
MarkersPlanRouteContext planRouteContext = mapActivity.getMyApplication().getItineraryHelper().getPlanRouteContext(); MarkersPlanRouteContext planRouteContext = mapActivity.getMyApplication().getMapMarkersHelper().getPlanRouteContext();
if (planRouteContext.isNavigationFromMarkers() && planRouteContext.getSnappedMode() != ApplicationMode.DEFAULT) { if (planRouteContext.isNavigationFromMarkers() && planRouteContext.getSnappedMode() != ApplicationMode.DEFAULT) {
planRouteContext.setNavigationFromMarkers(false); planRouteContext.setNavigationFromMarkers(false);
return planRouteContext.getSnappedMode(); return planRouteContext.getSnappedMode();

View file

@ -24,7 +24,7 @@ import net.osmand.plus.helpers.enums.DrivingRegion;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper.MapMarkerChangedListener; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.routing.RoutingHelperUtils; import net.osmand.plus.routing.RoutingHelperUtils;
import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.ApplicationMode;
@ -90,7 +90,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
} }
private void addMapMarkersListener(OsmandApplication app) { private void addMapMarkersListener(OsmandApplication app) {
app.getItineraryHelper().addListener(this); app.getMapMarkersHelper().addListener(this);
} }
@Override @Override

View file

@ -40,7 +40,7 @@ import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
import net.osmand.plus.audionotes.AudioVideoNotesPlugin; import net.osmand.plus.audionotes.AudioVideoNotesPlugin;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.quickaction.QuickAction; import net.osmand.plus.quickaction.QuickAction;
import net.osmand.plus.quickaction.QuickActionRegistry; import net.osmand.plus.quickaction.QuickActionRegistry;
@ -515,7 +515,7 @@ public class ExternalApiHelper {
PointDescription pd = new PointDescription( PointDescription pd = new PointDescription(
PointDescription.POINT_TYPE_MAP_MARKER, name != null ? name : ""); PointDescription.POINT_TYPE_MAP_MARKER, name != null ? name : "");
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
markersHelper.addMapMarker(new LatLon(lat, lon), pd); markersHelper.addMapMarker(new LatLon(lat, lon), pd);
MapMarker marker = markersHelper.getFirstMapMarker(); MapMarker marker = markersHelper.getFirstMapMarker();

View file

@ -19,7 +19,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.PluginsFragment; import net.osmand.plus.activities.PluginsFragment;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.mapmarkers.fragments.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.fragments.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapsource.EditMapSourceDialogFragment; import net.osmand.plus.mapsource.EditMapSourceDialogFragment;
import net.osmand.plus.openplacereviews.OPRConstants; import net.osmand.plus.openplacereviews.OPRConstants;
import net.osmand.plus.openplacereviews.OprAuthHelper.OprAuthorizationListener; import net.osmand.plus.openplacereviews.OprAuthHelper.OprAuthorizationListener;
@ -219,7 +219,7 @@ public class IntentHelper {
if (intent.hasExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS)) { if (intent.hasExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS)) {
Bundle openMapMarkersGroupsExtra = intent.getBundleExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS); Bundle openMapMarkersGroupsExtra = intent.getBundleExtra(MapMarkersDialogFragment.OPEN_MAP_MARKERS_GROUPS);
if (openMapMarkersGroupsExtra != null) { if (openMapMarkersGroupsExtra != null) {
MapMarkersDialogFragment.showInstance(mapActivity, openMapMarkersGroupsExtra.getString(ItineraryGroup.MARKERS_SYNC_GROUP_ID)); MapMarkersDialogFragment.showInstance(mapActivity, openMapMarkersGroupsExtra.getString(MapMarkersGroup.MARKERS_SYNC_GROUP_ID));
} }
mapActivity.setIntent(null); mapActivity.setIntent(null);
} }

View file

@ -47,7 +47,7 @@ import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu; import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
import net.osmand.plus.mapcontextmenu.other.ShareMenu; import net.osmand.plus.mapcontextmenu.other.ShareMenu;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper.MapMarkerChangedListener; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.ApplicationMode;
@ -414,7 +414,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
mapActivity.refreshMap(); mapActivity.refreshMap();
if (object instanceof MapMarker) { if (object instanceof MapMarker) {
app.getItineraryHelper().addListener(this); app.getMapMarkersHelper().addListener(this);
} else if (object instanceof TargetPoint) { } else if (object instanceof TargetPoint) {
app.getTargetPointsHelper().addPointListener(this); app.getTargetPointsHelper().addPointListener(this);
} }
@ -518,7 +518,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
if (mapActivity != null) { if (mapActivity != null) {
Object object = getObject(); Object object = getObject();
if (object instanceof MapMarker) { if (object instanceof MapMarker) {
mapActivity.getMyApplication().getItineraryHelper().removeListener(this); mapActivity.getMyApplication().getMapMarkersHelper().removeListener(this);
} }
MenuController menuController = getMenuController(); MenuController menuController = getMenuController();
if (menuController != null) { if (menuController != null) {

View file

@ -60,7 +60,7 @@ public class AmenityMenuController extends MenuController {
} }
String mapNameForMarker = amenity.getName() + "_" + amenity.getType().getKeyName(); String mapNameForMarker = amenity.getName() + "_" + amenity.getType().getKeyName();
marker = mapActivity.getMyApplication().getItineraryHelper().getMapMarker(mapNameForMarker, amenity.getLocation()); marker = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarker(mapNameForMarker, amenity.getLocation());
if (marker != null) { if (marker != null) {
MapMarkerMenuController markerMenuController = MapMarkerMenuController markerMenuController =
new MapMarkerMenuController(mapActivity, marker.getPointDescription(mapActivity), marker); new MapMarkerMenuController(mapActivity, marker.getPointDescription(mapActivity), marker);

View file

@ -14,7 +14,7 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.data.TransportStop; import net.osmand.data.TransportStop;
import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -44,7 +44,7 @@ public class FavouritePointMenuController extends MenuController {
super(new FavouritePointMenuBuilder(mapActivity, fav), pointDescription, mapActivity); super(new FavouritePointMenuBuilder(mapActivity, fav), pointDescription, mapActivity);
this.fav = fav; this.fav = fav;
final ItineraryHelper markersHelper = mapActivity.getMyApplication().getItineraryHelper(); final MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
mapMarker = markersHelper.getMapMarker(fav); mapMarker = markersHelper.getMapMarker(fav);
if (mapMarker == null) { if (mapMarker == null) {
mapMarker = markersHelper.getMapMarker(new LatLon(fav.getLatitude(), fav.getLongitude())); mapMarker = markersHelper.getMapMarker(new LatLon(fav.getLatitude(), fav.getLongitude()));

View file

@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.settings.backend.OsmandPreference; import net.osmand.plus.settings.backend.OsmandPreference;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -36,7 +36,7 @@ public class MapMarkerMenuController extends MenuController {
public void buttonPressed() { public void buttonPressed() {
MapActivity activity = getMapActivity(); MapActivity activity = getMapActivity();
if (activity != null) { if (activity != null) {
ItineraryHelper markersHelper = activity.getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = activity.getMyApplication().getMapMarkersHelper();
MapMarker marker = getMapMarker(); MapMarker marker = getMapMarker();
if (marker.history) { if (marker.history) {
markersHelper.restoreMarkerFromHistory(marker, 0); markersHelper.restoreMarkerFromHistory(marker, 0);
@ -62,7 +62,7 @@ public class MapMarkerMenuController extends MenuController {
indication.set(true); indication.set(true);
activity.getMapLayers().getMapWidgetRegistry().updateMapMarkersMode(activity); activity.getMapLayers().getMapWidgetRegistry().updateMapMarkersMode(activity);
} }
ItineraryHelper markersHelper = activity.getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = activity.getMyApplication().getMapMarkersHelper();
markersHelper.moveMarkerToTop(getMapMarker()); markersHelper.moveMarkerToTop(getMapMarker());
activity.getContextMenu().close(); activity.getContextMenu().close();
} }

View file

@ -19,7 +19,7 @@ import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController; import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.track.TrackMenuFragment; import net.osmand.plus.track.TrackMenuFragment;
import net.osmand.plus.wikivoyage.menu.WikivoyageWptPtMenuBuilder; import net.osmand.plus.wikivoyage.menu.WikivoyageWptPtMenuBuilder;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -36,7 +36,7 @@ public class WptPtMenuController extends MenuController {
@NonNull PointDescription pointDescription, @NonNull final WptPt wpt) { @NonNull PointDescription pointDescription, @NonNull final WptPt wpt) {
super(menuBuilder, pointDescription, mapActivity); super(menuBuilder, pointDescription, mapActivity);
this.wpt = wpt; this.wpt = wpt;
ItineraryHelper markersHelper = mapActivity.getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
mapMarker = markersHelper.getMapMarker(wpt); mapMarker = markersHelper.getMapMarker(wpt);
if (mapMarker == null) { if (mapMarker == null) {
mapMarker = markersHelper.getMapMarker(new LatLon(wpt.lat, wpt.lon)); mapMarker = markersHelper.getMapMarker(new LatLon(wpt.lat, wpt.lon));

View file

@ -54,7 +54,7 @@ public class MapMarkerEditorFragment extends PointEditorFragment {
marker.setOriginalPointDescription(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, name)); marker.setOriginalPointDescription(new PointDescription(PointDescription.POINT_TYPE_MAP_MARKER, name));
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null) { if (app != null) {
app.getItineraryHelper().updateMapMarker(marker, true); app.getMapMarkersHelper().updateMapMarker(marker, true);
} }
if (needDismiss) { if (needDismiss) {
dismiss(true); dismiss(true);
@ -76,7 +76,7 @@ public class MapMarkerEditorFragment extends PointEditorFragment {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null) { if (app != null) {
app.getItineraryHelper().removeMarker(marker); app.getMapMarkersHelper().removeMarker(marker);
} }
if (needDismiss) { if (needDismiss) {
dismiss(true); dismiss(true);

View file

@ -17,8 +17,8 @@ import net.osmand.GPXUtilities.WptPt;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.WptLocationPoint; import net.osmand.data.WptLocationPoint;
import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -220,8 +220,8 @@ public class WptPtEditorFragment extends PointEditorFragment {
private void syncGpx(GPXFile gpxFile) { private void syncGpx(GPXFile gpxFile) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null) { if (app != null) {
ItineraryHelper helper = app.getItineraryHelper(); MapMarkersHelper helper = app.getMapMarkersHelper();
ItineraryGroup group = helper.getMarkersGroup(gpxFile); MapMarkersGroup group = helper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
helper.runSynchronization(group); helper.runSynchronization(group);
} }

View file

@ -20,8 +20,8 @@ import net.osmand.data.FavouritePoint.BackgroundType;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.data.WptLocationPoint; import net.osmand.data.WptLocationPoint;
import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -238,8 +238,8 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
private void syncGpx(GPXFile gpxFile) { private void syncGpx(GPXFile gpxFile) {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
if (app != null) { if (app != null) {
ItineraryHelper helper = app.getItineraryHelper(); MapMarkersHelper helper = app.getMapMarkersHelper();
ItineraryGroup group = helper.getMarkersGroup(gpxFile); MapMarkersGroup group = helper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
helper.runSynchronization(group); helper.runSynchronization(group);
} }

View file

@ -6,9 +6,9 @@ public class GroupHeader {
@DrawableRes @DrawableRes
private int iconRes; private int iconRes;
private ItineraryGroup group; private MapMarkersGroup group;
public GroupHeader(int iconRes, ItineraryGroup group) { public GroupHeader(int iconRes, MapMarkersGroup group) {
this.iconRes = iconRes; this.iconRes = iconRes;
this.group = group; this.group = group;
} }
@ -18,7 +18,7 @@ public class GroupHeader {
return iconRes; return iconRes;
} }
public ItineraryGroup getGroup() { public MapMarkersGroup getGroup() {
return group; return group;
} }
} }

View file

@ -36,9 +36,9 @@ import java.util.TimeZone;
import static net.osmand.GPXUtilities.writeNotNullText; import static net.osmand.GPXUtilities.writeNotNullText;
import static net.osmand.plus.FavouritesDbHelper.backup; import static net.osmand.plus.FavouritesDbHelper.backup;
public class ItinerarySaveHelper { public class ItineraryDataHelper {
private static final Log log = PlatformUtil.getLog(ItinerarySaveHelper.class); private static final Log log = PlatformUtil.getLog(ItineraryDataHelper.class);
private static final String VISITED_DATE = "visited_date"; private static final String VISITED_DATE = "visited_date";
private static final String CREATION_DATE = "creation_date"; private static final String CREATION_DATE = "creation_date";
@ -58,11 +58,11 @@ public class ItinerarySaveHelper {
} }
private OsmandApplication app; private OsmandApplication app;
private ItineraryHelper itineraryHelper; private MapMarkersHelper mapMarkersHelper;
public ItinerarySaveHelper(OsmandApplication app, ItineraryHelper itineraryHelper) { public ItineraryDataHelper(OsmandApplication app, MapMarkersHelper mapMarkersHelper) {
this.app = app; this.app = app;
this.itineraryHelper = itineraryHelper; this.mapMarkersHelper = mapMarkersHelper;
} }
private File getInternalFile() { private File getInternalFile() {
@ -88,7 +88,7 @@ public class ItinerarySaveHelper {
} }
public Exception saveFile(File file) { public Exception saveFile(File file) {
List<ItineraryGroup> groups = itineraryHelper.getItineraryGroups(); List<MapMarkersGroup> groups = mapMarkersHelper.getMapMarkersGroups();
GPXFile gpxFile = generateGpx(groups); GPXFile gpxFile = generateGpx(groups);
return GPXUtilities.writeGpxFile(file, gpxFile); return GPXUtilities.writeGpxFile(file, gpxFile);
} }
@ -132,7 +132,7 @@ public class ItinerarySaveHelper {
} }
public GPXFile generateGpx() { public GPXFile generateGpx() {
return generateGpx(itineraryHelper.getMapMarkers(), false); return generateGpx(mapMarkersHelper.getMapMarkers(), false);
} }
public GPXFile generateGpx(List<MapMarker> markers, boolean completeBackup) { public GPXFile generateGpx(List<MapMarker> markers, boolean completeBackup) {
@ -153,10 +153,10 @@ public class ItinerarySaveHelper {
return gpxFile; return gpxFile;
} }
public GPXFile generateGpx(List<ItineraryGroup> itineraryGroups) { public GPXFile generateGpx(List<MapMarkersGroup> mapMarkersGroups) {
GPXFile gpxFile = new GPXFile(Version.getFullVersion(app)); GPXFile gpxFile = new GPXFile(Version.getFullVersion(app));
List<ItineraryGroupInfo> groups = new ArrayList<>(); List<ItineraryGroupInfo> groups = new ArrayList<>();
for (ItineraryGroup group : itineraryGroups) { for (MapMarkersGroup group : mapMarkersGroups) {
ItineraryGroupInfo groupInfo = ItineraryGroupInfo.createGroupInfo(app, group); ItineraryGroupInfo groupInfo = ItineraryGroupInfo.createGroupInfo(app, group);
for (MapMarker marker : group.getMarkers()) { for (MapMarker marker : group.getMarkers()) {
@ -236,7 +236,7 @@ public class ItinerarySaveHelper {
public String path; public String path;
public String categories; public String categories;
public static ItineraryGroupInfo createGroupInfo(OsmandApplication app, ItineraryGroup group) { public static ItineraryGroupInfo createGroupInfo(OsmandApplication app, MapMarkersGroup group) {
ItineraryGroupInfo groupInfo = new ItineraryGroupInfo(); ItineraryGroupInfo groupInfo = new ItineraryGroupInfo();
groupInfo.type = group.getType().getTypeName(); groupInfo.type = group.getType().getTypeName();
groupInfo.name = !Algorithms.isEmpty(group.getName()) ? group.getName() : null; groupInfo.name = !Algorithms.isEmpty(group.getName()) ? group.getName() : null;

View file

@ -162,7 +162,7 @@ public class MapMarkersDbHelper {
} }
} }
public void addGroup(ItineraryGroup group) { public void addGroup(MapMarkersGroup group) {
SQLiteConnection db = openConnection(false); SQLiteConnection db = openConnection(false);
if (db != null) { if (db != null) {
try { try {
@ -174,15 +174,15 @@ public class MapMarkersDbHelper {
} }
} }
public Map<String, ItineraryGroup> getAllGroupsMap() { public Map<String, MapMarkersGroup> getAllGroupsMap() {
Map<String, ItineraryGroup> res = new LinkedHashMap<>(); Map<String, MapMarkersGroup> res = new LinkedHashMap<>();
SQLiteConnection db = openConnection(true); SQLiteConnection db = openConnection(true);
if (db != null) { if (db != null) {
try { try {
SQLiteCursor query = db.rawQuery(GROUPS_TABLE_SELECT, null); SQLiteCursor query = db.rawQuery(GROUPS_TABLE_SELECT, null);
if (query != null && query.moveToFirst()) { if (query != null && query.moveToFirst()) {
do { do {
ItineraryGroup group = readGroup(query); MapMarkersGroup group = readGroup(query);
res.put(group.getId(), group); res.put(group.getId(), group);
} while (query.moveToNext()); } while (query.moveToNext());
} }
@ -196,14 +196,14 @@ public class MapMarkersDbHelper {
return res; return res;
} }
private ItineraryGroup readGroup(SQLiteCursor query) { private MapMarkersGroup readGroup(SQLiteCursor query) {
String id = query.getString(0); String id = query.getString(0);
String name = query.getString(1); String name = query.getString(1);
int type = query.getInt(2); int type = query.getInt(2);
boolean disabled = query.getInt(3) == 1; boolean disabled = query.getInt(3) == 1;
String categories = query.getString(4); String categories = query.getString(4);
ItineraryGroup res = new ItineraryGroup(id, name, ItineraryType.findTypeForId(type)); MapMarkersGroup res = new MapMarkersGroup(id, name, ItineraryType.findTypeForId(type));
res.setDisabled(disabled); res.setDisabled(disabled);
res.setWptCategories(categories == null ? null : Algorithms.decodeStringSet(categories)); res.setWptCategories(categories == null ? null : Algorithms.decodeStringSet(categories));

View file

@ -10,7 +10,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
public class ItineraryGroup { public class MapMarkersGroup {
public static final String MARKERS_SYNC_GROUP_ID = "markers_sync_group_id"; public static final String MARKERS_SYNC_GROUP_ID = "markers_sync_group_id";
@ -30,11 +30,11 @@ public class ItineraryGroup {
private GroupHeader header; private GroupHeader header;
private ShowHideHistoryButton showHideHistoryButton; private ShowHideHistoryButton showHideHistoryButton;
public ItineraryGroup() { public MapMarkersGroup() {
} }
public ItineraryGroup(@NonNull String id, @NonNull String name, @NonNull ItineraryType type) { public MapMarkersGroup(@NonNull String id, @NonNull String name, @NonNull ItineraryType type) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.type = type; this.type = type;

View file

@ -44,7 +44,7 @@ import java.util.concurrent.Executors;
import static net.osmand.data.PointDescription.POINT_TYPE_MAP_MARKER; import static net.osmand.data.PointDescription.POINT_TYPE_MAP_MARKER;
public class ItineraryHelper { public class MapMarkersHelper {
public static final int MAP_MARKERS_COLORS_COUNT = 7; public static final int MAP_MARKERS_COLORS_COUNT = 7;
@ -55,7 +55,7 @@ public class ItineraryHelper {
public static final int BY_DATE_ADDED_ASC = 4; public static final int BY_DATE_ADDED_ASC = 4;
private static final Log LOG = PlatformUtil.getLog(ItineraryHelper.class); private static final Log LOG = PlatformUtil.getLog(MapMarkersHelper.class);
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({BY_NAME, BY_DISTANCE_DESC, BY_DISTANCE_ASC, BY_DATE_ADDED_DESC, BY_DATE_ADDED_ASC}) @IntDef({BY_NAME, BY_DISTANCE_DESC, BY_DISTANCE_ASC, BY_DATE_ADDED_DESC, BY_DATE_ADDED_ASC})
@ -64,13 +64,13 @@ public class ItineraryHelper {
private OsmandApplication app; private OsmandApplication app;
private MapMarkersDbHelper markersDbHelper; private MapMarkersDbHelper markersDbHelper;
private ItinerarySaveHelper saveHelper; private ItineraryDataHelper saveHelper;
private ExecutorService executorService = Executors.newSingleThreadExecutor(); private ExecutorService executorService = Executors.newSingleThreadExecutor();
private List<MapMarker> mapMarkers = new ArrayList<>(); private List<MapMarker> mapMarkers = new ArrayList<>();
private List<MapMarker> mapMarkersHistory = new ArrayList<>(); private List<MapMarker> mapMarkersHistory = new ArrayList<>();
private List<ItineraryGroup> itineraryGroups = new ArrayList<>(); private List<MapMarkersGroup> mapMarkersGroups = new ArrayList<>();
private List<MapMarkerChangedListener> listeners = new ArrayList<>(); private List<MapMarkerChangedListener> listeners = new ArrayList<>();
private Set<OnGroupSyncedListener> syncListeners = new HashSet<>(); private Set<OnGroupSyncedListener> syncListeners = new HashSet<>();
@ -85,8 +85,8 @@ public class ItineraryHelper {
return mapMarkersHistory; return mapMarkersHistory;
} }
public List<ItineraryGroup> getItineraryGroups() { public List<MapMarkersGroup> getMapMarkersGroups() {
return itineraryGroups; return mapMarkersGroups;
} }
public boolean isStartFromMyLocation() { public boolean isStartFromMyLocation() {
@ -101,13 +101,13 @@ public class ItineraryHelper {
return planRouteContext; return planRouteContext;
} }
public ItinerarySaveHelper getSaveHelper() { public ItineraryDataHelper getSaveHelper() {
return saveHelper; return saveHelper;
} }
public ItineraryHelper(OsmandApplication app) { public MapMarkersHelper(OsmandApplication app) {
this.app = app; this.app = app;
saveHelper = new ItinerarySaveHelper(app, this); saveHelper = new ItineraryDataHelper(app, this);
markersDbHelper = app.getMapMarkersDbHelper(); markersDbHelper = app.getMapMarkersDbHelper();
planRouteContext = new MarkersPlanRouteContext(app); planRouteContext = new MarkersPlanRouteContext(app);
markersDbHelper.removeDisabledGroups(); markersDbHelper.removeDisabledGroups();
@ -132,26 +132,26 @@ public class ItineraryHelper {
} }
private void loadGroups() { private void loadGroups() {
Map<String, ItineraryGroup> groupsMap = markersDbHelper.getAllGroupsMap(); Map<String, MapMarkersGroup> groupsMap = markersDbHelper.getAllGroupsMap();
List<MapMarker> allMarkers = new ArrayList<>(mapMarkers); List<MapMarker> allMarkers = new ArrayList<>(mapMarkers);
allMarkers.addAll(mapMarkersHistory); allMarkers.addAll(mapMarkersHistory);
Iterator<Map.Entry<String, ItineraryGroup>> iterator = groupsMap.entrySet().iterator(); Iterator<Map.Entry<String, MapMarkersGroup>> iterator = groupsMap.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
ItineraryGroup group = iterator.next().getValue(); MapMarkersGroup group = iterator.next().getValue();
if (group.getType() == ItineraryType.TRACK && !new File(group.getId()).exists()) { if (group.getType() == ItineraryType.TRACK && !new File(group.getId()).exists()) {
markersDbHelper.removeMarkersGroup(group.getId()); markersDbHelper.removeMarkersGroup(group.getId());
iterator.remove(); iterator.remove();
} }
} }
ItineraryGroup noGroup = null; MapMarkersGroup noGroup = null;
for (MapMarker marker : allMarkers) { for (MapMarker marker : allMarkers) {
ItineraryGroup group = groupsMap.get(marker.groupKey); MapMarkersGroup group = groupsMap.get(marker.groupKey);
if (group == null) { if (group == null) {
if (noGroup == null) { if (noGroup == null) {
noGroup = new ItineraryGroup(); noGroup = new MapMarkersGroup();
noGroup.setCreationDate(Long.MAX_VALUE); noGroup.setCreationDate(Long.MAX_VALUE);
} }
noGroup.getMarkers().add(marker); noGroup.getMarkers().add(marker);
@ -163,7 +163,7 @@ public class ItineraryHelper {
} }
} }
itineraryGroups = new ArrayList<>(groupsMap.values()); mapMarkersGroups = new ArrayList<>(groupsMap.values());
if (noGroup != null) { if (noGroup != null) {
sortMarkers(noGroup.getMarkers(), false, BY_DATE_ADDED_DESC); sortMarkers(noGroup.getMarkers(), false, BY_DATE_ADDED_DESC);
addToGroupsList(noGroup); addToGroupsList(noGroup);
@ -171,7 +171,7 @@ public class ItineraryHelper {
sortGroups(); sortGroups();
for (ItineraryGroup group : itineraryGroups) { for (MapMarkersGroup group : mapMarkersGroups) {
updateGroup(group); updateGroup(group);
} }
} }
@ -181,7 +181,7 @@ public class ItineraryHelper {
} }
public void syncAllGroupsAsync() { public void syncAllGroupsAsync() {
for (ItineraryGroup gr : itineraryGroups) { for (MapMarkersGroup gr : mapMarkersGroups) {
if (gr.getId() != null && gr.getName() != null) { if (gr.getId() != null && gr.getName() != null) {
runSynchronization(gr); runSynchronization(gr);
} }
@ -300,7 +300,7 @@ public class ItineraryHelper {
}); });
} }
public void runSynchronization(final @NonNull ItineraryGroup group) { public void runSynchronization(final @NonNull MapMarkersGroup group) {
app.runInUIThread(new Runnable() { app.runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -309,20 +309,20 @@ public class ItineraryHelper {
}); });
} }
public ItineraryGroup getMarkersGroup(GPXFile gpx) { public MapMarkersGroup getMarkersGroup(GPXFile gpx) {
if (gpx == null || gpx.path == null) { if (gpx == null || gpx.path == null) {
return null; return null;
} }
return getMapMarkerGroupById(getMarkerGroupId(new File(gpx.path)), ItineraryType.TRACK); return getMapMarkerGroupById(getMarkerGroupId(new File(gpx.path)), ItineraryType.TRACK);
} }
public ItineraryGroup getMarkersGroup(FavoriteGroup favGroup) { public MapMarkersGroup getMarkersGroup(FavoriteGroup favGroup) {
return getMapMarkerGroupById(getMarkerGroupId(favGroup), ItineraryType.FAVOURITES); return getMapMarkerGroupById(getMarkerGroupId(favGroup), ItineraryType.FAVOURITES);
} }
public ItineraryGroup addOrEnableGpxGroup(@NonNull File file) { public MapMarkersGroup addOrEnableGpxGroup(@NonNull File file) {
updateGpxShowAsMarkers(file); updateGpxShowAsMarkers(file);
ItineraryGroup gr = getMapMarkerGroupById(getMarkerGroupId(file), ItineraryType.TRACK); MapMarkersGroup gr = getMapMarkerGroupById(getMarkerGroupId(file), ItineraryType.TRACK);
if (gr == null) { if (gr == null) {
gr = createGPXMarkerGroup(file); gr = createGPXMarkerGroup(file);
addGroupInternally(gr); addGroupInternally(gr);
@ -331,9 +331,9 @@ public class ItineraryHelper {
return gr; return gr;
} }
public ItineraryGroup addOrEnableGroup(@NonNull GPXFile file) { public MapMarkersGroup addOrEnableGroup(@NonNull GPXFile file) {
updateGpxShowAsMarkers(new File(file.path)); updateGpxShowAsMarkers(new File(file.path));
ItineraryGroup gr = getMarkersGroup(file); MapMarkersGroup gr = getMarkersGroup(file);
if (gr == null) { if (gr == null) {
gr = createGPXMarkerGroup(new File(file.path)); gr = createGPXMarkerGroup(new File(file.path));
addGroupInternally(gr); addGroupInternally(gr);
@ -342,8 +342,8 @@ public class ItineraryHelper {
return gr; return gr;
} }
public ItineraryGroup addOrEnableGroup(@NonNull FavoriteGroup group) { public MapMarkersGroup addOrEnableGroup(@NonNull FavoriteGroup group) {
ItineraryGroup gr = getMarkersGroup(group); MapMarkersGroup gr = getMarkersGroup(group);
if (gr == null) { if (gr == null) {
gr = createFavMarkerGroup(group); gr = createFavMarkerGroup(group);
addGroupInternally(gr); addGroupInternally(gr);
@ -352,9 +352,9 @@ public class ItineraryHelper {
return gr; return gr;
} }
public void enableGroup(@NonNull ItineraryGroup gr) { public void enableGroup(@NonNull MapMarkersGroup gr) {
// check if group doesn't exist internally // check if group doesn't exist internally
if (!itineraryGroups.contains(gr)) { if (!mapMarkersGroups.contains(gr)) {
addGroupInternally(gr); addGroupInternally(gr);
} }
if (gr.isDisabled()) { if (gr.isDisabled()) {
@ -363,7 +363,7 @@ public class ItineraryHelper {
runSynchronization(gr); runSynchronization(gr);
} }
private void addGroupInternally(ItineraryGroup gr) { private void addGroupInternally(MapMarkersGroup gr) {
markersDbHelper.addGroup(gr); markersDbHelper.addGroup(gr);
addHistoryMarkersToGroup(gr); addHistoryMarkersToGroup(gr);
addToGroupsList(gr); addToGroupsList(gr);
@ -377,7 +377,7 @@ public class ItineraryHelper {
} }
} }
private void addHistoryMarkersToGroup(@NonNull ItineraryGroup group) { private void addHistoryMarkersToGroup(@NonNull MapMarkersGroup group) {
List<MapMarker> historyMarkers = new ArrayList<>(mapMarkersHistory); List<MapMarker> historyMarkers = new ArrayList<>(mapMarkersHistory);
for (MapMarker m : historyMarkers) { for (MapMarker m : historyMarkers) {
if (m.groupKey != null && group.getId() != null && m.groupKey.equals(group.getId())) { if (m.groupKey != null && group.getId() != null && m.groupKey.equals(group.getId())) {
@ -386,7 +386,7 @@ public class ItineraryHelper {
} }
} }
public void removeMarkersGroup(ItineraryGroup group) { public void removeMarkersGroup(MapMarkersGroup group) {
if (group != null) { if (group != null) {
markersDbHelper.removeMarkersGroup(group.getId()); markersDbHelper.removeMarkersGroup(group.getId());
removeGroupActiveMarkers(group, false); removeGroupActiveMarkers(group, false);
@ -394,7 +394,7 @@ public class ItineraryHelper {
} }
} }
public void updateGroupDisabled(@NonNull ItineraryGroup group, boolean disabled) { public void updateGroupDisabled(@NonNull MapMarkersGroup group, boolean disabled) {
String id = group.getId(); String id = group.getId();
if (id != null) { if (id != null) {
markersDbHelper.updateGroupDisabled(id, disabled); markersDbHelper.updateGroupDisabled(id, disabled);
@ -402,7 +402,7 @@ public class ItineraryHelper {
} }
} }
public void updateGroupWptCategories(@NonNull ItineraryGroup group, Set<String> wptCategories) { public void updateGroupWptCategories(@NonNull MapMarkersGroup group, Set<String> wptCategories) {
String id = group.getId(); String id = group.getId();
if (id != null) { if (id != null) {
group.setWptCategories(wptCategories); group.setWptCategories(wptCategories);
@ -412,7 +412,7 @@ public class ItineraryHelper {
} }
} }
private void removeGroupActiveMarkers(ItineraryGroup group, boolean updateGroup) { private void removeGroupActiveMarkers(MapMarkersGroup group, boolean updateGroup) {
if (group != null) { if (group != null) {
markersDbHelper.removeActiveMarkersFromGroup(group.getId()); markersDbHelper.removeActiveMarkersFromGroup(group.getId());
removeFromMapMarkersList(group.getActiveMarkers()); removeFromMapMarkersList(group.getActiveMarkers());
@ -426,26 +426,26 @@ public class ItineraryHelper {
} }
public void updateGroups() { public void updateGroups() {
for (ItineraryGroup group : itineraryGroups) { for (MapMarkersGroup group : mapMarkersGroups) {
updateGroup(group); updateGroup(group);
} }
} }
public void updateGroup(ItineraryGroup itineraryGroup) { public void updateGroup(MapMarkersGroup mapMarkersGroup) {
if (itineraryGroup.getId() == null || itineraryGroup.getName() == null) { if (mapMarkersGroup.getId() == null || mapMarkersGroup.getName() == null) {
return; return;
} }
createHeadersInGroup(itineraryGroup); createHeadersInGroup(mapMarkersGroup);
int historyMarkersCount = itineraryGroup.getHistoryMarkers().size(); int historyMarkersCount = mapMarkersGroup.getHistoryMarkers().size();
ShowHideHistoryButton showHideHistoryButton = itineraryGroup.getShowHideHistoryButton(); ShowHideHistoryButton showHideHistoryButton = mapMarkersGroup.getShowHideHistoryButton();
if (showHideHistoryButton != null) { if (showHideHistoryButton != null) {
if (historyMarkersCount == 0) { if (historyMarkersCount == 0) {
itineraryGroup.setShowHideHistoryButton(null); mapMarkersGroup.setShowHideHistoryButton(null);
} }
} else if (historyMarkersCount > 0) { } else if (historyMarkersCount > 0) {
showHideHistoryButton = new ShowHideHistoryButton(); showHideHistoryButton = new ShowHideHistoryButton();
showHideHistoryButton.showHistory = false; showHideHistoryButton.showHistory = false;
itineraryGroup.setShowHideHistoryButton(showHideHistoryButton); mapMarkersGroup.setShowHideHistoryButton(showHideHistoryButton);
} }
} }
@ -458,25 +458,25 @@ public class ItineraryHelper {
private void addMarkerToGroup(MapMarker marker) { private void addMarkerToGroup(MapMarker marker) {
if (marker != null) { if (marker != null) {
ItineraryGroup itineraryGroup = getMapMarkerGroupById(marker.groupKey, marker.getType()); MapMarkersGroup mapMarkersGroup = getMapMarkerGroupById(marker.groupKey, marker.getType());
if (itineraryGroup != null) { if (mapMarkersGroup != null) {
itineraryGroup.getMarkers().add(marker); mapMarkersGroup.getMarkers().add(marker);
updateGroup(itineraryGroup); updateGroup(mapMarkersGroup);
if (itineraryGroup.getName() == null) { if (mapMarkersGroup.getName() == null) {
sortMarkers(itineraryGroup.getMarkers(), false, BY_DATE_ADDED_DESC); sortMarkers(mapMarkersGroup.getMarkers(), false, BY_DATE_ADDED_DESC);
} }
} else { } else {
itineraryGroup = new ItineraryGroup(marker.groupKey, marker.groupName, ItineraryType.MARKERS); mapMarkersGroup = new MapMarkersGroup(marker.groupKey, marker.groupName, ItineraryType.MARKERS);
itineraryGroup.setCreationDate(Long.MAX_VALUE); mapMarkersGroup.setCreationDate(Long.MAX_VALUE);
itineraryGroup.getMarkers().add(marker); mapMarkersGroup.getMarkers().add(marker);
addToGroupsList(itineraryGroup); addToGroupsList(mapMarkersGroup);
sortGroups(); sortGroups();
updateGroup(itineraryGroup); updateGroup(mapMarkersGroup);
} }
} }
} }
private void createHeadersInGroup(@NonNull ItineraryGroup group) { private void createHeadersInGroup(@NonNull MapMarkersGroup group) {
ItineraryType type = group.getType(); ItineraryType type = group.getType();
int headerIconId = 0; int headerIconId = 0;
if (type != ItineraryType.MARKERS) { if (type != ItineraryType.MARKERS) {
@ -489,19 +489,19 @@ public class ItineraryHelper {
private void removeMarkerFromGroup(MapMarker marker) { private void removeMarkerFromGroup(MapMarker marker) {
if (marker != null) { if (marker != null) {
ItineraryGroup itineraryGroup = getMapMarkerGroupById(marker.groupKey, marker.getType()); MapMarkersGroup mapMarkersGroup = getMapMarkerGroupById(marker.groupKey, marker.getType());
if (itineraryGroup != null) { if (mapMarkersGroup != null) {
itineraryGroup.getMarkers().remove(marker); mapMarkersGroup.getMarkers().remove(marker);
updateGroup(itineraryGroup); updateGroup(mapMarkersGroup);
} }
} }
} }
private void sortGroups() { private void sortGroups() {
if (itineraryGroups.size() > 0) { if (mapMarkersGroups.size() > 0) {
Collections.sort(itineraryGroups, new Comparator<ItineraryGroup>() { Collections.sort(mapMarkersGroups, new Comparator<MapMarkersGroup>() {
@Override @Override
public int compare(ItineraryGroup group1, ItineraryGroup group2) { public int compare(MapMarkersGroup group1, MapMarkersGroup group2) {
long t1 = group1.getCreationDate(); long t1 = group1.getCreationDate();
long t2 = group2.getCreationDate(); long t2 = group2.getCreationDate();
return (t1 > t2) ? -1 : ((t1 == t2) ? 0 : 1); return (t1 > t2) ? -1 : ((t1 == t2) ? 0 : 1);
@ -511,8 +511,8 @@ public class ItineraryHelper {
} }
@Nullable @Nullable
public ItineraryGroup getMapMarkerGroupById(String id, ItineraryType type) { public MapMarkersGroup getMapMarkerGroupById(String id, ItineraryType type) {
for (ItineraryGroup group : itineraryGroups) { for (MapMarkersGroup group : mapMarkersGroups) {
if ((id == null && group.getId() == null) if ((id == null && group.getId() == null)
|| (group.getId() != null && group.getId().equals(id))) { || (group.getId() != null && group.getId().equals(id))) {
if (type == ItineraryType.MARKERS || type == group.getType()) { if (type == ItineraryType.MARKERS || type == group.getType()) {
@ -523,14 +523,14 @@ public class ItineraryHelper {
return null; return null;
} }
private ItineraryGroup createGPXMarkerGroup(File fl) { private MapMarkersGroup createGPXMarkerGroup(File fl) {
return new ItineraryGroup(getMarkerGroupId(fl), return new MapMarkersGroup(getMarkerGroupId(fl),
Algorithms.getFileNameWithoutExtension(fl.getName()), Algorithms.getFileNameWithoutExtension(fl.getName()),
ItineraryType.TRACK); ItineraryType.TRACK);
} }
private ItineraryGroup createFavMarkerGroup(FavoriteGroup favGroup) { private MapMarkersGroup createFavMarkerGroup(FavoriteGroup favGroup) {
return new ItineraryGroup(favGroup.getName(), favGroup.getName(), ItineraryType.FAVOURITES); return new MapMarkersGroup(favGroup.getName(), favGroup.getName(), ItineraryType.FAVOURITES);
} }
private String getMarkerGroupId(File gpx) { private String getMarkerGroupId(File gpx) {
@ -542,13 +542,13 @@ public class ItineraryHelper {
} }
@NonNull @NonNull
public List<ItineraryGroup> getGroupsForDisplayedGpx() { public List<MapMarkersGroup> getGroupsForDisplayedGpx() {
List<ItineraryGroup> res = new ArrayList<>(); List<MapMarkersGroup> res = new ArrayList<>();
List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles(); List<SelectedGpxFile> selectedGpxFiles = app.getSelectedGpxHelper().getSelectedGPXFiles();
for (SelectedGpxFile selected : selectedGpxFiles) { for (SelectedGpxFile selected : selectedGpxFiles) {
ItineraryGroup search = getMarkersGroup(selected.getGpxFile()); MapMarkersGroup search = getMarkersGroup(selected.getGpxFile());
if (search == null && selected.getGpxFile() != null && selected.getGpxFile().path != null) { if (search == null && selected.getGpxFile() != null && selected.getGpxFile().path != null) {
ItineraryGroup group = createGPXMarkerGroup(new File(selected.getGpxFile().path)); MapMarkersGroup group = createGPXMarkerGroup(new File(selected.getGpxFile().path));
group.setDisabled(true); group.setDisabled(true);
createHeadersInGroup(group); createHeadersInGroup(group);
res.add(group); res.add(group);
@ -558,17 +558,17 @@ public class ItineraryHelper {
} }
@NonNull @NonNull
public List<ItineraryGroup> getGroupsForSavedArticlesTravelBook() { public List<MapMarkersGroup> getGroupsForSavedArticlesTravelBook() {
List<ItineraryGroup> res = new ArrayList<>(); List<MapMarkersGroup> res = new ArrayList<>();
TravelHelper travelHelper = app.getTravelHelper(); TravelHelper travelHelper = app.getTravelHelper();
if (travelHelper.isAnyTravelBookPresent()) { if (travelHelper.isAnyTravelBookPresent()) {
List<TravelArticle> savedArticles = travelHelper.getBookmarksHelper().getSavedArticles(); List<TravelArticle> savedArticles = travelHelper.getBookmarksHelper().getSavedArticles();
for (TravelArticle art : savedArticles) { for (TravelArticle art : savedArticles) {
String gpxName = travelHelper.getGPXName(art); String gpxName = travelHelper.getGPXName(art);
File path = app.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName); File path = app.getAppPath(IndexConstants.GPX_TRAVEL_DIR + gpxName);
ItineraryGroup search = getMapMarkerGroupById(getMarkerGroupId(path), ItineraryType.TRACK); MapMarkersGroup search = getMapMarkerGroupById(getMarkerGroupId(path), ItineraryType.TRACK);
if (search == null) { if (search == null) {
ItineraryGroup group = createGPXMarkerGroup(path); MapMarkersGroup group = createGPXMarkerGroup(path);
group.setDisabled(true); group.setDisabled(true);
createHeadersInGroup(group); createHeadersInGroup(group);
res.add(group); res.add(group);
@ -629,7 +629,7 @@ public class ItineraryHelper {
return null; return null;
} }
private void addNewMarkerIfNeeded(@NonNull ItineraryGroup group, private void addNewMarkerIfNeeded(@NonNull MapMarkersGroup group,
@NonNull List<MapMarker> groupMarkers, @NonNull List<MapMarker> groupMarkers,
@NonNull LatLon latLon, @NonNull LatLon latLon,
@NonNull String name, @NonNull String name,
@ -866,13 +866,13 @@ public class ItineraryHelper {
public void addMapMarkers(@NonNull List<LatLon> points, public void addMapMarkers(@NonNull List<LatLon> points,
@NonNull List<PointDescription> historyNames, @NonNull List<PointDescription> historyNames,
@Nullable ItineraryGroup group) { @Nullable MapMarkersGroup group) {
addMarkers(points, historyNames, group, null, null, null); addMarkers(points, historyNames, group, null, null, null);
} }
private void addMarkers(@NonNull List<LatLon> points, private void addMarkers(@NonNull List<LatLon> points,
@NonNull List<PointDescription> historyNames, @NonNull List<PointDescription> historyNames,
@Nullable ItineraryGroup group, @Nullable MapMarkersGroup group,
@Nullable List<FavouritePoint> favouritePoints, @Nullable List<FavouritePoint> favouritePoints,
@Nullable List<WptPt> wptPts, @Nullable List<WptPt> wptPts,
@Nullable List<String> mapObjNames) { @Nullable List<String> mapObjNames) {
@ -1006,7 +1006,7 @@ public class ItineraryHelper {
public List<MapMarker> getMapMarkersFromDefaultGroups(boolean history) { public List<MapMarker> getMapMarkersFromDefaultGroups(boolean history) {
List<MapMarker> mapMarkers = new ArrayList<>(); List<MapMarker> mapMarkers = new ArrayList<>();
for (ItineraryGroup group : itineraryGroups) { for (MapMarkersGroup group : mapMarkersGroups) {
if (group.getType() == ItineraryType.MARKERS) { if (group.getType() == ItineraryType.MARKERS) {
for (MapMarker marker : group.getMarkers()) { for (MapMarker marker : group.getMarkers()) {
if (history && marker.history || !history && !marker.history) { if (history && marker.history || !history && !marker.history) {
@ -1082,16 +1082,16 @@ public class ItineraryHelper {
// accessors to markers groups: // accessors to markers groups:
private void addToGroupsList(ItineraryGroup group) { private void addToGroupsList(MapMarkersGroup group) {
List<ItineraryGroup> copyList = new ArrayList<>(itineraryGroups); List<MapMarkersGroup> copyList = new ArrayList<>(mapMarkersGroups);
copyList.add(group); copyList.add(group);
itineraryGroups = copyList; mapMarkersGroups = copyList;
} }
private void removeFromGroupsList(ItineraryGroup group) { private void removeFromGroupsList(MapMarkersGroup group) {
List<ItineraryGroup> copyList = new ArrayList<>(itineraryGroups); List<MapMarkersGroup> copyList = new ArrayList<>(mapMarkersGroups);
copyList.remove(group); copyList.remove(group);
itineraryGroups = copyList; mapMarkersGroups = copyList;
} }
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
@ -1113,9 +1113,9 @@ public class ItineraryHelper {
private class SyncGroupTask extends AsyncTask<Void, Void, Void> { private class SyncGroupTask extends AsyncTask<Void, Void, Void> {
private ItineraryGroup group; private MapMarkersGroup group;
SyncGroupTask(ItineraryGroup group) { SyncGroupTask(MapMarkersGroup group) {
this.group = group; this.group = group;
} }

View file

@ -178,7 +178,7 @@ public class MarkersPlanRouteContext {
} }
private List<WptPt> getPointsToCalculate() { private List<WptPt> getPointsToCalculate() {
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<WptPt> points = new LinkedList<>(); List<WptPt> points = new LinkedList<>();
Location myLoc = app.getLocationProvider().getLastStaleKnownLocation(); Location myLoc = app.getLocationProvider().getLastStaleKnownLocation();
if (markersHelper.isStartFromMyLocation() && myLoc != null) { if (markersHelper.isStartFromMyLocation() && myLoc != null) {

View file

@ -18,7 +18,7 @@ import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.UiUtilities.UpdateLocationViewCache; import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryType; import net.osmand.plus.mapmarkers.ItineraryType;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -44,7 +44,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
this.mapActivity = mapActivity; this.mapActivity = mapActivity;
uiUtilities = mapActivity.getMyApplication().getUIUtilities(); uiUtilities = mapActivity.getMyApplication().getUIUtilities();
updateLocationViewCache = uiUtilities.getUpdateLocationViewCache(); updateLocationViewCache = uiUtilities.getUpdateLocationViewCache();
markers = mapActivity.getMyApplication().getItineraryHelper().getMapMarkers(); markers = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers();
night = !mapActivity.getMyApplication().getSettings().isLightContent(); night = !mapActivity.getMyApplication().getSettings().isLightContent();
showDirectionEnabled = mapActivity.getMyApplication().getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get(); showDirectionEnabled = mapActivity.getMyApplication().getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get();
} }
@ -152,7 +152,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
} }
final MapMarker marker = markers.get(position); final MapMarker marker = markers.get(position);
mapActivity.getMyApplication().getItineraryHelper().moveMapMarkerToHistory(marker); mapActivity.getMyApplication().getMapMarkersHelper().moveMapMarkerToHistory(marker);
changeMarkers(); changeMarkers();
notifyDataSetChanged(); notifyDataSetChanged();
@ -160,7 +160,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
.setAction(R.string.shared_string_undo, new View.OnClickListener() { .setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mapActivity.getMyApplication().getItineraryHelper().restoreMarkerFromHistory(marker, position); mapActivity.getMyApplication().getMapMarkersHelper().restoreMarkerFromHistory(marker, position);
changeMarkers(); changeMarkers();
notifyDataSetChanged(); notifyDataSetChanged();
} }
@ -189,7 +189,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
} }
public void changeMarkers() { public void changeMarkers() {
markers = mapActivity.getMyApplication().getItineraryHelper().getMapMarkers(); markers = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers();
} }
public void hideSnackbar() { public void hideSnackbar() {
@ -214,11 +214,11 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
public void onItemSwiped(RecyclerView.ViewHolder holder) { public void onItemSwiped(RecyclerView.ViewHolder holder) {
final int pos = holder.getAdapterPosition(); final int pos = holder.getAdapterPosition();
final MapMarker marker = getItem(pos); final MapMarker marker = getItem(pos);
mapActivity.getMyApplication().getItineraryHelper().moveMapMarkerToHistory(marker); mapActivity.getMyApplication().getMapMarkersHelper().moveMapMarkerToHistory(marker);
ItineraryGroup group = mapActivity.getMyApplication().getItineraryHelper().getMapMarkerGroupById(marker.groupKey, MapMarkersGroup group = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkerGroupById(marker.groupKey,
ItineraryType.MARKERS); ItineraryType.MARKERS);
if (group != null) { if (group != null) {
mapActivity.getMyApplication().getItineraryHelper().updateGroup(group); mapActivity.getMyApplication().getMapMarkersHelper().updateGroup(group);
} }
changeMarkers(); changeMarkers();
notifyDataSetChanged(); notifyDataSetChanged();
@ -226,7 +226,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
.setAction(R.string.shared_string_undo, new View.OnClickListener() { .setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mapActivity.getMyApplication().getItineraryHelper().restoreMarkerFromHistory(marker, pos); mapActivity.getMyApplication().getMapMarkersHelper().restoreMarkerFromHistory(marker, pos);
changeMarkers(); changeMarkers();
notifyDataSetChanged(); notifyDataSetChanged();
} }

View file

@ -22,11 +22,11 @@ import net.osmand.IndexConstants;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.plus.GpxSelectionHelper; import net.osmand.plus.GpxSelectionHelper;
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.GroupHeader; import net.osmand.plus.mapmarkers.GroupHeader;
import net.osmand.plus.mapmarkers.ItineraryType; import net.osmand.plus.mapmarkers.ItineraryType;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ShowHideHistoryButton; import net.osmand.plus.mapmarkers.ShowHideHistoryButton;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -84,7 +84,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
private void updateShowDirectionMarkers() { private void updateShowDirectionMarkers() {
showDirectionEnabled = app.getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get(); showDirectionEnabled = app.getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get();
List<MapMarker> mapMarkers = app.getItineraryHelper().getMapMarkers(); List<MapMarker> mapMarkers = app.getMapMarkersHelper().getMapMarkers();
int markersCount = mapMarkers.size(); int markersCount = mapMarkers.size();
showDirectionMarkers = new ArrayList<>(mapMarkers.subList(0, getToIndex(markersCount))); showDirectionMarkers = new ArrayList<>(mapMarkers.subList(0, getToIndex(markersCount)));
} }
@ -101,9 +101,9 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
private void createDisplayGroups() { private void createDisplayGroups() {
items = new ArrayList<>(); items = new ArrayList<>();
ItineraryHelper helper = app.getItineraryHelper(); MapMarkersHelper helper = app.getMapMarkersHelper();
helper.updateGroups(); helper.updateGroups();
List<ItineraryGroup> groups = new ArrayList<>(helper.getItineraryGroups()); List<MapMarkersGroup> groups = new ArrayList<>(helper.getMapMarkersGroups());
groups.addAll(helper.getGroupsForDisplayedGpx()); groups.addAll(helper.getGroupsForDisplayedGpx());
groups.addAll(helper.getGroupsForSavedArticlesTravelBook()); groups.addAll(helper.getGroupsForSavedArticlesTravelBook());
@ -134,7 +134,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
Calendar markerCalendar = Calendar.getInstance(); Calendar markerCalendar = Calendar.getInstance();
for (int i = 0; i < groups.size(); i++) { for (int i = 0; i < groups.size(); i++) {
ItineraryGroup group = groups.get(i); MapMarkersGroup group = groups.get(i);
if (!group.isVisible()) { if (!group.isVisible()) {
continue; continue;
} }
@ -228,7 +228,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
return null; return null;
} }
private void populateAdapterWithGroupMarkers(ItineraryGroup group, int position) { private void populateAdapterWithGroupMarkers(MapMarkersGroup group, int position) {
if (position != RecyclerView.NO_POSITION) { if (position != RecyclerView.NO_POSITION) {
ShowHideHistoryButton showHideHistoryButton = group.getShowHideHistoryButton(); ShowHideHistoryButton showHideHistoryButton = group.getShowHideHistoryButton();
if (!group.isDisabled()) { if (!group.isDisabled()) {
@ -253,7 +253,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
public int getGroupHeaderPosition(String groupId) { public int getGroupHeaderPosition(String groupId) {
int pos = -1; int pos = -1;
ItineraryGroup group = app.getItineraryHelper().getMapMarkerGroupById(groupId, ItineraryType.MARKERS); MapMarkersGroup group = app.getMapMarkersHelper().getMapMarkerGroupById(groupId, ItineraryType.MARKERS);
if (group != null) { if (group != null) {
pos = items.indexOf(group.getGroupHeader()); pos = items.indexOf(group.getGroupHeader());
} }
@ -376,9 +376,9 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
return; return;
} }
if (markerInHistory) { if (markerInHistory) {
app.getItineraryHelper().restoreMarkerFromHistory(marker, 0); app.getMapMarkersHelper().restoreMarkerFromHistory(marker, 0);
} else { } else {
app.getItineraryHelper().moveMapMarkerToHistory(marker); app.getMapMarkersHelper().moveMapMarkerToHistory(marker);
} }
updateDisplayedData(); updateDisplayedData();
if (!markerInHistory) { if (!markerInHistory) {
@ -386,7 +386,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
.setAction(R.string.shared_string_undo, new View.OnClickListener() { .setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
mapActivity.getMyApplication().getItineraryHelper().restoreMarkerFromHistory(marker, 0); mapActivity.getMyApplication().getMapMarkersHelper().restoreMarkerFromHistory(marker, 0);
updateDisplayedData(); updateDisplayedData();
} }
}); });
@ -421,7 +421,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
headerViewHolder.articleDescription.setVisibility(View.GONE); headerViewHolder.articleDescription.setVisibility(View.GONE);
} else if (header instanceof GroupHeader) { } else if (header instanceof GroupHeader) {
final GroupHeader groupHeader = (GroupHeader) header; final GroupHeader groupHeader = (GroupHeader) header;
final ItineraryGroup group = groupHeader.getGroup(); final MapMarkersGroup group = groupHeader.getGroup();
String groupName = group.getName(); String groupName = group.getName();
if (groupName.isEmpty()) { if (groupName.isEmpty()) {
groupName = app.getString(R.string.shared_string_favorites); groupName = app.getString(R.string.shared_string_favorites);
@ -466,7 +466,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
CompoundButton.OnCheckedChangeListener checkedChangeListener = new CompoundButton.OnCheckedChangeListener() { CompoundButton.OnCheckedChangeListener checkedChangeListener = new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean enabled) { public void onCheckedChanged(CompoundButton compoundButton, boolean enabled) {
final ItineraryHelper itineraryHelper = app.getItineraryHelper(); final MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
final GPXFile[] gpxFile = new GPXFile[1]; final GPXFile[] gpxFile = new GPXFile[1];
boolean disabled = !enabled; boolean disabled = !enabled;
@ -482,7 +482,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
fragment.setUsedOnMap(false); fragment.setUsedOnMap(false);
fragment.show(mapActivity.getSupportFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG);
} }
itineraryHelper.updateGroupDisabled(group, disabled); mapMarkersHelper.updateGroupDisabled(group, disabled);
if (group.getType() == ItineraryType.TRACK) { if (group.getType() == ItineraryType.TRACK) {
group.setVisibleUntilRestart(disabled); group.setVisibleUntilRestart(disabled);
String gpxPath = group.getGpxPath(); String gpxPath = group.getGpxPath();
@ -496,9 +496,9 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
switchGpxVisibility(gpxFile[0], selectedGpxFile, !disabled); switchGpxVisibility(gpxFile[0], selectedGpxFile, !disabled);
} }
if(!disabled) { if(!disabled) {
itineraryHelper.enableGroup(group); mapMarkersHelper.enableGroup(group);
} else { } else {
itineraryHelper.runSynchronization(group); mapMarkersHelper.runSynchronization(group);
} }
if (disabled) { if (disabled) {
@ -509,7 +509,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
if (group.getType() == ItineraryType.TRACK && gpxFile[0] != null) { if (group.getType() == ItineraryType.TRACK && gpxFile[0] != null) {
switchGpxVisibility(gpxFile[0], null, true); switchGpxVisibility(gpxFile[0], null, true);
} }
itineraryHelper.enableGroup(group); mapMarkersHelper.enableGroup(group);
} }
}); });
UiUtilities.setupSnackbar(snackbar, night); UiUtilities.setupSnackbar(snackbar, night);
@ -549,7 +549,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
final Object header = getItem(position); final Object header = getItem(position);
if (header instanceof CategoriesSubHeader) { if (header instanceof CategoriesSubHeader) {
final CategoriesSubHeader categoriesSubHeader = (CategoriesSubHeader) header; final CategoriesSubHeader categoriesSubHeader = (CategoriesSubHeader) header;
final ItineraryGroup group = categoriesSubHeader.getGroup(); final MapMarkersGroup group = categoriesSubHeader.getGroup();
View.OnClickListener openChooseCategoriesDialog = new View.OnClickListener() { View.OnClickListener openChooseCategoriesDialog = new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -563,7 +563,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
fragment.setUsedOnMap(false); fragment.setUsedOnMap(false);
fragment.show(mapActivity.getSupportFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG); fragment.show(mapActivity.getSupportFragmentManager(), SelectWptCategoriesBottomSheetDialogFragment.TAG);
} else { } else {
mapActivity.getMyApplication().getItineraryHelper().addOrEnableGpxGroup(new File(group.getGpxPath())); mapActivity.getMyApplication().getMapMarkersHelper().addOrEnableGpxGroup(new File(group.getGpxPath()));
} }
} }
}; };
@ -592,7 +592,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
} }
} }
private String getGroupWptCategoriesString(ItineraryGroup group) { private String getGroupWptCategoriesString(MapMarkersGroup group) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Set<String> categories = group.getWptCategories(); Set<String> categories = group.getWptCategories();
if (categories != null && !categories.isEmpty()) { if (categories != null && !categories.isEmpty()) {
@ -664,13 +664,13 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
public class CategoriesSubHeader { public class CategoriesSubHeader {
private ItineraryGroup group; private MapMarkersGroup group;
public CategoriesSubHeader(ItineraryGroup group) { public CategoriesSubHeader(MapMarkersGroup group) {
this.group = group; this.group = group;
} }
public ItineraryGroup getGroup() { public MapMarkersGroup getGroup() {
return group; return group;
} }
} }

View file

@ -51,7 +51,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
public void createHeaders() { public void createHeaders() {
items = new ArrayList<>(); items = new ArrayList<>();
markerGroups = new HashMap<>(); markerGroups = new HashMap<>();
List<MapMarker> markersHistory = app.getItineraryHelper().getMapMarkersHistory(); List<MapMarker> markersHistory = app.getMapMarkersHelper().getMapMarkersHistory();
int previousHeader = -1; int previousHeader = -1;
int monthsDisplayed = 0; int monthsDisplayed = 0;
@ -161,13 +161,13 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
if (position < 0) { if (position < 0) {
return; return;
} }
app.getItineraryHelper().restoreMarkerFromHistory(marker, 0); app.getMapMarkersHelper().restoreMarkerFromHistory(marker, 0);
snackbar = Snackbar.make(itemViewHolder.itemView, app.getString(R.string.marker_moved_to_active), Snackbar.LENGTH_LONG) snackbar = Snackbar.make(itemViewHolder.itemView, app.getString(R.string.marker_moved_to_active), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() { .setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
app.getItineraryHelper().moveMapMarkerToHistory(marker); app.getMapMarkersHelper().moveMapMarkerToHistory(marker);
} }
}); });
UiUtilities.setupSnackbar(snackbar, night); UiUtilities.setupSnackbar(snackbar, night);
@ -216,14 +216,14 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
return; return;
} }
for (MapMarker marker : group) { for (MapMarker marker : group) {
app.getItineraryHelper().removeMarker((MapMarker) marker); app.getMapMarkersHelper().removeMarker((MapMarker) marker);
} }
snackbar = Snackbar.make(holder.itemView, app.getString(R.string.n_items_removed), Snackbar.LENGTH_LONG) snackbar = Snackbar.make(holder.itemView, app.getString(R.string.n_items_removed), Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_undo, new View.OnClickListener() { .setAction(R.string.shared_string_undo, new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
for (MapMarker marker : group) { for (MapMarker marker : group) {
app.getItineraryHelper().addMarker(marker); app.getMapMarkersHelper().addMarker(marker);
} }
} }
}); });

View file

@ -97,7 +97,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
boolean firstSelectedMarker = pos == firstSelectedMarkerPos; boolean firstSelectedMarker = pos == firstSelectedMarkerPos;
boolean roundTripFinishItem = finish && showRoundTripItem; boolean roundTripFinishItem = finish && showRoundTripItem;
boolean useLocation = app.getItineraryHelper().isStartFromMyLocation() && showLocationItem; boolean useLocation = app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem;
MapMarker marker = null; MapMarker marker = null;
Location location = null; Location location = null;
@ -168,7 +168,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
if (locationItem) { if (locationItem) {
holder.topDivider.setVisibility(View.VISIBLE); holder.topDivider.setVisibility(View.VISIBLE);
holder.checkBox.setChecked(app.getItineraryHelper().isStartFromMyLocation()); holder.checkBox.setChecked(app.getMapMarkersHelper().isStartFromMyLocation());
holder.distance.setVisibility(View.GONE); holder.distance.setVisibility(View.GONE);
holder.description.setText(locDescription.getName()); holder.description.setText(locDescription.getName());
} else if (roundTripFinishItem) { } else if (roundTripFinishItem) {
@ -270,7 +270,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
return false; return false;
} }
int offset = showLocationItem ? 1 : 0; int offset = showLocationItem ? 1 : 0;
Collections.swap(mapActivity.getMyApplication().getItineraryHelper().getMapMarkers(), from - offset, to - offset); Collections.swap(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers(), from - offset, to - offset);
Collections.swap(items, from, to); Collections.swap(items, from, to);
notifyItemMoved(from, to); notifyItemMoved(from, to);
return true; return true;
@ -310,7 +310,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
lookupLocationAddress(app); lookupLocationAddress(app);
items.add(myLoc); items.add(myLoc);
} }
items.addAll(mapActivity.getMyApplication().getItineraryHelper().getMapMarkers()); items.addAll(mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers());
calculateStartAndFinishPos(); calculateStartAndFinishPos();
showRoundTripItem = inRoundTrip && !inDragAndDrop && startPos != -1; showRoundTripItem = inRoundTrip && !inDragAndDrop && startPos != -1;
if (showRoundTripItem) { if (showRoundTripItem) {
@ -343,7 +343,7 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<MapMarkerItemVie
boolean startCalculated = false; boolean startCalculated = false;
boolean finishCalculated = false; boolean finishCalculated = false;
boolean firstSelectedMarkerCalculated = false; boolean firstSelectedMarkerCalculated = false;
if (app.getItineraryHelper().isStartFromMyLocation() && showLocationItem) { if (app.getMapMarkersHelper().isStartFromMyLocation() && showLocationItem) {
startPos = 0; startPos = 0;
startCalculated = true; startCalculated = true;
if (inRoundTrip && !inDragAndDrop) { if (inRoundTrip && !inDragAndDrop) {

View file

@ -56,7 +56,7 @@ public class AddFavouritesGroupBottomSheetDialogFragment extends AddGroupBottomS
if (!group.isVisible()) { if (!group.isVisible()) {
favouritesDbHelper.editFavouriteGroup(group, group.getName(), group.getColor(), true); favouritesDbHelper.editFavouriteGroup(group, group.getName(), group.getColor(), true);
} }
getMyApplication().getItineraryHelper().addOrEnableGroup(group); getMyApplication().getMapMarkersHelper().addOrEnableGroup(group);
dismiss(); dismiss();
} }
} }

View file

@ -108,7 +108,7 @@ public class AddTracksGroupBottomSheetDialogFragment extends AddGroupBottomSheet
GPXFile res = GPXUtilities.loadGPXFile(gpx); GPXFile res = GPXUtilities.loadGPXFile(gpx);
selectionHelper.selectGpxFile(res, true, false, false, false, false); selectionHelper.selectGpxFile(res, true, false, false, false, false);
} }
app.getItineraryHelper().addOrEnableGpxGroup(gpx); app.getMapMarkersHelper().addOrEnableGpxGroup(gpx);
} }
} }
dismiss(); dismiss();

View file

@ -4,8 +4,8 @@ import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper.MapMarkersSortByDef; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersSortByDef;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
@ -38,7 +38,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (listener != null) {
listener.onMapMarkersOrderByModeChanged(ItineraryHelper.BY_NAME); listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_NAME);
} }
dismiss(); dismiss();
} }
@ -56,7 +56,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (listener != null) {
listener.onMapMarkersOrderByModeChanged(ItineraryHelper.BY_DISTANCE_ASC); listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DISTANCE_ASC);
} }
dismiss(); dismiss();
} }
@ -72,7 +72,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (listener != null) {
listener.onMapMarkersOrderByModeChanged(ItineraryHelper.BY_DISTANCE_DESC); listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DISTANCE_DESC);
} }
dismiss(); dismiss();
} }
@ -90,7 +90,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (listener != null) {
listener.onMapMarkersOrderByModeChanged(ItineraryHelper.BY_DATE_ADDED_ASC); listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DATE_ADDED_ASC);
} }
dismiss(); dismiss();
} }
@ -106,7 +106,7 @@ public class OrderByBottomSheetDialogFragment extends MenuBottomSheetDialogFragm
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (listener != null) { if (listener != null) {
listener.onMapMarkersOrderByModeChanged(ItineraryHelper.BY_DATE_ADDED_DESC); listener.onMapMarkersOrderByModeChanged(MapMarkersHelper.BY_DATE_ADDED_DESC);
} }
dismiss(); dismiss();
} }

View file

@ -20,8 +20,8 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.ShortDescriptionItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -138,18 +138,18 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
private void updateAddOrEnableGroupWptCategories() { private void updateAddOrEnableGroupWptCategories() {
OsmandApplication app = getMyApplication(); OsmandApplication app = getMyApplication();
GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper(); GpxSelectionHelper gpxSelectionHelper = app.getSelectedGpxHelper();
ItineraryHelper itineraryHelper = app.getItineraryHelper(); MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpxFile.path); SelectedGpxFile selectedGpxFile = gpxSelectionHelper.getSelectedFileByPath(gpxFile.path);
if (selectedGpxFile == null) { if (selectedGpxFile == null) {
gpxSelectionHelper.selectGpxFile(gpxFile, true, false, false, false, false); gpxSelectionHelper.selectGpxFile(gpxFile, true, false, false, false, false);
} }
ItineraryGroup group = itineraryHelper.getMarkersGroup(gpxFile); MapMarkersGroup group = mapMarkersHelper.getMarkersGroup(gpxFile);
if (group == null) { if (group == null) {
group = itineraryHelper.addOrEnableGroup(gpxFile); group = mapMarkersHelper.addOrEnableGroup(gpxFile);
} }
itineraryHelper.updateGroupWptCategories(group, selectedCategories); mapMarkersHelper.updateGroupWptCategories(group, selectedCategories);
itineraryHelper.runSynchronization(group); mapMarkersHelper.runSynchronization(group);
} }
private boolean isAllChecked() { private boolean isAllChecked() {

View file

@ -72,8 +72,8 @@ import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.CoordinateInputFormats; import net.osmand.plus.mapmarkers.CoordinateInputFormats;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.bottomsheets.CoordinateInputActionsBottomSheet; import net.osmand.plus.mapmarkers.bottomsheets.CoordinateInputActionsBottomSheet;
import net.osmand.plus.mapmarkers.bottomsheets.CoordinateInputBottomSheetDialogFragment; import net.osmand.plus.mapmarkers.bottomsheets.CoordinateInputBottomSheetDialogFragment;
import net.osmand.plus.mapmarkers.bottomsheets.CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener; import net.osmand.plus.mapmarkers.bottomsheets.CoordinateInputBottomSheetDialogFragment.CoordinateInputFormatChangeListener;
@ -174,8 +174,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
} }
private void syncGpx(GPXFile gpxFile) { private void syncGpx(GPXFile gpxFile) {
ItineraryHelper helper = getMyApplication().getItineraryHelper(); MapMarkersHelper helper = getMyApplication().getMapMarkersHelper();
ItineraryGroup group = helper.getMarkersGroup(gpxFile); MapMarkersGroup group = helper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
helper.runSynchronization(group); helper.runSynchronization(group);
} }
@ -1095,7 +1095,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
public void saveGpx(final String fileName) { public void saveGpx(final String fileName) {
new SaveGpxAsyncTask(app, getGpx(),fileName, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new SaveGpxAsyncTask(app, getGpx(),fileName, false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
hasUnsavedChanges = false; hasUnsavedChanges = false;
app.getItineraryHelper().addOrEnableGroup(getGpx()); app.getMapMarkersHelper().addOrEnableGroup(getGpx());
if (listener != null) { if (listener != null) {
listener.onPointsSaved(); listener.onPointsSaved();
} }

View file

@ -93,7 +93,7 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
ListView listView = (ListView) view.findViewById(android.R.id.list); ListView listView = (ListView) view.findViewById(android.R.id.list);
final ArrayAdapter<MapMarker> adapter = new MapMarkersListAdapter(); final ArrayAdapter<MapMarker> adapter = new MapMarkersListAdapter();
List<MapMarker> markers = getMyApplication().getItineraryHelper().getMapMarkers(); List<MapMarker> markers = getMyApplication().getMapMarkersHelper().getMapMarkers();
if (markers.size() > 0) { if (markers.size() > 0) {
for (MapMarker marker : markers) { for (MapMarker marker : markers) {
adapter.add(marker); adapter.add(marker);

View file

@ -67,7 +67,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
MapMarker marker = adapter.getItem(pos); MapMarker marker = adapter.getItem(pos);
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
if (app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { if (app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) {
app.getItineraryHelper().moveMarkerToTop(marker); app.getMapMarkersHelper().moveMarkerToTop(marker);
updateAdapter(); updateAdapter();
} else { } else {
FavouritePoint fav = marker.favouritePoint == null FavouritePoint fav = marker.favouritePoint == null
@ -114,7 +114,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
toPosition = holder.getAdapterPosition(); toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) { if (toPosition >= 0 && fromPosition >= 0 && toPosition != fromPosition) {
hideSnackbar(); hideSnackbar();
mapActivity.getMyApplication().getItineraryHelper().reorderActiveMarkersIfNeeded(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
} }

View file

@ -32,12 +32,12 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.fragments.CoordinateInputDialogFragment.OnPointsSavedListener; import net.osmand.plus.mapmarkers.fragments.CoordinateInputDialogFragment.OnPointsSavedListener;
import net.osmand.plus.mapmarkers.fragments.DirectionIndicationDialogFragment.DirectionIndicationFragmentListener; import net.osmand.plus.mapmarkers.fragments.DirectionIndicationDialogFragment.DirectionIndicationFragmentListener;
import net.osmand.plus.mapmarkers.ItineraryHelper.MapMarkersSortByDef; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkersSortByDef;
import net.osmand.plus.mapmarkers.ItineraryHelper.OnGroupSyncedListener; import net.osmand.plus.mapmarkers.MapMarkersHelper.OnGroupSyncedListener;
import net.osmand.plus.mapmarkers.bottomsheets.OptionsBottomSheetDialogFragment; import net.osmand.plus.mapmarkers.bottomsheets.OptionsBottomSheetDialogFragment;
import net.osmand.plus.mapmarkers.bottomsheets.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener; import net.osmand.plus.mapmarkers.bottomsheets.OptionsBottomSheetDialogFragment.MarkerOptionsFragmentListener;
import net.osmand.plus.mapmarkers.bottomsheets.OrderByBottomSheetDialogFragment; import net.osmand.plus.mapmarkers.bottomsheets.OrderByBottomSheetDialogFragment;
@ -223,13 +223,13 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
getMyApplication().getItineraryHelper().addSyncListener(this); getMyApplication().getMapMarkersHelper().addSyncListener(this);
} }
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
getMyApplication().getItineraryHelper().removeSyncListener(this); getMyApplication().getMapMarkersHelper().removeSyncListener(this);
} }
@Override @Override
@ -408,7 +408,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
@Override @Override
public void buildRouteOnClick() { public void buildRouteOnClick() {
if (mapActivity != null) { if (mapActivity != null) {
if (mapActivity.getMyApplication().getItineraryHelper().getMapMarkers().isEmpty()) { if (mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers().isEmpty()) {
Toast.makeText(mapActivity, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show(); Toast.makeText(mapActivity, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show();
} else { } else {
PlanRouteFragment.showInstance(mapActivity); PlanRouteFragment.showInstance(mapActivity);
@ -420,7 +420,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
@Override @Override
public void saveAsNewTrackOnClick() { public void saveAsNewTrackOnClick() {
if (mapActivity != null) { if (mapActivity != null) {
if (mapActivity.getMyApplication().getItineraryHelper().getMapMarkers().isEmpty()) { if (mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers().isEmpty()) {
Toast.makeText(mapActivity, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show(); Toast.makeText(mapActivity, getString(R.string.plan_route_no_markers_toast), Toast.LENGTH_SHORT).show();
} else { } else {
SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment(); SaveAsTrackBottomSheetDialogFragment fragment = new SaveAsTrackBottomSheetDialogFragment();
@ -433,7 +433,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
@Override @Override
public void moveAllToHistoryOnClick() { public void moveAllToHistoryOnClick() {
if (mapActivity != null) { if (mapActivity != null) {
final ItineraryHelper helper = mapActivity.getMyApplication().getItineraryHelper(); final MapMarkersHelper helper = mapActivity.getMyApplication().getMapMarkersHelper();
final List<MapMarker> markers = new ArrayList<>(helper.getMapMarkers()); final List<MapMarker> markers = new ArrayList<>(helper.getMapMarkers());
helper.moveAllActiveMarkersToHistory(); helper.moveAllActiveMarkersToHistory();
if (viewPager.getCurrentItem() == ACTIVE_MARKERS_POSITION) { if (viewPager.getCurrentItem() == ACTIVE_MARKERS_POSITION) {
@ -486,7 +486,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
@Override @Override
public void saveGpx(final String fileName) { public void saveGpx(final String fileName) {
final String gpxPath = mapActivity.getMyApplication().getItineraryHelper().getSaveHelper().saveMarkersToFile(fileName); final String gpxPath = mapActivity.getMyApplication().getMapMarkersHelper().getSaveHelper().saveMarkersToFile(fileName);
snackbar = Snackbar.make(viewPager, String.format(getString(R.string.shared_string_file_is_saved), fileName) + ".", Snackbar.LENGTH_LONG) 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() { .setAction(R.string.shared_string_show, new View.OnClickListener() {
@Override @Override
@ -511,7 +511,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
boolean useCenter = !(mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation() && location != null); boolean useCenter = !(mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation() && location != null);
LatLon loc = useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude()); LatLon loc = useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude());
app.getItineraryHelper().sortMarkers(sortByMode, loc); app.getMapMarkersHelper().sortMarkers(sortByMode, loc);
activeFragment.updateAdapter(); activeFragment.updateAdapter();
} }
}; };

View file

@ -195,10 +195,10 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final MapMarker marker = (MapMarker) item; final MapMarker marker = (MapMarker) item;
int snackbarStringRes; int snackbarStringRes;
if (direction == ItemTouchHelper.RIGHT) { if (direction == ItemTouchHelper.RIGHT) {
app.getItineraryHelper().moveMapMarkerToHistory((MapMarker) item); app.getMapMarkersHelper().moveMapMarkerToHistory((MapMarker) item);
snackbarStringRes = R.string.marker_moved_to_history; snackbarStringRes = R.string.marker_moved_to_history;
} else { } else {
app.getItineraryHelper().removeMarker((MapMarker) item); app.getMapMarkersHelper().removeMarker((MapMarker) item);
snackbarStringRes = R.string.item_removed; snackbarStringRes = R.string.item_removed;
} }
updateAdapter(); updateAdapter();
@ -207,9 +207,9 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (direction == ItemTouchHelper.RIGHT) { if (direction == ItemTouchHelper.RIGHT) {
app.getItineraryHelper().restoreMarkerFromHistory(marker, 0); app.getMapMarkersHelper().restoreMarkerFromHistory(marker, 0);
} else { } else {
app.getItineraryHelper().addMarker(marker); app.getMapMarkersHelper().addMarker(marker);
} }
updateAdapter(); updateAdapter();
} }
@ -236,7 +236,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
if (!marker.history) { if (!marker.history) {
if (app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { if (app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) {
app.getItineraryHelper().moveMarkerToTop(marker); app.getMapMarkersHelper().moveMarkerToTop(marker);
updateAdapter(); updateAdapter();
} else { } else {
FavouritePoint fav = marker.favouritePoint == null FavouritePoint fav = marker.favouritePoint == null
@ -344,7 +344,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
Object item = adapter.getItem(pos); Object item = adapter.getItem(pos);
if (item instanceof MapMarker) { if (item instanceof MapMarker) {
if (getMyApplication() != null) { if (getMyApplication() != null) {
getMyApplication().getItineraryHelper().restoreMarkerFromHistory((MapMarker) item, 0); getMyApplication().getMapMarkersHelper().restoreMarkerFromHistory((MapMarker) item, 0);
} }
updateAdapter(); updateAdapter();
} }
@ -355,7 +355,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
Object item = adapter.getItem(pos); Object item = adapter.getItem(pos);
if (item instanceof MapMarker) { if (item instanceof MapMarker) {
if (getMyApplication() != null) { if (getMyApplication() != null) {
getMyApplication().getItineraryHelper().removeMarker((MapMarker) item); getMyApplication().getMapMarkersHelper().removeMarker((MapMarker) item);
} }
updateAdapter(); updateAdapter();
} }

View file

@ -24,7 +24,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapmarkers.ItineraryHelper.MapMarkerChangedListener; import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.adapters.MapMarkerHeaderViewHolder; import net.osmand.plus.mapmarkers.adapters.MapMarkerHeaderViewHolder;
import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder; import net.osmand.plus.mapmarkers.adapters.MapMarkerItemViewHolder;
@ -152,10 +152,10 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkerChan
final MapMarker marker = (MapMarker) item; final MapMarker marker = (MapMarker) item;
int snackbarStringRes; int snackbarStringRes;
if (direction == ItemTouchHelper.LEFT) { if (direction == ItemTouchHelper.LEFT) {
app.getItineraryHelper().restoreMarkerFromHistory((MapMarker) item, 0); app.getMapMarkersHelper().restoreMarkerFromHistory((MapMarker) item, 0);
snackbarStringRes = R.string.marker_moved_to_active; snackbarStringRes = R.string.marker_moved_to_active;
} else { } else {
app.getItineraryHelper().removeMarker((MapMarker) item); app.getMapMarkersHelper().removeMarker((MapMarker) item);
snackbarStringRes = R.string.item_removed; snackbarStringRes = R.string.item_removed;
} }
snackbar = Snackbar.make(viewHolder.itemView, snackbarStringRes, Snackbar.LENGTH_LONG) snackbar = Snackbar.make(viewHolder.itemView, snackbarStringRes, Snackbar.LENGTH_LONG)
@ -163,9 +163,9 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkerChan
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (direction == ItemTouchHelper.LEFT) { if (direction == ItemTouchHelper.LEFT) {
app.getItineraryHelper().moveMapMarkerToHistory(marker); app.getMapMarkersHelper().moveMapMarkerToHistory(marker);
} else { } else {
app.getItineraryHelper().addMarker(marker); app.getMapMarkersHelper().addMarker(marker);
} }
} }
}); });
@ -211,7 +211,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkerChan
recyclerView.setEmptyView(emptyView); recyclerView.setEmptyView(emptyView);
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
app.getItineraryHelper().addListener(this); app.getMapMarkersHelper().addListener(this);
return mainView; return mainView;
} }
@ -231,7 +231,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkerChan
public void onMakeMarkerActive(int pos) { public void onMakeMarkerActive(int pos) {
Object item = adapter.getItem(pos); Object item = adapter.getItem(pos);
if (item instanceof MapMarker) { if (item instanceof MapMarker) {
app.getItineraryHelper().restoreMarkerFromHistory((MapMarker) item, 0); app.getMapMarkersHelper().restoreMarkerFromHistory((MapMarker) item, 0);
} }
} }
@ -239,7 +239,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkerChan
public void onDeleteMarker(int pos) { public void onDeleteMarker(int pos) {
Object item = adapter.getItem(pos); Object item = adapter.getItem(pos);
if (item instanceof MapMarker) { if (item instanceof MapMarker) {
app.getItineraryHelper().removeMarker((MapMarker) item); app.getMapMarkersHelper().removeMarker((MapMarker) item);
} }
} }
}; };
@ -247,7 +247,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkerChan
@Override @Override
public void onDestroy() { public void onDestroy() {
app.getItineraryHelper().removeListener(this); app.getMapMarkersHelper().removeListener(this);
super.onDestroy(); super.onDestroy();
} }

View file

@ -48,7 +48,7 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment; import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.MarkersPlanRouteContext; import net.osmand.plus.mapmarkers.MarkersPlanRouteContext;
import net.osmand.plus.mapmarkers.bottomsheets.PlanRouteOptionsBottomSheetDialogFragment; import net.osmand.plus.mapmarkers.bottomsheets.PlanRouteOptionsBottomSheetDialogFragment;
@ -77,7 +77,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
public static final String TAG = "PlanRouteFragment"; public static final String TAG = "PlanRouteFragment";
private static final int MIN_DISTANCE_FOR_RECALCULATE = 50; // in meters private static final int MIN_DISTANCE_FOR_RECALCULATE = 50; // in meters
private ItineraryHelper markersHelper; private MapMarkersHelper markersHelper;
private MarkersPlanRouteContext planRouteContext; private MarkersPlanRouteContext planRouteContext;
private MapMarkersListAdapter adapter; private MapMarkersListAdapter adapter;
@ -116,7 +116,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final MapActivity mapActivity = getMapActivity(); final MapActivity mapActivity = getMapActivity();
markersHelper = mapActivity.getMyApplication().getItineraryHelper(); markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
planRouteContext = markersHelper.getPlanRouteContext(); planRouteContext = markersHelper.getPlanRouteContext();
planRouteContext.setListener(new MarkersPlanRouteContext.PlanRouteProgressListener() { planRouteContext.setListener(new MarkersPlanRouteContext.PlanRouteProgressListener() {
@Override @Override
@ -351,7 +351,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
public void onDragEnded(RecyclerView.ViewHolder holder) { public void onDragEnded(RecyclerView.ViewHolder holder) {
toPosition = holder.getAdapterPosition(); toPosition = holder.getAdapterPosition();
if (toPosition >= 0 && fromPosition >= 0) { if (toPosition >= 0 && fromPosition >= 0) {
mapActivity.getMyApplication().getItineraryHelper().reorderActiveMarkersIfNeeded(); mapActivity.getMyApplication().getMapMarkersHelper().reorderActiveMarkersIfNeeded();
mapActivity.refreshMap(); mapActivity.refreshMap();
adapter.reloadData(); adapter.reloadData();
try { try {
@ -572,7 +572,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
if (mapActivity != null) { if (mapActivity != null) {
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
Location myLoc = app.getLocationProvider().getLastStaleKnownLocation(); Location myLoc = app.getLocationProvider().getLastStaleKnownLocation();
boolean startFromLocation = app.getItineraryHelper().isStartFromMyLocation() && myLoc != null; boolean startFromLocation = app.getMapMarkersHelper().isStartFromMyLocation() && myLoc != null;
if (selectedCount > (startFromLocation ? 0 : 1)) { if (selectedCount > (startFromLocation ? 0 : 1)) {
sortSelectedMarkersDoorToDoor(mapActivity, startFromLocation, myLoc); sortSelectedMarkersDoorToDoor(mapActivity, startFromLocation, myLoc);
} }
@ -668,7 +668,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
previousMapPosition = tileView.getMapPosition(); previousMapPosition = tileView.getMapPosition();
tileView.setMapPosition(portrait ? MIDDLE_TOP_CONSTANT : LANDSCAPE_MIDDLE_RIGHT_CONSTANT); tileView.setMapPosition(portrait ? MIDDLE_TOP_CONSTANT : LANDSCAPE_MIDDLE_RIGHT_CONSTANT);
selectedCount = mapActivity.getMyApplication().getItineraryHelper().getSelectedMarkersCount(); selectedCount = mapActivity.getMyApplication().getMapMarkersHelper().getSelectedMarkersCount();
planRouteContext.recreateSnapTrkSegment(planRouteContext.isAdjustMapOnStart()); planRouteContext.recreateSnapTrkSegment(planRouteContext.isAdjustMapOnStart());
planRouteContext.setAdjustMapOnStart(true); planRouteContext.setAdjustMapOnStart(true);
mapActivity.refreshMap(); mapActivity.refreshMap();
@ -825,7 +825,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
double left = 0, right = 0; double left = 0, right = 0;
double top = 0, bottom = 0; double top = 0, bottom = 0;
Location myLocation = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation(); Location myLocation = mapActivity.getMyApplication().getLocationProvider().getLastStaleKnownLocation();
if (mapActivity.getMyApplication().getItineraryHelper().isStartFromMyLocation() && myLocation != null) { if (mapActivity.getMyApplication().getMapMarkersHelper().isStartFromMyLocation() && myLocation != null) {
left = myLocation.getLongitude(); left = myLocation.getLongitude();
right = myLocation.getLongitude(); right = myLocation.getLongitude();
top = myLocation.getLatitude(); top = myLocation.getLatitude();
@ -879,7 +879,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
public static boolean showInstance(MapActivity mapActivity) { public static boolean showInstance(MapActivity mapActivity) {
try { try {
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
boolean fullscreen = portrait && mapActivity.getMyApplication().getItineraryHelper().getPlanRouteContext().isMarkersListOpened(); boolean fullscreen = portrait && mapActivity.getMyApplication().getMapMarkersHelper().getPlanRouteContext().isMarkersListOpened();
int containerRes = portrait ? (fullscreen ? R.id.fragmentContainer : R.id.bottomFragmentContainer) : R.id.topFragmentContainer; int containerRes = portrait ? (fullscreen ? R.id.fragmentContainer : R.id.bottomFragmentContainer) : R.id.topFragmentContainer;
FragmentManager fm = mapActivity.getSupportFragmentManager(); FragmentManager fm = mapActivity.getSupportFragmentManager();
fm.beginTransaction() fm.beginTransaction()
@ -909,7 +909,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
@Override @Override
protected List<MapMarker> doInBackground(Void... voids) { protected List<MapMarker> doInBackground(Void... voids) {
ItineraryHelper markersHelper = mapActivity.getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
List<MapMarker> selectedMarkers = markersHelper.getSelectedMarkers(); List<MapMarker> selectedMarkers = markersHelper.getSelectedMarkers();
List<LatLon> selectedLatLon = markersHelper.getSelectedMarkersLatLon(); List<LatLon> selectedLatLon = markersHelper.getSelectedMarkersLatLon();
@ -945,7 +945,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
} }
} }
mapActivity.getMyApplication().getItineraryHelper().addSelectedMarkersToTop(res); mapActivity.getMyApplication().getMapMarkersHelper().addSelectedMarkersToTop(res);
adapter.reloadData(); adapter.reloadData();
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
planRouteContext.recreateSnapTrkSegment(false); planRouteContext.recreateSnapTrkSegment(false);

View file

@ -8,8 +8,8 @@ import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItemType;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import java.io.File; import java.io.File;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -65,8 +65,8 @@ public class DeletePointsTask extends AsyncTask<Void, Void, Void> {
} }
private void syncGpx(GPXFile gpxFile) { private void syncGpx(GPXFile gpxFile) {
ItineraryHelper helper = app.getItineraryHelper(); MapMarkersHelper helper = app.getMapMarkersHelper();
ItineraryGroup group = helper.getMarkersGroup(gpxFile); MapMarkersGroup group = helper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
helper.runSynchronization(group); helper.runSynchronization(group);
} }

View file

@ -49,8 +49,8 @@ import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.measurementtool.OptionsDividerItem; import net.osmand.plus.measurementtool.OptionsDividerItem;
import net.osmand.plus.myplaces.DeletePointsTask.OnPointsDeleteListener; import net.osmand.plus.myplaces.DeletePointsTask.OnPointsDeleteListener;
import net.osmand.plus.settings.backend.ApplicationMode; import net.osmand.plus.settings.backend.ApplicationMode;
@ -72,7 +72,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
private OsmandApplication app; private OsmandApplication app;
private GpxSelectionHelper selectedGpxHelper; private GpxSelectionHelper selectedGpxHelper;
private ItineraryHelper itineraryHelper; private MapMarkersHelper mapMarkersHelper;
private GpxDisplayGroup group; private GpxDisplayGroup group;
@ -83,7 +83,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
} }
app = requiredMyApplication(); app = requiredMyApplication();
selectedGpxHelper = app.getSelectedGpxHelper(); selectedGpxHelper = app.getSelectedGpxHelper();
itineraryHelper = app.getItineraryHelper(); mapMarkersHelper = app.getMapMarkersHelper();
items.add(new TitleItem(getCategoryName(app, group.getName()))); items.add(new TitleItem(getCategoryName(app, group.getName())));
GPXFile gpxFile = group.getGpx(); GPXFile gpxFile = group.getGpx();
@ -192,7 +192,7 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
} }
private BaseBottomSheetItem createCopyToMarkersItem(final GPXFile gpxFile) { private BaseBottomSheetItem createCopyToMarkersItem(final GPXFile gpxFile) {
ItineraryGroup markersGroup = itineraryHelper.getMarkersGroup(gpxFile); MapMarkersGroup markersGroup = mapMarkersHelper.getMarkersGroup(gpxFile);
final boolean synced = markersGroup != null && (Algorithms.isEmpty(markersGroup.getWptCategories()) final boolean synced = markersGroup != null && (Algorithms.isEmpty(markersGroup.getWptCategories())
|| markersGroup.getWptCategories().contains(group.getName())); || markersGroup.getWptCategories().contains(group.getName()));
@ -216,10 +216,10 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
selectedGpxHelper.selectGpxFile(gpxFile, true, false, false, false, false); selectedGpxHelper.selectGpxFile(gpxFile, true, false, false, false, false);
} }
boolean groupCreated = false; boolean groupCreated = false;
ItineraryGroup markersGroup = itineraryHelper.getMarkersGroup(gpxFile); MapMarkersGroup markersGroup = mapMarkersHelper.getMarkersGroup(gpxFile);
if (markersGroup == null) { if (markersGroup == null) {
groupCreated = true; groupCreated = true;
markersGroup = itineraryHelper.addOrEnableGroup(gpxFile); markersGroup = mapMarkersHelper.addOrEnableGroup(gpxFile);
} }
Set<String> categories = markersGroup.getWptCategories(); Set<String> categories = markersGroup.getWptCategories();
Set<String> selectedCategories = new HashSet<>(); Set<String> selectedCategories = new HashSet<>();
@ -232,11 +232,11 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
selectedCategories.add(group.getName()); selectedCategories.add(group.getName());
} }
if (Algorithms.isEmpty(selectedCategories)) { if (Algorithms.isEmpty(selectedCategories)) {
itineraryHelper.removeMarkersGroup(markersGroup); mapMarkersHelper.removeMarkersGroup(markersGroup);
} else { } else {
itineraryHelper.updateGroupWptCategories(markersGroup, selectedCategories); mapMarkersHelper.updateGroupWptCategories(markersGroup, selectedCategories);
if (!groupCreated) { if (!groupCreated) {
itineraryHelper.runSynchronization(markersGroup); mapMarkersHelper.runSynchronization(markersGroup);
} }
} }
} }
@ -524,8 +524,8 @@ public class EditTrackGroupDialogFragment extends MenuBottomSheetDialogFragment
} }
private void syncGpx(GPXFile gpxFile) { private void syncGpx(GPXFile gpxFile) {
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
ItineraryGroup group = markersHelper.getMarkersGroup(gpxFile); MapMarkersGroup group = markersHelper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
markersHelper.runSynchronization(group); markersHelper.runSynchronization(group);
} }

View file

@ -63,8 +63,8 @@ import net.osmand.plus.base.OsmandExpandableListFragment;
import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.base.PointImageDrawable;
import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.mapmarkers.fragments.CoordinateInputDialogFragment; import net.osmand.plus.mapmarkers.fragments.CoordinateInputDialogFragment;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.myplaces.DeletePointsTask.OnPointsDeleteListener; import net.osmand.plus.myplaces.DeletePointsTask.OnPointsDeleteListener;
import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener; import net.osmand.plus.myplaces.TrackBitmapDrawer.TrackBitmapDrawerListener;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
@ -399,7 +399,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER, true); createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER, true);
GPXFile gpxFile = getGpx(); GPXFile gpxFile = getGpx();
if (gpxFile != null && gpxFile.path != null) { if (gpxFile != null && gpxFile.path != null) {
final ItineraryHelper markersHelper = app.getItineraryHelper(); final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
final boolean synced = markersHelper.getMarkersGroup(getGpx()) != null; final boolean synced = markersHelper.getMarkersGroup(getGpx()) != null;
createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers createMenuItem(menu, SELECT_MAP_MARKERS_ID, synced ? R.string.remove_from_map_markers
: R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag, MenuItem.SHOW_AS_ACTION_NEVER); : R.string.shared_string_add_to_map_markers, R.drawable.ic_action_flag, MenuItem.SHOW_AS_ACTION_NEVER);
@ -494,15 +494,15 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
} }
private void addOrRemoveMapMarkersSyncGroup() { private void addOrRemoveMapMarkersSyncGroup() {
final ItineraryHelper markersHelper = app.getItineraryHelper(); final MapMarkersHelper markersHelper = app.getMapMarkersHelper();
FragmentActivity activity = getActivity(); FragmentActivity activity = getActivity();
if (activity == null) { if (activity == null) {
return; return;
} }
final GPXFile gpxFile = getGpx(); final GPXFile gpxFile = getGpx();
ItineraryGroup markersSearch = markersHelper.getMarkersGroup(gpxFile); MapMarkersGroup markersSearch = markersHelper.getMarkersGroup(gpxFile);
final ItineraryGroup markersGr; final MapMarkersGroup markersGr;
final boolean markersRemoved; final boolean markersRemoved;
if (markersSearch != null) { if (markersSearch != null) {
markersGr = markersSearch; markersGr = markersSearch;
@ -538,7 +538,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
markersHelper.addOrEnableGroup(gpxFile); markersHelper.addOrEnableGroup(gpxFile);
} }
} else { } else {
ItineraryGroup group = markersHelper.getMarkersGroup(gpxFile); MapMarkersGroup group = markersHelper.getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
markersHelper.removeMarkersGroup(group); markersHelper.removeMarkersGroup(group);
} }

View file

@ -45,7 +45,7 @@ import net.osmand.plus.helpers.MapMarkerDialogHelper;
import net.osmand.plus.helpers.WaypointDialogHelper; import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.mapcontextmenu.other.FavouritesBottomSheetMenuFragment; import net.osmand.plus.mapcontextmenu.other.FavouritesBottomSheetMenuFragment;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
import net.osmand.plus.search.QuickSearchDialogFragment; import net.osmand.plus.search.QuickSearchDialogFragment;
import net.osmand.plus.widgets.style.CustomTypefaceSpan; import net.osmand.plus.widgets.style.CustomTypefaceSpan;
@ -306,7 +306,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
List<Object> items = new ArrayList<>(); List<Object> items = new ArrayList<>();
MarkersItemsAdapter adapter = new MarkersItemsAdapter(app, items); MarkersItemsAdapter adapter = new MarkersItemsAdapter(app, items);
adapter.setItemClickListener(getAdapterOnClickListener(items)); adapter.setItemClickListener(getAdapterOnClickListener(items));
ItineraryHelper helper = app.getItineraryHelper(); MapMarkersHelper helper = app.getMapMarkersHelper();
items.add(MARKERS); items.add(MARKERS);
items.addAll(helper.getMapMarkers()); items.addAll(helper.getMapMarkers());
BaseBottomSheetItem scrollItem = new HorizontalRecyclerBottomSheetItem.Builder() BaseBottomSheetItem scrollItem = new HorizontalRecyclerBottomSheetItem.Builder()

View file

@ -715,7 +715,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
} }
// Map markers card // Map markers card
List<MapMarker> mapMarkers = app.getItineraryHelper().getMapMarkers(); List<MapMarker> mapMarkers = app.getMapMarkersHelper().getMapMarkers();
if (mapMarkers.size() > 0) { if (mapMarkers.size() > 0) {
MapMarkersCard mapMarkersCard = new MapMarkersCard(mapActivity, mapMarkers); MapMarkersCard mapMarkersCard = new MapMarkersCard(mapActivity, mapMarkers);
menuCards.add(mapMarkersCard); menuCards.add(mapMarkersCard);
@ -2054,7 +2054,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
MapMarker m = null; MapMarker m = null;
List<MapMarker> mapMarkers = mapActivity.getMyApplication().getItineraryHelper().getMapMarkers(); List<MapMarker> mapMarkers = mapActivity.getMyApplication().getMapMarkersHelper().getMapMarkers();
if (index != -1 && mapMarkers.size() > index) { if (index != -1 && mapMarkers.size() > index) {
m = mapMarkers.get(index); m = mapMarkers.get(index);
} }

View file

@ -13,8 +13,8 @@ import net.osmand.plus.R;
import net.osmand.plus.mapmarkers.ItineraryType; import net.osmand.plus.mapmarkers.ItineraryType;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -29,7 +29,7 @@ import static net.osmand.IndexConstants.GPX_FILE_EXT;
public class HistoryMarkersSettingsItem extends CollectionSettingsItem<MapMarker> { public class HistoryMarkersSettingsItem extends CollectionSettingsItem<MapMarker> {
private ItineraryHelper markersHelper; private MapMarkersHelper markersHelper;
public HistoryMarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List<MapMarker> items) { public HistoryMarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List<MapMarker> items) {
super(app, null, items); super(app, null, items);
@ -46,7 +46,7 @@ public class HistoryMarkersSettingsItem extends CollectionSettingsItem<MapMarker
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
markersHelper = app.getItineraryHelper(); markersHelper = app.getMapMarkersHelper();
existingItems = new ArrayList<>(markersHelper.getMapMarkersFromDefaultGroups(true)); existingItems = new ArrayList<>(markersHelper.getMapMarkersFromDefaultGroups(true));
} }
@ -123,10 +123,10 @@ public class HistoryMarkersSettingsItem extends CollectionSettingsItem<MapMarker
} }
} }
public ItineraryGroup getMarkersGroup() { public MapMarkersGroup getMarkersGroup() {
String name = app.getString(R.string.markers_history); String name = app.getString(R.string.markers_history);
String groupId = ExportSettingsType.HISTORY_MARKERS.name(); String groupId = ExportSettingsType.HISTORY_MARKERS.name();
ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryType.MARKERS); MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, ItineraryType.MARKERS);
markersGroup.setMarkers(items); markersGroup.setMarkers(items);
return markersGroup; return markersGroup;
} }

View file

@ -13,8 +13,8 @@ import net.osmand.plus.R;
import net.osmand.plus.mapmarkers.ItineraryType; import net.osmand.plus.mapmarkers.ItineraryType;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.MapMarkersDbHelper; import net.osmand.plus.mapmarkers.MapMarkersDbHelper;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -29,7 +29,7 @@ import static net.osmand.IndexConstants.GPX_FILE_EXT;
public class MarkersSettingsItem extends CollectionSettingsItem<MapMarker> { public class MarkersSettingsItem extends CollectionSettingsItem<MapMarker> {
private ItineraryHelper markersHelper; private MapMarkersHelper markersHelper;
public MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List<MapMarker> items) { public MarkersSettingsItem(@NonNull OsmandApplication app, @NonNull List<MapMarker> items) {
super(app, null, items); super(app, null, items);
@ -46,7 +46,7 @@ public class MarkersSettingsItem extends CollectionSettingsItem<MapMarker> {
@Override @Override
protected void init() { protected void init() {
super.init(); super.init();
markersHelper = app.getItineraryHelper(); markersHelper = app.getMapMarkersHelper();
existingItems = new ArrayList<>(markersHelper.getMapMarkersFromDefaultGroups(false)); existingItems = new ArrayList<>(markersHelper.getMapMarkersFromDefaultGroups(false));
} }
@ -123,10 +123,10 @@ public class MarkersSettingsItem extends CollectionSettingsItem<MapMarker> {
} }
} }
public ItineraryGroup getMarkersGroup() { public MapMarkersGroup getMarkersGroup() {
String name = app.getString(R.string.map_markers); String name = app.getString(R.string.map_markers);
String groupId = ExportSettingsType.ACTIVE_MARKERS.name(); String groupId = ExportSettingsType.ACTIVE_MARKERS.name();
ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryType.MARKERS); MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, ItineraryType.MARKERS);
markersGroup.setMarkers(items); markersGroup.setMarkers(items);
return markersGroup; return markersGroup;
} }

View file

@ -32,7 +32,7 @@ import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo; import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
import net.osmand.plus.helpers.SearchHistoryHelper; import net.osmand.plus.helpers.SearchHistoryHelper;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryType; import net.osmand.plus.mapmarkers.ItineraryType;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine; import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine;
@ -606,19 +606,19 @@ public class SettingsHelper {
myPlacesItems.put(ExportSettingsType.MULTIMEDIA_NOTES, files); myPlacesItems.put(ExportSettingsType.MULTIMEDIA_NOTES, files);
} }
} }
List<MapMarker> mapMarkers = app.getItineraryHelper().getMapMarkersFromDefaultGroups(false); List<MapMarker> mapMarkers = app.getMapMarkersHelper().getMapMarkersFromDefaultGroups(false);
if (!mapMarkers.isEmpty()) { if (!mapMarkers.isEmpty()) {
String name = app.getString(R.string.map_markers); String name = app.getString(R.string.map_markers);
String groupId = ExportSettingsType.ACTIVE_MARKERS.name(); String groupId = ExportSettingsType.ACTIVE_MARKERS.name();
ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryType.MARKERS); MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, ItineraryType.MARKERS);
markersGroup.setMarkers(mapMarkers); markersGroup.setMarkers(mapMarkers);
myPlacesItems.put(ExportSettingsType.ACTIVE_MARKERS, Collections.singletonList(markersGroup)); myPlacesItems.put(ExportSettingsType.ACTIVE_MARKERS, Collections.singletonList(markersGroup));
} }
List<MapMarker> markersHistory = app.getItineraryHelper().getMapMarkersFromDefaultGroups(true); List<MapMarker> markersHistory = app.getMapMarkersHelper().getMapMarkersFromDefaultGroups(true);
if (!markersHistory.isEmpty()) { if (!markersHistory.isEmpty()) {
String name = app.getString(R.string.shared_string_history); String name = app.getString(R.string.shared_string_history);
String groupId = ExportSettingsType.HISTORY_MARKERS.name(); String groupId = ExportSettingsType.HISTORY_MARKERS.name();
ItineraryGroup markersGroup = new ItineraryGroup(groupId, name, ItineraryType.MARKERS); MapMarkersGroup markersGroup = new MapMarkersGroup(groupId, name, ItineraryType.MARKERS);
markersGroup.setMarkers(markersHistory); markersGroup.setMarkers(markersHistory);
myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup)); myPlacesItems.put(ExportSettingsType.HISTORY_MARKERS, Collections.singletonList(markersGroup));
} }
@ -721,8 +721,8 @@ public class SettingsHelper {
List<FavoriteGroup> favoriteGroups = new ArrayList<>(); List<FavoriteGroup> favoriteGroups = new ArrayList<>();
List<OsmNotesPoint> osmNotesPointList = new ArrayList<>(); List<OsmNotesPoint> osmNotesPointList = new ArrayList<>();
List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>(); List<OpenstreetmapPoint> osmEditsPointList = new ArrayList<>();
List<ItineraryGroup> markersGroups = new ArrayList<>(); List<MapMarkersGroup> markersGroups = new ArrayList<>();
List<ItineraryGroup> markersHistoryGroups = new ArrayList<>(); List<MapMarkersGroup> markersHistoryGroups = new ArrayList<>();
List<HistoryEntry> historyEntries = new ArrayList<>(); List<HistoryEntry> historyEntries = new ArrayList<>();
List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>(); List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>();
@ -756,12 +756,12 @@ public class SettingsHelper {
osmEditsPointList.add((OpenstreetmapPoint) object); osmEditsPointList.add((OpenstreetmapPoint) object);
} else if (object instanceof FavoriteGroup) { } else if (object instanceof FavoriteGroup) {
favoriteGroups.add((FavoriteGroup) object); favoriteGroups.add((FavoriteGroup) object);
} else if (object instanceof ItineraryGroup) { } else if (object instanceof MapMarkersGroup) {
ItineraryGroup markersGroup = (ItineraryGroup) object; MapMarkersGroup markersGroup = (MapMarkersGroup) object;
if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) { if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
markersGroups.add((ItineraryGroup) object); markersGroups.add((MapMarkersGroup) object);
} else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) { } else if (ExportSettingsType.HISTORY_MARKERS.name().equals(markersGroup.getId())) {
markersHistoryGroups.add((ItineraryGroup) object); markersHistoryGroups.add((MapMarkersGroup) object);
} }
} else if (object instanceof HistoryEntry) { } else if (object instanceof HistoryEntry) {
historyEntries.add((HistoryEntry) object); historyEntries.add((HistoryEntry) object);
@ -813,7 +813,7 @@ public class SettingsHelper {
} }
if (!markersGroups.isEmpty()) { if (!markersGroups.isEmpty()) {
List<MapMarker> mapMarkers = new ArrayList<>(); List<MapMarker> mapMarkers = new ArrayList<>();
for (ItineraryGroup group : markersGroups) { for (MapMarkersGroup group : markersGroups) {
mapMarkers.addAll(group.getMarkers()); mapMarkers.addAll(group.getMarkers());
} }
MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class, settingsItems); MarkersSettingsItem baseItem = getBaseItem(SettingsItemType.ACTIVE_MARKERS, MarkersSettingsItem.class, settingsItems);
@ -821,7 +821,7 @@ public class SettingsHelper {
} }
if (!markersHistoryGroups.isEmpty()) { if (!markersHistoryGroups.isEmpty()) {
List<MapMarker> mapMarkers = new ArrayList<>(); List<MapMarker> mapMarkers = new ArrayList<>();
for (ItineraryGroup group : markersHistoryGroups) { for (MapMarkersGroup group : markersHistoryGroups) {
mapMarkers.addAll(group.getMarkers()); mapMarkers.addAll(group.getMarkers());
} }
HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class, settingsItems); HistoryMarkersSettingsItem baseItem = getBaseItem(SettingsItemType.HISTORY_MARKERS, HistoryMarkersSettingsItem.class, settingsItems);
@ -911,8 +911,8 @@ public class SettingsHelper {
List<OsmNotesPoint> notesPointList = new ArrayList<>(); List<OsmNotesPoint> notesPointList = new ArrayList<>();
List<OpenstreetmapPoint> editsPointList = new ArrayList<>(); List<OpenstreetmapPoint> editsPointList = new ArrayList<>();
List<FavoriteGroup> favoriteGroups = new ArrayList<>(); List<FavoriteGroup> favoriteGroups = new ArrayList<>();
List<ItineraryGroup> markersGroups = new ArrayList<>(); List<MapMarkersGroup> markersGroups = new ArrayList<>();
List<ItineraryGroup> markersHistoryGroups = new ArrayList<>(); List<MapMarkersGroup> markersHistoryGroups = new ArrayList<>();
List<HistoryEntry> historyEntries = new ArrayList<>(); List<HistoryEntry> historyEntries = new ArrayList<>();
List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>(); List<OnlineRoutingEngine> onlineRoutingEngines = new ArrayList<>();

View file

@ -41,7 +41,7 @@ import net.osmand.plus.helpers.AvoidSpecificRoads.AvoidRoadInfo;
import net.osmand.plus.helpers.FileNameTranslationHelper; import net.osmand.plus.helpers.FileNameTranslationHelper;
import net.osmand.plus.helpers.GpxUiHelper; import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry; import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine; import net.osmand.plus.onlinerouting.engine.OnlineRoutingEngine;
import net.osmand.plus.osmedit.OpenstreetmapPoint; import net.osmand.plus.osmedit.OpenstreetmapPoint;
import net.osmand.plus.osmedit.OsmEditingPlugin; import net.osmand.plus.osmedit.OsmEditingPlugin;
@ -377,8 +377,8 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
GlobalSettingsItem globalSettingsItem = (GlobalSettingsItem) object; GlobalSettingsItem globalSettingsItem = (GlobalSettingsItem) object;
item.setTitle(globalSettingsItem.getPublicName(app)); item.setTitle(globalSettingsItem.getPublicName(app));
item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_settings, getItemIconColor(object))); item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_settings, getItemIconColor(object)));
} else if (object instanceof ItineraryGroup) { } else if (object instanceof MapMarkersGroup) {
ItineraryGroup markersGroup = (ItineraryGroup) object; MapMarkersGroup markersGroup = (MapMarkersGroup) object;
if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) { if (ExportSettingsType.ACTIVE_MARKERS.name().equals(markersGroup.getId())) {
item.setTitle(getString(R.string.map_markers)); item.setTitle(getString(R.string.map_markers));
item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, getItemIconColor(object))); item.setIcon(uiUtilities.getIcon(R.drawable.ic_action_flag, getItemIconColor(object)));

View file

@ -18,7 +18,7 @@ import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.FontCache; import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.settings.backend.ExportSettingsCategory; import net.osmand.plus.settings.backend.ExportSettingsCategory;
import net.osmand.plus.settings.backend.ExportSettingsType; import net.osmand.plus.settings.backend.ExportSettingsType;
import net.osmand.plus.settings.backend.backup.FileSettingsItem; import net.osmand.plus.settings.backend.backup.FileSettingsItem;
@ -311,8 +311,8 @@ public class ExportSettingsAdapter extends OsmandBaseExpandableListAdapter {
itemsSize += ((FileSettingsItem) object).getSize(); itemsSize += ((FileSettingsItem) object).getSize();
} else if (object instanceof File) { } else if (object instanceof File) {
itemsSize += ((File) object).length(); itemsSize += ((File) object).length();
} else if (object instanceof ItineraryGroup) { } else if (object instanceof MapMarkersGroup) {
int selectedMarkers = ((ItineraryGroup) object).getMarkers().size(); int selectedMarkers = ((MapMarkersGroup) object).getMarkers().size();
String itemsDescr = app.getString(R.string.shared_string_items); String itemsDescr = app.getString(R.string.shared_string_items);
return app.getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers); return app.getString(R.string.ltr_or_rtl_combine_via_colon, itemsDescr, selectedMarkers);
} }

View file

@ -20,7 +20,7 @@ import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.base.PointImageDrawable; import net.osmand.plus.base.PointImageDrawable;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.settings.backend.OsmandSettings; import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.OsmandMapLayer; import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.OsmandMapTileView;
@ -39,7 +39,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
protected OsmandMapTileView view; protected OsmandMapTileView view;
private FavouritesDbHelper favouritesDbHelper; private FavouritesDbHelper favouritesDbHelper;
private ItineraryHelper itineraryHelper; private MapMarkersHelper mapMarkersHelper;
protected List<FavouritePoint> cache = new ArrayList<>(); protected List<FavouritePoint> cache = new ArrayList<>();
private MapTextLayer textLayer; private MapTextLayer textLayer;
@ColorInt @ColorInt
@ -57,7 +57,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
this.view = view; this.view = view;
settings = view.getApplication().getSettings(); settings = view.getApplication().getSettings();
favouritesDbHelper = view.getApplication().getFavorites(); favouritesDbHelper = view.getApplication().getFavorites();
itineraryHelper = view.getApplication().getItineraryHelper(); mapMarkersHelper = view.getApplication().getMapMarkersHelper();
textLayer = view.getLayerByClass(MapTextLayer.class); textLayer = view.getLayerByClass(MapTextLayer.class);
defaultColor = ContextCompat.getColor(view.getContext(), R.color.color_favorite); defaultColor = ContextCompat.getColor(view.getContext(), R.color.color_favorite);
grayColor = ContextCompat.getColor(view.getContext(), R.color.color_favorite_gray); grayColor = ContextCompat.getColor(view.getContext(), R.color.color_favorite_gray);
@ -85,7 +85,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
if (contextMenuLayer.getMoveableObject() instanceof FavouritePoint) { if (contextMenuLayer.getMoveableObject() instanceof FavouritePoint) {
FavouritePoint objectInMotion = (FavouritePoint) contextMenuLayer.getMoveableObject(); FavouritePoint objectInMotion = (FavouritePoint) contextMenuLayer.getMoveableObject();
PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox); PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox);
MapMarker mapMarker = itineraryHelper.getMapMarker(objectInMotion); MapMarker mapMarker = mapMarkersHelper.getMapMarker(objectInMotion);
float textScale = this.settings.TEXT_SCALE.get(); float textScale = this.settings.TEXT_SCALE.get();
drawBigPoint(canvas, objectInMotion, pf.x, pf.y, mapMarker, textScale); drawBigPoint(canvas, objectInMotion, pf.x, pf.y, mapMarker, textScale);
} }
@ -106,7 +106,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
List<LatLon> smallObjectsLatLon = new ArrayList<>(); List<LatLon> smallObjectsLatLon = new ArrayList<>();
for (FavoriteGroup group : favouritesDbHelper.getFavoriteGroups()) { for (FavoriteGroup group : favouritesDbHelper.getFavoriteGroups()) {
List<Pair<FavouritePoint, MapMarker>> fullObjects = new ArrayList<>(); List<Pair<FavouritePoint, MapMarker>> fullObjects = new ArrayList<>();
boolean synced = itineraryHelper.getMarkersGroup(group) != null; boolean synced = mapMarkersHelper.getMarkersGroup(group) != null;
for (FavouritePoint favoritePoint : group.getPoints()) { for (FavouritePoint favoritePoint : group.getPoints()) {
double lat = favoritePoint.getLatitude(); double lat = favoritePoint.getLatitude();
double lon = favoritePoint.getLongitude(); double lon = favoritePoint.getLongitude();
@ -115,7 +115,7 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
&& lon >= latLonBounds.left && lon <= latLonBounds.right) { && lon >= latLonBounds.left && lon <= latLonBounds.right) {
MapMarker marker = null; MapMarker marker = null;
if (synced) { if (synced) {
if ((marker = itineraryHelper.getMapMarker(favoritePoint)) == null) { if ((marker = mapMarkersHelper.getMapMarker(favoritePoint)) == null) {
continue; continue;
} }
} }

View file

@ -47,8 +47,8 @@ import net.osmand.plus.base.PointImageDrawable;
import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint; import net.osmand.plus.mapcontextmenu.controllers.SelectedGpxMenuController.SelectedGpxPoint;
import net.osmand.plus.mapcontextmenu.other.TrackChartPoints; import net.osmand.plus.mapcontextmenu.other.TrackChartPoints;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.ItineraryGroup; import net.osmand.plus.mapmarkers.MapMarkersGroup;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.render.OsmandRenderer; import net.osmand.plus.render.OsmandRenderer;
import net.osmand.plus.render.OsmandRenderer.RenderingContext; import net.osmand.plus.render.OsmandRenderer.RenderingContext;
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu; import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
@ -118,7 +118,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
private TrackChartPoints trackChartPoints; private TrackChartPoints trackChartPoints;
private GpxDbHelper gpxDbHelper; private GpxDbHelper gpxDbHelper;
private ItineraryHelper itineraryHelper; private MapMarkersHelper mapMarkersHelper;
private GpxSelectionHelper selectedGpxHelper; private GpxSelectionHelper selectedGpxHelper;
private final Map<String, CachedTrack> segmentsCache = new HashMap<>(); private final Map<String, CachedTrack> segmentsCache = new HashMap<>();
@ -165,7 +165,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
this.view = view; this.view = view;
gpxDbHelper = view.getApplication().getGpxDbHelper(); gpxDbHelper = view.getApplication().getGpxDbHelper();
selectedGpxHelper = view.getApplication().getSelectedGpxHelper(); selectedGpxHelper = view.getApplication().getSelectedGpxHelper();
itineraryHelper = view.getApplication().getItineraryHelper(); mapMarkersHelper = view.getApplication().getMapMarkersHelper();
osmandRenderer = view.getApplication().getResourceManager().getRenderer().getRenderer(); osmandRenderer = view.getApplication().getResourceManager().getRenderer().getRenderer();
currentTrackColorPref = view.getSettings().CURRENT_TRACK_COLOR; currentTrackColorPref = view.getSettings().CURRENT_TRACK_COLOR;
@ -259,7 +259,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
SelectedGpxFile gpxFile = pointFileMap.get(objectInMotion); SelectedGpxFile gpxFile = pointFileMap.get(objectInMotion);
if (gpxFile != null) { if (gpxFile != null) {
PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox); PointF pf = contextMenuLayer.getMovableCenterPoint(tileBox);
MapMarker mapMarker = itineraryHelper.getMapMarker(objectInMotion); MapMarker mapMarker = mapMarkersHelper.getMapMarker(objectInMotion);
float textScale = view.getSettings().TEXT_SCALE.get(); float textScale = view.getSettings().TEXT_SCALE.get();
drawBigPoint(canvas, objectInMotion, getFileColor(gpxFile), pf.x, pf.y, mapMarker, textScale); drawBigPoint(canvas, objectInMotion, getFileColor(gpxFile), pf.x, pf.y, mapMarker, textScale);
} }
@ -543,7 +543,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
for (SelectedGpxFile g : selectedGPXFiles) { for (SelectedGpxFile g : selectedGPXFiles) {
List<Pair<WptPt, MapMarker>> fullObjects = new ArrayList<>(); List<Pair<WptPt, MapMarker>> fullObjects = new ArrayList<>();
int fileColor = getFileColor(g); int fileColor = getFileColor(g);
boolean synced = itineraryHelper.getMarkersGroup(g.getGpxFile()) != null; boolean synced = mapMarkersHelper.getMarkersGroup(g.getGpxFile()) != null;
for (WptPt wpt : getListStarPoints(g)) { for (WptPt wpt : getListStarPoints(g)) {
if (wpt.lat >= latLonBounds.bottom && wpt.lat <= latLonBounds.top if (wpt.lat >= latLonBounds.bottom && wpt.lat <= latLonBounds.top
&& wpt.lon >= latLonBounds.left && wpt.lon <= latLonBounds.right && wpt.lon >= latLonBounds.left && wpt.lon <= latLonBounds.right
@ -551,7 +551,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
pointFileMap.put(wpt, g); pointFileMap.put(wpt, g);
MapMarker marker = null; MapMarker marker = null;
if (synced) { if (synced) {
if ((marker = itineraryHelper.getMapMarker(wpt)) == null) { if ((marker = mapMarkersHelper.getMapMarker(wpt)) == null) {
continue; continue;
} }
} }
@ -1226,9 +1226,9 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
} }
private void syncGpx(GPXFile gpxFile) { private void syncGpx(GPXFile gpxFile) {
ItineraryGroup group = view.getApplication().getItineraryHelper().getMarkersGroup(gpxFile); MapMarkersGroup group = view.getApplication().getMapMarkersHelper().getMarkersGroup(gpxFile);
if (group != null) { if (group != null) {
itineraryHelper.runSynchronization(group); mapMarkersHelper.runSynchronization(group);
} }
} }

View file

@ -31,7 +31,7 @@ import net.osmand.data.LatLon;
import net.osmand.data.PointDescription; import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint; import net.osmand.data.QuadPoint;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndConstants;
import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmAndFormatter;
@ -251,7 +251,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
} else { } else {
myLoc = app.getLocationProvider().getLastStaleKnownLocation(); myLoc = app.getLocationProvider().getLastStaleKnownLocation();
} }
ItineraryHelper markersHelper = app.getItineraryHelper(); MapMarkersHelper markersHelper = app.getMapMarkersHelper();
List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers(); List<MapMarker> activeMapMarkers = markersHelper.getMapMarkers();
int displayedWidgets = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get(); int displayedWidgets = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
@ -340,7 +340,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
int displayedWidgets = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get(); int displayedWidgets = settings.DISPLAYED_MARKERS_WIDGETS_COUNT.get();
ItineraryHelper markersHelper = map.getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
for (MapMarker marker : markersHelper.getMapMarkers()) { for (MapMarker marker : markersHelper.getMapMarkers()) {
if (isLocationVisible(tileBox, marker) && !overlappedByWaypoint(marker) if (isLocationVisible(tileBox, marker) && !overlappedByWaypoint(marker)
@ -516,7 +516,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|| !settings.SHOW_MAP_MARKERS.get()) { || !settings.SHOW_MAP_MARKERS.get()) {
return false; return false;
} }
final ItineraryHelper helper = map.getMyApplication().getItineraryHelper(); final MapMarkersHelper helper = map.getMyApplication().getMapMarkersHelper();
final MapMarker old = helper.getMapMarkers().get(0); final MapMarker old = helper.getMapMarkers().get(0);
helper.moveMarkerToTop((MapMarker) o); helper.moveMarkerToTop((MapMarker) o);
String title = map.getString(R.string.marker_activated, helper.getMapMarkers().get(0).getName(map)); String title = map.getString(R.string.marker_activated, helper.getMapMarkers().get(0).getName(map));
@ -546,7 +546,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
int r = getDefaultRadiusPoi(tileBox); int r = getDefaultRadiusPoi(tileBox);
boolean selectMarkerOnSingleTap = app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get(); boolean selectMarkerOnSingleTap = app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get();
for (MapMarker marker : app.getItineraryHelper().getMapMarkers()) { for (MapMarker marker : app.getMapMarkersHelper().getMapMarkers()) {
if ((!unknownLocation && selectMarkerOnSingleTap) || !isSynced(marker)) { if ((!unknownLocation && selectMarkerOnSingleTap) || !isSynced(marker)) {
LatLon latLon = marker.point; LatLon latLon = marker.point;
if (latLon != null) { if (latLon != null) {
@ -639,7 +639,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
boolean result = false; boolean result = false;
MapMarker newObject = null; MapMarker newObject = null;
if (o instanceof MapMarker) { if (o instanceof MapMarker) {
ItineraryHelper markersHelper = map.getMyApplication().getItineraryHelper(); MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
MapMarker marker = (MapMarker) o; MapMarker marker = (MapMarker) o;
PointDescription originalDescription = marker.getOriginalPointDescription(); PointDescription originalDescription = marker.getOriginalPointDescription();

View file

@ -15,7 +15,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.mapmarkers.MapMarker; import net.osmand.plus.mapmarkers.MapMarker;
import net.osmand.plus.mapmarkers.fragments.MapMarkersDialogFragment; import net.osmand.plus.mapmarkers.fragments.MapMarkersDialogFragment;
import net.osmand.plus.mapmarkers.ItineraryHelper; import net.osmand.plus.mapmarkers.MapMarkersHelper;
import net.osmand.plus.views.AnimateDraggingMapThread; import net.osmand.plus.views.AnimateDraggingMapThread;
import net.osmand.plus.views.DirectionDrawable; import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
@ -32,7 +32,7 @@ public class MapMarkersWidgetsFactory {
public static final int MIN_DIST_2ND_ROW_SHOW = 150; // meters public static final int MIN_DIST_2ND_ROW_SHOW = 150; // meters
private final MapActivity map; private final MapActivity map;
private ItineraryHelper helper; private MapMarkersHelper helper;
private boolean portraitMode; private boolean portraitMode;
private View topBar; private View topBar;
@ -56,7 +56,7 @@ public class MapMarkersWidgetsFactory {
public MapMarkersWidgetsFactory(final MapActivity map) { public MapMarkersWidgetsFactory(final MapActivity map) {
this.map = map; this.map = map;
helper = map.getMyApplication().getItineraryHelper(); helper = map.getMyApplication().getMapMarkersHelper();
portraitMode = AndroidUiHelper.isOrientationPortrait(map); portraitMode = AndroidUiHelper.isOrientationPortrait(map);
topBar = map.findViewById(R.id.map_markers_top_bar); topBar = map.findViewById(R.id.map_markers_top_bar);
@ -288,7 +288,7 @@ public class MapMarkersWidgetsFactory {
private boolean firstMarker; private boolean firstMarker;
private final OsmandMapTileView view; private final OsmandMapTileView view;
private MapActivity map; private MapActivity map;
private ItineraryHelper helper; private MapMarkersHelper helper;
private float[] calculations = new float[1]; private float[] calculations = new float[1];
private int cachedMeters; private int cachedMeters;
private int cachedMarkerColorIndex = -1; private int cachedMarkerColorIndex = -1;
@ -299,7 +299,7 @@ public class MapMarkersWidgetsFactory {
this.map = map; this.map = map;
this.firstMarker = firstMarker; this.firstMarker = firstMarker;
this.view = map.getMapView(); this.view = map.getMapView();
helper = map.getMyApplication().getItineraryHelper(); helper = map.getMyApplication().getMapMarkersHelper();
setText(null, null); setText(null, null);
setOnClickListener(new View.OnClickListener() { setOnClickListener(new View.OnClickListener() {

View file

@ -495,7 +495,7 @@ public class RouteInfoWidgetsFactory {
Location myLocation = getApplication().getLocationProvider().getLastKnownLocation(); Location myLocation = getApplication().getLocationProvider().getLastKnownLocation();
LatLon l = getNextTargetPoint(); LatLon l = getNextTargetPoint();
if (l == null) { if (l == null) {
List<MapMarker> markers = getApplication().getItineraryHelper().getMapMarkers(); List<MapMarker> markers = getApplication().getMapMarkersHelper().getMapMarkers();
if (markers.size() > 0) { if (markers.size() > 0) {
l = markers.get(0).point; l = markers.get(0).point;
} }