diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java index b2bd9b2d9a..d3c86131b7 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicEditPoiFragment.java @@ -20,6 +20,7 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; + import net.osmand.PlatformUtil; import net.osmand.osm.edit.OSMSettings; import net.osmand.plus.IconsCache; @@ -229,8 +230,13 @@ public class BasicEditPoiFragment extends Fragment linearLayout.addView(getView(i)); } if (!data.isInEdit()) { - data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(), - openingHours.toStringNoMonths()); + String openingHoursString = openingHours.toStringNoMonths(); + if (!TextUtils.isEmpty(openingHoursString)) { + data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(), + openingHoursString); + } else { + data.removeTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue()); + } } } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java index 7791e3ef29..b255d55406 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java @@ -1,11 +1,14 @@ package net.osmand.plus.osmedit; +import net.osmand.PlatformUtil; import net.osmand.data.Amenity; import net.osmand.osm.PoiType; import net.osmand.osm.edit.Node; import net.osmand.osm.edit.OSMSettings; import net.osmand.util.Algorithms; +import org.apache.commons.logging.Log; + import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; @@ -13,6 +16,7 @@ import java.util.Map; import java.util.Set; public class EditPoiData { + private static final Log LOG = PlatformUtil.getLog(EditPoiData.class); private Set mListeners = new HashSet<>(); private LinkedHashMap tagValues = new LinkedHashMap(); private boolean isInEdit = false; @@ -46,8 +50,8 @@ public class EditPoiData { amenity.getPhone()); tryAddTag(OSMSettings.OSMTagKey.WEBSITE.getValue(), amenity.getSite()); - for (String tag : node.getTagKeySet()) { - tryAddTag(tag, node.getTag(tag)); + for (String tag : amenity.getAdditionalInfo().keySet()) { + tryAddTag(tag, amenity.getAdditionalInfo(tag)); } String subType = amenity.getSubType(); String key; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 7e4183b568..5ec24ac042 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -216,7 +216,12 @@ public class EditPoiDialogFragment extends DialogFragment { @Override public void afterTextChanged(Editable s) { if (!getEditPoiData().isInEdit()) { - getEditPoiData().putTag(OSMSettings.OSMTagKey.NAME.getValue(), s.toString()); + if (!TextUtils.isEmpty(s)) { + getEditPoiData().putTag(OSMSettings.OSMTagKey.NAME.getValue(), + s.toString()); + } else { + getEditPoiData().removeTag(OSMSettings.OSMTagKey.NAME.getValue()); + } } } }); @@ -244,8 +249,7 @@ public class EditPoiDialogFragment extends DialogFragment { poiTypeEditText.setText(editPoiData.amenity.getSubType()); Button saveButton = (Button) view.findViewById(R.id.saveButton); - int saveButtonTextId = R.string.default_buttons_commit; - saveButton.setText(saveButtonTextId); + saveButton.setText(R.string.shared_string_save); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -333,8 +337,7 @@ public class EditPoiDialogFragment extends DialogFragment { getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { - if (keyCode == android.view.KeyEvent.KEYCODE_BACK - && editPoiData.hasChangesBeenMade()) { + if (keyCode == android.view.KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_DOWN) { return true; } else {