diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java b/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java index 186a81abfd..81462b1d4d 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AddPOIAction.java @@ -121,7 +121,7 @@ public class AddPOIAction extends QuickAction { Node node = new Node(latLon.getLatitude(), latLon.getLongitude(), -1); node.replaceTags(getTagsFromParams()); EditPoiData editPoiData = new EditPoiData(node, activity.getMyApplication()); - if (Boolean.valueOf(getParams().get(KEY_DIALOG))) { + if (Boolean.parseBoolean(getParams().get(KEY_DIALOG)) || editPoiData.hasEmptyValue()) { Entity newEntity = editPoiData.getEntity(); EditPoiDialogFragment editPoiDialogFragment = EditPoiDialogFragment.createInstance(newEntity, true, getTagsFromParams()); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java index 541df2c7f6..3aba617bda 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java @@ -196,6 +196,9 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment continue; addTagView(tag.getKey(), tag.getValue()); } + if (editPoiData.hasEmptyValue()) { + linearLayout.findViewById(R.id.valueEditText).requestFocus(); + } editPoiData.setIsInEdit(false); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java index 6931dd8592..86ea01258e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiData.java @@ -7,7 +7,6 @@ import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiType; import net.osmand.osm.edit.Entity; import net.osmand.plus.OsmandApplication; -import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -91,7 +90,7 @@ public class EditPoiData { } private void tryAddTag(String key, String value) { - if (!Algorithms.isEmpty(value)) { + if (value != null) { tagValues.put(key, value); } } @@ -118,7 +117,6 @@ public class EditPoiData { return Collections.unmodifiableMap(tagValues); } - public void putTag(String tag, String value) { checkNotInEdit(); try { @@ -136,7 +134,6 @@ public class EditPoiData { } } - private void checkNotInEdit() { if(isInEdit) { throw new IllegalStateException("Can't modify in edit mode"); @@ -254,4 +251,13 @@ public class EditPoiData { changedTags.removeAll(Arrays.asList(currentPoiType.getEditOsmTag(), currentPoiType.getOsmTag2())); } } + + public boolean hasEmptyValue() { + for (String value : tagValues.values()) { + if (value.isEmpty()) { + return true; + } + } + return false; + } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java index 0a93dc3419..848fd77fd1 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPoiDialogFragment.java @@ -97,7 +97,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { private static final String TAGS_LIST = "tags_list"; private static final String IS_ADDING_POI = "is_adding_poi"; - public static final HashSet BASIC_TAGS = new HashSet() ; + public static final HashSet BASIC_TAGS = new HashSet(); + public static final int ADVANCED_TAB = 1; + static { BASIC_TAGS.add(OSMSettings.OSMTagKey.NAME.getValue()); BASIC_TAGS.add(OSMSettings.OSMTagKey.ADDR_STREET.getValue()); @@ -379,6 +381,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment { }); setAdapterForPoiTypeEditText(); setCancelable(false); + if (editPoiData.hasEmptyValue()) { + viewPager.setCurrentItem(ADVANCED_TAB); + } return view; }