-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
b8e75ef
commit 147cb25
Showing
28 changed files
with
196 additions
and
35 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
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
48 changes: 48 additions & 0 deletions
48
...stnordost/streetcomplete/quests/bicycle_repair_station/AddBicycleRepairStationServices.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,48 @@ | ||
package de.westnordost.streetcomplete.quests.bicycle_repair_station | ||
|
||
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 | ||
import de.westnordost.streetcomplete.util.ktx.toYesNo | ||
|
||
class AddBicycleRepairStationServices : OsmFilterQuestType<List<BicycleRepairStationService>>() { | ||
|
||
override val elementFilter = """ | ||
nodes, ways with | ||
amenity = bicycle_repair_station | ||
and ( | ||
!service:bicycle:pump | ||
or !service:bicycle:stand | ||
or !service:bicycle:tools | ||
or !service:bicycle:chain_tool | ||
) | ||
and access !~ private|no | ||
""" | ||
|
||
override val changesetComment = "Specify features of bicycle repair stations" | ||
override val wikiLink = "Tag:amenity=bicycle_repair_station" | ||
override val icon = R.drawable.ic_quest_bicycle_repair_amenity | ||
override val isDeleteElementEnabled = true | ||
override val achievements = listOf(BICYCLIST) | ||
|
||
override fun getTitle(tags: Map<String, String>) = R.string.quest_bicycle_repair_station_services_title | ||
|
||
override fun createForm() = AddBicycleRepairStationServicesForm() | ||
|
||
override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = | ||
getMapData().filter(""" | ||
nodes, ways with | ||
amenity ~ bicycle_repair_station|compressed_air | ||
""") | ||
|
||
override fun applyAnswerTo(answer: List<BicycleRepairStationService>, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) { | ||
for (entry in BicycleRepairStationService.entries) { | ||
tags["service:bicycle:${entry.value}"] = (entry in answer).toYesNo() | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...rdost/streetcomplete/quests/bicycle_repair_station/AddBicycleRepairStationServicesForm.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,15 @@ | ||
package de.westnordost.streetcomplete.quests.bicycle_repair_station | ||
|
||
import de.westnordost.streetcomplete.quests.AImageListQuestForm | ||
|
||
class AddBicycleRepairStationServicesForm : AImageListQuestForm<BicycleRepairStationService, List<BicycleRepairStationService>>() { | ||
|
||
override val items get() = BicycleRepairStationService.entries.map { it.asItem() } | ||
|
||
override val maxSelectableItems = -1 | ||
override val itemsPerRow = 3 | ||
|
||
override fun onClickOk(selectedItems: List<BicycleRepairStationService>) { | ||
applyAnswer(selectedItems) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...e/westnordost/streetcomplete/quests/bicycle_repair_station/BicycleRepairStationService.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.bicycle_repair_station | ||
|
||
enum class BicycleRepairStationService(val value: String) { | ||
PUMP("pump"), | ||
TOOLS("tools"), | ||
STAND("stand"), | ||
CHAIN_TOOL("chain_tool"), | ||
} |
22 changes: 22 additions & 0 deletions
22
...stnordost/streetcomplete/quests/bicycle_repair_station/BicycleRepairStationServiceItem.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.bicycle_repair_station | ||
|
||
import de.westnordost.streetcomplete.R | ||
import de.westnordost.streetcomplete.quests.bicycle_repair_station.BicycleRepairStationService.* | ||
import de.westnordost.streetcomplete.view.image_select.Item | ||
|
||
fun BicycleRepairStationService.asItem(): Item<BicycleRepairStationService> = | ||
Item(this, iconResId, titleResId) | ||
|
||
val BicycleRepairStationService.titleResId: Int get() = when (this) { | ||
PUMP -> R.string.quest_bicycle_repair_station_pump | ||
TOOLS -> R.string.quest_bicycle_repair_station_tools | ||
STAND -> R.string.quest_bicycle_repair_station_stand | ||
CHAIN_TOOL -> R.string.quest_bicycle_repair_station_chain_tool | ||
} | ||
|
||
val BicycleRepairStationService.iconResId: Int get() = when (this) { | ||
PUMP -> R.drawable.bicycle_repair_station_pump | ||
TOOLS -> R.drawable.bicycle_repair_station_tools | ||
STAND -> R.drawable.bicycle_repair_station_stand | ||
CHAIN_TOOL -> R.drawable.bicycle_repair_station_chain_tool | ||
} |
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
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.
Binary file added
BIN
+9.72 KB
app/src/main/res/drawable-xhdpi/bicycle_repair_station_chain_tool.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.
Binary file added
BIN
+14.3 KB
app/src/main/res/drawable-xxhdpi/bicycle_repair_station_chain_tool.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.
56 changes: 56 additions & 0 deletions
56
app/src/main/res/drawable/ic_quest_bicycle_repair_amenity.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,56 @@ | ||
<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.35 -28.65,64 -64,64s-64,-28.65 -64,-64 28.65,-64 64,-64 64,28.65 64,64" | ||
android:fillColor="#ca72e2"/> | ||
<path | ||
android:fillColor="#000" | ||
android:pathData="m61.25,57.77 l-10.48,0.07c-0.96,0.01 -1.81,0.62 -2.11,1.53l-5.83,17.36c-1.25,-0.27 -2.54,-0.42 -3.87,-0.42 -10.14,0 -18.43,8.29 -18.43,18.43 0,10.14 8.29,18.43 18.43,18.43 9.94,0 18.05,-7.97 18.37,-17.84 0.04,-0.2 0.06,-0.39 0.06,-0.59 -0,-0.19 -0.02,-0.39 -0.06,-0.58 -0.22,-6.98 -4.35,-13 -10.26,-15.94l1.02,-3.05 17.22,20.91c0.52,0.61 1.07,0.78 1.84,0.82h3.82c1.08,9.13 8.88,16.27 18.29,16.27 9.94,0 18.05,-7.97 18.37,-17.84 0.04,-0.2 0.06,-0.39 0.06,-0.59 -0,-0.2 -0.02,-0.4 -0.06,-0.59 -0.32,-9.87 -8.43,-17.84 -18.37,-17.84 -2.84,0 -5.52,0.67 -7.93,1.83l-5.43,-8.39c-0.13,-0.2 -0.29,-0.38 -0.48,-0.53l0.4,-1.67 4.94,0.09c1.24,0.02 2.27,-0.97 2.29,-2.21 0.02,-1.24 -0.96,-2.27 -2.21,-2.29l-10.65,-0.2c-1.24,-0.02 -2.27,0.97 -2.29,2.21 -0.02,1.24 0.97,2.26 2.21,2.29l1.1,0.02 -0.3,1.27h-20.65l2.15,-6.4 8.87,-0.06c1.24,-0.01 2.24,-1.02 2.23,-2.26 -0.01,-1.24 -1.02,-2.24 -2.26,-2.23zM52.3,73.23h17.53l-3.93,16.51zM74.01,75.12 L77.53,80.56c-3.52,2.92 -5.93,7.12 -6.54,11.86h-1.1zM38.96,82.32c0.66,0 1.31,0.07 1.94,0.16l-3.85,11.47c-0.4,1.18 0.24,2.45 1.41,2.85 1.18,0.39 2.45,-0.24 2.85,-1.42l3.84,-11.43c3.74,2.14 6.25,6.15 6.25,10.8 0,6.9 -5.53,12.43 -12.43,12.43 -6.9,0 -12.44,-5.53 -12.44,-12.43 0,-6.9 5.53,-12.44 12.44,-12.44zM89.25,82.32c6.9,0 12.44,5.53 12.44,12.44 0,6.9 -5.53,12.43 -12.44,12.43 -6.16,0 -11.22,-4.41 -12.24,-10.27h12.32c1.78,0 2.86,-1.97 1.89,-3.47l-6.62,-10.23c1.44,-0.57 3,-0.9 4.65,-0.9zM80.8,85.62 L85.2,92.42h-8.16c0.5,-2.67 1.85,-5.03 3.76,-6.8z" | ||
android:fillAlpha="0.2"/> | ||
<path | ||
android:pathData="m54.29,90.66a15.44,15.44 0,0 1,-15.44 15.44,15.44 15.44,0 0,1 -15.44,-15.44 15.44,15.44 0,0 1,15.44 -15.44,15.44 15.44,0 0,1 15.44,15.44" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="6" | ||
android:strokeColor="#555" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="m66.95,90.58 l6.97,-29.28" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4.5" | ||
android:strokeColor="#ffe420" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="m70.06,61.09 l10.65,0.2" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4.5" | ||
android:strokeColor="#555" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="m104.62,90.66a15.44,15.44 0,0 1,-15.44 15.44,15.44 15.44,0 0,1 -15.44,-15.44 15.44,15.44 0,0 1,15.44 -15.44,15.44 15.44,0 0,1 15.44,15.44" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="6" | ||
android:strokeColor="#555" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="m47.43,66.88 l19.52,23.7l22.31,0l-15.34,-23.7l-26.49,0" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4.5" | ||
android:strokeColor="#ffe420" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:pathData="m39.06,90.58 l11.62,-34.6 10.49,-0.08" | ||
android:strokeLineJoin="round" | ||
android:strokeWidth="4.5" | ||
android:strokeColor="#ffe420" | ||
android:strokeLineCap="round"/> | ||
<path | ||
android:fillColor="#000" | ||
android:pathData="m36,22a16,16 0,0 0,-14.39 9h16.39v14h-16.39a16,16 0,0 0,14.39 9,16 16,0 0,0 14.83,-10h26.34a16,16 0,0 0,14.83 10,16 16,0 0,0 14.39,-9h-16.39v-14h16.39a16,16 0,0 0,-14.39 -9,16 16,0 0,0 -14.83,10h-26.34a16,16 0,0 0,-14.83 -10z" | ||
android:fillAlpha="0.2"/> | ||
<path | ||
android:pathData="m36,18a16,16 0,0 0,-14.39 9h16.39v14h-16.39a16,16 0,0 0,14.39 9,16 16,0 0,0 14.83,-10h26.34a16,16 0,0 0,14.83 10,16 16,0 0,0 14.39,-9h-16.39v-14h16.39a16,16 0,0 0,-14.39 -9,16 16,0 0,0 -14.83,10h-26.34a16,16 0,0 0,-14.83 -10z" | ||
android:fillColor="#fff"/> | ||
</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
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.