Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-09-30 19:46:57 +02:00
commit 93596c066b
3 changed files with 19 additions and 15 deletions

View file

@ -181,9 +181,11 @@ public class AdvancedDataFragment extends Fragment
public void updateViews() { public void updateViews() {
linearLayout.removeAllViews(); linearLayout.removeAllViews();
editPoiData.setIsInEdit(true);
for (Entry<String, String> tag : editPoiData.getTagValues().entrySet()) { for (Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
addTagView(tag.getKey(), tag.getValue()); addTagView(tag.getKey(), tag.getValue());
} }
editPoiData.setIsInEdit(false);
} }
public void addTagView(String tg, String vl) { public void addTagView(String tg, String vl) {
@ -201,21 +203,20 @@ public class AdvancedDataFragment extends Fragment
} }
final AutoCompleteTextView tagEditText = final AutoCompleteTextView tagEditText =
(AutoCompleteTextView) convertView.findViewById(R.id.tagEditText); (AutoCompleteTextView) convertView.findViewById(R.id.tagEditText);
tagEditText.setText(tg);
final AutoCompleteTextView valueEditText =
(AutoCompleteTextView) convertView.findViewById(R.id.valueEditText);
ImageButton deleteItemImageButton = ImageButton deleteItemImageButton =
(ImageButton) convertView.findViewById(R.id.deleteItemImageButton); (ImageButton) convertView.findViewById(R.id.deleteItemImageButton);
valueEditText.setText(vl);
deleteItemImageButton.setImageDrawable(deleteDrawable); deleteItemImageButton.setImageDrawable(deleteDrawable);
final String[] previousTag = new String[]{tg}; final String[] previousTag = new String[]{tg};
deleteItemImageButton.setOnClickListener(new View.OnClickListener() { deleteItemImageButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
linearLayout.removeView((View) v.getParent()); 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() { tagEditText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { 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() { valueEditText.addTextChangedListener(new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {

View file

@ -324,7 +324,4 @@ public class BasicDataFragment extends Fragment
return view; return view;
} }
} }
// TODO: 8/27/15 Consider moving to OpeningHoursParser
} }

View file

@ -1,17 +1,17 @@
package net.osmand.plus.osmedit.data; 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.data.Amenity;
import net.osmand.osm.PoiType; import net.osmand.osm.PoiType;
import net.osmand.osm.edit.Node; import net.osmand.osm.edit.Node;
import net.osmand.osm.edit.OSMSettings; import net.osmand.osm.edit.OSMSettings;
import net.osmand.util.Algorithms; 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 { public class EditPoiData {
private Set<TagsChangedListener> mListeners = new HashSet<>(); private Set<TagsChangedListener> mListeners = new HashSet<>();
private LinkedHashMap<String, String > tagValues = new LinkedHashMap<String, String>(); private LinkedHashMap<String, String > tagValues = new LinkedHashMap<String, String>();
@ -107,7 +107,11 @@ public class EditPoiData {
isInEdit = false; isInEdit = false;
} }
} }
public void setIsInEdit(boolean isInEdit) {
this.isInEdit = isInEdit;
}
public boolean isInEdit() { public boolean isInEdit() {
return isInEdit; return isInEdit;
} }