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 {
|
public enum MapMarkersOrderByMode {
|
||||||
|
CUSTOM,
|
||||||
DISTANCE_DESC,
|
DISTANCE_DESC,
|
||||||
DISTANCE_ASC,
|
DISTANCE_ASC,
|
||||||
NAME,
|
NAME,
|
||||||
DATE_ADDED_DESC,
|
DATE_ADDED_DESC,
|
||||||
DATE_ADDED_ASC;
|
DATE_ADDED_ASC;
|
||||||
|
|
||||||
|
public boolean isCustom() {
|
||||||
|
return this == CUSTOM;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isDistanceDescending() {
|
public boolean isDistanceDescending() {
|
||||||
return this == DISTANCE_DESC;
|
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.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
|
@ -77,6 +78,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
|
||||||
hideSnackbar();
|
hideSnackbar();
|
||||||
mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded();
|
mapActivity.getMyApplication().getMapMarkersHelper().checkAndFixActiveMarkersOrderIfNeeded();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
|
mapActivity.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -290,8 +290,10 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOrderByMode(MapMarkersOrderByMode orderByMode) {
|
private void setOrderByMode(MapMarkersOrderByMode orderByMode) {
|
||||||
getMyApplication().getMapMarkersHelper().orderMarkers(orderByMode);
|
if (orderByMode != MapMarkersOrderByMode.CUSTOM) {
|
||||||
activeFragment.updateAdapter();
|
getMyApplication().getMapMarkersHelper().orderMarkers(orderByMode);
|
||||||
|
activeFragment.updateAdapter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
|
|
|
@ -496,6 +496,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
public void setSelectedObject(Object o) {
|
public void setSelectedObject(Object o) {
|
||||||
if (o instanceof MapMarker) {
|
if (o instanceof MapMarker) {
|
||||||
map.getMyApplication().getMapMarkersHelper().moveMarkerToTop((MapMarker) o);
|
map.getMyApplication().getMapMarkersHelper().moveMarkerToTop((MapMarker) o);
|
||||||
|
map.getMyApplication().getSettings().MAP_MARKERS_ORDER_BY_MODE.set(OsmandSettings.MapMarkersOrderByMode.CUSTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue