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 60f7bd5771..ef1cbb504b 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt @@ -24,6 +24,7 @@ import de.westnordost.streetcomplete.quests.bench_backrest.AddBenchBackrest import de.westnordost.streetcomplete.quests.bike_parking_capacity.AddBikeParkingCapacity import de.westnordost.streetcomplete.quests.bike_parking_cover.AddBikeParkingCover import de.westnordost.streetcomplete.quests.bike_parking_type.AddBikeParkingType +import de.westnordost.streetcomplete.quests.bike_rental_type.AddBikeRentalType import de.westnordost.streetcomplete.quests.board_type.AddBoardType import de.westnordost.streetcomplete.quests.bollard_type.AddBollardType import de.westnordost.streetcomplete.quests.bridge_structure.AddBridgeStructure @@ -316,8 +317,9 @@ fun questTypeRegistry( /* ↓ 2.solvable when right in front of it but takes longer to input --------------------- */ - // bike parking: would be higher up if not for bike parking capacity which is usually not solvable when moving past + // bike parking/rental: would be higher up if not for bike parking/rental capacity which is usually not solvable when moving past AddBikeParkingCover(), // used by OsmAnd in the object description + AddBikeRentalType(), // generally less overlap of possible types/fewer choices/simpler to answer AddBikeParkingType(), // used by OsmAnd AddBikeParkingAccess(), AddBikeParkingFee(), diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/AddBikeRentalType.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/AddBikeRentalType.kt new file mode 100644 index 0000000000..4a7966fe47 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/AddBikeRentalType.kt @@ -0,0 +1,48 @@ +package de.westnordost.streetcomplete.quests.bike_rental_type + +import de.westnordost.streetcomplete.R +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.osm.osmquests.Tags +import de.westnordost.streetcomplete.data.user.achievements.QuestTypeAchievement.BICYCLIST + +class AddBikeRentalType : OsmFilterQuestType() { + + override val elementFilter = """ + nodes, ways with + amenity = bicycle_rental + and access !~ private|no + and (!bicycle_rental or bicycle_rental = yes) + and !shop + """ + override val changesetComment = "Add bicycle rental type" + override val wikiLink = "Key:bicycle_rental" + override val icon = R.drawable.ic_quest_bicycle_rental + override val isDeleteElementEnabled = true + override val questTypeAchievements = listOf(BICYCLIST) + + override fun getTitle(tags: Map) = R.string.quest_bicycle_rental_type_title + + override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = + getMapData().filter("nodes, ways with amenity = bicycle_rental") + + override fun createForm() = AddBikeRentalTypeForm() + + override fun applyAnswerTo(answer: BikeRentalTypeAnswer, tags: Tags, timestampEdited: Long) { + when (answer) { + is BikeRentalType -> { + tags["bicycle_rental"] = answer.osmValue + if (answer == BikeRentalType.HUMAN) { + tags["shop"] = "rental" + } + } + is BikeShopWithRental -> { + tags.remove("amenity") + tags["shop"] = "bicycle" + tags["service:bicycle:rental"] = "yes" + } + } + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/AddBikeRentalTypeForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/AddBikeRentalTypeForm.kt new file mode 100644 index 0000000000..fd959205e1 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/AddBikeRentalTypeForm.kt @@ -0,0 +1,25 @@ +package de.westnordost.streetcomplete.quests.bike_rental_type + +import de.westnordost.streetcomplete.R +import de.westnordost.streetcomplete.quests.AImageListQuestAnswerFragment +import de.westnordost.streetcomplete.quests.bike_rental_type.BikeRentalType.DOCKING_STATION +import de.westnordost.streetcomplete.quests.bike_rental_type.BikeRentalType.DROPOFF_POINT +import de.westnordost.streetcomplete.quests.bike_rental_type.BikeRentalType.HUMAN +import de.westnordost.streetcomplete.view.image_select.Item + +class AddBikeRentalTypeForm : AImageListQuestAnswerFragment() { + + override val items: List> = listOf( + Item(DOCKING_STATION, R.drawable.bicycle_rental_docking_station, R.string.quest_bicycle_rental_type_docking_station), + Item(DROPOFF_POINT, R.drawable.bicycle_rental_dropoff_point, R.string.quest_bicycle_rental_type_dropoff_point), + Item(HUMAN, R.drawable.bicycle_rental_human, R.string.quest_bicycle_rental_type_human), + Item(BikeShopWithRental, R.drawable.bicycle_rental_shop_with_rental, R.string.quest_bicycle_rental_type_shop_with_rental), + ) + + override val itemsPerRow = 2 + override val moveFavoritesToFront = false + + override fun onClickOk(selectedItems: List) { + applyAnswer(selectedItems.single()) + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/BikeRentalType.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/BikeRentalType.kt new file mode 100644 index 0000000000..9fa31ba302 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_type/BikeRentalType.kt @@ -0,0 +1,11 @@ +package de.westnordost.streetcomplete.quests.bike_rental_type + +sealed interface BikeRentalTypeAnswer + +enum class BikeRentalType(val osmValue: String) : BikeRentalTypeAnswer { + DOCKING_STATION("docking_station"), + DROPOFF_POINT("dropoff_point"), + HUMAN("shop"), +} + +object BikeShopWithRental : BikeRentalTypeAnswer diff --git a/app/src/main/res/authors.txt b/app/src/main/res/authors.txt index a3761cf38d..da0d955e96 100644 --- a/app/src/main/res/authors.txt +++ b/app/src/main/res/authors.txt @@ -38,6 +38,11 @@ bicycle_parking_type_stand.jpg CC0 Mateusz Konieczny https://commo bicycle_parking_type_wheel... CC-BY-SA 4.0 Joxemai https://commons.wikimedia.org/wiki/File:Bizikletak_lotzekoa.JPG bicycle_parking_type_handl... CC-BY-SA 4.0 Hiddewie https://commons.wikimedia.org/wiki/File:Bicycle_parking_handlebar_holder.jpg +bicycle_rental_docking_stat... CC-BY-SA 3.0 Siyuwj https://commons.wikimedia.org/wiki/File:Bicycle_rental_site_of_Tiangongyuan_Station.JPG +bicycle_rental_dropoff_poin... CC-BY-SA 4.0 Alexander Migl https://commons.wikimedia.org/wiki/File:Stuttgart-Vaihingen_Train_Station_Mobility_Hub_IMG_5767.jpg +bicycle_rental_human.jpg CC-BY-SA 2.0 TijsB https://commons.wikimedia.org/wiki/File:Tel_Aviv-_bike_rental_(5889990605).jpg +bicycle_rental_shop_with_re... CC-BY-SA 2.0 Darb02 https://commons.wikimedia.org/wiki/File:Rydjor_Bike_Shop_and_Antique_Bike_Museum.jpg + bollard_fixed.jpg CC-BY-SA 4.0 Matija Nalis https://github.com/streetcomplete/StreetComplete/issues/3657#issuecomment-1020666101 bollard_flexible.jpg CC0 Ruben Kelevra https://commons.wikimedia.org/wiki/File:Flexible_bollard.jpg bollard_foldable.jpg CC-BY-SA 3.0 Hauke Stieler https://wiki.openstreetmap.org/wiki/File:Bollard_foldable.jpg diff --git a/app/src/main/res/drawable-hdpi/bicycle_rental_docking_station.jpg b/app/src/main/res/drawable-hdpi/bicycle_rental_docking_station.jpg new file mode 100644 index 0000000000..4a33771247 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/bicycle_rental_docking_station.jpg differ diff --git a/app/src/main/res/drawable-hdpi/bicycle_rental_dropoff_point.jpg b/app/src/main/res/drawable-hdpi/bicycle_rental_dropoff_point.jpg new file mode 100644 index 0000000000..c3ef556ee5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/bicycle_rental_dropoff_point.jpg differ diff --git a/app/src/main/res/drawable-hdpi/bicycle_rental_human.jpg b/app/src/main/res/drawable-hdpi/bicycle_rental_human.jpg new file mode 100644 index 0000000000..57874ef0f8 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/bicycle_rental_human.jpg differ diff --git a/app/src/main/res/drawable-hdpi/bicycle_rental_shop_with_rental.jpg b/app/src/main/res/drawable-hdpi/bicycle_rental_shop_with_rental.jpg new file mode 100644 index 0000000000..8c109d18dd Binary files /dev/null and b/app/src/main/res/drawable-hdpi/bicycle_rental_shop_with_rental.jpg differ diff --git a/app/src/main/res/drawable-mdpi/bicycle_rental_docking_station.jpg b/app/src/main/res/drawable-mdpi/bicycle_rental_docking_station.jpg new file mode 100644 index 0000000000..f54fdf48a1 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/bicycle_rental_docking_station.jpg differ diff --git a/app/src/main/res/drawable-mdpi/bicycle_rental_dropoff_point.jpg b/app/src/main/res/drawable-mdpi/bicycle_rental_dropoff_point.jpg new file mode 100644 index 0000000000..b598c13978 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/bicycle_rental_dropoff_point.jpg differ diff --git a/app/src/main/res/drawable-mdpi/bicycle_rental_human.jpg b/app/src/main/res/drawable-mdpi/bicycle_rental_human.jpg new file mode 100644 index 0000000000..76fba91fdc Binary files /dev/null and b/app/src/main/res/drawable-mdpi/bicycle_rental_human.jpg differ diff --git a/app/src/main/res/drawable-mdpi/bicycle_rental_shop_with_rental.jpg b/app/src/main/res/drawable-mdpi/bicycle_rental_shop_with_rental.jpg new file mode 100644 index 0000000000..ff2e1fb362 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/bicycle_rental_shop_with_rental.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/bicycle_rental_docking_station.jpg b/app/src/main/res/drawable-xhdpi/bicycle_rental_docking_station.jpg new file mode 100644 index 0000000000..72b58349eb Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bicycle_rental_docking_station.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/bicycle_rental_dropoff_point.jpg b/app/src/main/res/drawable-xhdpi/bicycle_rental_dropoff_point.jpg new file mode 100644 index 0000000000..b159b40e09 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bicycle_rental_dropoff_point.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/bicycle_rental_human.jpg b/app/src/main/res/drawable-xhdpi/bicycle_rental_human.jpg new file mode 100644 index 0000000000..86556cbf1d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bicycle_rental_human.jpg differ diff --git a/app/src/main/res/drawable-xhdpi/bicycle_rental_shop_with_rental.jpg b/app/src/main/res/drawable-xhdpi/bicycle_rental_shop_with_rental.jpg new file mode 100644 index 0000000000..79e53a6ef9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/bicycle_rental_shop_with_rental.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/bicycle_rental_docking_station.jpg b/app/src/main/res/drawable-xxhdpi/bicycle_rental_docking_station.jpg new file mode 100644 index 0000000000..340b31c320 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bicycle_rental_docking_station.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/bicycle_rental_dropoff_point.jpg b/app/src/main/res/drawable-xxhdpi/bicycle_rental_dropoff_point.jpg new file mode 100644 index 0000000000..d8dd6c60ac Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bicycle_rental_dropoff_point.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/bicycle_rental_human.jpg b/app/src/main/res/drawable-xxhdpi/bicycle_rental_human.jpg new file mode 100644 index 0000000000..0e3450d1be Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bicycle_rental_human.jpg differ diff --git a/app/src/main/res/drawable-xxhdpi/bicycle_rental_shop_with_rental.jpg b/app/src/main/res/drawable-xxhdpi/bicycle_rental_shop_with_rental.jpg new file mode 100644 index 0000000000..2a769e488a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/bicycle_rental_shop_with_rental.jpg differ diff --git a/app/src/main/res/drawable/ic_quest_bicycle_rental.xml b/app/src/main/res/drawable/ic_quest_bicycle_rental.xml new file mode 100644 index 0000000000..2dd9c2827e --- /dev/null +++ b/app/src/main/res/drawable/ic_quest_bicycle_rental.xml @@ -0,0 +1,33 @@ + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 563e9ae882..922a8fd70a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -657,6 +657,12 @@ However, before uploading your changes, the app checks with a <a href=\"https Building Handlebar holder + What type of bicycle rental is this? + Docking station which locks bikes + Designated spot (bikes locked individually) + Human-operated bike rental + Bike store that also rents bikes + "How many bikes can be parked here?" "Note that most normal stands can be used from both sides to park each one bike."