mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Fix Codacy issues
This commit is contained in:
parent
08501b9348
commit
f9fd354d00
3 changed files with 27 additions and 5 deletions
|
|
@ -24,6 +24,7 @@ import static fr.free.nrw.commons.utils.LengthUtils.formatDistanceBetween;
|
|||
|
||||
public class NearbyController {
|
||||
private static final int MAX_RESULTS = 1000;
|
||||
|
||||
private static List<Place> loadAttractionsFromLocation(LatLng curLatLng, Context context) {
|
||||
Timber.d("Loading attractions near %s", curLatLng);
|
||||
if (curLatLng == null) {
|
||||
|
|
@ -53,7 +54,15 @@ public class NearbyController {
|
|||
}
|
||||
return places;
|
||||
}
|
||||
public static List<Place> loadAttractionsFromLocationToPlaces(LatLng curLatLng, Context context){
|
||||
|
||||
/**
|
||||
* Loads attractions from location for list view, we need to return Place data type
|
||||
* @param curLatLng
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static List<Place> loadAttractionsFromLocationToPlaces(LatLng curLatLng, Context context) {
|
||||
|
||||
List<Place> places = loadAttractionsFromLocation(curLatLng,context);
|
||||
places = places.subList(0, Math.min(places.size(), MAX_RESULTS));
|
||||
|
|
@ -63,7 +72,16 @@ public class NearbyController {
|
|||
}
|
||||
return places;
|
||||
}
|
||||
public static List<BaseMarkerOptions> loadAttractionsFromLocationToBaseMarkerOptions(LatLng curLatLng, Context context){
|
||||
|
||||
/**
|
||||
*Loads attractions from location for map view, we need to return BaseMarkerOption data type
|
||||
* @param curLatLng
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static List<BaseMarkerOptions> loadAttractionsFromLocationToBaseMarkerOptions(
|
||||
LatLng curLatLng,
|
||||
Context context) {
|
||||
List<BaseMarkerOptions> baseMarkerOptionses = new ArrayList<>();
|
||||
List<Place> places = loadAttractionsFromLocation(curLatLng,context);
|
||||
places = places.subList(0, Math.min(places.size(), MAX_RESULTS));
|
||||
|
|
@ -71,7 +89,8 @@ public class NearbyController {
|
|||
String distance = formatDistanceBetween(curLatLng, place.location);
|
||||
place.setDistance(distance);
|
||||
baseMarkerOptionses.add(new MarkerOptions()
|
||||
.position(new com.mapbox.mapboxsdk.geometry.LatLng(place.location.latitude,place.location.longitude))
|
||||
.position(new com.mapbox.mapboxsdk.geometry
|
||||
.LatLng(place.location.latitude,place.location.longitude))
|
||||
.title(place.name)
|
||||
.snippet(place.description));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,9 @@ public class NearbyListFragment extends ListFragment {
|
|||
@Override
|
||||
protected List<Place> doInBackground(Void... params) {
|
||||
return NearbyController.loadAttractionsFromLocationToPlaces(
|
||||
((NearbyActivity)getActivity()).getLocationManager().getLatestLocation(), getActivity()
|
||||
((NearbyActivity)getActivity())
|
||||
.getLocationManager()
|
||||
.getLatestLocation(), getActivity()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,8 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
|||
|
||||
@Override
|
||||
protected List<BaseMarkerOptions> doInBackground(Void... params) {
|
||||
return NearbyController.loadAttractionsFromLocationToBaseMarkerOptions(currentLocation, getActivity()
|
||||
return NearbyController
|
||||
.loadAttractionsFromLocationToBaseMarkerOptions(currentLocation, getActivity()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue