Fix Codacy issues

This commit is contained in:
Neslihan 2017-05-12 19:05:20 +03:00
parent f9fd354d00
commit ed32ebbb62
3 changed files with 17 additions and 15 deletions

View file

@ -55,12 +55,11 @@ public class NearbyActivity extends BaseActivity {
}
private void showMapView() {
if(!isMapViewActive){
if (!isMapViewActive) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.container, new NearbyMapFragment()).commit();
isMapViewActive = true;
}
}
@Override

View file

@ -7,6 +7,8 @@ import android.preference.PreferenceManager;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import fr.free.nrw.commons.location.LatLng;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -15,7 +17,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import fr.free.nrw.commons.location.LatLng;
import timber.log.Timber;
import static fr.free.nrw.commons.utils.LengthUtils.computeDistanceBetween;
@ -56,13 +57,14 @@ public class NearbyController {
}
/**
* Loads attractions from location for list view, we need to return Place data type
* @param curLatLng
* @param context
* Loads attractions from location for list view, we need to return Place data type.
* @param curLatLng users current location
* @param context current activity
* @return
*/
public static List<Place> loadAttractionsFromLocationToPlaces(LatLng curLatLng, Context context) {
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));
@ -74,9 +76,9 @@ public class NearbyController {
}
/**
*Loads attractions from location for map view, we need to return BaseMarkerOption data type
* @param curLatLng
* @param context
*Loads attractions from location for map view, we need to return BaseMarkerOption data type.
* @param curLatLng users current location
* @param context the activity
* @return
*/
public static List<BaseMarkerOptions> loadAttractionsFromLocationToBaseMarkerOptions(
@ -89,10 +91,10 @@ public class NearbyController {
String distance = formatDistanceBetween(curLatLng, place.location);
place.setDistance(distance);
baseMarkerOptionses.add(new MarkerOptions()
.position(new com.mapbox.mapboxsdk.geometry
.position(new com.mapbox.mapboxsdk.geometry
.LatLng(place.location.latitude,place.location.longitude))
.title(place.name)
.snippet(place.description));
.title(place.name)
.snippet(place.description));
}
return baseMarkerOptionses;
}

View file

@ -3,6 +3,9 @@ package fr.free.nrw.commons.nearby;
import android.net.Uri;
import android.os.StrictMode;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.location.LatLng;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@ -16,8 +19,6 @@ import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.location.LatLng;
import timber.log.Timber;
public class NearbyPlaces {