forked from streetcomplete/StreetComplete
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Holger Jeromin <mailgithub@katur.de>
- Loading branch information
1 parent
b9b0049
commit b116b81
Showing
25 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/de/westnordost/streetcomplete/quests/valves/AddValves.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/de/westnordost/streetcomplete/quests/valves/AddValvesForm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
app/src/main/java/de/westnordost/streetcomplete/quests/valves/Valves.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/main/java/de/westnordost/streetcomplete/quests/valves/ValvesItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.