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