Skip to content

Commit

Permalink
display in location hint also if thing is inside or outside (fixes #5170
Browse files Browse the repository at this point in the history
)
  • Loading branch information
westnordost committed Oct 20, 2023
1 parent c2a29b5 commit a154cde
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ private fun getLocationHtml(
val level = getLevelLabel(tags, resources)
// by default only show house number if no level is given
val houseNumber = if (showHouseNumber ?: (level == null)) getHouseNumberHtml(tags, resources) else null
val indoor = getIndoorOutdoorLabel(tags, resources)

return if (level != null && houseNumber != null) {
resources.getString(R.string.label_housenumber_location, houseNumber, level)
return if ((level != null || indoor != null) && houseNumber != null) {
resources.getString(R.string.label_housenumber_location, houseNumber, level ?: indoor)
} else {
level ?: houseNumber
}
Expand Down Expand Up @@ -103,6 +104,13 @@ fun getNameLabel(tags: Map<String, String>): String? {
?: ref
}

/** Returns a text that describes whether it is inside or outside (of a building) */
fun getIndoorOutdoorLabel(tags: Map<String, String>, resources: Resources): String? = when {
tags["indoor"] == "yes" || tags["location"] == "indoor" -> resources.getString(R.string.inside)
tags["indoor"] == "no" || tags["location"] == "outdoor" -> resources.getString(R.string.outside)
else -> null
}

/** Returns a text that describes the floor / level, e.g. "on floor 5" */
fun getLevelLabel(tags: Map<String, String>, resources: Resources): String? {
/* distinguish between "floor" and "level":
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ The info you enter is directly added to OpenStreetMap in your name, without the
<string name="underground">underground</string>
<string name="at_housename">house name %s</string>
<string name="at_housenumber">house number %s</string>
<!-- as in: “Where is the ATM?” - “It is inside” -->
<string name="inside">inside</string>
<!-- as in: “Where is the ATM?” - “It is outside” -->
<string name="outside">outside</string>
<!-- when the user left the answer form empty -->
<string name="no_changes">"You did not give an answer"</string>

Expand Down

0 comments on commit a154cde

Please sign in to comment.