Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d41f911900
1 changed files with 17 additions and 23 deletions
|
@ -7,6 +7,7 @@ import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnFocusChangeListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
|
@ -14,7 +15,6 @@ import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
@ -193,28 +193,23 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
||||||
final AutoCompleteTextView valueEditText =
|
final AutoCompleteTextView valueEditText =
|
||||||
(AutoCompleteTextView) convertView.findViewById(R.id.valueEditText);
|
(AutoCompleteTextView) convertView.findViewById(R.id.valueEditText);
|
||||||
tagEditText.setText(tg);
|
tagEditText.setText(tg);
|
||||||
tagEditText.addTextChangedListener(new TextWatcher() {
|
tagEditText.setAdapter(tagAdapter);
|
||||||
@Override
|
tagEditText.setThreshold(1);
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
tagEditText.setOnFocusChangeListener(new OnFocusChangeListener() {
|
||||||
if (!editPoiData.isInEdit()) {
|
@Override
|
||||||
editPoiData.removeTag(s.toString());
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if (!hasFocus) {
|
||||||
|
if (!editPoiData.isInEdit()) {
|
||||||
|
String s = tagEditText.getText().toString();
|
||||||
|
editPoiData.removeTag(previousTag[0]);
|
||||||
|
editPoiData.putTag(s.toString(), valueEditText.getText().toString());
|
||||||
|
previousTag[0] = s.toString();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tagAdapter.getFilter().filter(tagEditText.getText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
if (!editPoiData.isInEdit()) {
|
|
||||||
editPoiData.removeTag(previousTag[0]);
|
|
||||||
editPoiData.putTag(s.toString(), valueEditText.getText().toString());
|
|
||||||
previousTag[0] = s.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
initAutocompleteTextView(tagEditText, tagAdapter);
|
|
||||||
|
|
||||||
valueEditText.setText(vl);
|
valueEditText.setText(vl);
|
||||||
valueEditText.addTextChangedListener(new TextWatcher() {
|
valueEditText.addTextChangedListener(new TextWatcher() {
|
||||||
|
@ -261,8 +256,7 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
||||||
|
|
||||||
private static void initAutocompleteTextView(final AutoCompleteTextView textView,
|
private static void initAutocompleteTextView(final AutoCompleteTextView textView,
|
||||||
final ArrayAdapter<String> adapter) {
|
final ArrayAdapter<String> adapter) {
|
||||||
textView.setAdapter(adapter);
|
|
||||||
textView.setThreshold(1);
|
|
||||||
textView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
textView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFocusChange(View v, boolean hasFocus) {
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
|
Loading…
Reference in a new issue