Fix point description

This commit is contained in:
Victor Shcherb 2020-01-09 17:58:58 +01:00
parent a39d69db75
commit 91eb10347e
8 changed files with 13 additions and 16 deletions

View file

@ -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);
}

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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);
}
}
}

View file

@ -194,9 +194,10 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
List<FavouritePoint> 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: