add checks for getPoiCategory
This commit is contained in:
parent
ff4b3f4046
commit
144e0012c1
3 changed files with 18 additions and 8 deletions
|
@ -1,5 +1,7 @@
|
||||||
package net.osmand.plus.osmedit;
|
package net.osmand.plus.osmedit;
|
||||||
|
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
|
@ -52,7 +54,7 @@ public class EditPoiData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public PoiCategory getPoiCategory() {
|
public PoiCategory getPoiCategory() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
if (!getEditPoiData().isInEdit()) {
|
if (!getEditPoiData().isInEdit()) {
|
||||||
getEditPoiData().updateTypeTag(s.toString(), true);
|
getEditPoiData().updateTypeTag(s.toString(), true);
|
||||||
if (!getMyApplication().isApplicationInitializing()) {
|
if (!getMyApplication().isApplicationInitializing()) {
|
||||||
poiTypeTextInputLayout.setHint(editPoiData.getPoiCategory().getTranslation());
|
PoiCategory category = editPoiData.getPoiCategory();
|
||||||
|
if (category != null) {
|
||||||
|
poiTypeTextInputLayout.setHint(category.getTranslation());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,9 +292,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
if (event.getX() >= (editText.getRight()
|
if (event.getX() >= (editText.getRight()
|
||||||
- editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
|
- editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
|
||||||
- editText.getPaddingRight())) {
|
- editText.getPaddingRight())) {
|
||||||
if (editPoiData.getPoiCategory() != null) {
|
PoiCategory category = editPoiData.getPoiCategory();
|
||||||
|
if (category != null) {
|
||||||
PoiSubTypeDialogFragment dialogFragment =
|
PoiSubTypeDialogFragment dialogFragment =
|
||||||
PoiSubTypeDialogFragment.createInstance(editPoiData.getPoiCategory());
|
PoiSubTypeDialogFragment.createInstance(category);
|
||||||
dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
|
dialogFragment.setOnItemSelectListener(new PoiSubTypeDialogFragment.OnItemSelectListener() {
|
||||||
@Override
|
@Override
|
||||||
public void select(String category) {
|
public void select(String category) {
|
||||||
|
@ -466,8 +470,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
|
||||||
node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag2());
|
node.removeTag(EditPoiData.REMOVE_TAG_PREFIX + poiType.getOsmTag2());
|
||||||
}
|
}
|
||||||
} else if (!Algorithms.isEmpty(poiTypeTag)) {
|
} else if (!Algorithms.isEmpty(poiTypeTag)) {
|
||||||
node.putTagNoLC(editPoiData.getPoiCategory().getDefaultTag(), poiTypeTag);
|
PoiCategory category = editPoiData.getPoiCategory();
|
||||||
|
if (category != null) {
|
||||||
|
node.putTagNoLC(category.getDefaultTag(), poiTypeTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (offlineEdit && !Algorithms.isEmpty(poiTypeTag)) {
|
if (offlineEdit && !Algorithms.isEmpty(poiTypeTag)) {
|
||||||
node.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiTypeTag);
|
node.putTagNoLC(EditPoiData.POI_TYPE_TAG, poiTypeTag);
|
||||||
|
|
|
@ -117,8 +117,10 @@ public class AddPOIAction extends QuickAction {
|
||||||
newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
|
newNode.putTagNoLC(poiType.getOsmTag2(), poiType.getOsmValue2());
|
||||||
}
|
}
|
||||||
} else if (!Algorithms.isEmpty(tag.getValue())) {
|
} else if (!Algorithms.isEmpty(tag.getValue())) {
|
||||||
newNode.putTagNoLC(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue());
|
PoiCategory category = editPoiData.getPoiCategory();
|
||||||
|
if (category != null) {
|
||||||
|
newNode.putTagNoLC(category.getDefaultTag(), tag.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (offlineEdit && !Algorithms.isEmpty(tag.getValue())) {
|
if (offlineEdit && !Algorithms.isEmpty(tag.getValue())) {
|
||||||
newNode.putTagNoLC(tag.getKey(), tag.getValue());
|
newNode.putTagNoLC(tag.getKey(), tag.getValue());
|
||||||
|
|
Loading…
Reference in a new issue