diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 34216131d9..cacd826bae 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -3158,12 +3158,17 @@ public class OsmandSettings { } public enum MapMarkersOrderByMode { + CUSTOM, DISTANCE_DESC, DISTANCE_ASC, NAME, DATE_ADDED_DESC, DATE_ADDED_ASC; + public boolean isCustom() { + return this == CUSTOM; + } + public boolean isDistanceDescending() { return this == DISTANCE_DESC; } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java index 4870299cee..54646a2a50 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersActiveFragment.java @@ -18,6 +18,7 @@ import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener; import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.dashboard.DashLocationFragment; @@ -77,6 +78,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL hideSnackbar(); mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded(); adapter.notifyDataSetChanged(); + mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); } } }); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java index 4dd9983c39..81985824b0 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java @@ -290,8 +290,10 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm } private void setOrderByMode(MapMarkersOrderByMode orderByMode) { - getMyApplication().getMapMarkersHelper().orderMarkers(orderByMode); - activeFragment.updateAdapter(); + if (orderByMode != MapMarkersOrderByMode.CUSTOM) { + getMyApplication().getMapMarkersHelper().orderMarkers(orderByMode); + activeFragment.updateAdapter(); + } } private MapActivity getMapActivity() { diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index bfc0e5c646..15cdc2ec9c 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -496,6 +496,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi public void setSelectedObject(Object o) { if (o instanceof MapMarker) { map.getMyApplication().getMapMarkersHelper().moveMarkerToTop((MapMarker) o); + map.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM); } }