From 640a54cdbc01d83825c0e9b7fdedd806f3600aed Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 8 Dec 2017 13:51:08 +0200 Subject: [PATCH] If "One tap make active" for markers is on, make active after click in list too --- .../mapmarkers/MapMarkersActiveFragment.java | 37 +++++++++++-------- .../mapmarkers/MapMarkersGroupsFragment.java | 37 +++++++++++-------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java index 0d3a289064..867700c77c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java @@ -63,24 +63,29 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL return; } MapMarker marker = adapter.getItem(pos); - WptPt wptPt = marker.wptPt; - FavouritePoint favouritePoint = marker.favouritePoint; - Object objectToShow; - PointDescription pointDescription; - if (wptPt != null) { - pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, wptPt.name); - objectToShow = wptPt; - } else if (favouritePoint != null) { - pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, favouritePoint.getName()); - objectToShow = favouritePoint; + if (mapActivity.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { + mapActivity.getMyApplication().getMapMarkersHelper().moveMarkerToTop(marker); + updateAdapter(); } else { - pointDescription = marker.getPointDescription(mapActivity); - objectToShow = marker; + WptPt wptPt = marker.wptPt; + FavouritePoint favouritePoint = marker.favouritePoint; + Object objectToShow; + PointDescription pointDescription; + if (wptPt != null) { + pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, wptPt.name); + objectToShow = wptPt; + } else if (favouritePoint != null) { + pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, favouritePoint.getName()); + objectToShow = favouritePoint; + } else { + pointDescription = marker.getPointDescription(mapActivity); + objectToShow = marker; + } + mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), + 15, pointDescription, true, objectToShow); + MapActivity.launchMapActivityMoveToTop(mapActivity); + ((DialogFragment) getParentFragment()).dismiss(); } - mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), - 15, pointDescription, true, objectToShow); - MapActivity.launchMapActivityMoveToTop(mapActivity); - ((DialogFragment) getParentFragment()).dismiss(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java index 0a4a68f539..9f23c3de6f 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java @@ -231,24 +231,29 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL if (item instanceof MapMarker) { MapMarker marker = (MapMarker) item; if (!marker.history) { - WptPt wptPt = marker.wptPt; - FavouritePoint favouritePoint = marker.favouritePoint; - Object objectToShow; - PointDescription pointDescription; - if (wptPt != null) { - pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, wptPt.name); - objectToShow = wptPt; - } else if (favouritePoint != null) { - pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, favouritePoint.getName()); - objectToShow = favouritePoint; + if (mapActivity.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { + mapActivity.getMyApplication().getMapMarkersHelper().moveMarkerToTop(marker); + updateAdapter(); } else { - pointDescription = marker.getPointDescription(mapActivity); - objectToShow = marker; + WptPt wptPt = marker.wptPt; + FavouritePoint favouritePoint = marker.favouritePoint; + Object objectToShow; + PointDescription pointDescription; + if (wptPt != null) { + pointDescription = new PointDescription(PointDescription.POINT_TYPE_WPT, wptPt.name); + objectToShow = wptPt; + } else if (favouritePoint != null) { + pointDescription = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, favouritePoint.getName()); + objectToShow = favouritePoint; + } else { + pointDescription = marker.getPointDescription(mapActivity); + objectToShow = marker; + } + mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), + 15, pointDescription, true, objectToShow); + MapActivity.launchMapActivityMoveToTop(mapActivity); + ((DialogFragment) getParentFragment()).dismiss(); } - mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), - 15, pointDescription, true, objectToShow); - MapActivity.launchMapActivityMoveToTop(mapActivity); - ((DialogFragment) getParentFragment()).dismiss(); } else { HistoryMarkerMenuBottomSheetDialogFragment fragment = new HistoryMarkerMenuBottomSheetDialogFragment(); fragment.setUsedOnMap(false);