From bdb3845431cdb1d87ee37dc7361e42f077aeb403 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Wed, 30 Sep 2015 20:45:24 +0300 Subject: [PATCH] EditPoiFragment. SecondTabBroken. --- .../plus/osmedit/AdvancedDataFragment.java | 13 ++++++++----- .../osmand/plus/osmedit/BasicDataFragment.java | 3 --- .../osmand/plus/osmedit/data/EditPoiData.java | 18 +++++++++++------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java index a379fbe878..14f33d89d6 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedDataFragment.java @@ -181,9 +181,11 @@ public class AdvancedDataFragment extends Fragment public void updateViews() { linearLayout.removeAllViews(); + editPoiData.setIsInEdit(true); for (Entry tag : editPoiData.getTagValues().entrySet()) { addTagView(tag.getKey(), tag.getValue()); } + editPoiData.setIsInEdit(false); } public void addTagView(String tg, String vl) { @@ -201,21 +203,20 @@ public class AdvancedDataFragment extends Fragment } final AutoCompleteTextView tagEditText = (AutoCompleteTextView) convertView.findViewById(R.id.tagEditText); - tagEditText.setText(tg); - final AutoCompleteTextView valueEditText = - (AutoCompleteTextView) convertView.findViewById(R.id.valueEditText); ImageButton deleteItemImageButton = (ImageButton) convertView.findViewById(R.id.deleteItemImageButton); - valueEditText.setText(vl); deleteItemImageButton.setImageDrawable(deleteDrawable); final String[] previousTag = new String[]{tg}; deleteItemImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { linearLayout.removeView((View) v.getParent()); - editPoiData.removeTag(tagEditText.toString()); + editPoiData.removeTag(tagEditText.getText().toString()); } }); + final AutoCompleteTextView valueEditText = + (AutoCompleteTextView) convertView.findViewById(R.id.valueEditText); + tagEditText.setText(tg); tagEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -259,6 +260,8 @@ public class AdvancedDataFragment extends Fragment } }); + + valueEditText.setText(vl); valueEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java index 857ce4a0ef..38553d550d 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/BasicDataFragment.java @@ -324,7 +324,4 @@ public class BasicDataFragment extends Fragment return view; } } - - // TODO: 8/27/15 Consider moving to OpeningHoursParser - } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/data/EditPoiData.java b/OsmAnd/src/net/osmand/plus/osmedit/data/EditPoiData.java index a397e3c696..8067974d7c 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/data/EditPoiData.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/data/EditPoiData.java @@ -1,17 +1,17 @@ package net.osmand.plus.osmedit.data; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - 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 java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + public class EditPoiData { private Set mListeners = new HashSet<>(); private LinkedHashMap tagValues = new LinkedHashMap(); @@ -107,7 +107,11 @@ public class EditPoiData { isInEdit = false; } } - + + public void setIsInEdit(boolean isInEdit) { + this.isInEdit = isInEdit; + } + public boolean isInEdit() { return isInEdit; }