Skip to content

Commit

Permalink
Added valves quest (#644)
Browse files Browse the repository at this point in the history
Co-authored-by: Holger Jeromin <mailgithub@katur.de>
  • Loading branch information
mcliquid and HolgerJeromin authored Sep 12, 2024
1 parent b9b0049 commit b116b81
Show file tree
Hide file tree
Showing 25 changed files with 214 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ import de.westnordost.streetcomplete.quests.traffic_signals_vibrate.AddTrafficSi
import de.westnordost.streetcomplete.quests.trail_visibility.AddTrailVisibility
import de.westnordost.streetcomplete.quests.tree.AddTreeGenus
import de.westnordost.streetcomplete.quests.sac_scale.AddSacScale
import de.westnordost.streetcomplete.quests.valves.AddValves
import de.westnordost.streetcomplete.quests.via_ferrata_scale.AddViaFerrataScale
import de.westnordost.streetcomplete.quests.way_lit.AddWayLit
import de.westnordost.streetcomplete.quests.wheelchair_access.AddWheelchairAccessBusiness
Expand Down Expand Up @@ -604,6 +605,7 @@ fun getQuestTypeList(
EE_QUEST_OFFSET + 7 to AddServiceBuildingOperator(),
EE_QUEST_OFFSET + 29 to AddStreetCabinetType(),
EE_QUEST_OFFSET + 8 to AddOutdoorSeatingType(),
EE_QUEST_OFFSET + 51 to AddValves(),
EE_QUEST_OFFSET + 25 to AddDestination(),
EE_QUEST_OFFSET + 22 to AddArtworkType(),
EE_QUEST_OFFSET + 23 to AddRailwayPlatformRef(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package de.westnordost.streetcomplete.quests.valves

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
import de.westnordost.streetcomplete.data.osm.mapdata.Element
import de.westnordost.streetcomplete.data.osm.mapdata.MapDataWithGeometry
import de.westnordost.streetcomplete.data.osm.mapdata.filter
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.BICYCLIST
import de.westnordost.streetcomplete.osm.Tags

class AddValves : OsmFilterQuestType<List<Valves>>() {

override val elementFilter = """
nodes, ways with
(compressed_air = yes
or service:bicycle:pump = yes
or amenity = compressed_air)
and access !~ private|no
and !valves
"""
override val changesetComment = "Specify valves types for air pumps or compressed air"
override val wikiLink = "Key:valves"
override val icon = R.drawable.ic_quest_valve
override val isDeleteElementEnabled = true
override val achievements = listOf(BICYCLIST)

override fun getTitle(tags: Map<String, String>) = R.string.quest_valves_title

override fun createForm() = AddValvesForm()

override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
getMapData().filter("nodes, ways with amenity = compressed_air or service:bicycle:pump = yes or compressed_air = yes")

override fun applyAnswerTo(answer: List<Valves>, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
tags["valves"] = answer.joinToString(";") { it.osmValue }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package de.westnordost.streetcomplete.quests.valves

import android.os.Bundle
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.osm.lane_narrowing_traffic_calming.asItem
import de.westnordost.streetcomplete.quests.AImageListQuestForm

class AddValvesForm : AImageListQuestForm<Valves, List<Valves>>() {

override val items get() = Valves.entries.map { it.asItem() }
override val itemsPerRow = 2
override val maxSelectableItems = -1
override val moveFavoritesToFront = false

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

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

enum class Valves(val osmValue: String) {
SCHRADER("schrader"),
SCLAVERAND("sclaverand"),
DUNLOP("dunlop"),
REGINA("regina");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package de.westnordost.streetcomplete.quests.valves

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.valves.Valves.*
import de.westnordost.streetcomplete.view.image_select.DisplayItem
import de.westnordost.streetcomplete.view.image_select.Item

fun Valves.asItem() = Item(this, iconResId, titleResId)

private val Valves.titleResId: Int get() = when (this) {
SCHRADER -> R.string.quest_valves_schrader
SCLAVERAND -> R.string.quest_valves_sclaverand
DUNLOP -> R.string.quest_valves_dunlop
REGINA -> R.string.quest_valves_regina
}

private val Valves.iconResId: Int get() = when (this) {
SCHRADER -> R.drawable.valves_schrader
SCLAVERAND -> R.drawable.valves_presta
DUNLOP -> R.drawable.valves_dunlop
REGINA -> R.drawable.valves_regina
}
6 changes: 6 additions & 0 deletions app/src/main/res/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ tourism_information_map.jpg CC0 https://commons.wikimedia.org/w
tourism_information_office.jpg CC-BY-SA 4.0 https://commons.wikimedia.org/wiki/File:Tourist_information_shop,_Delft_(2018).jpg (Donald Trung)
tourism_information_termina... CC-BY 4.0 https://wiki.openstreetmap.org/wiki/File:Uh%C5%99%C3%ADn%C4%9Bves,_Nov%C3%A9_n%C3%A1m%C4%9Bst%C3%AD,_informa%C4%8Dn%C3%AD_stojan.jpg (ŠJů)

valves_schrader.jpg Free Art License BohwaZ https://commons.wikimedia.org/wiki/File:Valve_Schrader.jpg
valves_sclaverand.jpg Free Art License BohwaZ https://commons.wikimedia.org/wiki/File:Valve_Presta.JPG
valves_dunlop.jpg Free Art License BohwaZ https://commons.wikimedia.org/wiki/File:Valve_Dunlop.JPG
valves_regina.jpg Free Art License BohwaZ https://commons.wikimedia.org/wiki/File:Valve_Regina_avec_son_bouchon.jpg


via_ferrata_scale_0.jpg CC-BY-SA-2.0 https://wiki.openstreetmap.org/wiki/File:Super_easy_ferrata.jpg
via_ferrata_scale_1.jpg CC-BY-SA-3.0 https://wiki.openstreetmap.org/wiki/File:Alpspitz-ferrata-a.jpg
via_ferrata_scale_2.jpg CC-BY-SA-2.0 https://wiki.openstreetmap.org/wiki/File:Alpspitz-ferrata-b.jpg
Expand Down
Binary file added app/src/main/res/drawable-hdpi/valves_dunlop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/valves_presta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/valves_regina.jpg
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.
Binary file added app/src/main/res/drawable-mdpi/valves_dunlop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/valves_presta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/valves_regina.jpg
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.
Binary file added app/src/main/res/drawable-xhdpi/valves_dunlop.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/valves_presta.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/valves_regina.jpg
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.
57 changes: 57 additions & 0 deletions app/src/main/res/drawable/ic_quest_valve.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="128dp"
android:height="128dp"
android:viewportWidth="128"
android:viewportHeight="128">
<path
android:pathData="M128,64c0,35.3 -28.7,64 -64,64S0,99.3 0,64 28.7,0 64,0s64,28.7 64,64"
android:fillColor="#ca72e2"/>
<path
android:pathData="M49.8,104.1h28.5V27.9h-28.5v76.2Z"
android:fillColor="#8ea0ad"/>
<path
android:pathData="M45,58.9h38v-14.3h-38v14.3Z"
android:fillColor="#444"/>
<path
android:pathData="M59.3,27.9h9.5v-14.3h-9.3l-0.2,14.3Z"
android:fillColor="#666"/>
<path
android:pathData="M45,113.6h38v-9.5h-38v9.5Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,32.9h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,37.4h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,42.2h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,63.8h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,68.3h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,73.1h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,78h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,82.5h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,87.3h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,92.2h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,96.7h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
<path
android:pathData="M49.8,101.5h28.5v-2.4h-28.5v2.4Z"
android:fillColor="#c4ced4"/>
</vector>
8 changes: 8 additions & 0 deletions app/src/main/res/values/strings_ee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,14 @@
<string name="quest_shelter_type_field_shelter">Field shelter</string>
<string name="quest_shelter_type_rock_shelter">Rock shelter</string>

<!-- valves (air compressor or bicycle pump) -->
<string name="quest_valves_title">What types of valves are available here?</string>
<string name="quest_valves_disabled_msg">This quest is disabled by default because it requires a very close inspection of the available valves.</string>
<string name="quest_valves_sclaverand">SV: Sclaverand / Presta / French valve</string>
<string name="quest_valves_dunlop">DV/NV: Dunlop / Woods</string>
<string name="quest_valves_schrader">AV: Schrader / Car valve</string>
<string name="quest_valves_regina">RV: Regina / Italian</string>

<!-- artwork type -->
<string name="quest_artwork_title">What kind of artwork is this?</string>
<string name="quest_artwork_sculpture">Sculpture</string>
Expand Down
50 changes: 50 additions & 0 deletions res/graphics/quest/valve.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b116b81

Please sign in to comment.