Merge branch 'master' of https://github.com/osmandapp/Osmand
This commit is contained in:
commit
7fa2ccef32
2 changed files with 16 additions and 7 deletions
|
@ -26,14 +26,13 @@ public class EditPoiData {
|
|||
private boolean hasChangesBeenMade = false;
|
||||
private Map<String, PoiType> allTranslatedSubTypes;
|
||||
private PoiCategory category;
|
||||
private String subtype;
|
||||
|
||||
public EditPoiData(Node node, OsmandApplication app) {
|
||||
allTranslatedSubTypes = app.getPoiTypes().getAllTranslatedNames(true);
|
||||
category = app.getPoiTypes().getOtherPoiCategory();
|
||||
subtype = "";
|
||||
entity = node;
|
||||
initTags(node);
|
||||
updateTypeTag(getPoiTypeString());
|
||||
}
|
||||
|
||||
public Map<String, PoiType> getAllTranslatedSubTypes() {
|
||||
|
@ -43,7 +42,7 @@ public class EditPoiData {
|
|||
public void updateType(PoiCategory type) {
|
||||
if(type != null && type != category) {
|
||||
category = type;
|
||||
subtype = "";
|
||||
tagValues.put(POI_TYPE_TAG, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +56,8 @@ public class EditPoiData {
|
|||
}
|
||||
|
||||
public String getPoiTypeString() {
|
||||
return subtype;
|
||||
String s = tagValues.get(POI_TYPE_TAG) ;
|
||||
return s == null ? "" : s;
|
||||
}
|
||||
|
||||
public Node getEntity() {
|
||||
|
@ -94,7 +94,6 @@ public class EditPoiData {
|
|||
if(tp != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(tp);
|
||||
if (pt != null) {
|
||||
subtype = tp;
|
||||
category = pt.getCategory();
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +180,16 @@ public class EditPoiData {
|
|||
return hasChangesBeenMade;
|
||||
}
|
||||
|
||||
public void updateTypeTag(String string) {
|
||||
tagValues.put(POI_TYPE_TAG, string);
|
||||
retrieveType();
|
||||
PoiType pt = getPoiTypeDefined();
|
||||
if(pt != null) {
|
||||
tagValues.remove(pt.getOsmTag());
|
||||
tagValues.remove(pt.getOsmTag2());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -250,7 +250,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (!getEditPoiData().isInEdit()) {
|
||||
getEditPoiData().putTag(EditPoiData.POI_TYPE_TAG, s.toString());
|
||||
getEditPoiData().updateTypeTag(s.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -314,7 +314,7 @@ public class EditPoiDialogFragment extends DialogFragment {
|
|||
if (poiType.getOsmTag2() != null) {
|
||||
node.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
|
||||
}
|
||||
} else {
|
||||
} else if (!Algorithms.isEmpty(tag.getValue())) {
|
||||
node.putTag(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue