diff --git a/app/src/main/java/de/westnordost/streetcomplete/util/NameAndLocationLabel.kt b/app/src/main/java/de/westnordost/streetcomplete/util/NameAndLocationLabel.kt index f0192f280b..1bd60feca0 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/util/NameAndLocationLabel.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/util/NameAndLocationLabel.kt @@ -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 } @@ -103,6 +104,13 @@ fun getNameLabel(tags: Map): String? { ?: ref } +/** Returns a text that describes whether it is inside or outside (of a building) */ +fun getIndoorOutdoorLabel(tags: Map, 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, resources: Resources): String? { /* distinguish between "floor" and "level": diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 415cefe4e0..0eca901475 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -119,6 +119,10 @@ The info you enter is directly added to OpenStreetMap in your name, without the underground house name %s house number %s + + inside + + outside "You did not give an answer"