Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Quest: building:material #569

Open
wants to merge 9 commits into
base: modified
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import de.westnordost.streetcomplete.quests.building_colour.AddBuildingColour
import de.westnordost.streetcomplete.quests.building_entrance.AddEntrance
import de.westnordost.streetcomplete.quests.building_entrance_reference.AddEntranceReference
import de.westnordost.streetcomplete.quests.building_levels.AddBuildingLevels
import de.westnordost.streetcomplete.quests.building_material.AddBuildingMaterial
import de.westnordost.streetcomplete.quests.building_type.AddBuildingType
import de.westnordost.streetcomplete.quests.building_underground.AddIsBuildingUnderground
import de.westnordost.streetcomplete.quests.bus_stop_bench.AddBenchStatusOnBusStop
Expand Down Expand Up @@ -599,6 +600,7 @@ fun getQuestTypeList(
// quests added in SCEE
EE_QUEST_OFFSET + 0 to AddBenchMaterial(),
EE_QUEST_OFFSET + 27 to AddBuildingColour(),
EE_QUEST_OFFSET + 49 to AddBuildingMaterial(),
EE_QUEST_OFFSET + 24 to AddRoofColour(),
EE_QUEST_OFFSET + 1 to AddContactPhone(),
EE_QUEST_OFFSET + 2 to AddContactWebsite(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.westnordost.streetcomplete.quests.building_material

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.osm.Tags

class AddBuildingMaterial : OsmFilterQuestType<BuildingMaterial>() {

override val elementFilter = """
ways, relations with
((building and building !~ no|construction|roof|carport)
or (building:part and building:part !~ no|construction|roof|carport))
and !building:material
and indoor != no
and wall != no
"""
override val changesetComment = "Specify building material"
override val wikiLink = "Key:building:material"
override val icon = R.drawable.ic_quest_building_material

override val defaultDisabledMessage = R.string.default_disabled_msg_difficult_and_time_consuming

override fun getTitle(tags: Map<String, String>) = when {
tags.containsKey("building:part") -> R.string.quest_buildingPartMaterial_title
else -> R.string.quest_buildingMaterial_title
}

override fun createForm() = AddBuildingMaterialForm()

override fun applyAnswerTo(
answer: BuildingMaterial,
tags: Tags,
geometry: ElementGeometry,
timestampEdited: Long,
) {
tags["building:material"] = answer.osmValue
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.westnordost.streetcomplete.quests.building_material

import android.os.Bundle
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AImageListQuestForm

class AddBuildingMaterialForm : AImageListQuestForm<BuildingMaterial, BuildingMaterial>() {

override val items = BuildingMaterial.entries.map { it.asItem() }

override val itemsPerRow = 3

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
imageSelector.cellLayoutId = R.layout.cell_labeled_icon_select
}

override fun onClickOk(selectedItems: List<BuildingMaterial>) {
applyAnswer(selectedItems.single())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package de.westnordost.streetcomplete.quests.building_material

import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.view.image_select.DisplayItem
import de.westnordost.streetcomplete.view.image_select.Item

enum class BuildingMaterial(
val osmValue: String,
@DrawableRes val imageResId: Int,
@StringRes val titleResId: Int,
) {
CEMENT_BLOCK(
osmValue = "cement_block",
imageResId = R.drawable.building_material_cement_block,
titleResId = R.string.quest_building_material_value_cement_block
),
BRICK(
osmValue = "brick",
imageResId = R.drawable.building_material_brick,
titleResId = R.string.quest_building_material_value_brick
),
PLASTER(
osmValue = "plaster",
imageResId = R.drawable.building_material_plaster,
titleResId = R.string.quest_building_material_value_plaster
),
WOOD(
osmValue = "wood",
imageResId = R.drawable.building_material_wood,
titleResId = R.string.quest_building_material_value_wood
),
CONCRETE(
osmValue = "concrete",
imageResId = R.drawable.building_material_concrete,
titleResId = R.string.quest_building_material_value_concrete
),
METAL(
osmValue = "metal",
imageResId = R.drawable.building_material_metal,
titleResId = R.string.quest_building_material_value_metal
),
STONE(
osmValue = "stone",
imageResId = R.drawable.building_material_stone,
titleResId = R.string.quest_building_material_value_stone
),
GLASS(
osmValue = "glass",
imageResId = R.drawable.building_material_glass,
titleResId = R.string.quest_building_material_value_glass
),
MIRROR(
osmValue = "mirror",
imageResId = R.drawable.building_material_mirror,
titleResId = R.string.quest_building_material_value_mirror
),
MUD(
osmValue = "mud",
imageResId = R.drawable.building_material_mud,
titleResId = R.string.quest_building_material_value_mud
),
PLASTIC(
osmValue = "plastic",
imageResId = R.drawable.building_material_plastic,
titleResId = R.string.quest_building_material_value_plastic
),
TIMBER_FRAMING(
osmValue = "timber_framing",
imageResId = R.drawable.building_material_timber_framing,
titleResId = R.string.quest_building_material_value_timber_framing
),
SANDSTONE(
osmValue = "sandstone",
imageResId = R.drawable.building_material_sandstone,
titleResId = R.string.quest_building_material_value_sandstone
),
CLAY(
osmValue = "clay",
imageResId = R.drawable.building_material_clay,
titleResId = R.string.quest_building_material_value_clay
),
REED(
osmValue = "reed",
imageResId = R.drawable.building_material_reed,
titleResId = R.string.quest_building_material_value_reed
),
LOAM(
osmValue = "loam",
imageResId = R.drawable.building_material_loam,
titleResId = R.string.quest_building_material_value_loam
),
MARBLE(
osmValue = "marble",
imageResId = R.drawable.building_material_marble,
titleResId = R.string.quest_building_material_value_marble
),
SLATE(
osmValue = "slate",
imageResId = R.drawable.building_material_slate,
titleResId = R.string.quest_building_material_value_slate
),
VINYL(
osmValue = "vinyl",
imageResId = R.drawable.building_material_vinyl,
titleResId = R.string.quest_building_material_value_vinyl
),
LIMESTONE(
osmValue = "limestone",
imageResId = R.drawable.building_material_limestone,
titleResId = R.string.quest_building_material_value_limestone
),
TILES(
osmValue = "tiles",
imageResId = R.drawable.building_material_tiles,
titleResId = R.string.quest_building_material_value_tiles
),
BAMBOO(
osmValue = "bamboo",
imageResId = R.drawable.building_material_bamboo,
titleResId = R.string.quest_building_material_value_bamboo
),
ADOBE(
osmValue = "adobe",
imageResId = R.drawable.building_material_adobe,
titleResId = R.string.quest_building_material_value_adobe
)
}

fun Collection<BuildingMaterial>.toItems() = map { it.asItem() }

fun BuildingMaterial.asItem(): DisplayItem<BuildingMaterial> = Item(this, imageResId, titleResId)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/ic_quest_building_material.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="128dp"
android:height="128dp"
android:viewportWidth="34"
android:viewportHeight="34">
<path
android:fillColor="#c8c4b7"
android:pathData="M32.64 23.28c-3.51 8.67-13.38 12.85-22.05 9.35-8.67-3.51-12.85-13.38-9.35-22.05C4.75 1.91 14.62-2.27 23.29 1.23c8.67 3.51 12.85 13.38 9.35 22.05" />
<path
android:pathData="M6.34 16.93L16.92 6.35 27.5 16.93"
android:strokeWidth="3"
android:strokeAlpha="0.2"
android:strokeColor="#000"
android:strokeLineCap="square" />
<path
android:pathData="M6.34 15.94L16.92 5.36 27.5 15.94"
android:strokeWidth="3"
android:strokeColor="#c84747"
android:strokeLineCap="square" />
<path
android:fillColor="#B6EF28"
android:pathData="M16.92 8.46l-8.47 8.47v14.65c0.68 0.39 1.39 0.74 2.14 1.05 2.08 0.84 4.22 1.23 6.33 1.24h0.34c2.87-0.06 5.67-0.85 8.12-2.26V16.94z" />
</vector>
27 changes: 27 additions & 0 deletions app/src/main/res/values/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,31 @@ Out of the box SCEE is configured to behave very similar to StreetComplete.</str
<string name="outside_downloaded_area_warning">This position is outside the downloaded area. Continue?</string>
<!-- actually there are still SC translations available, as only the main string has been removed from SC. -->
<string name="close">Close</string>

<!-- building material -->
<string name="quest_buildingMaterial_title">"What is the overall surface material of building walls here?"</string>
<string name="quest_buildingPartMaterial_title">"What overall material is this building part made of?"</string>
Comment on lines +740 to +741
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the building part title also refer to surface material?

<string name="quest_building_material_value_cement_block">Cement block</string>
<string name="quest_building_material_value_brick">Brick</string>
<string name="quest_building_material_value_plaster">Plaster</string>
<string name="quest_building_material_value_wood">Wood</string>
<string name="quest_building_material_value_concrete">Concrete</string>
<string name="quest_building_material_value_metal">Metal</string>
<string name="quest_building_material_value_stone">Stone</string>
<string name="quest_building_material_value_glass">Glass</string>
<string name="quest_building_material_value_mirror">Mirror</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be named "mirrored glass" to be more clear.

<string name="quest_building_material_value_mud">Mud</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be named "dried mud" to be more clear.

<string name="quest_building_material_value_plastic">Plastic</string>
<string name="quest_building_material_value_timber_framing">Timber Framing</string>
<string name="quest_building_material_value_sandstone">Sandstone</string>
<string name="quest_building_material_value_clay">Clay</string>
<string name="quest_building_material_value_reed">Reed</string>
<string name="quest_building_material_value_loam">Loam</string>
<string name="quest_building_material_value_marble">Marble</string>
<string name="quest_building_material_value_slate">Slate</string>
<string name="quest_building_material_value_vinyl">Vinyl</string>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wiki rather explicitly calls this "plastic vinyl strips". Not sure though whether this needs to be mentioned in the text.

<string name="quest_building_material_value_limestone">Limestone</string>
<string name="quest_building_material_value_tiles">Tiles</string>
<string name="quest_building_material_value_bamboo">Bamboo</string>
<string name="quest_building_material_value_adobe">Adobe</string>
</resources>