use of fr.free.nrw.commons.nearby.NearbyController.NearbyPlacesInfo in project apps-android-commons by commons-app.
the class NearbyParentFragment method populatePlacesForAnotherLocation.
private void populatePlacesForAnotherLocation(final fr.free.nrw.commons.location.LatLng curlatLng, final fr.free.nrw.commons.location.LatLng searchLatLng, @Nullable final String customQuery) {
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable.fromCallable(() -> nearbyController.loadAttractionsFromLocation(curlatLng, searchLatLng, false, true, Utils.isMonumentsEnabled(new Date()), customQuery));
compositeDisposable.add(nearbyPlacesInfoObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(nearbyPlacesInfo -> {
if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
showErrorMessage(getString(R.string.no_nearby_places_around));
} else {
// Updating last searched location
applicationKvStore.putString("LastLocation", searchLatLng.getLatitude() + "," + searchLatLng.getLongitude());
updateMapMarkers(nearbyPlacesInfo, false);
lastFocusLocation = searchLatLng;
}
}, throwable -> {
Timber.e(throwable);
showErrorMessage(getString(R.string.error_fetching_nearby_places) + throwable.getLocalizedMessage());
setProgressBarVisibility(false);
presenter.lockUnlockNearby(false);
setFilterState();
}));
}
use of fr.free.nrw.commons.nearby.NearbyController.NearbyPlacesInfo in project apps-android-commons by commons-app.
the class NearbyParentFragment method populatePlacesForCurrentLocation.
private void populatePlacesForCurrentLocation(final fr.free.nrw.commons.location.LatLng curlatLng, final fr.free.nrw.commons.location.LatLng searchLatLng, @Nullable final String customQuery) {
final Observable<NearbyPlacesInfo> nearbyPlacesInfoObservable = Observable.fromCallable(() -> nearbyController.loadAttractionsFromLocation(curlatLng, searchLatLng, false, true, Utils.isMonumentsEnabled(new Date()), customQuery));
compositeDisposable.add(nearbyPlacesInfoObservable.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(nearbyPlacesInfo -> {
if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
showErrorMessage(getString(R.string.no_nearby_places_around));
} else {
updateMapMarkers(nearbyPlacesInfo, true);
lastFocusLocation = searchLatLng;
}
}, throwable -> {
Timber.d(throwable);
showErrorMessage(getString(R.string.error_fetching_nearby_places) + throwable.getLocalizedMessage());
setProgressBarVisibility(false);
presenter.lockUnlockNearby(false);
setFilterState();
}));
}
Aggregations