Add missing listener

This commit is contained in:
Victor Shcherb 2015-09-30 12:26:12 +02:00
parent 00c43a45b4
commit 028130a318

View file

@ -11,6 +11,7 @@ import net.osmand.plus.IconsCache;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.osmedit.data.EditPoiData; import net.osmand.plus.osmedit.data.EditPoiData;
import net.osmand.plus.osmedit.data.EditPoiData.TagsChangedListener;
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment; import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
import net.osmand.plus.osmedit.dialogs.OpeningHoursHoursDialogFragment; import net.osmand.plus.osmedit.dialogs.OpeningHoursHoursDialogFragment;
import net.osmand.util.OpeningHoursParser; import net.osmand.util.OpeningHoursParser;
@ -92,6 +93,7 @@ public class BasicDataFragment extends Fragment {
phoneEditText = (EditText) view.findViewById(R.id.phoneEditText); phoneEditText = (EditText) view.findViewById(R.id.phoneEditText);
webSiteEditText = (EditText) view.findViewById(R.id.webSiteEditText); webSiteEditText = (EditText) view.findViewById(R.id.webSiteEditText);
descriptionEditText = (EditText) view.findViewById(R.id.descriptionEditText); descriptionEditText = (EditText) view.findViewById(R.id.descriptionEditText);
listeners.clear();
addTextWatcher(OSMSettings.OSMTagKey.ADDR_STREET.getValue(), streetEditText); addTextWatcher(OSMSettings.OSMTagKey.ADDR_STREET.getValue(), streetEditText);
addTextWatcher(OSMSettings.OSMTagKey.WEBSITE.getValue(), webSiteEditText); addTextWatcher(OSMSettings.OSMTagKey.WEBSITE.getValue(), webSiteEditText);
addTextWatcher(OSMSettings.OSMTagKey.PHONE.getValue(), phoneEditText); addTextWatcher(OSMSettings.OSMTagKey.PHONE.getValue(), phoneEditText);
@ -156,7 +158,7 @@ public class BasicDataFragment extends Fragment {
// } // }
} }
protected void addTextWatcher(final String tag, EditText e) { protected void addTextWatcher(final String tag, final EditText e) {
e.addTextChangedListener(new TextWatcher() { e.addTextChangedListener(new TextWatcher() {
@Override @Override
@ -175,6 +177,18 @@ public class BasicDataFragment extends Fragment {
} }
}); });
listeners.add(new TagsChangedListener() {
@Override
public void onTagsChanged() {
String vl = getData().getTagValues().get(tag);
if(vl == null) {
vl = "";
}
e.setText(vl);
}
});
} }
@Override @Override