From 91eb10347e73a912700e00b38afa4343b75d9124 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 9 Jan 2020 17:58:58 +0100 Subject: [PATCH] Fix point description --- OsmAnd/src/net/osmand/data/FavouritePoint.java | 4 ---- OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java | 2 +- .../editors/FavoritePointEditorFragment.java | 2 +- .../other/FavouritesBottomSheetMenuFragment.java | 6 +++--- .../osmand/plus/mapmarkers/MapMarkersActiveFragment.java | 2 +- .../osmand/plus/mapmarkers/MapMarkersGroupsFragment.java | 2 +- .../routepreparationmenu/AddPointBottomSheetDialog.java | 4 ++-- .../net/osmand/plus/search/QuickSearchListFragment.java | 7 ++++--- 8 files changed, 13 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/data/FavouritePoint.java b/OsmAnd/src/net/osmand/data/FavouritePoint.java index 4000a81cc6..fec482236e 100644 --- a/OsmAnd/src/net/osmand/data/FavouritePoint.java +++ b/OsmAnd/src/net/osmand/data/FavouritePoint.java @@ -85,10 +85,6 @@ public class FavouritePoint implements Serializable, LocationPoint { this.address = address; } - public PointDescription getPointDescription() { - return new PointDescription(PointDescription.POINT_TYPE_FAVORITE, getName()); - } - public boolean isAddressSpecified() { return !Algorithms.isEmpty(address); } diff --git a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java index ef285c337b..d5ee2d23fc 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/FavoriteDialogs.java @@ -82,7 +82,7 @@ public class FavoriteDialogs { if (helper.editFavourite(fp, point.getLatitude(), point.getLongitude())) { if (activity instanceof MapActivity) { ((MapActivity) activity).getContextMenu() - .show(new LatLon(point.getLatitude(), point.getLongitude()), fp.getPointDescription(), fp); + .show(new LatLon(point.getLatitude(), point.getLongitude()), fp.getPointDescription(activity), fp); } } if (activity instanceof MapActivity) { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java index 0bde7245f4..3bd6c94fd2 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/FavoritePointEditorFragment.java @@ -249,7 +249,7 @@ public class FavoritePointEditorFragment extends PointEditorFragment { MapContextMenu menu = mapActivity.getContextMenu(); LatLon latLon = new LatLon(favorite.getLatitude(), favorite.getLongitude()); if (menu.getLatLon() != null && menu.getLatLon().equals(latLon)) { - menu.update(latLon, favorite.getPointDescription(), favorite); + menu.update(latLon, favorite.getPointDescription(mapActivity), favorite); } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/FavouritesBottomSheetMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/FavouritesBottomSheetMenuFragment.java index f64d963b66..2fad28e8c0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/FavouritesBottomSheetMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/FavouritesBottomSheetMenuFragment.java @@ -152,13 +152,13 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag LatLon ll = new LatLon(point.getLatitude(), point.getLongitude()); switch (pointType) { case START: - targetPointsHelper.setStartPoint(ll, true, point.getPointDescription()); + targetPointsHelper.setStartPoint(ll, true, point.getPointDescription(mapActivity)); break; case TARGET: - targetPointsHelper.navigateToPoint(ll, true, -1, point.getPointDescription()); + targetPointsHelper.navigateToPoint(ll, true, -1, point.getPointDescription(mapActivity)); break; case INTERMEDIATE: - targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size(), point.getPointDescription()); + targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size(), point.getPointDescription(mapActivity)); break; case HOME: favorites.setSpecialPoint(ll, FavouritePoint.SpecialPointType.HOME, null); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java index b537172683..55292080fd 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java @@ -76,7 +76,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL ? app.getFavorites().getVisibleFavByLatLon(marker.point) : marker.favouritePoint; if (fav != null) { - showMap(marker.point, fav.getPointDescription(), fav); + showMap(marker.point, fav.getPointDescription(mapActivity), fav); return; } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java index e6f6b9d827..1ed6666726 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java @@ -236,7 +236,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL ? app.getFavorites().getVisibleFavByLatLon(marker.point) : marker.favouritePoint; if (fav != null) { - showMap(marker.point, fav.getPointDescription(), fav); + showMap(marker.point, fav.getPointDescription(mapActivity), fav); return; } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java index 58aaedbfa9..ffb62da631 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AddPointBottomSheetDialog.java @@ -474,7 +474,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment { if (item instanceof FavouritePoint) { FavouritePoint point = (FavouritePoint) item; ll = new LatLon(point.getLatitude(), point.getLongitude()); - name = point.getPointDescription(); + name = point.getPointDescription(mapActivity); } else if (item instanceof PointType) { MapActivity mapActivity = (MapActivity) getActivity(); if (mapActivity != null) { @@ -489,7 +489,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment { } if (point != null) { ll = new LatLon(point.getLatitude(), point.getLongitude()); - name = point.getPointDescription(); + name = point.getPointDescription(mapActivity); } } } diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java index a5dacec773..013a8d33df 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java @@ -194,9 +194,10 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment { List favs = app.getFavorites().getFavouritePoints(); for (FavouritePoint f : favs) { if (entryLatLon.equals(new LatLon(f.getLatitude(), f.getLongitude())) - && pointDescription.getName().equals(f.getName())) { + && (pointDescription.getName().equals(f.getName()) || + pointDescription.getName().equals(f.getDisplayName(app)))) { object = f; - pointDescription = f.getPointDescription(); + pointDescription = f.getPointDescription(app); break; } } @@ -204,7 +205,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment { break; case FAVORITE: FavouritePoint fav = (FavouritePoint) object; - pointDescription = fav.getPointDescription(); + pointDescription = fav.getPointDescription(app); break; case VILLAGE: case CITY: