From 1745590f70e4d50835d2f8e6456ff32adb2dd6e6 Mon Sep 17 00:00:00 2001 From: Kai Michael Poppe Date: Sun, 14 Jul 2024 06:01:32 +0200 Subject: [PATCH] [WIP] Add Boat Rental Quest Resolves #5426. Known issues - feedback required: * Order in QuestModule * Is this a RARE achievement (only 5.3k boat_rentals tagged today) * Answer SVGs range from 0 to 100 in my view as to their fit (I love the floaty duckboat for "pedalboard" ;-)) Wouldn't CC0 images from wikidata the better idea? --- .../streetcomplete/quests/QuestsModule.kt | 3 ++ .../quests/boat_rental/AddBoatRental.kt | 36 ++++++++++++++++++ .../quests/boat_rental/AddBoatRentalForm.kt | 23 +++++++++++ .../quests/boat_rental/BoatRental.kt | 14 +++++++ .../quests/boat_rental/BoatRentalItem.kt | 38 +++++++++++++++++++ .../res/drawable/ic_boat_rental_canoe.xml | 15 ++++++++ .../res/drawable/ic_boat_rental_dinghy.xml | 5 +++ .../res/drawable/ic_boat_rental_houseboat.xml | 9 +++++ .../res/drawable/ic_boat_rental_jetski.xml | 25 ++++++++++++ .../res/drawable/ic_boat_rental_kayak.xml | 29 ++++++++++++++ .../res/drawable/ic_boat_rental_motorboat.xml | 13 +++++++ .../drawable/ic_boat_rental_pedalboard.xml | 15 ++++++++ .../res/drawable/ic_boat_rental_sailboat.xml | 7 ++++ .../ic_boat_rental_standup_paddleboard.xml | 5 +++ .../res/drawable/ic_quest_boat_rental.xml | 38 +++++++++++++++++++ app/src/main/res/values/strings.xml | 11 ++++++ res/graphics/boat rental/canoe.svg | 14 +++++++ res/graphics/boat rental/dinghy.svg | 5 +++ res/graphics/boat rental/houseboat.svg | 7 ++++ res/graphics/boat rental/jetski.svg | 21 ++++++++++ res/graphics/boat rental/kayak.svg | 17 +++++++++ res/graphics/boat rental/motorboat.svg | 9 +++++ res/graphics/boat rental/paddleboard.svg | 5 +++ res/graphics/boat rental/pedalboard.svg | 10 +++++ res/graphics/boat rental/sailboat.svg | 6 +++ res/graphics/quest/boat_rental.svg | 2 + 26 files changed, 382 insertions(+) create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRental.kt create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRentalForm.kt create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRental.kt create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRentalItem.kt create mode 100644 app/src/main/res/drawable/ic_boat_rental_canoe.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_dinghy.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_houseboat.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_jetski.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_kayak.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_motorboat.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_pedalboard.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_sailboat.xml create mode 100644 app/src/main/res/drawable/ic_boat_rental_standup_paddleboard.xml create mode 100644 app/src/main/res/drawable/ic_quest_boat_rental.xml create mode 100644 res/graphics/boat rental/canoe.svg create mode 100644 res/graphics/boat rental/dinghy.svg create mode 100644 res/graphics/boat rental/houseboat.svg create mode 100644 res/graphics/boat rental/jetski.svg create mode 100644 res/graphics/boat rental/kayak.svg create mode 100644 res/graphics/boat rental/motorboat.svg create mode 100644 res/graphics/boat rental/paddleboard.svg create mode 100644 res/graphics/boat rental/pedalboard.svg create mode 100644 res/graphics/boat rental/sailboat.svg create mode 100644 res/graphics/quest/boat_rental.svg diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt index ec82803b88..6cc97fed2d 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt @@ -39,6 +39,7 @@ import de.westnordost.streetcomplete.quests.bike_rental_type.AddBikeRentalType import de.westnordost.streetcomplete.quests.bike_shop.AddBikeRepairAvailability import de.westnordost.streetcomplete.quests.bike_shop.AddSecondHandBicycleAvailability import de.westnordost.streetcomplete.quests.board_type.AddBoardType +import de.westnordost.streetcomplete.quests.boat_rental.AddBoatRental import de.westnordost.streetcomplete.quests.bollard_type.AddBollardType import de.westnordost.streetcomplete.quests.bridge_structure.AddBridgeStructure import de.westnordost.streetcomplete.quests.building_entrance.AddEntrance @@ -427,6 +428,8 @@ fun questTypeRegistry( /* ↓ 3.quests that may need some exploration / walking around --------------------------- */ + 170 to AddBoatRental(), + // ferry: usually visible from looking at the boat, but not always... 101 to AddFerryAccessPedestrian(), 102 to AddFerryAccessMotorVehicle(), diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRental.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRental.kt new file mode 100644 index 0000000000..f2e22d68b8 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRental.kt @@ -0,0 +1,36 @@ +package de.westnordost.streetcomplete.quests.boat_rental + +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.data.user.achievements.EditTypeAchievement.OUTDOORS +import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement.RARE +import de.westnordost.streetcomplete.osm.Tags + +class AddBoatRental : OsmFilterQuestType>() { + + override val elementFilter = """ + nodes, ways with + ( + amenity = boat_rental + ) + and ${ALL_RENTALS.joinToString(" and ") { "!$it" }} + """ + override val changesetComment = "Specify boat types for rental" + override val wikiLink = "Tag:amenity=boat_rental" + override val icon = R.drawable.ic_quest_boat_rental + override val achievements = listOf(OUTDOORS, RARE) + + override fun getTitle(tags: Map) = R.string.quest_boat_rental_title + + override fun createForm() = AddBoatRentalForm() + + override fun applyAnswerTo(answer: List, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) { + answer.forEach{ tags[it.osmValue] = "yes" } + } +} + +private val ALL_RENTALS = + setOf("canoe_rental", "kayak_rental", "pedalboard_rental", + "motorboat_rental", "standup_paddleboard_rental", "sailboat_rental", + "jetski_rental", "houseboat_rental", "dinghy_rental") diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRentalForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRentalForm.kt new file mode 100644 index 0000000000..2038f22242 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/AddBoatRentalForm.kt @@ -0,0 +1,23 @@ +package de.westnordost.streetcomplete.quests.boat_rental + +import android.os.Bundle +import de.westnordost.streetcomplete.R +import de.westnordost.streetcomplete.quests.AImageListQuestForm + +class AddBoatRentalForm : AImageListQuestForm>() { + + override val items = BoatRental.entries.map { it.asItem() } + override val itemsPerRow = 3 + + 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) { + applyAnswer(selectedItems) + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRental.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRental.kt new file mode 100644 index 0000000000..60c283e6d3 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRental.kt @@ -0,0 +1,14 @@ +package de.westnordost.streetcomplete.quests.boat_rental + +// sorted by taginfo usages as per July 2024 +enum class BoatRental(val osmValue: String) { + CANOE("canoe_rental"), + KAYAK("kayak_rental"), + PEDALBOARD("pedalboard_rental"), + MOTORBOAT("motorboat_rental"), + PADDLEBOARD("standup_paddleboard_rental"), + SAILBOAT("sailboat_rental"), + JETSKI("jetski_rental"), + HOUSEBOAT("houseboat_rental"), + DINGHY("dinghy_rental"), +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRentalItem.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRentalItem.kt new file mode 100644 index 0000000000..ba3deb39ad --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/boat_rental/BoatRentalItem.kt @@ -0,0 +1,38 @@ +package de.westnordost.streetcomplete.quests.boat_rental + +import de.westnordost.streetcomplete.R +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.MOTORBOAT +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.HOUSEBOAT +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.PEDALBOARD +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.JETSKI +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.SAILBOAT +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.DINGHY +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.KAYAK +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.CANOE +import de.westnordost.streetcomplete.quests.boat_rental.BoatRental.PADDLEBOARD +import de.westnordost.streetcomplete.view.image_select.Item + +fun BoatRental.asItem() = Item(this, iconResId, titleResId) + +private val BoatRental.titleResId: Int get() = when (this) { + CANOE -> R.string.quest_boat_rental_canoe + KAYAK -> R.string.quest_boat_rental_kayak + PEDALBOARD -> R.string.quest_boat_rental_pedalboard + MOTORBOAT -> R.string.quest_boat_rental_motorboat + PADDLEBOARD -> R.string.quest_boat_rental_paddleboard + SAILBOAT -> R.string.quest_boat_rental_sailboat + JETSKI -> R.string.quest_boat_rental_jetski + HOUSEBOAT -> R.string.quest_boat_rental_houseboat + DINGHY -> R.string.quest_boat_rental_dinghy +} +private val BoatRental.iconResId: Int get() = when (this) { + CANOE -> R.drawable.ic_boat_rental_canoe + KAYAK -> R.drawable.ic_boat_rental_kayak + PEDALBOARD -> R.drawable.ic_boat_rental_pedalboard + MOTORBOAT -> R.drawable.ic_boat_rental_motorboat + PADDLEBOARD -> R.drawable.ic_boat_rental_standup_paddleboard + SAILBOAT -> R.drawable.ic_boat_rental_sailboat + JETSKI -> R.drawable.ic_boat_rental_jetski + HOUSEBOAT -> R.drawable.ic_boat_rental_houseboat + DINGHY -> R.drawable.ic_boat_rental_dinghy +} diff --git a/app/src/main/res/drawable/ic_boat_rental_canoe.xml b/app/src/main/res/drawable/ic_boat_rental_canoe.xml new file mode 100644 index 0000000000..00cf681052 --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_canoe.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_dinghy.xml b/app/src/main/res/drawable/ic_boat_rental_dinghy.xml new file mode 100644 index 0000000000..2a6894e59c --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_dinghy.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_houseboat.xml b/app/src/main/res/drawable/ic_boat_rental_houseboat.xml new file mode 100644 index 0000000000..c9fafd06f7 --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_houseboat.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_jetski.xml b/app/src/main/res/drawable/ic_boat_rental_jetski.xml new file mode 100644 index 0000000000..0a418df06b --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_jetski.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_kayak.xml b/app/src/main/res/drawable/ic_boat_rental_kayak.xml new file mode 100644 index 0000000000..d2a3c01435 --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_kayak.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_motorboat.xml b/app/src/main/res/drawable/ic_boat_rental_motorboat.xml new file mode 100644 index 0000000000..0ac847359f --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_motorboat.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_pedalboard.xml b/app/src/main/res/drawable/ic_boat_rental_pedalboard.xml new file mode 100644 index 0000000000..0cc045adea --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_pedalboard.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_sailboat.xml b/app/src/main/res/drawable/ic_boat_rental_sailboat.xml new file mode 100644 index 0000000000..41fa5cef5a --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_sailboat.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_boat_rental_standup_paddleboard.xml b/app/src/main/res/drawable/ic_boat_rental_standup_paddleboard.xml new file mode 100644 index 0000000000..c70dd969c7 --- /dev/null +++ b/app/src/main/res/drawable/ic_boat_rental_standup_paddleboard.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_quest_boat_rental.xml b/app/src/main/res/drawable/ic_quest_boat_rental.xml new file mode 100644 index 0000000000..220c3d4462 --- /dev/null +++ b/app/src/main/res/drawable/ic_quest_boat_rental.xml @@ -0,0 +1,38 @@ + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f53156187e..3dc69b8434 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -799,6 +799,17 @@ Before uploading your changes, the app checks with a <a href=\"https://www.we Is it just a map and only a map? If the board is about a particular topic, please specify it, regardless of whether it also includes a map. For example a public transport board may have a bus route map. If the topic is not listed among the available answers, please consider leaving a note instead. + Which type of boats are for rent here? + Motorboat + Jetski + Sailboat + Pedalboard + Kayak + Canoe + Houseboat + Dinghy + Standup Paddleboard + What type of bollard is this? Rising Removable (with or without key) diff --git a/res/graphics/boat rental/canoe.svg b/res/graphics/boat rental/canoe.svg new file mode 100644 index 0000000000..da1168385e --- /dev/null +++ b/res/graphics/boat rental/canoe.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/res/graphics/boat rental/dinghy.svg b/res/graphics/boat rental/dinghy.svg new file mode 100644 index 0000000000..3427aef89d --- /dev/null +++ b/res/graphics/boat rental/dinghy.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/graphics/boat rental/houseboat.svg b/res/graphics/boat rental/houseboat.svg new file mode 100644 index 0000000000..ca782d4d74 --- /dev/null +++ b/res/graphics/boat rental/houseboat.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/res/graphics/boat rental/jetski.svg b/res/graphics/boat rental/jetski.svg new file mode 100644 index 0000000000..c1209e427b --- /dev/null +++ b/res/graphics/boat rental/jetski.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/res/graphics/boat rental/kayak.svg b/res/graphics/boat rental/kayak.svg new file mode 100644 index 0000000000..228ea0563d --- /dev/null +++ b/res/graphics/boat rental/kayak.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/res/graphics/boat rental/motorboat.svg b/res/graphics/boat rental/motorboat.svg new file mode 100644 index 0000000000..32dbcdb93b --- /dev/null +++ b/res/graphics/boat rental/motorboat.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/res/graphics/boat rental/paddleboard.svg b/res/graphics/boat rental/paddleboard.svg new file mode 100644 index 0000000000..c3180119cc --- /dev/null +++ b/res/graphics/boat rental/paddleboard.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/res/graphics/boat rental/pedalboard.svg b/res/graphics/boat rental/pedalboard.svg new file mode 100644 index 0000000000..beefac3e00 --- /dev/null +++ b/res/graphics/boat rental/pedalboard.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/res/graphics/boat rental/sailboat.svg b/res/graphics/boat rental/sailboat.svg new file mode 100644 index 0000000000..7f4a45f9bd --- /dev/null +++ b/res/graphics/boat rental/sailboat.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/graphics/quest/boat_rental.svg b/res/graphics/quest/boat_rental.svg new file mode 100644 index 0000000000..fab7dd609f --- /dev/null +++ b/res/graphics/quest/boat_rental.svg @@ -0,0 +1,2 @@ + +