This commit is contained in:
Victor Shcherb 2018-05-17 01:21:17 +02:00
parent 9ea3c852d7
commit 9752fb70cd
3 changed files with 32 additions and 13 deletions

View file

@ -179,23 +179,34 @@ public class MapPoiTypes {
if (skipNonEditable && pc.isNotEditableOsm()) { if (skipNonEditable && pc.isNotEditableOsm()) {
continue; continue;
} }
for (PoiType pt : pc.getPoiTypes()) { for (PoiFilter pf : pc.getPoiFilters()) {
if (pt.isReference()) { if (skipNonEditable && pf.isNotEditableOsm()) {
continue; continue;
} }
if (pt.getBaseLangType() != null) { addPoiTypesTranslation(skipNonEditable, translation, pf);
continue;
}
if (skipNonEditable && pt.isNotEditableOsm()) {
continue;
}
translation.put(pt.getKeyName().replace('_', ' ').toLowerCase(), pt);
translation.put(pt.getTranslation().toLowerCase(), pt);
} }
addPoiTypesTranslation(skipNonEditable, translation, pc);
} }
return translation; return translation;
} }
private void addPoiTypesTranslation(boolean skipNonEditable, Map<String, PoiType> translation, PoiFilter pf) {
for (PoiType pt : pf.getPoiTypes()) {
if (pt.isReference()) {
continue;
}
if (pt.getBaseLangType() != null) {
continue;
}
if (skipNonEditable && pt.isNotEditableOsm()) {
continue;
}
translation.put(pt.getKeyName().replace('_', ' ').toLowerCase(), pt);
translation.put(pt.getTranslation().toLowerCase(), pt);
}
}
public List<AbstractPoiType> getAllTypesTranslatedNames(StringMatcher matcher) { public List<AbstractPoiType> getAllTypesTranslatedNames(StringMatcher matcher) {
List<AbstractPoiType> tm = new ArrayList<AbstractPoiType>(); List<AbstractPoiType> tm = new ArrayList<AbstractPoiType>();
for (PoiCategory pc : categories) { for (PoiCategory pc : categories) {

View file

@ -215,6 +215,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
}); });
valueEditText.setText(vl); valueEditText.setText(vl);
valueEditText.setAdapter(valueAdapter);
valueEditText.setThreshold(3);
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) {
@ -279,7 +281,8 @@ public class AdvancedEditPoiFragment extends BaseOsmAndFragment
} }
if (poiType.getEditOsmTag() != null && if (poiType.getEditOsmTag() != null &&
!poiType.getEditOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) { !poiType.getEditOsmTag().equals(OSMSettings.OSMTagKey.NAME.getValue())) {
stringSet.add(poiType.getEditOsmTag()); String editOsmTag = poiType.getEditOsmTag();
stringSet.add(editOsmTag);
if (poiType.getOsmTag2() != null) { if (poiType.getOsmTag2() != null) {
stringSet.add(poiType.getOsmTag2()); stringSet.add(poiType.getOsmTag2());
} }

View file

@ -580,11 +580,16 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
if(!s.getKeyName().contains("osmand")) { if(!s.getKeyName().contains("osmand")) {
addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s); addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s);
} }
if(!Algorithms.isEmpty(s.getEditOsmValue())) {
addMapEntryAdapter(subCategories, s.getEditOsmValue().replace('_', ' '), s);
}
} }
} }
} }
for (Map.Entry<String, PoiType> s : editPoiData.getAllTranslatedSubTypes().entrySet()) { for (Map.Entry<String, PoiType> s : editPoiData.getAllTranslatedSubTypes().entrySet()) {
addMapEntryAdapter(subCategories, s.getKey(), s.getValue()); if(!s.getKey().contains("osmand")) {
addMapEntryAdapter(subCategories, s.getKey(), s.getValue());
}
} }
final ArrayAdapter<Object> adapter; final ArrayAdapter<Object> adapter;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {