Change Wikipedia poi behaviour
This commit is contained in:
parent
873fb38c0a
commit
05eb4d701c
14 changed files with 210 additions and 261 deletions
|
@ -65,8 +65,6 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object is responsible to maintain layers using by map activity
|
* Object is responsible to maintain layers using by map activity
|
||||||
*/
|
*/
|
||||||
|
@ -273,7 +271,9 @@ public class MapActivityLayers {
|
||||||
final ContextMenuAdapter adapter = new ContextMenuAdapter(app);
|
final ContextMenuAdapter adapter = new ContextMenuAdapter(app);
|
||||||
final List<PoiUIFilter> list = new ArrayList<>();
|
final List<PoiUIFilter> list = new ArrayList<>();
|
||||||
for (PoiUIFilter f : poiFilters.getSortedPoiFilters(true)) {
|
for (PoiUIFilter f : poiFilters.getSortedPoiFilters(true)) {
|
||||||
addFilterToList(adapter, list, f, true);
|
if (!f.isTopWikiFilter()) {
|
||||||
|
addFilterToList(adapter, list, f, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
list.add(poiFilters.getCustomPOIFilter());
|
list.add(poiFilters.getCustomPOIFilter());
|
||||||
adapter.setProfileDependent(true);
|
adapter.setProfileDependent(true);
|
||||||
|
@ -306,9 +306,9 @@ public class MapActivityLayers {
|
||||||
if (filter.isStandardFilter()) {
|
if (filter.isStandardFilter()) {
|
||||||
filter.removeUnsavedFilterByName();
|
filter.removeUnsavedFilterByName();
|
||||||
}
|
}
|
||||||
poiFilters.addSelectedPoiFilter(PoiTemplateList.POI, filter);
|
poiFilters.addSelectedPoiFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
poiFilters.removeSelectedPoiFilter(PoiTemplateList.POI, filter);
|
poiFilters.removeSelectedPoiFilter(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapView.refreshMap();
|
mapView.refreshMap();
|
||||||
|
@ -351,7 +351,9 @@ public class MapActivityLayers {
|
||||||
final List<PoiUIFilter> list = new ArrayList<>();
|
final List<PoiUIFilter> list = new ArrayList<>();
|
||||||
list.add(poiFilters.getCustomPOIFilter());
|
list.add(poiFilters.getCustomPOIFilter());
|
||||||
for (PoiUIFilter f : poiFilters.getSortedPoiFilters(true)) {
|
for (PoiUIFilter f : poiFilters.getSortedPoiFilters(true)) {
|
||||||
addFilterToList(adapter, list, f, false);
|
if (!f.isTopWikiFilter()) {
|
||||||
|
addFilterToList(adapter, list, f, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(activity, !isNightMode(app));
|
final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(activity, !isNightMode(app));
|
||||||
|
@ -370,8 +372,9 @@ public class MapActivityLayers {
|
||||||
if (pf.isStandardFilter()) {
|
if (pf.isStandardFilter()) {
|
||||||
pf.removeUnsavedFilterByName();
|
pf.removeUnsavedFilterByName();
|
||||||
}
|
}
|
||||||
poiFilters.clearSelectedPoiFilters(PoiTemplateList.POI);
|
PoiUIFilter wiki = poiFilters.getTopWikiPoiFilter();
|
||||||
poiFilters.addSelectedPoiFilter(PoiTemplateList.POI, pf);
|
poiFilters.clearSelectedPoiFilters(wiki);
|
||||||
|
poiFilters.addSelectedPoiFilter(pf);
|
||||||
mapView.refreshMap();
|
mapView.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,8 +78,6 @@ import java.util.TreeMap;
|
||||||
|
|
||||||
import gnu.trove.set.hash.TLongHashSet;
|
import gnu.trove.set.hash.TLongHashSet;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search poi activity
|
* Search poi activity
|
||||||
*/
|
*/
|
||||||
|
@ -166,7 +164,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
filter.setFilterByName(searchFilter.getText().toString().trim());
|
filter.setFilterByName(searchFilter.getText().toString().trim());
|
||||||
app.getPoiFilters().addSelectedPoiFilter(PoiTemplateList.POI, filter);
|
app.getPoiFilters().addSelectedPoiFilter(filter);
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), 15);
|
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(), 15);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
import net.osmand.plus.inapp.InAppPurchaseHelper;
|
||||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.render.RendererRegistry;
|
import net.osmand.plus.render.RendererRegistry;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
@ -101,7 +102,6 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.TEXT_SIZE_ID;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.TRANSPORT_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.TRANSPORT_ID;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.WIKIPEDIA_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.WIKIPEDIA_ID;
|
||||||
import static net.osmand.plus.ContextMenuAdapter.makeDeleteAction;
|
import static net.osmand.plus.ContextMenuAdapter.makeDeleteAction;
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_DENSITY_ATTR;
|
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_DENSITY_ATTR;
|
||||||
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_ATTR;
|
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_ATTR;
|
||||||
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_SCHEME_ATTR;
|
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_SCHEME_ATTR;
|
||||||
|
@ -255,7 +255,8 @@ public class ConfigureMapMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId, final int pos, boolean isChecked, int[] viewCoordinates) {
|
public boolean onContextMenuClick(final ArrayAdapter<ContextMenuItem> adapter, int itemId,
|
||||||
|
final int pos, boolean isChecked, int[] viewCoordinates) {
|
||||||
final OsmandSettings settings = ma.getMyApplication().getSettings();
|
final OsmandSettings settings = ma.getMyApplication().getSettings();
|
||||||
final PoiFiltersHelper poiFiltersHelper = ma.getMyApplication().getPoiFilters();
|
final PoiFiltersHelper poiFiltersHelper = ma.getMyApplication().getPoiFilters();
|
||||||
final ContextMenuItem item = cm.getItem(pos);
|
final ContextMenuItem item = cm.getItem(pos);
|
||||||
|
@ -263,12 +264,13 @@ public class ConfigureMapMenu {
|
||||||
item.setColorRes(isChecked ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
item.setColorRes(isChecked ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
||||||
}
|
}
|
||||||
if (itemId == R.string.layer_poi) {
|
if (itemId == R.string.layer_poi) {
|
||||||
poiFiltersHelper.clearSelectedPoiFilters(PoiTemplateList.POI);
|
PoiUIFilter wiki = poiFiltersHelper.getTopWikiPoiFilter();
|
||||||
|
poiFiltersHelper.clearSelectedPoiFilters(wiki);
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
showPoiFilterDialog(adapter, adapter.getItem(pos));
|
showPoiFilterDialog(adapter, adapter.getItem(pos));
|
||||||
} else {
|
} else {
|
||||||
adapter.getItem(pos).setDescription(
|
adapter.getItem(pos).setDescription(
|
||||||
poiFiltersHelper.getSelectedPoiFiltersName(PoiTemplateList.POI));
|
poiFiltersHelper.getSelectedPoiFiltersName(wiki));
|
||||||
}
|
}
|
||||||
} else if (itemId == R.string.layer_amenity_label) {
|
} else if (itemId == R.string.layer_amenity_label) {
|
||||||
settings.SHOW_POI_LABEL.set(isChecked);
|
settings.SHOW_POI_LABEL.set(isChecked);
|
||||||
|
@ -283,17 +285,17 @@ public class ConfigureMapMenu {
|
||||||
showGpxSelectionDialog(adapter, adapter.getItem(pos));
|
showGpxSelectionDialog(adapter, adapter.getItem(pos));
|
||||||
}
|
}
|
||||||
} else if (itemId == R.string.shared_string_wikipedia) {
|
} else if (itemId == R.string.shared_string_wikipedia) {
|
||||||
WikipediaPoiMenu.toggleWikipediaPoi(ma, isChecked, true,
|
WikipediaPoiMenu.toggleWikipediaPoi(ma, isChecked, new CallbackWithObject<Boolean>() {
|
||||||
new CallbackWithObject<Boolean>() {
|
@Override
|
||||||
@Override
|
public boolean processResult(Boolean selected) {
|
||||||
public boolean processResult(Boolean selected) {
|
item.setSelected(selected);
|
||||||
item.setSelected(selected);
|
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
||||||
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
item.setDescription(selected ?
|
||||||
item.setDescription(selected ? WikipediaPoiMenu.getLanguagesSummary(ma.getMyApplication()) : null);
|
WikipediaPoiMenu.getLanguagesSummary(ma.getMyApplication()) : null);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (itemId == R.string.rendering_category_transport) {
|
} else if (itemId == R.string.rendering_category_transport) {
|
||||||
boolean selected = TransportLinesMenu.isShowLines(ma.getMyApplication());
|
boolean selected = TransportLinesMenu.isShowLines(ma.getMyApplication());
|
||||||
TransportLinesMenu.toggleTransportLines(ma, !selected, new CallbackWithObject<Boolean>() {
|
TransportLinesMenu.toggleTransportLines(ma, !selected, new CallbackWithObject<Boolean>() {
|
||||||
|
@ -343,19 +345,20 @@ public class ConfigureMapMenu {
|
||||||
protected void showPoiFilterDialog(final ArrayAdapter<ContextMenuItem> adapter,
|
protected void showPoiFilterDialog(final ArrayAdapter<ContextMenuItem> adapter,
|
||||||
final ContextMenuItem item) {
|
final ContextMenuItem item) {
|
||||||
final PoiFiltersHelper poiFiltersHelper = ma.getMyApplication().getPoiFilters();
|
final PoiFiltersHelper poiFiltersHelper = ma.getMyApplication().getPoiFilters();
|
||||||
|
final PoiUIFilter wiki = poiFiltersHelper.getTopWikiPoiFilter();
|
||||||
MapActivityLayers.DismissListener dismissListener =
|
MapActivityLayers.DismissListener dismissListener =
|
||||||
new MapActivityLayers.DismissListener() {
|
new MapActivityLayers.DismissListener() {
|
||||||
@Override
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
PoiFiltersHelper pf = ma.getMyApplication().getPoiFilters();
|
PoiFiltersHelper pf = ma.getMyApplication().getPoiFilters();
|
||||||
boolean selected = pf.isShowingAnyPoi(PoiTemplateList.POI);
|
boolean selected = pf.isShowingAnyPoi(wiki);
|
||||||
item.setSelected(selected);
|
item.setSelected(selected);
|
||||||
item.setDescription(pf.getSelectedPoiFiltersName(PoiTemplateList.POI));
|
item.setDescription(pf.getSelectedPoiFiltersName(wiki));
|
||||||
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
item.setColorRes(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (poiFiltersHelper.isShowingAnyPoi(PoiTemplateList.POI)) {
|
if (poiFiltersHelper.isShowingAnyPoi(wiki)) {
|
||||||
ma.getMapLayers().showMultichoicePoiFilterDialog(ma.getMapView(),
|
ma.getMapLayers().showMultichoicePoiFilterDialog(ma.getMapView(),
|
||||||
dismissListener);
|
dismissListener);
|
||||||
} else {
|
} else {
|
||||||
|
@ -387,12 +390,13 @@ public class ConfigureMapMenu {
|
||||||
.setItemDeleteAction(makeDeleteAction(settings.SHOW_FAVORITES))
|
.setItemDeleteAction(makeDeleteAction(settings.SHOW_FAVORITES))
|
||||||
.setListener(l)
|
.setListener(l)
|
||||||
.createItem());
|
.createItem());
|
||||||
selected = app.getPoiFilters().isShowingAnyPoi(PoiTemplateList.POI);
|
PoiUIFilter wiki = app.getPoiFilters().getTopWikiPoiFilter();
|
||||||
|
selected = app.getPoiFilters().isShowingAnyPoi(wiki);
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setId(POI_OVERLAY_ID)
|
.setId(POI_OVERLAY_ID)
|
||||||
.setTitleId(R.string.layer_poi, activity)
|
.setTitleId(R.string.layer_poi, activity)
|
||||||
.setSelected(selected)
|
.setSelected(selected)
|
||||||
.setDescription(app.getPoiFilters().getSelectedPoiFiltersName(PoiTemplateList.POI))
|
.setDescription(app.getPoiFilters().getSelectedPoiFiltersName(wiki))
|
||||||
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||||
.setIcon(R.drawable.ic_action_info_dark)
|
.setIcon(R.drawable.ic_action_info_dark)
|
||||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||||
|
@ -428,7 +432,7 @@ public class ConfigureMapMenu {
|
||||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||||
.setListener(l).createItem());
|
.setListener(l).createItem());
|
||||||
|
|
||||||
selected = app.getPoiFilters().isShowingAnyPoi(PoiTemplateList.WIKI);
|
selected = app.getPoiFilters().isTopWikiFilterSelected();
|
||||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||||
.setId(WIKIPEDIA_ID)
|
.setId(WIKIPEDIA_ID)
|
||||||
.setTitleId(R.string.shared_string_wikipedia, activity)
|
.setTitleId(R.string.shared_string_wikipedia, activity)
|
||||||
|
@ -437,7 +441,6 @@ public class ConfigureMapMenu {
|
||||||
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||||
.setIcon(R.drawable.ic_plugin_wikipedia)
|
.setIcon(R.drawable.ic_plugin_wikipedia)
|
||||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||||
.setItemDeleteAction(makeDeleteAction(settings.SHOW_WIKIPEDIA_POI))
|
|
||||||
.setListener(l).createItem());
|
.setListener(l).createItem());
|
||||||
|
|
||||||
selected = settings.SHOW_MAP_MARKERS.get();
|
selected = settings.SHOW_MAP_MARKERS.get();
|
||||||
|
|
|
@ -13,7 +13,6 @@ import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.api.SQLiteAPI;
|
import net.osmand.plus.api.SQLiteAPI;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||||
|
@ -38,10 +37,11 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import static net.osmand.osm.MapPoiTypes.WIKI_PLACE;
|
import static net.osmand.osm.MapPoiTypes.WIKI_PLACE;
|
||||||
|
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.ENABLED_WIKI_POI_LANGUAGES_KEY;
|
||||||
|
import static net.osmand.plus.wikipedia.WikipediaPoiMenu.GLOBAL_WIKI_POI_ENABLED_KEY;
|
||||||
|
|
||||||
public class PoiFiltersHelper {
|
public class PoiFiltersHelper {
|
||||||
|
|
||||||
|
@ -55,10 +55,10 @@ public class PoiFiltersHelper {
|
||||||
private PoiUIFilter customPOIFilter;
|
private PoiUIFilter customPOIFilter;
|
||||||
private PoiUIFilter showAllPOIFilter;
|
private PoiUIFilter showAllPOIFilter;
|
||||||
private PoiUIFilter localWikiPoiFilter;
|
private PoiUIFilter localWikiPoiFilter;
|
||||||
private PoiUIFilter globalWikiPoiFilter;
|
private PoiUIFilter topWikiPoiFilter;
|
||||||
private List<PoiUIFilter> cacheTopStandardFilters;
|
private List<PoiUIFilter> cacheTopStandardFilters;
|
||||||
private List<PoiUIFilter> cacheWikipediaFilters;
|
private Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>();
|
||||||
private Map<PoiTemplateList, Set<PoiUIFilter>> selectedPoiFilters = new TreeMap<>();
|
private boolean updatePoiFiltersOnMap;
|
||||||
|
|
||||||
private static final String UDF_CAR_AID = "car_aid";
|
private static final String UDF_CAR_AID = "car_aid";
|
||||||
private static final String UDF_FOR_TOURISTS = "for_tourists";
|
private static final String UDF_FOR_TOURISTS = "for_tourists";
|
||||||
|
@ -75,10 +75,6 @@ public class PoiFiltersHelper {
|
||||||
UDF_CAR_AID, UDF_FOR_TOURISTS, UDF_FOOD_SHOP, UDF_FUEL, UDF_SIGHTSEEING, UDF_EMERGENCY,
|
UDF_CAR_AID, UDF_FOR_TOURISTS, UDF_FOOD_SHOP, UDF_FUEL, UDF_SIGHTSEEING, UDF_EMERGENCY,
|
||||||
UDF_PUBLIC_TRANSPORT, UDF_ACCOMMODATION, UDF_RESTAURANTS, UDF_PARKING
|
UDF_PUBLIC_TRANSPORT, UDF_ACCOMMODATION, UDF_RESTAURANTS, UDF_PARKING
|
||||||
};
|
};
|
||||||
|
|
||||||
public enum PoiTemplateList {
|
|
||||||
POI, WIKI
|
|
||||||
}
|
|
||||||
|
|
||||||
public PoiFiltersHelper(OsmandApplication application) {
|
public PoiFiltersHelper(OsmandApplication application) {
|
||||||
this.application = application;
|
this.application = application;
|
||||||
|
@ -139,56 +135,42 @@ public class PoiFiltersHelper {
|
||||||
return localWikiPoiFilter;
|
return localWikiPoiFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoiUIFilter getGlobalWikiPoiFilter() {
|
public void prepareTopWikiFilter(@NonNull PoiUIFilter wiki) {
|
||||||
if (globalWikiPoiFilter == null) {
|
boolean prepareByDefault = true;
|
||||||
|
Bundle wikiSettings = WikipediaPoiMenu.getWikiPoiSettings(application);
|
||||||
|
if (wikiSettings != null) {
|
||||||
|
boolean allLanguages = wikiSettings.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
||||||
|
List<String> languages = wikiSettings
|
||||||
|
.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
|
||||||
|
if (!allLanguages && languages != null) {
|
||||||
|
prepareByDefault = false;
|
||||||
|
String wikiLang = "wiki:lang:";
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String lang : languages) {
|
||||||
|
if (sb.length() > 1) {
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
|
sb.append(wikiLang).append(lang);
|
||||||
|
}
|
||||||
|
wiki.setFilterByName(sb.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (prepareByDefault) {
|
||||||
|
wiki.setFilterByName(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PoiUIFilter getTopWikiPoiFilter() {
|
||||||
|
if (topWikiPoiFilter == null) {
|
||||||
String wikiFilterId = PoiUIFilter.STD_PREFIX + "osmwiki";
|
String wikiFilterId = PoiUIFilter.STD_PREFIX + "osmwiki";
|
||||||
for (PoiUIFilter filter : getTopDefinedPoiFilters()) {
|
for (PoiUIFilter filter : getTopDefinedPoiFilters()) {
|
||||||
if (wikiFilterId.equals(filter.getFilterId())) {
|
if (wikiFilterId.equals(filter.getFilterId())) {
|
||||||
globalWikiPoiFilter = filter;
|
topWikiPoiFilter = filter;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return globalWikiPoiFilter;
|
return topWikiPoiFilter;
|
||||||
}
|
|
||||||
|
|
||||||
public List<PoiUIFilter> getLocalWikipediaPoiFilters(boolean onlyActiveLocales) {
|
|
||||||
String wikiLang = "wiki:lang:";
|
|
||||||
if (cacheWikipediaFilters == null) {
|
|
||||||
List<PoiUIFilter> wikipediaFilters = new ArrayList<>();
|
|
||||||
PoiType place = application.getPoiTypes().getPoiTypeByKey(WIKI_PLACE);
|
|
||||||
if (place != null) {
|
|
||||||
for (String locale : application.getPoiTypes().getAllAvailableWikiLocales()) {
|
|
||||||
PoiUIFilter filter = new PoiUIFilter(place, application, " " +
|
|
||||||
WikipediaPoiMenu.getTranslation(application, locale));
|
|
||||||
filter.setSavedFilterByName(wikiLang + locale);
|
|
||||||
filter.setStandardFilter(true);
|
|
||||||
wikipediaFilters.add(filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cacheWikipediaFilters = wikipediaFilters;
|
|
||||||
}
|
|
||||||
if (onlyActiveLocales && cacheWikipediaFilters.size() > 0) {
|
|
||||||
List<PoiUIFilter> onlyActiveLocalFilters = new ArrayList<>();
|
|
||||||
Bundle wikiPoiSettings = WikipediaPoiMenu.getWikiPoiSettings(application);
|
|
||||||
if (wikiPoiSettings != null) {
|
|
||||||
List<String> enabledWikipediaPoiLocales =
|
|
||||||
wikiPoiSettings.getStringArrayList(WikipediaPoiMenu.ENABLED_WIKI_POI_LANGUAGES_KEY);
|
|
||||||
if (enabledWikipediaPoiLocales != null) {
|
|
||||||
for (PoiUIFilter filter : cacheWikipediaFilters) {
|
|
||||||
for (String locale : enabledWikipediaPoiLocales) {
|
|
||||||
String filterId = filter.getSavedFilterByName();
|
|
||||||
String filterLocale = filterId.substring(wikiLang.length());
|
|
||||||
if (locale.equalsIgnoreCase(filterLocale)) {
|
|
||||||
onlyActiveLocalFilters.add(filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return onlyActiveLocalFilters;
|
|
||||||
}
|
|
||||||
return cacheWikipediaFilters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PoiUIFilter getShowAllPOIFilter() {
|
public PoiUIFilter getShowAllPOIFilter() {
|
||||||
|
@ -235,13 +217,9 @@ public class PoiFiltersHelper {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (PoiUIFilter f : getLocalWikipediaPoiFilters(true)) {
|
|
||||||
if (f.getFilterId().equals(filterId)) {
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PoiUIFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(),
|
PoiUIFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(),
|
||||||
getGlobalWikiPoiFilter(), getShowAllPOIFilter(), getNominatimPOIFilter(), getNominatimAddressFilter());
|
getTopWikiPoiFilter(), getLocalWikiPOIFilter(), getShowAllPOIFilter(),
|
||||||
|
getNominatimPOIFilter(), getNominatimAddressFilter());
|
||||||
if (ff != null) {
|
if (ff != null) {
|
||||||
return ff;
|
return ff;
|
||||||
}
|
}
|
||||||
|
@ -306,6 +284,9 @@ public class PoiFiltersHelper {
|
||||||
List<PoiUIFilter> top = new ArrayList<>();
|
List<PoiUIFilter> top = new ArrayList<>();
|
||||||
// user defined
|
// user defined
|
||||||
top.addAll(getUserDefinedPoiFilters(true));
|
top.addAll(getUserDefinedPoiFilters(true));
|
||||||
|
if (getLocalWikiPOIFilter() != null) {
|
||||||
|
top.add(getLocalWikiPOIFilter());
|
||||||
|
}
|
||||||
// default
|
// default
|
||||||
MapPoiTypes poiTypes = application.getPoiTypes();
|
MapPoiTypes poiTypes = application.getPoiTypes();
|
||||||
for (AbstractPoiType t : poiTypes.getTopVisibleFilters()) {
|
for (AbstractPoiType t : poiTypes.getTopVisibleFilters()) {
|
||||||
|
@ -505,79 +486,68 @@ public class PoiFiltersHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<PoiUIFilter> getSelectedPoiFilters() {
|
public Set<PoiUIFilter> getSelectedPoiFilters(PoiUIFilter ... filtersToExclude) {
|
||||||
Set<PoiUIFilter> result = new TreeSet<>();
|
if (filtersToExclude != null) {
|
||||||
for (Set<PoiUIFilter> template : selectedPoiFilters.values()) {
|
Set<PoiUIFilter> filters = new TreeSet<>();
|
||||||
if (template != null) {
|
for (PoiUIFilter filter : selectedPoiFilters) {
|
||||||
result.addAll(template);
|
boolean skip = false;
|
||||||
|
for (PoiUIFilter filterToExclude : filtersToExclude) {
|
||||||
|
String filterToExcludeId = filterToExclude.getFilterId();
|
||||||
|
if (filterToExcludeId != null && filterToExcludeId.equals(filter.getFilterId())) {
|
||||||
|
skip = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!skip) {
|
||||||
|
filters.add(filter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return filters;
|
||||||
}
|
}
|
||||||
return result;
|
return selectedPoiFilters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
public void addSelectedPoiFilter(PoiUIFilter filter) {
|
||||||
public Set<PoiUIFilter> getSelectedPoiFilters(PoiTemplateList type) {
|
if (filter.isTopWikiFilter()) {
|
||||||
Set<PoiUIFilter> result = selectedPoiFilters.get(type);
|
prepareTopWikiFilter(filter);
|
||||||
if (result == null) {
|
|
||||||
return new TreeSet<>();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addSelectedPoiFilter(PoiTemplateList type, PoiUIFilter filter) {
|
|
||||||
if (!selectedPoiFilters.containsKey(type)) {
|
|
||||||
selectedPoiFilters.put(type, new TreeSet<PoiUIFilter>());
|
|
||||||
}
|
|
||||||
Set<PoiUIFilter> templateFilters = selectedPoiFilters.get(type);
|
|
||||||
if (templateFilters != null) {
|
|
||||||
templateFilters.add(filter);
|
|
||||||
}
|
}
|
||||||
|
selectedPoiFilters.add(filter);
|
||||||
saveSelectedPoiFilters();
|
saveSelectedPoiFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSelectedPoiFilter(PoiTemplateList type, PoiUIFilter filter) {
|
public void removeSelectedPoiFilter(PoiUIFilter filter) {
|
||||||
if (selectedPoiFilters.containsKey(type)) {
|
selectedPoiFilters.remove(filter);
|
||||||
Set<PoiUIFilter> templateFilters = selectedPoiFilters.get(type);
|
saveSelectedPoiFilters();
|
||||||
if (templateFilters != null) {
|
}
|
||||||
templateFilters.remove(filter);
|
|
||||||
|
public boolean isShowingAnyPoi(PoiUIFilter ... filtersToExclude) {
|
||||||
|
return !getSelectedPoiFilters(filtersToExclude).isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearSelectedPoiFilters(PoiUIFilter ... filtersToExclude) {
|
||||||
|
if (filtersToExclude != null && filtersToExclude.length > 0) {
|
||||||
|
Iterator<PoiUIFilter> it = selectedPoiFilters.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
PoiUIFilter filter = it.next();
|
||||||
|
boolean skip = false;
|
||||||
|
for (PoiUIFilter filterToExclude : filtersToExclude) {
|
||||||
|
String filterToExcludeId = filterToExclude.getFilterId();
|
||||||
|
if (filterToExcludeId != null
|
||||||
|
&& filterToExcludeId.equals(filter.getFilterId())) {
|
||||||
|
skip = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!skip) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
selectedPoiFilters.clear();
|
||||||
}
|
}
|
||||||
saveSelectedPoiFilters();
|
saveSelectedPoiFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isShowingAnyPoi() {
|
|
||||||
for (PoiTemplateList type : selectedPoiFilters.keySet()) {
|
|
||||||
if (isShowingAnyPoi(type)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isShowingAnyPoi(PoiTemplateList type) {
|
|
||||||
return !getSelectedPoiFilters(type).isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearSelectedPoiFilters() {
|
|
||||||
for (PoiTemplateList t : selectedPoiFilters.keySet()) {
|
|
||||||
clearSelectedPoiFilters(t);
|
|
||||||
}
|
|
||||||
saveSelectedPoiFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearSelectedPoiFilters(PoiTemplateList type) {
|
|
||||||
Set<PoiUIFilter> templateFilters = selectedPoiFilters.get(type);
|
|
||||||
if (templateFilters != null) {
|
|
||||||
templateFilters.clear();
|
|
||||||
}
|
|
||||||
saveSelectedPoiFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hidePoiFilters() {
|
|
||||||
selectedPoiFilters.clear();
|
|
||||||
saveSelectedPoiFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFiltersName(Set<PoiUIFilter> filters) {
|
public String getFiltersName(Set<PoiUIFilter> filters) {
|
||||||
if (filters.isEmpty()) {
|
if (filters.isEmpty()) {
|
||||||
return application.getResources().getString(R.string.shared_string_none);
|
return application.getResources().getString(R.string.shared_string_none);
|
||||||
|
@ -590,23 +560,28 @@ public class PoiFiltersHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectedPoiFiltersName(PoiTemplateList type) {
|
public String getSelectedPoiFiltersName(PoiUIFilter ... filtersToExclude) {
|
||||||
return getFiltersName(getSelectedPoiFilters(type));
|
return getFiltersName(getSelectedPoiFilters(filtersToExclude));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPoiFilterSelected(PoiUIFilter filter) {
|
public boolean isPoiFilterSelected(PoiUIFilter filter) {
|
||||||
for (Set<PoiUIFilter> template : selectedPoiFilters.values()) {
|
return selectedPoiFilters.contains(filter);
|
||||||
return template.contains(filter);
|
}
|
||||||
|
|
||||||
|
public boolean isTopWikiFilterSelected() {
|
||||||
|
String wikiFilterId = getTopWikiPoiFilter().getFilterId();
|
||||||
|
for (PoiUIFilter filter : selectedPoiFilters) {
|
||||||
|
if (wikiFilterId.equals(filter.getFilterId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPoiFilterSelected(String filterId) {
|
public boolean isPoiFilterSelected(String filterId) {
|
||||||
for (Set<PoiUIFilter> template : selectedPoiFilters.values()) {
|
for (PoiUIFilter filter : selectedPoiFilters) {
|
||||||
for (PoiUIFilter filter : template) {
|
if (filter.filterId.equals(filterId)) {
|
||||||
if (filter.filterId.equals(filterId)) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -618,21 +593,16 @@ public class PoiFiltersHelper {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
selectedPoiFilters.clear();
|
selectedPoiFilters.clear();
|
||||||
OsmandSettings settings = application.getSettings();
|
for (String f : application.getSettings().getSelectedPoiFilters()) {
|
||||||
Set<String> filters = settings.getSelectedPoiFilters();
|
|
||||||
boolean shouldShowWikiPoi = WikipediaPoiMenu.isWikiPoiEnabled(application);
|
|
||||||
for (String f : filters) {
|
|
||||||
PoiUIFilter filter = getFilterById(f);
|
PoiUIFilter filter = getFilterById(f);
|
||||||
if (filter != null) {
|
if (filter != null) {
|
||||||
if (filter.isWikiFilter()) {
|
if (filter.isTopWikiFilter()) {
|
||||||
if (shouldShowWikiPoi) {
|
prepareTopWikiFilter(filter);
|
||||||
addSelectedPoiFilter(PoiTemplateList.WIKI, filter);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
addSelectedPoiFilter(PoiTemplateList.POI, filter);
|
|
||||||
}
|
}
|
||||||
|
selectedPoiFilters.add(filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updatePoiFiltersOnMap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -664,14 +634,22 @@ public class PoiFiltersHelper {
|
||||||
|
|
||||||
private void saveSelectedPoiFilters() {
|
private void saveSelectedPoiFilters() {
|
||||||
Set<String> filters = new HashSet<>();
|
Set<String> filters = new HashSet<>();
|
||||||
for (Set<PoiUIFilter> template : selectedPoiFilters.values()) {
|
for (PoiUIFilter filter : selectedPoiFilters) {
|
||||||
for (PoiUIFilter filter : template) {
|
filters.add(filter.filterId);
|
||||||
filters.add(filter.filterId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
application.getSettings().setSelectedPoiFilters(filters);
|
application.getSettings().setSelectedPoiFilters(filters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldUpdatePoiFiltersOnMap() {
|
||||||
|
boolean shouldUpdate = updatePoiFiltersOnMap;
|
||||||
|
updatePoiFiltersOnMap = false;
|
||||||
|
return shouldUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatePoiFiltersOnMap(boolean updatePoiFiltersOnMap) {
|
||||||
|
this.updatePoiFiltersOnMap = updatePoiFiltersOnMap;
|
||||||
|
}
|
||||||
|
|
||||||
public class PoiFilterDbHelper {
|
public class PoiFilterDbHelper {
|
||||||
|
|
||||||
private static final int TRUE_INT = 1;
|
private static final int TRUE_INT = 1;
|
||||||
|
|
|
@ -150,8 +150,11 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWikiFilter() {
|
public boolean isWikiFilter() {
|
||||||
return filterId.startsWith(STD_PREFIX + WIKI_PLACE)
|
return filterId.startsWith(STD_PREFIX + WIKI_PLACE) || isTopWikiFilter();
|
||||||
|| filterId.equals(STD_PREFIX + OSM_WIKI_CATEGORY);
|
}
|
||||||
|
|
||||||
|
public boolean isTopWikiFilter() {
|
||||||
|
return filterId.equals(STD_PREFIX + OSM_WIKI_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFilterByName() {
|
public String getFilterByName() {
|
||||||
|
|
|
@ -33,8 +33,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
public class ShowHidePoiAction extends QuickAction {
|
public class ShowHidePoiAction extends QuickAction {
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,18 +112,18 @@ public class ShowHidePoiAction extends QuickAction {
|
||||||
PoiFiltersHelper pf = activity.getMyApplication().getPoiFilters();
|
PoiFiltersHelper pf = activity.getMyApplication().getPoiFilters();
|
||||||
List<PoiUIFilter> poiFilters = loadPoiFilters(activity.getMyApplication().getPoiFilters());
|
List<PoiUIFilter> poiFilters = loadPoiFilters(activity.getMyApplication().getPoiFilters());
|
||||||
|
|
||||||
if (!isCurrentFilters(pf.getSelectedPoiFilters(PoiTemplateList.POI), poiFilters)) {
|
if (!isCurrentFilters(pf.getSelectedPoiFilters(), poiFilters)) {
|
||||||
|
|
||||||
pf.clearSelectedPoiFilters(PoiTemplateList.POI);
|
pf.clearSelectedPoiFilters();
|
||||||
|
|
||||||
for (PoiUIFilter filter : poiFilters) {
|
for (PoiUIFilter filter : poiFilters) {
|
||||||
if (filter.isStandardFilter()) {
|
if (filter.isStandardFilter()) {
|
||||||
filter.removeUnsavedFilterByName();
|
filter.removeUnsavedFilterByName();
|
||||||
}
|
}
|
||||||
pf.addSelectedPoiFilter(PoiTemplateList.POI, filter);
|
pf.addSelectedPoiFilter(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else pf.clearSelectedPoiFilters(PoiTemplateList.POI);
|
} else pf.clearSelectedPoiFilters();
|
||||||
|
|
||||||
activity.getMapLayers().updateLayers(activity.getMapView());
|
activity.getMapLayers().updateLayers(activity.getMapView());
|
||||||
}
|
}
|
||||||
|
@ -135,7 +133,7 @@ public class ShowHidePoiAction extends QuickAction {
|
||||||
PoiFiltersHelper pf = application.getPoiFilters();
|
PoiFiltersHelper pf = application.getPoiFilters();
|
||||||
List<PoiUIFilter> poiFilters = loadPoiFilters(application.getPoiFilters());
|
List<PoiUIFilter> poiFilters = loadPoiFilters(application.getPoiFilters());
|
||||||
|
|
||||||
return isCurrentFilters(pf.getSelectedPoiFilters(PoiTemplateList.POI), poiFilters);
|
return isCurrentFilters(pf.getSelectedPoiFilters(), poiFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCurrentFilters(Set<PoiUIFilter> currentPoiFilters, List<PoiUIFilter> poiFilters) {
|
private boolean isCurrentFilters(Set<PoiUIFilter> currentPoiFilters, List<PoiUIFilter> poiFilters) {
|
||||||
|
|
|
@ -120,8 +120,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
public class MapRouteInfoMenu implements IRouteInformationListener, CardListener, FavoritesListener {
|
public class MapRouteInfoMenu implements IRouteInformationListener, CardListener, FavoritesListener {
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapRouteInfoMenu.class);
|
private static final Log LOG = PlatformUtil.getLog(MapRouteInfoMenu.class);
|
||||||
|
@ -1158,7 +1156,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
private void createShowAlongTheRouteItems(MapActivity mapActivity, LinearLayout optionsContainer) {
|
private void createShowAlongTheRouteItems(MapActivity mapActivity, LinearLayout optionsContainer) {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
final ApplicationMode applicationMode = app.getRoutingHelper().getAppMode();
|
final ApplicationMode applicationMode = app.getRoutingHelper().getAppMode();
|
||||||
final Set<PoiUIFilter> poiFilters = app.getPoiFilters().getSelectedPoiFilters(PoiTemplateList.POI);
|
final Set<PoiUIFilter> poiFilters = app.getPoiFilters().getSelectedPoiFilters();
|
||||||
final boolean traffic = app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(applicationMode);
|
final boolean traffic = app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(applicationMode);
|
||||||
final boolean fav = app.getSettings().SHOW_NEARBY_FAVORITES.getModeValue(applicationMode);
|
final boolean fav = app.getSettings().SHOW_NEARBY_FAVORITES.getModeValue(applicationMode);
|
||||||
if (!poiFilters.isEmpty()) {
|
if (!poiFilters.isEmpty()) {
|
||||||
|
@ -1184,7 +1182,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
mapActivity.getMyApplication().getPoiFilters().removeSelectedPoiFilter(PoiTemplateList.POI, poiUIFilter);
|
mapActivity.getMyApplication().getPoiFilters()
|
||||||
|
.removeSelectedPoiFilter(poiUIFilter);
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
updateOptionsButtons();
|
updateOptionsButtons();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,8 +45,6 @@ import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment implements IRouteInformationListener, IRoutingDataUpdateListener {
|
public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment implements IRouteInformationListener, IRoutingDataUpdateListener {
|
||||||
|
|
||||||
public static final String TAG = "ShowAlongTheRouteBottomSheet";
|
public static final String TAG = "ShowAlongTheRouteBottomSheet";
|
||||||
|
@ -436,8 +434,8 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
View v;
|
View v;
|
||||||
if (type == WaypointHelper.POI) {
|
if (type == WaypointHelper.POI) {
|
||||||
v = themedInflater.inflate(R.layout.along_the_route_radius_poi, null);
|
v = themedInflater.inflate(R.layout.along_the_route_radius_poi, null);
|
||||||
String descEx = !app.getPoiFilters().isShowingAnyPoi(PoiTemplateList.POI) ?
|
String descEx = !app.getPoiFilters().isShowingAnyPoi() ?
|
||||||
getString(R.string.poi) : app.getPoiFilters().getSelectedPoiFiltersName(PoiTemplateList.POI);
|
getString(R.string.poi) : app.getPoiFilters().getSelectedPoiFiltersName();
|
||||||
((TextView) v.findViewById(R.id.title)).setText(getString(R.string.search_radius_proximity) + ":");
|
((TextView) v.findViewById(R.id.title)).setText(getString(R.string.search_radius_proximity) + ":");
|
||||||
((TextView) v.findViewById(R.id.titleEx)).setText(getString(R.string.shared_string_type) + ":");
|
((TextView) v.findViewById(R.id.titleEx)).setText(getString(R.string.shared_string_type) + ":");
|
||||||
final TextView radiusEx = (TextView) v.findViewById(R.id.descriptionEx);
|
final TextView radiusEx = (TextView) v.findViewById(R.id.descriptionEx);
|
||||||
|
@ -487,7 +485,7 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
new MapActivityLayers.DismissListener() {
|
new MapActivityLayers.DismissListener() {
|
||||||
@Override
|
@Override
|
||||||
public void dismiss() {
|
public void dismiss() {
|
||||||
if (app.getPoiFilters().isShowingAnyPoi(PoiTemplateList.POI)) {
|
if (app.getPoiFilters().isShowingAnyPoi()) {
|
||||||
enableType(type, enable);
|
enableType(type, enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,6 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
import static net.osmand.plus.search.SendSearchQueryBottomSheet.MISSING_SEARCH_LOCATION_KEY;
|
import static net.osmand.plus.search.SendSearchQueryBottomSheet.MISSING_SEARCH_LOCATION_KEY;
|
||||||
import static net.osmand.plus.search.SendSearchQueryBottomSheet.MISSING_SEARCH_QUERY_KEY;
|
import static net.osmand.plus.search.SendSearchQueryBottomSheet.MISSING_SEARCH_QUERY_KEY;
|
||||||
import static net.osmand.search.core.ObjectType.POI_TYPE;
|
import static net.osmand.search.core.ObjectType.POI_TYPE;
|
||||||
|
@ -388,8 +387,8 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
} else {
|
} else {
|
||||||
filter = (PoiUIFilter) searchPhrase.getLastSelectedWord().getResult().object;
|
filter = (PoiUIFilter) searchPhrase.getLastSelectedWord().getResult().object;
|
||||||
}
|
}
|
||||||
app.getPoiFilters().clearSelectedPoiFilters(PoiTemplateList.POI);
|
app.getPoiFilters().clearSelectedPoiFilters();
|
||||||
app.getPoiFilters().addSelectedPoiFilter(PoiTemplateList.POI, filter);
|
app.getPoiFilters().addSelectedPoiFilter(filter);
|
||||||
|
|
||||||
mapActivity.getContextMenu().closeActiveToolbar();
|
mapActivity.getContextMenu().closeActiveToolbar();
|
||||||
showToolbar();
|
showToolbar();
|
||||||
|
@ -866,7 +865,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeSearch() {
|
public void closeSearch() {
|
||||||
app.getPoiFilters().clearSelectedPoiFilters(PoiTemplateList.POI);
|
app.getPoiFilters().clearSelectedPoiFilters();
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@ import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
public class QuickSearchHelper implements ResourceListener {
|
public class QuickSearchHelper implements ResourceListener {
|
||||||
|
|
||||||
public static final int SEARCH_FAVORITE_API_PRIORITY = 50;
|
public static final int SEARCH_FAVORITE_API_PRIORITY = 50;
|
||||||
|
@ -504,8 +502,8 @@ public class QuickSearchHelper implements ResourceListener {
|
||||||
});
|
});
|
||||||
controller.setTitle(filter.getName());
|
controller.setTitle(filter.getName());
|
||||||
PoiFiltersHelper helper = mapActivity.getMyApplication().getPoiFilters();
|
PoiFiltersHelper helper = mapActivity.getMyApplication().getPoiFilters();
|
||||||
helper.clearSelectedPoiFilters(PoiTemplateList.POI);
|
helper.clearSelectedPoiFilters();
|
||||||
helper.addSelectedPoiFilter(PoiTemplateList.POI, filter);
|
helper.addSelectedPoiFilter(filter);
|
||||||
mapActivity.showTopToolbar(controller);
|
mapActivity.showTopToolbar(controller);
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -514,7 +512,7 @@ public class QuickSearchHelper implements ResourceListener {
|
||||||
@NonNull TopToolbarController controller,
|
@NonNull TopToolbarController controller,
|
||||||
@Nullable Runnable action) {
|
@Nullable Runnable action) {
|
||||||
mapActivity.hideTopToolbar(controller);
|
mapActivity.hideTopToolbar(controller);
|
||||||
mapActivity.getMyApplication().getPoiFilters().clearSelectedPoiFilters(PoiTemplateList.POI);
|
mapActivity.getMyApplication().getPoiFilters().clearSelectedPoiFilters();
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
action.run();
|
action.run();
|
||||||
|
|
|
@ -1525,7 +1525,6 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public final CommonPreference<Boolean> WIKI_ARTICLE_SHOW_IMAGES_ASKED = new BooleanPreference("wikivoyage_show_images_asked", false).makeGlobal();
|
public final CommonPreference<Boolean> WIKI_ARTICLE_SHOW_IMAGES_ASKED = new BooleanPreference("wikivoyage_show_images_asked", false).makeGlobal();
|
||||||
public final CommonPreference<WikiArticleShowImages> WIKI_ARTICLE_SHOW_IMAGES = new EnumStringPreference<>("wikivoyage_show_imgs", WikiArticleShowImages.OFF, WikiArticleShowImages.values()).makeGlobal();
|
public final CommonPreference<WikiArticleShowImages> WIKI_ARTICLE_SHOW_IMAGES = new EnumStringPreference<>("wikivoyage_show_imgs", WikiArticleShowImages.OFF, WikiArticleShowImages.values()).makeGlobal();
|
||||||
public final CommonPreference<Boolean> SHOW_WIKIPEDIA_POI = new BooleanPreference("show_wikipedia_poi", false).makeProfile();
|
|
||||||
public final CommonPreference<Boolean> GLOBAL_WIKIPEDIA_POI_ENABLED = new BooleanPreference("global_wikipedia_poi_enabled", false).makeProfile();
|
public final CommonPreference<Boolean> GLOBAL_WIKIPEDIA_POI_ENABLED = new BooleanPreference("global_wikipedia_poi_enabled", false).makeProfile();
|
||||||
public final ListStringPreference WIKIPEDIA_POI_ENABLED_LANGUAGES = (ListStringPreference) new ListStringPreference("wikipedia_poi_enabled_languages", null, ",").makeProfile().cache();
|
public final ListStringPreference WIKIPEDIA_POI_ENABLED_LANGUAGES = (ListStringPreference) new ListStringPreference("wikipedia_poi_enabled_languages", null, ",").makeProfile().cache();
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.helpers.WaypointHelper;
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
|
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||||
import net.osmand.plus.poi.PoiUIFilter;
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.routing.IRouteInformationListener;
|
import net.osmand.plus.routing.IRouteInformationListener;
|
||||||
|
@ -204,8 +205,9 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||||
Set<PoiUIFilter> selectedPoiFilters = app.getPoiFilters().getSelectedPoiFilters();
|
PoiFiltersHelper ph = app.getPoiFilters();
|
||||||
if (!this.filters.equals(selectedPoiFilters)) {
|
Set<PoiUIFilter> selectedPoiFilters = ph.getSelectedPoiFilters();
|
||||||
|
if (!this.filters.equals(selectedPoiFilters) || ph.shouldUpdatePoiFiltersOnMap()) {
|
||||||
this.filters = new TreeSet<>(selectedPoiFilters);
|
this.filters = new TreeSet<>(selectedPoiFilters);
|
||||||
data.clearCache();
|
data.clearCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,7 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
||||||
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked, topDefined));
|
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), checked, topDefined));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
isGlobalWikiPoiEnabled = true;
|
||||||
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
|
for (String locale : app.getPoiTypes().getAllAvailableWikiLocales()) {
|
||||||
boolean topDefined = preferredLocales.contains(locale);
|
boolean topDefined = preferredLocales.contains(locale);
|
||||||
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false, topDefined));
|
languages.add(new WikiLanguageItem(locale, WikipediaPoiMenu.getTranslation(app, locale), false, topDefined));
|
||||||
|
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static net.osmand.osm.MapPoiTypes.WIKI_LANG;
|
import static net.osmand.osm.MapPoiTypes.WIKI_LANG;
|
||||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
|
||||||
|
|
||||||
public class WikipediaPoiMenu {
|
public class WikipediaPoiMenu {
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ public class WikipediaPoiMenu {
|
||||||
final int toggleActionStringId = R.string.shared_string_wikipedia;
|
final int toggleActionStringId = R.string.shared_string_wikipedia;
|
||||||
final int languageActionStringId = R.string.shared_string_language;
|
final int languageActionStringId = R.string.shared_string_language;
|
||||||
final int spaceHeight = app.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_big_item_height);
|
final int spaceHeight = app.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_big_item_height);
|
||||||
final boolean enabled = app.getPoiFilters().isShowingAnyPoi(PoiTemplateList.WIKI);
|
final boolean enabled = app.getPoiFilters().isTopWikiFilterSelected();
|
||||||
ContextMenuAdapter adapter = new ContextMenuAdapter(app);
|
ContextMenuAdapter adapter = new ContextMenuAdapter(app);
|
||||||
adapter.setDefaultLayoutId(R.layout.dash_item_with_description_72dp);
|
adapter.setDefaultLayoutId(R.layout.dash_item_with_description_72dp);
|
||||||
adapter.setProfileDependent(true);
|
adapter.setProfileDependent(true);
|
||||||
|
@ -76,11 +75,11 @@ public class WikipediaPoiMenu {
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
toggleWikipediaPoi(mapActivity, !enabled, true, callback);
|
toggleWikipediaPoi(mapActivity, !enabled, callback);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (itemId == languageActionStringId) {
|
} else if (itemId == languageActionStringId) {
|
||||||
showLanguagesDialog(mapActivity, appMode, true, true, callback);
|
showLanguagesDialog(mapActivity, appMode, true, callback);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +233,6 @@ public class WikipediaPoiMenu {
|
||||||
private static void showLanguagesDialog(@NonNull final MapActivity mapActivity,
|
private static void showLanguagesDialog(@NonNull final MapActivity mapActivity,
|
||||||
@NonNull final ApplicationMode appMode,
|
@NonNull final ApplicationMode appMode,
|
||||||
final boolean usedOnMap,
|
final boolean usedOnMap,
|
||||||
final boolean refresh,
|
|
||||||
final CallbackWithObject<Boolean> callback) {
|
final CallbackWithObject<Boolean> callback) {
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
SelectWikiLanguagesBottomSheet.showInstance(mapActivity, appMode, usedOnMap,
|
SelectWikiLanguagesBottomSheet.showInstance(mapActivity, appMode, usedOnMap,
|
||||||
|
@ -244,15 +242,9 @@ public class WikipediaPoiMenu {
|
||||||
if (result) {
|
if (result) {
|
||||||
Bundle wikiPoiSetting = getWikiPoiSettingsForProfile(app, appMode);
|
Bundle wikiPoiSetting = getWikiPoiSettingsForProfile(app, appMode);
|
||||||
if (wikiPoiSetting != null) {
|
if (wikiPoiSetting != null) {
|
||||||
boolean globalWikiEnabled =
|
refreshWikipediaOnMap(mapActivity);
|
||||||
wikiPoiSetting.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
|
||||||
if (refresh) {
|
|
||||||
refreshWikiPoi(mapActivity, globalWikiEnabled);
|
|
||||||
} else {
|
|
||||||
toggleWikipediaPoi(mapActivity, true, usedOnMap, callback);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
toggleWikipediaPoi(mapActivity, false, usedOnMap, callback);
|
toggleWikipediaPoi(mapActivity, false, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -304,65 +296,47 @@ public class WikipediaPoiMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void toggleWikipediaPoi(final MapActivity mapActivity, boolean enable,
|
public static void toggleWikipediaPoi(final MapActivity mapActivity, boolean enable,
|
||||||
boolean usedOnMap, CallbackWithObject<Boolean> callback) {
|
CallbackWithObject<Boolean> callback) {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
OsmandSettings settings = app.getSettings();
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
Bundle wikiPoiSettings = getWikiPoiSettings(app);
|
showWikipediaOnMap(app);
|
||||||
if (wikiPoiSettings != null) {
|
|
||||||
settings.SHOW_WIKIPEDIA_POI.set(true);
|
|
||||||
boolean globalWikiEnabled = wikiPoiSettings.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
|
||||||
showWikiOnMap(app, globalWikiEnabled);
|
|
||||||
} else {
|
|
||||||
ApplicationMode appMode = settings.getApplicationMode();
|
|
||||||
showLanguagesDialog(mapActivity, appMode, usedOnMap, false, callback);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
settings.SHOW_WIKIPEDIA_POI.set(false);
|
hideWikipediaFromMap(app);
|
||||||
hideWikiFromMap(app);
|
|
||||||
}
|
}
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.processResult(settings.SHOW_WIKIPEDIA_POI.get());
|
callback.processResult(enable);
|
||||||
}
|
}
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void refreshWikiPoi(MapActivity mapActivity, boolean globalWikiEnabled) {
|
public static void refreshWikipediaOnMap(MapActivity mapActivity) {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
hideWikiFromMap(app);
|
hideWikipediaFromMap(app);
|
||||||
showWikiOnMap(app, globalWikiEnabled);
|
showWikipediaOnMap(app);
|
||||||
|
app.getPoiFilters().setUpdatePoiFiltersOnMap(true);
|
||||||
mapActivity.getDashboard().refreshContent(true);
|
mapActivity.getDashboard().refreshContent(true);
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showWikiOnMap(OsmandApplication app, boolean globalWikiEnabled) {
|
private static void showWikipediaOnMap(OsmandApplication app) {
|
||||||
PoiFiltersHelper ph = app.getPoiFilters();
|
PoiFiltersHelper ph = app.getPoiFilters();
|
||||||
if (globalWikiEnabled) {
|
PoiUIFilter wiki = ph.getTopWikiPoiFilter();
|
||||||
ph.addSelectedPoiFilter(PoiTemplateList.WIKI, ph.getGlobalWikiPoiFilter());
|
ph.addSelectedPoiFilter(wiki);
|
||||||
} else {
|
|
||||||
List<PoiUIFilter> filters = ph.getLocalWikipediaPoiFilters(true);
|
|
||||||
for (PoiUIFilter filter : filters) {
|
|
||||||
ph.addSelectedPoiFilter(PoiTemplateList.WIKI, filter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void hideWikiFromMap(OsmandApplication app) {
|
private static void hideWikipediaFromMap(OsmandApplication app) {
|
||||||
PoiFiltersHelper ph = app.getPoiFilters();
|
PoiFiltersHelper ph = app.getPoiFilters();
|
||||||
for (PoiUIFilter filter : ph.getSelectedPoiFilters(PoiTemplateList.WIKI)) {
|
PoiUIFilter wiki = ph.getTopWikiPoiFilter();
|
||||||
ph.removePoiFilter(filter);
|
ph.removePoiFilter(wiki);
|
||||||
}
|
ph.removeSelectedPoiFilter(wiki);
|
||||||
ph.clearSelectedPoiFilters(PoiTemplateList.WIKI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLanguagesSummary(OsmandApplication app) {
|
public static String getLanguagesSummary(OsmandApplication app) {
|
||||||
Bundle wikiLanguagesSetting = getWikiPoiSettings(app);
|
Bundle wikiSetting = getWikiPoiSettings(app);
|
||||||
if (wikiLanguagesSetting != null) {
|
if (wikiSetting != null) {
|
||||||
boolean globalWikiEnabled = wikiLanguagesSetting.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
boolean globalWikiEnabled = wikiSetting.getBoolean(GLOBAL_WIKI_POI_ENABLED_KEY);
|
||||||
List<String> enabledLocales = wikiLanguagesSetting.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
|
List<String> enabledLocales = wikiSetting.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
|
||||||
if (globalWikiEnabled) {
|
if (!globalWikiEnabled && enabledLocales != null) {
|
||||||
return app.getString(R.string.shared_string_all_languages);
|
|
||||||
} else if (enabledLocales != null) {
|
|
||||||
List<String> translations = new ArrayList<>();
|
List<String> translations = new ArrayList<>();
|
||||||
for (String locale : enabledLocales) {
|
for (String locale : enabledLocales) {
|
||||||
translations.add(getTranslation(app, locale));
|
translations.add(getTranslation(app, locale));
|
||||||
|
@ -370,11 +344,7 @@ public class WikipediaPoiMenu {
|
||||||
return android.text.TextUtils.join(", ", translations);
|
return android.text.TextUtils.join(", ", translations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return app.getString(R.string.shared_string_all_languages);
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isWikiPoiEnabled(OsmandApplication app) {
|
|
||||||
return app.getSettings().SHOW_WIKIPEDIA_POI.get() && getWikiPoiSettings(app) != null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) {
|
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) {
|
||||||
|
@ -385,7 +355,7 @@ public class WikipediaPoiMenu {
|
||||||
@NonNull Set<String> availableArticleLangs,
|
@NonNull Set<String> availableArticleLangs,
|
||||||
String preferredLanguage) {
|
String preferredLanguage) {
|
||||||
Bundle wikiPoiSettings = getWikiPoiSettings(app);
|
Bundle wikiPoiSettings = getWikiPoiSettings(app);
|
||||||
if (!app.getSettings().SHOW_WIKIPEDIA_POI.get() || wikiPoiSettings == null) {
|
if (!app.getPoiFilters().isTopWikiFilterSelected() || wikiPoiSettings == null) {
|
||||||
// Wikipedia POI setting disabled
|
// Wikipedia POI setting disabled
|
||||||
return preferredLanguage;
|
return preferredLanguage;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue