diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiSubTypeDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiSubTypeDialogFragment.java index a25295985f..c2872e6e68 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiSubTypeDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiSubTypeDialogFragment.java @@ -2,6 +2,8 @@ package net.osmand.plus.osmedit.dialogs; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.TreeSet; import net.osmand.osm.MapPoiTypes; import net.osmand.osm.PoiCategory; @@ -24,7 +26,7 @@ public class PoiSubTypeDialogFragment extends DialogFragment { MapPoiTypes poiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); final PoiCategory a = poiTypes.getPoiCategoryByName((String) getArguments().getSerializable(KEY_POI_CATEGORY)); - List strings = new ArrayList<>(); + Set strings = new TreeSet<>(); for (PoiType s : a.getPoiTypes()) { if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) { strings.add(s.getTranslation()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiTypeDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiTypeDialogFragment.java index 287d9b27a9..808ce6acf4 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiTypeDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/PoiTypeDialogFragment.java @@ -21,17 +21,14 @@ public class PoiTypeDialogFragment extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { MapPoiTypes poiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes(); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - final List categories = poiTypes.getCategories(false); - ArrayList vals = new ArrayList<>(categories.size()); - ArrayList toDelete = new ArrayList<>(); - for (PoiCategory category : categories) { - if (category.isNotEditableOsm()) { - toDelete.add(category); - } else { + final List categories = new ArrayList(); + ArrayList vals = new ArrayList<>(); + for (PoiCategory category : poiTypes.getCategories(false)) { + if (!category.isNotEditableOsm()) { vals.add(category.getTranslation()); + categories.add(category); } } - categories.removeAll(toDelete); builder.setItems(vals.toArray(new String[vals.size()]), new Dialog.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) {