mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixed bug when there are places nearby but none are loaded
This commit is contained in:
parent
5447ae0dcb
commit
dd4e7c3aa0
1 changed files with 1 additions and 2 deletions
|
|
@ -29,7 +29,6 @@ public class NearbyPlaces {
|
||||||
private static final Uri WIKIDATA_QUERY_URL = Uri.parse("https://query.wikidata.org/sparql");
|
private static final Uri WIKIDATA_QUERY_URL = Uri.parse("https://query.wikidata.org/sparql");
|
||||||
private static final Uri WIKIDATA_QUERY_UI_URL = Uri.parse("https://query.wikidata.org/");
|
private static final Uri WIKIDATA_QUERY_UI_URL = Uri.parse("https://query.wikidata.org/");
|
||||||
private final String wikidataQuery;
|
private final String wikidataQuery;
|
||||||
private double radius = INITIAL_RADIUS;
|
|
||||||
private List<Place> places;
|
private List<Place> places;
|
||||||
|
|
||||||
public NearbyPlaces() {
|
public NearbyPlaces() {
|
||||||
|
|
@ -43,6 +42,7 @@ public class NearbyPlaces {
|
||||||
|
|
||||||
List<Place> getFromWikidataQuery(LatLng curLatLng, String lang) {
|
List<Place> getFromWikidataQuery(LatLng curLatLng, String lang) {
|
||||||
List<Place> places = Collections.emptyList();
|
List<Place> places = Collections.emptyList();
|
||||||
|
double radius = INITIAL_RADIUS;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// increase the radius gradually to find a satisfactory number of nearby places
|
// increase the radius gradually to find a satisfactory number of nearby places
|
||||||
|
|
@ -60,7 +60,6 @@ public class NearbyPlaces {
|
||||||
// errors tend to be caused by too many results (and time out)
|
// errors tend to be caused by too many results (and time out)
|
||||||
// try a small radius next time
|
// try a small radius next time
|
||||||
Timber.d("back to initial radius: %f", radius);
|
Timber.d("back to initial radius: %f", radius);
|
||||||
radius = INITIAL_RADIUS;
|
|
||||||
}
|
}
|
||||||
return places;
|
return places;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue