From 1ae6e344b1a01fd7b124661530883edd631afd1c Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 7 Sep 2018 17:48:04 +0300 Subject: [PATCH 1/2] Fix deleting basic tags in offline mode --- .../src/net/osmand/plus/osmedit/BasicEditPoiFragment.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java index f745f0f084..746daa6f8f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java @@ -46,6 +46,8 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment private EditText webSiteEditText; private EditText descriptionEditText; OpeningHoursAdapter mOpeningHoursAdapter; + + private boolean basicTagsInitialized = false; @Nullable @Override @@ -130,7 +132,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment if (data != null && !data.isInEdit()) { if (!TextUtils.isEmpty(s)) { data.putTag(tag, s.toString()); - } else { + } else if (basicTagsInitialized && isResumed()) { data.removeTag(tag); } } @@ -178,6 +180,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment } mOpeningHoursAdapter.replaceOpeningHours(openingHours); mOpeningHoursAdapter.updateViews(); + basicTagsInitialized = true; } private class OpeningHoursAdapter { @@ -223,7 +226,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(), openingHoursString); } - } else { + } else if (basicTagsInitialized && isResumed()) { data.removeTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue()); } } From 5057c46c21bd4a161fbe8fdc55df9851d496bedd Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 7 Sep 2018 18:17:44 +0300 Subject: [PATCH 2/2] Fix deleting basic tags in offline mode after switching tabs --- OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java index 746daa6f8f..f476a7528a 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java @@ -165,6 +165,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment if (data == null) { return; } + basicTagsInitialized = false; Map tagValues = data.getTagValues(); streetEditText.setText(tagValues.get(OSMSettings.OSMTagKey.ADDR_STREET.getValue())); houseNumberEditText.setText(tagValues.get(OSMSettings.OSMTagKey.ADDR_HOUSE_NUMBER.getValue()));