Merge pull request #9880 from osmandapp/Nearby_wikipedia_articles
fix "Nearby wikipedia articles" so the settings are applied
This commit is contained in:
commit
9b1a3b9660
1 changed files with 10 additions and 13 deletions
|
@ -53,6 +53,7 @@ import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard;
|
||||||
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask;
|
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask;
|
||||||
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
|
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
|
||||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||||
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.transport.TransportStopRoute;
|
import net.osmand.plus.transport.TransportStopRoute;
|
||||||
import net.osmand.plus.views.layers.POIMapLayer;
|
import net.osmand.plus.views.layers.POIMapLayer;
|
||||||
|
@ -992,18 +993,10 @@ public class MenuBuilder {
|
||||||
if (showNearestWiki && latLon != null) {
|
if (showNearestWiki && latLon != null) {
|
||||||
QuadRect rect = MapUtils.calculateLatLonBbox(
|
QuadRect rect = MapUtils.calculateLatLonBbox(
|
||||||
latLon.getLatitude(), latLon.getLongitude(), 250);
|
latLon.getLatitude(), latLon.getLongitude(), 250);
|
||||||
nearestWiki = app.getResourceManager().searchAmenities(
|
PoiUIFilter wikiPoiFilter = app.getPoiFilters().getTopWikiPoiFilter();
|
||||||
new BinaryMapIndexReader.SearchPoiTypeFilter() {
|
|
||||||
@Override
|
nearestWiki = getAmenities(rect, wikiPoiFilter);
|
||||||
public boolean accept(PoiCategory type, String subcategory) {
|
|
||||||
return type != null && type.isWiki();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}, rect.top, rect.left, rect.bottom, rect.right, -1, null);
|
|
||||||
Collections.sort(nearestWiki, new Comparator<Amenity>() {
|
Collections.sort(nearestWiki, new Comparator<Amenity>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1016,8 +1009,7 @@ public class MenuBuilder {
|
||||||
Long id = objectId;
|
Long id = objectId;
|
||||||
List<Amenity> wikiList = new ArrayList<>();
|
List<Amenity> wikiList = new ArrayList<>();
|
||||||
for (Amenity wiki : nearestWiki) {
|
for (Amenity wiki : nearestWiki) {
|
||||||
String lng = wiki.getContentLanguage("content", preferredMapAppLang, "en");
|
if (wiki.getId().equals(id)) {
|
||||||
if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredMapAppLang))) {
|
|
||||||
wikiList.add(wiki);
|
wikiList.add(wiki);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1027,6 +1019,11 @@ public class MenuBuilder {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Amenity> getAmenities(QuadRect rect, PoiUIFilter wikiPoiFilter) {
|
||||||
|
return wikiPoiFilter.searchAmenities(rect.top, rect.left,
|
||||||
|
rect.bottom, rect.right, -1, null);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <P> void execute(AsyncTask<P, ?, ?> task, P... requests) {
|
public static <P> void execute(AsyncTask<P, ?, ?> task, P... requests) {
|
||||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests);
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, requests);
|
||||||
|
|
Loading…
Reference in a new issue