fix export custom poi types with all categories selected
This commit is contained in:
parent
9d9dd32503
commit
e6ad6f3c38
3 changed files with 18 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,20 @@ 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<>();
|
||||
for (PoiType poiType : category.getPoiTypes()) {
|
||||
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