mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Fix Codacy issues
This commit is contained in:
parent
f9fd354d00
commit
ed32ebbb62
3 changed files with 17 additions and 15 deletions
|
|
@ -55,12 +55,11 @@ public class NearbyActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMapView() {
|
private void showMapView() {
|
||||||
if(!isMapViewActive){
|
if (!isMapViewActive) {
|
||||||
getSupportFragmentManager().beginTransaction()
|
getSupportFragmentManager().beginTransaction()
|
||||||
.replace(R.id.container, new NearbyMapFragment()).commit();
|
.replace(R.id.container, new NearbyMapFragment()).commit();
|
||||||
isMapViewActive = true;
|
isMapViewActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import android.preference.PreferenceManager;
|
||||||
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
|
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
|
||||||
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.location.LatLng;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -15,7 +17,6 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import fr.free.nrw.commons.location.LatLng;
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
import static fr.free.nrw.commons.utils.LengthUtils.computeDistanceBetween;
|
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
|
* Loads attractions from location for list view, we need to return Place data type.
|
||||||
* @param curLatLng
|
* @param curLatLng users current location
|
||||||
* @param context
|
* @param context current activity
|
||||||
* @return
|
* @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);
|
List<Place> places = loadAttractionsFromLocation(curLatLng,context);
|
||||||
places = places.subList(0, Math.min(places.size(), MAX_RESULTS));
|
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
|
*Loads attractions from location for map view, we need to return BaseMarkerOption data type.
|
||||||
* @param curLatLng
|
* @param curLatLng users current location
|
||||||
* @param context
|
* @param context the activity
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static List<BaseMarkerOptions> loadAttractionsFromLocationToBaseMarkerOptions(
|
public static List<BaseMarkerOptions> loadAttractionsFromLocationToBaseMarkerOptions(
|
||||||
|
|
@ -89,10 +91,10 @@ public class NearbyController {
|
||||||
String distance = formatDistanceBetween(curLatLng, place.location);
|
String distance = formatDistanceBetween(curLatLng, place.location);
|
||||||
place.setDistance(distance);
|
place.setDistance(distance);
|
||||||
baseMarkerOptionses.add(new MarkerOptions()
|
baseMarkerOptionses.add(new MarkerOptions()
|
||||||
.position(new com.mapbox.mapboxsdk.geometry
|
.position(new com.mapbox.mapboxsdk.geometry
|
||||||
.LatLng(place.location.latitude,place.location.longitude))
|
.LatLng(place.location.latitude,place.location.longitude))
|
||||||
.title(place.name)
|
.title(place.name)
|
||||||
.snippet(place.description));
|
.snippet(place.description));
|
||||||
}
|
}
|
||||||
return baseMarkerOptionses;
|
return baseMarkerOptionses;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@ package fr.free.nrw.commons.nearby;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
|
|
||||||
|
import fr.free.nrw.commons.Utils;
|
||||||
|
import fr.free.nrw.commons.location.LatLng;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
@ -16,8 +19,6 @@ import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import fr.free.nrw.commons.Utils;
|
|
||||||
import fr.free.nrw.commons.location.LatLng;
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class NearbyPlaces {
|
public class NearbyPlaces {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue