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.
- Loading branch information
Showing
42 changed files
with
292 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
33 changes: 33 additions & 0 deletions
33
...rc/main/java/de/westnordost/streetcomplete/quests/via_ferrata_scale/AddViaFerrataScale.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,33 @@ | ||
package de.westnordost.streetcomplete.quests.via_ferrata_scale | ||
|
||
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.osm.Tags | ||
|
||
class AddViaFerrataScale : OsmFilterQuestType<ViaFerrataScale>() { | ||
|
||
override val elementFilter = """ | ||
ways with | ||
highway = via_ferrata | ||
and !via_ferrata_scale | ||
""" | ||
override val changesetComment = "Specify Via Ferrata Grade Scale" | ||
override val wikiLink = "Key:via_ferrata_scale" | ||
override val icon = R.drawable.ic_quest_via_ferrata_scale | ||
override val defaultDisabledMessage = R.string.default_disabled_msg_viaFerrataScale | ||
|
||
override fun getTitle(tags: Map<String, String>) = R.string.quest_viaFerrataScale_title | ||
|
||
override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = | ||
getMapData().filter("ways with highway = via_ferrata") | ||
|
||
override fun createForm() = AddViaFerrataScaleForm() | ||
|
||
override fun applyAnswerTo(answer: ViaFerrataScale, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) { | ||
tags["via_ferrata_scale"] = answer.osmValue | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ain/java/de/westnordost/streetcomplete/quests/via_ferrata_scale/AddViaFerrataScaleForm.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,33 @@ | ||
package de.westnordost.streetcomplete.quests.via_ferrata_scale | ||
|
||
import android.os.Bundle | ||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.quests.AImageListQuestForm | ||
import de.westnordost.streetcomplete.view.image_select.DisplayItem | ||
|
||
class AddViaFerrataScaleForm : AImageListQuestForm<ViaFerrataScale, ViaFerrataScale>() { | ||
|
||
override val items: List<DisplayItem<ViaFerrataScale>> get() = listOf( | ||
ViaFerrataScale.ZERO, | ||
ViaFerrataScale.ONE, | ||
ViaFerrataScale.TWO, | ||
ViaFerrataScale.THREE, | ||
ViaFerrataScale.FOUR, | ||
ViaFerrataScale.FIVE, | ||
ViaFerrataScale.SIX | ||
).toItems() | ||
|
||
// optional: add quest_viaFerrataScale_hint text, but quest is already very long | ||
|
||
override val itemsPerRow = 1 | ||
override val moveFavoritesToFront = false | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
imageSelector.cellLayoutId = R.layout.cell_labeled_icon_select_via_ferrata_scale | ||
} | ||
|
||
override fun onClickOk(selectedItems: List<ViaFerrataScale>) { | ||
applyAnswer(selectedItems.first()) | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
app/src/main/java/de/westnordost/streetcomplete/quests/via_ferrata_scale/ViaFerrataScale.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,52 @@ | ||
package de.westnordost.streetcomplete.quests.via_ferrata_scale | ||
|
||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.quests.via_ferrata_scale.ViaFerrataScale.* | ||
import de.westnordost.streetcomplete.view.image_select.GroupableDisplayItem | ||
import de.westnordost.streetcomplete.view.image_select.Item | ||
|
||
enum class ViaFerrataScale(val osmValue: String) { | ||
ZERO("0"), | ||
ONE("1"), | ||
TWO("2"), | ||
THREE("3"), | ||
FOUR("4"), | ||
FIVE("5"), | ||
SIX("6") | ||
} | ||
fun Collection<ViaFerrataScale>.toItems() = map { it.asItem() } | ||
|
||
fun ViaFerrataScale.asItem(): GroupableDisplayItem<ViaFerrataScale> { | ||
return Item(this, imageResId, titleResId, descriptionResId) | ||
} | ||
|
||
private val ViaFerrataScale.imageResId: Int get() = when (this) { | ||
ZERO -> R.drawable.via_ferrata_scale_0 | ||
ONE -> R.drawable.via_ferrata_scale_1 | ||
TWO -> R.drawable.via_ferrata_scale_2 | ||
THREE -> R.drawable.via_ferrata_scale_3 | ||
FOUR -> R.drawable.via_ferrata_scale_4 | ||
FIVE -> R.drawable.via_ferrata_scale_5 | ||
SIX -> R.drawable.via_ferrata_scale_6 | ||
} | ||
|
||
private val ViaFerrataScale.titleResId: Int get() = when (this) { | ||
ZERO -> R.string.quest_viaFerrataScale_zero | ||
ONE -> R.string.quest_viaFerrataScale_one | ||
TWO -> R.string.quest_viaFerrataScale_two | ||
THREE -> R.string.quest_viaFerrataScale_three | ||
FOUR -> R.string.quest_viaFerrataScale_four | ||
FIVE -> R.string.quest_viaFerrataScale_five | ||
SIX -> R.string.quest_viaFerrataScale_six | ||
} | ||
|
||
private val ViaFerrataScale.descriptionResId: Int? get() = when (this) { | ||
ZERO -> R.string.quest_viaFerrataScale_zero_description | ||
ONE -> R.string.quest_viaFerrataScale_one_description | ||
TWO -> R.string.quest_viaFerrataScale_two_description | ||
THREE -> R.string.quest_viaFerrataScale_three_description | ||
FOUR -> R.string.quest_viaFerrataScale_four_description | ||
FIVE -> R.string.quest_viaFerrataScale_five_description | ||
SIX -> R.string.quest_viaFerrataScale_six_description | ||
else -> null | ||
} |
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.
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.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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,67 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="128.02dp" | ||
android:height="128.07dp" | ||
android:viewportWidth="128.02" | ||
android:viewportHeight="128.07"> | ||
<path | ||
android:pathData="m119.44,96.04c-17.67,30.61 -56.81,41.1 -87.43,23.43 -30.61,-17.67 -41.1,-56.81 -23.43,-87.43 17.67,-30.61 56.81,-41.1 87.43,-23.43 30.61,17.67 41.1,56.81 23.43,87.43" | ||
android:strokeWidth=".2" | ||
android:fillColor="#529add"/> | ||
<path | ||
android:pathData="m76.46,14.91c0.22,-1.97 1.5,-5.16 1.33,-6.29 -0.51,-3.38 -3.4,-3.51 -3.96,-3.24 -1.33,0.5 -3.95,1.04 -5.41,1.32 -0.89,0.05 -1.76,0.3 -2.57,0.76 -3.18,1.81 -4.09,6.22 -2.02,9.86s6.32,5.12 9.5,3.31c1.82,-1.03 2.89,-2.92 3.09,-5.03 0,0 0,0.01 0,0.01 -0,-0.03 0,-0.06 -0,-0.09 0.02,-0.2 0.03,-0.41 0.03,-0.62zM71.82,18.11c-1.94,1.06 -4.5,0.14 -5.76,-2.06 -1.26,-2.23 -0.71,-4.92 1.24,-6.03 1.95,-1.11 4.55,-0.2 5.81,2.03 1.26,2.23 0.71,4.92 -1.24,6.03 -0.02,0.01 -0.04,0.02 -0.06,0.03" | ||
android:fillColor="#3d3c3c"/> | ||
<path | ||
android:pathData="m128.02,64.04c0,-35.35 -28.65,-64 -64,-64 -0.54,0 -1.07,0.01 -1.6,0.02 -5.44,15.43 -10.63,30.68 -10.63,30.68l5.75,18.63 -14.52,31.8 0.63,18.72 -6.19,22.4c8.09,3.7 17.08,5.76 26.56,5.76 35.35,0 64,-28.65 64,-64z" | ||
android:fillColor="#9ba2a8"/> | ||
<path | ||
android:pathData="m117.32,45.67 l5.91,-3.25 -48.17,-29.28 -23.23,17.47c-0.03,0.08 -0.04,0.13 -0.04,0.13l5.75,18.63 -0.1,0.17 39.78,-8.73z" | ||
android:fillColor="#505b66"/> | ||
<path | ||
android:pathData="m74.97,80.25 l-31.92,0.94 0.6,18.69 -0.32,1.18 25.2,-7.32 47.84,7.13c0.18,-0.25 0.35,-0.5 0.52,-0.75z" | ||
android:fillColor="#505b66"/> | ||
<path | ||
android:pathData="m77.4,59.61c2.04,-5.77 13.97,-18.49 24.42,-1.77 12.16,16.6 -29.9,17.29 -24.42,1.77z" | ||
android:fillColor="#29546c"/> | ||
<path | ||
android:pathData="m101.83,57.83c-0.93,-1.26 -1.86,-2.32 -2.79,-3.2 0.36,0.43 0.71,0.88 1.07,1.37 11.28,15.4 -18.88,19.37 -23.01,3.14 -0.23,0.3 -0.36,0.47 -0.36,0.47 3.11,16.2 37.23,14.82 25.08,-1.77z" | ||
android:strokeAlpha="0.25" | ||
android:fillColor="#00b5ae" | ||
android:fillAlpha="0.25"/> | ||
<path | ||
android:pathData="m85.05,75.37c0.79,2.34 -0.47,4.88 -2.81,5.67s-4.88,-0.47 -5.67,-2.81l-2.65,-7.85c-0.79,-2.34 0.47,-4.88 2.81,-5.67 2.34,-0.79 4.88,0.47 5.67,2.81z" | ||
android:fillColor="#f4b7a9"/> | ||
<path | ||
android:pathData="m85.05,75.37c0.79,2.34 -0.47,4.88 -2.81,5.67s-4.88,-0.47 -5.67,-2.81l-2.65,-7.85c-0.79,-2.34 0.47,-4.88 2.81,-5.67 2.34,-0.79 4.88,0.47 5.67,2.81z" | ||
android:strokeAlpha="0.41" | ||
android:fillColor="#f4b7a9" | ||
android:fillAlpha="0.41"/> | ||
<path | ||
android:pathData="m104.79,76.1c0,-0.26 -0.01,-0.52 -0.03,-0.77 0.02,-0.15 0.03,-0.3 0.03,-0.45l0,-14.45c0,-1.92 -1.56,-3.48 -3.48,-3.48s-3.48,1.56 -3.48,3.48l0,5.9c-0.06,-0.02 -0.44,0.02 -0.5,0l0,-5.9c0,-1.92 -1.23,-3.48 -3.15,-3.48s-3.48,1.56 -3.48,3.48l0,5.9l-0.5,0l0,-5.9c0,-1.92 -1.23,-3.48 -3.15,-3.48s-3.48,1.56 -3.48,3.48l0,5.9c-0.06,0.02 -0.45,-0.02 -0.51,0l0,-5.9c0,-1.92 -1.23,-3.48 -3.15,-3.48s-3.48,1.56 -3.48,3.48l0,14.45c0,0.15 0.01,0.3 0.03,0.45 -0.02,0.26 -0.03,0.51 -0.03,0.77 0,4 2.34,7.46 5.72,9.09l0,40.25c6.07,-1.79 11.76,-4.45 16.93,-7.84l0,-32.4c3.38,-1.63 5.72,-5.09 5.72,-9.09z" | ||
android:fillColor="#f4b7a9"/> | ||
<path | ||
android:pathData="m104.79,60.43c0,-1.92 -1.56,-3.48 -3.48,-3.48 -0.94,0 -1.8,0.38 -2.43,0.99 0.18,-0.03 0.37,-0.05 0.56,-0.05 1.92,0 3.48,1.56 3.48,3.48l0,15.67c0,4 -2.34,7.46 -5.72,9.09l0,32.4c-1.75,1.15 -3.55,2.21 -5.41,3.18 2.52,-1.22 4.95,-2.59 7.28,-4.12l0,-32.4c3.38,-1.63 5.72,-5.09 5.72,-9.09 -0,-0.26 -0,-15.67 -0,-15.67z" | ||
android:strokeAlpha="0.39" | ||
android:fillColor="#c9978c" | ||
android:fillAlpha="0.39"/> | ||
<path | ||
android:pathData="m66.62,16.76c0.82,-0.59 2.06,-0.62 3.04,-0.31 2.58,0.81 3.74,4.44 2.59,8.1s-4.18,5.97 -6.76,5.15 -4.83,-6.97 -0.89,-11.35z" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="2.03" | ||
android:fillColor="#00000000" | ||
android:strokeColor="#fff" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="m77.79,8.62c-0.51,-3.38 -3.4,-3.51 -3.96,-3.24 -1.33,0.5 -3.95,1.04 -5.41,1.32 -0.89,0.05 -1.76,0.3 -2.57,0.76 -3.18,1.81 -4.09,6.22 -2.02,9.86 1.73,3.05 4.95,4.6 7.84,3.96 -0.03,-0.09 0.05,-1.48 -0.92,-2.81 -1.75,0.37 -3.63,-0.57 -4.68,-2.42 -1.26,-2.23 -0.71,-4.92 1.24,-6.03 1.95,-1.11 4.55,-0.2 5.81,2.03 1.11,1.96 0.9,4.24 -0.51,5.53 0.11,0.09 0.93,2.01 1.02,2.87 1.71,-1.05 2.61,-2.8 2.8,-4.84 0,0 0,0.01 0,0.01 -0,-0.03 0,-0.06 -0,-0.09 0.02,-0.21 0.03,-0.41 0.03,-0.62 0.22,-1.97 1.5,-5.16 1.33,-6.29z" | ||
android:fillColor="#3d3c3c"/> | ||
<path | ||
android:pathData="M74.67,8.08m-1.13,0a1.13,1.13 0,1 1,2.26 0a1.13,1.13 0,1 1,-2.26 0" | ||
android:fillColor="#1b1919"/> | ||
<path | ||
android:pathData="m66.06,27.41c-1.15,-0.14 -2.23,0.6 -2.5,1.73l-20.43,87.81 -2.41,10.36c-0.28,1.22 0.47,2.43 1.69,2.71l0.04,0.01c1.22,0.28 2.43,-0.47 2.71,-1.69l2.31,-9.92 20.95,-90.04c0.08,-0.33 -0.14,-0.66 -0.48,-0.71 -0.63,-0.1 -1.26,-0.19 -1.89,-0.27z" | ||
android:fillColor="#ea7053"/> | ||
<path | ||
android:pathData="m67.94,27.68c-0.3,-0.05 -0.59,0.15 -0.66,0.45l-20.68,88.88 -2.69,11.54c-0.04,0.17 -0.24,0.33 -0.46,0.44 -0.28,0.14 -0.62,0.11 -0.88,-0.06l-0.96,-0.62c-0.32,-0.07 -0.64,0.12 -0.71,0.44 0,0 0.31,0.72 1.25,1.22 1.63,0.46 2.77,-0.54 3.09,-1.93l2.24,-9.61 20.95,-90.04c0.08,-0.33 -0.14,-0.66 -0.48,-0.71 -0,-0 -0.01,-0 -0.01,-0z" | ||
android:strokeAlpha="0.48" | ||
android:fillColor="#f2aa99" | ||
android:fillAlpha="0.48"/> | ||
</vector> |
50 changes: 50 additions & 0 deletions
50
app/src/main/res/layout/cell_labeled_icon_select_via_ferrata_scale.xml
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,50 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="0dp" | ||
android:padding="4dp" | ||
android:background="@drawable/image_select_cell"> | ||
|
||
<ImageView | ||
android:id="@+id/imageView" | ||
android:layout_width="0dp" | ||
android:layout_height="0dp" | ||
android:scaleType="centerCrop" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintWidth_percent="0.40" | ||
app:layout_constraintDimensionRatio="1:1" | ||
android:adjustViewBounds="true" | ||
tools:src="@drawable/via_ferrata_scale_1" | ||
/> | ||
|
||
<LinearLayout | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="8dp" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/imageView" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
style="@style/TitleNextToImage" | ||
tools:text="@string/quest_viaFerrataScale_one" /> | ||
|
||
<TextView | ||
android:id="@+id/descriptionView" | ||
style="@style/DescriptionNextToImage" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
tools:text="@string/quest_viaFerrataScale_one_description" /> | ||
|
||
</LinearLayout> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
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
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
Oops, something went wrong.