Search in sources :

Example 1 with MapMarkersSortByDef

use of net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef in project Osmand by osmandapp.

the class MapMarkersDialogFragment method createOrderByFragmentListener.

private OrderByFragmentListener createOrderByFragmentListener() {
    return new OrderByFragmentListener() {

        @Override
        public void onMapMarkersOrderByModeChanged(@MapMarkersSortByDef int sortByMode) {
            OsmandApplication app = getMyApplication();
            MapActivity mapActivity = getMapActivity();
            Location location = app.getLocationProvider().getLastKnownLocation();
            boolean useCenter = !(mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation() && location != null);
            LatLon loc = useCenter ? mapActivity.getMapLocation() : new LatLon(location.getLatitude(), location.getLongitude());
            app.getMapMarkersHelper().sortMarkers(sortByMode, loc);
            activeFragment.updateAdapter();
        }
    };
}
Also used : OrderByFragmentListener(net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener) MapMarkersSortByDef(net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef) LatLon(net.osmand.data.LatLon) OsmandApplication(net.osmand.plus.OsmandApplication) MapActivity(net.osmand.plus.activities.MapActivity) Location(net.osmand.Location)

Aggregations

Location (net.osmand.Location)1 LatLon (net.osmand.data.LatLon)1 MapMarkersSortByDef (net.osmand.plus.MapMarkersHelper.MapMarkersSortByDef)1 OsmandApplication (net.osmand.plus.OsmandApplication)1 MapActivity (net.osmand.plus.activities.MapActivity)1 OrderByFragmentListener (net.osmand.plus.mapmarkers.OrderByBottomSheetDialogFragment.OrderByFragmentListener)1