From b565be01498001930b1e8571a0bef45f78379036 Mon Sep 17 00:00:00 2001 From: theirix Date: Sun, 8 Jan 2017 17:15:09 +0300 Subject: [PATCH] Show OLC in addition to lat/lon in point descriptions --- .../net/osmand/plus/mapcontextmenu/MenuController.java | 5 +++++ .../plus/mapcontextmenu/builders/AmenityMenuBuilder.java | 8 ++++++++ .../src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java index 7c9486c190..83c779a1d1 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuController.java @@ -22,6 +22,7 @@ import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.MapActivity; @@ -203,8 +204,12 @@ public abstract class MenuController extends BaseMenuController { } protected void addMyLocationToPlainItems(LatLon latLon) { + OsmandSettings st = ((OsmandApplication) getMapActivity().getApplicationContext()).getSettings(); addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationName(getMapActivity(), latLon.getLatitude(), latLon.getLongitude(), true).replaceAll("\n", " "), false, false, null); + if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT) + addPlainMenuItem(R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName( + latLon.getLatitude(), latLon.getLongitude()).replaceAll("\n", " "), false, false, null); } public PointDescription getPointDescription() { diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index f61d5d309a..de6911b4f8 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -24,6 +24,8 @@ import net.osmand.data.PointDescription; import net.osmand.osm.AbstractPoiType; import net.osmand.osm.MapPoiTypes; import net.osmand.osm.PoiType; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.MenuBuilder; @@ -464,9 +466,15 @@ public class AmenityMenuBuilder extends MenuBuilder { buildAmenityRow(view, wikiInfo); } + OsmandSettings st = ((OsmandApplication) mapActivity.getApplicationContext()).getSettings(); buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(), true) .replaceAll("\n", " "), 0, false, null, false, 0, false, null); + if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT) + buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName( + amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude()) + .replaceAll("\n", " "), 0, false, null, false, 0, false, null); + } public void buildAmenityRow(View view, AmenityInfoRow info) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java index 96a5940ea7..55af4578dd 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java @@ -5,6 +5,8 @@ import android.view.View; import net.osmand.data.PointDescription; import net.osmand.osm.MapPoiTypes; import net.osmand.osm.PoiType; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.MenuBuilder; @@ -71,8 +73,13 @@ public class EditPOIMenuBuilder extends MenuBuilder { } } + OsmandSettings st = ((OsmandApplication) mapActivity.getApplicationContext()).getSettings(); buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationName(app, osmPoint.getLatitude(), osmPoint.getLongitude(), true) .replaceAll("\n", " "), 0, false, null, false, 0, false, null); + if (st.COORDINATES_FORMAT.get() != PointDescription.OLC_FORMAT) + buildRow(view, R.drawable.ic_action_get_my_location, PointDescription.getLocationOlcName( + osmPoint.getLatitude(), osmPoint.getLongitude()) + .replaceAll("\n", " "), 0, false, null, false, 0, false, null); } }