app/src/main/java/fr/free/nrw/commons/nearby/NearbyController.java
public static List<NearbyBaseMarker> loadAttractionsFromLocationToBaseMarkerOptions(
            LatLng curLatLng,
            List<Place> placeList,
            Context context) {
        List<NearbyBaseMarker> baseMarkerOptions = new ArrayList<>();

        if (placeList == null) {
            return baseMarkerOptions;
        }

        placeList = placeList.subList(0, Math.min(placeList.size(), MAX_RESULTS));

        VectorDrawableCompat vectorDrawable = null;
        try {
            vectorDrawable = VectorDrawableCompat.create(
                    context.getResources(), R.drawable.ic_custom_map_marker, context.getTheme()
            );
        } catch (Resources.NotFoundException e) {
            // ignore when running tests.
        }
        if (vectorDrawable != null) {
            Bitmap icon = UiUtils.getBitmap(vectorDrawable);

            for (Place place : placeList) {
                String distance = formatDistanceBetween(curLatLng, place.location);
                place.setDistance(distance);

                NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker();
                nearbyBaseMarker.title(place.name);
                nearbyBaseMarker.position(
                        new com.mapbox.mapboxsdk.geometry.LatLng(
                                place.location.getLatitude(),
                                place.location.getLongitude()));
                nearbyBaseMarker.place(place);
                nearbyBaseMarker.icon(IconFactory.getInstance(context)
                        .fromBitmap(icon));

                baseMarkerOptions.add(nearbyBaseMarker);
            }
        }
        return baseMarkerOptions;
    }
/**
     * Loads attractions from location for map view, we need to return BaseMarkerOption data type.
     *
     * @param curLatLng users current location
     * @param placeList list of nearby places in Place data type
     * @return BaseMarkerOptions list that holds nearby places
     */
Loads attractions from location for map view, we need to return BaseMarkerOption data type.
@param curLatLng users current location
@param placeList list of nearby places in Place data type
@return BaseMarkerOptions list that holds nearby places
Loads attractions from location for map view we need to return BaseMarkerOption data type . @param curLatLng users current location @param placeList list of nearby places in Place data type @return BaseMarkerOptions list that holds nearby places
public static List<NearbyBaseMarker> loadAttractionsFromLocationToBaseMarkerOptions(
            LatLng curLatLng,
            List<Place> placeList,
            Context context) {
        List<NearbyBaseMarker> baseMarkerOptions = new ArrayList<>();
        if (placeList == null) {
            return baseMarkerOptions;
        }
        placeList = placeList.subList(0, Math.min(placeList.size(), MAX_RESULTS));
        VectorDrawableCompat vectorDrawable = null;
        try {
            vectorDrawable = VectorDrawableCompat.create(
                    context.getResources(), R.drawable.ic_custom_map_marker, context.getTheme()
            );
        } catch (Resources.NotFoundException e) {
        }
        if (vectorDrawable != null) {
            Bitmap icon = UiUtils.getBitmap(vectorDrawable);
            for (Place place : placeList) {
                String distance = formatDistanceBetween(curLatLng, place.location);
                place.setDistance(distance);
                NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker();
                nearbyBaseMarker.title(place.name);
                nearbyBaseMarker.position(
                        new com.mapbox.mapboxsdk.geometry.LatLng(
                                place.location.getLatitude(),
                                place.location.getLongitude()));
                nearbyBaseMarker.place(place);
                nearbyBaseMarker.icon(IconFactory.getInstance(context)
                        .fromBitmap(icon));
                baseMarkerOptions.add(nearbyBaseMarker);
            }
        }
        return baseMarkerOptions;
    }
public static List < NearbyBaseMarker > loadAttractionsFromLocationToBaseMarkerOptions ( LatLng curLatLng , List < Place > placeList , Context context ) { List < NearbyBaseMarker > baseMarkerOptions = new ArrayList < > ( ) ; if ( placeList == null ) { return baseMarkerOptions ; } placeList = placeList . subList ( 0 , Math . min ( placeList . size ( ) , MAX_RESULTS ) ) ; VectorDrawableCompat vectorDrawable = null ; try { vectorDrawable = VectorDrawableCompat . create ( context . getResources ( ) , R . drawable . ic_custom_map_marker , context . getTheme ( ) ) ; } catch ( Resources . NotFoundException e ) { } if ( vectorDrawable != null ) { Bitmap icon = UiUtils . getBitmap ( vectorDrawable ) ; for ( Place place : placeList ) { String distance = formatDistanceBetween ( curLatLng , place . location ) ; place . setDistance ( distance ) ; NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker ( ) ; nearbyBaseMarker . title ( place . name ) ; nearbyBaseMarker . position ( new com . mapbox . mapboxsdk . geometry . LatLng ( place . location . getLatitude ( ) , place . location . getLongitude ( ) ) ) ; nearbyBaseMarker . place ( place ) ; nearbyBaseMarker . icon ( IconFactory . getInstance ( context ) . fromBitmap ( icon ) ) ; baseMarkerOptions . add ( nearbyBaseMarker ) ; } } return baseMarkerOptions ; }
Loads attractions from location for map view, we need to return BaseMarkerOption data type.
Loads attractions from location for map view we need to return BaseMarkerOption data type .
// ignore when running tests.