Fix sorting
This commit is contained in:
parent
e580a0d193
commit
d852ec728e
4 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -290,9 +290,11 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
|||
}
|
||||
|
||||
private void setOrderByMode(MapMarkersOrderByMode orderByMode) {
|
||||
if (orderByMode != MapMarkersOrderByMode.CUSTOM) {
|
||||
getMyApplication().getMapMarkersHelper().orderMarkers(orderByMode);
|
||||
activeFragment.updateAdapter();
|
||||
}
|
||||
}
|
||||
|
||||
private MapActivity getMapActivity() {
|
||||
return (MapActivity) getActivity();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue