Fix NPE in osm point category
This commit is contained in:
parent
c432539209
commit
c45e8b0162
4 changed files with 16 additions and 20 deletions
|
@ -9,6 +9,7 @@
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
|
<string name="shared_string_without_name">Without name</string>
|
||||||
<string name="what_is_here">What\'s here:</string>
|
<string name="what_is_here">What\'s here:</string>
|
||||||
<string name="parked_at">parked at</string>
|
<string name="parked_at">parked at</string>
|
||||||
<string name="pick_up_till">Pick up until</string>
|
<string name="pick_up_till">Pick up until</string>
|
||||||
|
|
|
@ -196,12 +196,6 @@ public class EditPOIMenuController extends MenuController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCategory() {
|
private String getCategory() {
|
||||||
String category = "";
|
return OsmEditingPlugin.getCategory(osmPoint, getMapActivity());
|
||||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
|
||||||
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
|
||||||
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
|
|
||||||
category = getMapActivity().getString(R.string.osn_bug_name);
|
|
||||||
}
|
|
||||||
return category;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,6 +445,19 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getCategory(OsmPoint osmPoint, Context context) {
|
||||||
|
String category = "";
|
||||||
|
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||||
|
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
||||||
|
if (Algorithms.isEmpty(category)) {
|
||||||
|
category = context.getString(R.string.shared_string_without_name);
|
||||||
|
}
|
||||||
|
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
|
||||||
|
category = context.getString(R.string.osn_bug_name);
|
||||||
|
}
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getPrefix(OsmPoint osmPoint) {
|
public static String getPrefix(OsmPoint osmPoint) {
|
||||||
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " ";
|
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,11 +301,7 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCategory(OsmPoint point) {
|
private String getCategory(OsmPoint point) {
|
||||||
String category = "";
|
return OsmEditingPlugin.getCategory(point, getContext());
|
||||||
if (point.getGroup() == OsmPoint.Group.POI) {
|
|
||||||
category = ((OpenstreetmapPoint) point).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
|
||||||
}
|
|
||||||
return category;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDescription(OsmPoint point) {
|
private String getDescription(OsmPoint point) {
|
||||||
|
@ -322,20 +318,12 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
||||||
|
|
||||||
String category = getCategory(point);
|
String category = getCategory(point);
|
||||||
|
|
||||||
String comment = "";
|
|
||||||
if (point.getGroup() == OsmPoint.Group.BUG) {
|
|
||||||
comment = getContext().getString(R.string.osn_bug_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
String prefix = OsmEditingPlugin.getPrefix(point);
|
String prefix = OsmEditingPlugin.getPrefix(point);
|
||||||
|
|
||||||
String description = "";
|
String description = "";
|
||||||
if (!Algorithms.isEmpty(action)) {
|
if (!Algorithms.isEmpty(action)) {
|
||||||
description += action + " • ";
|
description += action + " • ";
|
||||||
}
|
}
|
||||||
if (!Algorithms.isEmpty(comment)) {
|
|
||||||
description += comment + " • ";
|
|
||||||
}
|
|
||||||
if (!Algorithms.isEmpty(category)) {
|
if (!Algorithms.isEmpty(category)) {
|
||||||
description += category + " • ";
|
description += category + " • ";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue