From 744b36b87c78e5d02681ff2b3b9719a767ab1766 Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Sat, 25 Jul 2020 18:01:09 +0300 Subject: [PATCH 1/2] Fix #6589 (Changing POI category on an existing object has no impact.(try to change the category by tapping on label icon)) --- .../net/osmand/plus/osmedit/EditPoiDialogFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 932ef59db5..f31cf04c51 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -112,6 +112,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { private EditPoiData editPoiData; private EditPoiViewPager viewPager; private AutoCompleteTextView poiTypeEditText; + private boolean poiCategoryChanged; private OnSaveButtonClickListener onSaveButtonClickListener; private OpenstreetmapUtil mOpenstreetmapUtil; @@ -298,7 +299,11 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { @Override public void afterTextChanged(Editable s) { if (!getEditPoiData().isInEdit()) { - getEditPoiData().updateTypeTag(s.toString(), true); + if (!poiCategoryChanged) { + getEditPoiData().updateTypeTag(s.toString(), true); + } else { + poiCategoryChanged = false; + } if (!getMyApplication().isApplicationInitializing()) { PoiCategory category = editPoiData.getPoiCategory(); if (category != null) { @@ -643,6 +648,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { } public void setPoiCategory(PoiCategory type) { + poiCategoryChanged = true; editPoiData.updateType(type); poiTypeEditText.setText(editPoiData.getPoiTypeString()); setAdapterForPoiTypeEditText(); From b2335175cf4b16480e73b295f0b435b495cd019c Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Wed, 29 Jul 2020 16:20:29 +0300 Subject: [PATCH 2/2] Fix Changing POI category on an existing object has no impact --- OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java | 2 ++ .../net/osmand/plus/osmedit/EditPoiDialogFragment.java | 8 +------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java index e081c60c59..27a25bfc1c 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java @@ -51,6 +51,8 @@ public class EditPoiData { category = type; tagValues.put(POI_TYPE_TAG, ""); changedTags.add(POI_TYPE_TAG); + removeCurrentTypeTag(); + currentPoiType=null; } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index f31cf04c51..932ef59db5 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -112,7 +112,6 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { private EditPoiData editPoiData; private EditPoiViewPager viewPager; private AutoCompleteTextView poiTypeEditText; - private boolean poiCategoryChanged; private OnSaveButtonClickListener onSaveButtonClickListener; private OpenstreetmapUtil mOpenstreetmapUtil; @@ -299,11 +298,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { @Override public void afterTextChanged(Editable s) { if (!getEditPoiData().isInEdit()) { - if (!poiCategoryChanged) { - getEditPoiData().updateTypeTag(s.toString(), true); - } else { - poiCategoryChanged = false; - } + getEditPoiData().updateTypeTag(s.toString(), true); if (!getMyApplication().isApplicationInitializing()) { PoiCategory category = editPoiData.getPoiCategory(); if (category != null) { @@ -648,7 +643,6 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { } public void setPoiCategory(PoiCategory type) { - poiCategoryChanged = true; editPoiData.updateType(type); poiTypeEditText.setText(editPoiData.getPoiTypeString()); setAdapterForPoiTypeEditText();