Fix poi editing
This commit is contained in:
parent
f3584ea58a
commit
64345810e0
4 changed files with 22 additions and 9 deletions
|
@ -187,6 +187,7 @@ public class EditPoiData {
|
|||
if(pt != null) {
|
||||
tagValues.remove(pt.getOsmTag());
|
||||
tagValues.remove(pt.getOsmTag2());
|
||||
category = pt.getCategory();
|
||||
}
|
||||
notifyDatasetChanged(POI_TYPE_TAG);
|
||||
}
|
||||
|
|
|
@ -316,15 +316,17 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
HashSet<String> tagsCopy = new HashSet<>();
|
||||
tagsCopy.addAll(editPoiData.getTagValues().keySet());
|
||||
tagsCopy.removeAll(BASIC_TAGS);
|
||||
if (tagsCopy.isEmpty() || editPoiData.getPoiCategory() == getMyApplication().getPoiTypes().getOtherPoiCategory()) {
|
||||
if (tagsCopy.isEmpty()) {
|
||||
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
|
||||
} else {
|
||||
new SaveWithAdvancedTagsDialogFragment().show(getChildFragmentManager(), "dialog");
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else if(editPoiData.getPoiCategory() == getMyApplication().getPoiTypes().getOtherPoiCategory()) {
|
||||
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
|
||||
} else {
|
||||
save();
|
||||
}
|
||||
}
|
||||
|
||||
private void save() {
|
||||
Node original = editPoiData.getEntity();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.osmand.plus.osmedit.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
@ -27,11 +25,15 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
final PoiCategory a = poiTypes.getPoiCategoryByName((String) getArguments().getSerializable(KEY_POI_CATEGORY));
|
||||
Set<String> strings = new TreeSet<>();
|
||||
for (PoiType s : a.getPoiTypes()) {
|
||||
if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
||||
strings.add(s.getTranslation());
|
||||
if(a == poiTypes.getOtherPoiCategory()) {
|
||||
for (PoiCategory category : poiTypes.getCategories(false)) {
|
||||
if (!category.isNotEditableOsm()) {
|
||||
addCategory(category, strings);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addCategory(a, strings);
|
||||
}
|
||||
final String[] subCats = strings.toArray(new String[strings.size()]);
|
||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
|
@ -43,6 +45,14 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
|
|||
return builder.create();
|
||||
}
|
||||
|
||||
private void addCategory(final PoiCategory a, Set<String> strings) {
|
||||
for (PoiType s : a.getPoiTypes()) {
|
||||
if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
||||
strings.add(s.getTranslation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static PoiSubTypeDialogFragment createInstance(PoiCategory cat) {
|
||||
PoiSubTypeDialogFragment fragment = new PoiSubTypeDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
|
|
Loading…
Reference in a new issue