Merge pull request #11430 from osmandapp/fix_export_custom_poi_types
Fix export custom poi types
This commit is contained in:
commit
7ac56c9359
3 changed files with 19 additions and 3 deletions
|
@ -542,7 +542,8 @@ public class QuickSearchCustomPoiFragment extends DialogFragment implements OnFi
|
|||
titleView.setText(textString);
|
||||
Set<String> subtypes = filter.getAcceptedSubtypes(category);
|
||||
if (categorySelected) {
|
||||
if (subtypes == null) {
|
||||
LinkedHashSet<String> poiTypes = filter.getAcceptedTypes().get(category);
|
||||
if (subtypes == null || (poiTypes != null && category.getPoiTypes().size() == poiTypes.size())) {
|
||||
descView.setText(getString(R.string.shared_string_all));
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -101,7 +101,7 @@ public class QuickSearchSubCategoriesFragment extends BaseOsmAndDialogFragment {
|
|||
updateAddBtnVisibility();
|
||||
}
|
||||
});
|
||||
if (selectAll || acceptedCategories == null) {
|
||||
if (selectAll || acceptedCategories == null || poiCategory.getPoiTypes().size() == acceptedCategories.size()) {
|
||||
adapter.setSelectedItems(poiTypeList);
|
||||
selectAll = true;
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.google.gson.reflect.TypeToken;
|
|||
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
|
@ -148,7 +149,21 @@ public class PoiUiFiltersSettingsItem extends CollectionSettingsItem<PoiUIFilter
|
|||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("name", filter.getName());
|
||||
jsonObject.put("filterId", filter.getFilterId());
|
||||
jsonObject.put("acceptedTypes", gson.toJson(filter.getAcceptedTypes(), type));
|
||||
|
||||
Map<PoiCategory, LinkedHashSet<String>> acceptedTypes = filter.getAcceptedTypes();
|
||||
for (PoiCategory category : acceptedTypes.keySet()) {
|
||||
LinkedHashSet<String> poiTypes = acceptedTypes.get(category);
|
||||
if (poiTypes == null) {
|
||||
poiTypes = new LinkedHashSet<>();
|
||||
List<PoiType> types = category.getPoiTypes();
|
||||
for (PoiType poiType : types) {
|
||||
poiTypes.add(poiType.getKeyName());
|
||||
}
|
||||
acceptedTypes.put(category, poiTypes);
|
||||
}
|
||||
}
|
||||
|
||||
jsonObject.put("acceptedTypes", gson.toJson(acceptedTypes, type));
|
||||
jsonArray.put(jsonObject);
|
||||
}
|
||||
json.put("items", jsonArray);
|
||||
|
|
Loading…
Reference in a new issue