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 ef1cbb504b..a6115b9523 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_capacity.AddBikeRentalCapacity 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 @@ -323,6 +324,7 @@ fun questTypeRegistry( AddBikeParkingType(), // used by OsmAnd AddBikeParkingAccess(), AddBikeParkingFee(), + AddBikeRentalCapacity(), // less ambiguous than bike parking AddBikeParkingCapacity(), // used by cycle map layer on osm.org, OsmAnd // address: usually only visible when just in front + sometimes requires to take "other answer" diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacity.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacity.kt index a3bbe79ff7..0e2507be30 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacity.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacity.kt @@ -36,7 +36,7 @@ class AddBikeParkingCapacity : OsmFilterQuestType() { override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = getMapData().filter("nodes, ways with amenity = bicycle_parking") - override fun createForm() = AddBikeParkingCapacityForm() + override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = true) override fun applyAnswerTo(answer: Int, tags: Tags, timestampEdited: Long) { tags.updateWithCheckDate("capacity", answer.toString()) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacityForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacityForm.kt index 4289458be0..92dd5a5a3c 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacityForm.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_parking_capacity/AddBikeParkingCapacityForm.kt @@ -2,6 +2,8 @@ package de.westnordost.streetcomplete.quests.bike_parking_capacity import android.os.Bundle import android.view.View +import androidx.core.os.bundleOf +import androidx.core.view.isGone import androidx.core.widget.doAfterTextChanged import de.westnordost.streetcomplete.R import de.westnordost.streetcomplete.databinding.QuestBikeParkingCapacityBinding @@ -17,6 +19,8 @@ class AddBikeParkingCapacityForm : AbstractQuestFormAnswerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + val showClarificationText = arguments?.getBoolean(ARG_SHOW_CLARIFICATION) ?: false + binding.clarificationText.isGone = !showClarificationText binding.capacityInput.doAfterTextChanged { checkIsFormComplete() } } @@ -25,4 +29,14 @@ class AddBikeParkingCapacityForm : AbstractQuestFormAnswerFragment() { override fun onClickOk() { applyAnswer(capacity) } + + companion object { + private const val ARG_SHOW_CLARIFICATION = "show_clarification" + + fun create(showClarificationText: Boolean): AddBikeParkingCapacityForm { + val form = AddBikeParkingCapacityForm() + form.arguments = bundleOf(ARG_SHOW_CLARIFICATION to showClarificationText) + return form + } + } } diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacity.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacity.kt new file mode 100644 index 0000000000..4d5b3c20a0 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacity.kt @@ -0,0 +1,39 @@ +package de.westnordost.streetcomplete.quests.bike_rental_capacity + +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 +import de.westnordost.streetcomplete.osm.updateWithCheckDate +import de.westnordost.streetcomplete.quests.bike_parking_capacity.AddBikeParkingCapacityForm + +class AddBikeRentalCapacity : OsmFilterQuestType() { + + override val elementFilter = """ + nodes, ways with + amenity = bicycle_rental + and access !~ private|no + and bicycle_rental = docking_station + and (!capacity or capacity older today -6 years) + """ + + override val changesetComment = "Add bicycle rental capacities" + override val wikiLink = "Tag:amenity=bicycle_rental" + override val icon = R.drawable.ic_quest_bicycle_rental_capacity + override val isDeleteElementEnabled = true + override val questTypeAchievements = listOf(BICYCLIST) + + override fun getTitle(tags: Map) = R.string.quest_bicycle_rental_capacity_title + + override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = + getMapData().filter("nodes, ways with amenity = bicycle_rental") + + override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = false) + + override fun applyAnswerTo(answer: Int, tags: Tags, timestampEdited: Long) { + tags.updateWithCheckDate("capacity", answer.toString()) + } +} diff --git a/app/src/main/java/de/westnordost/streetcomplete/screens/main/map/PinIcons.kt b/app/src/main/java/de/westnordost/streetcomplete/screens/main/map/PinIcons.kt index faf22354db..5c99af78a2 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/screens/main/map/PinIcons.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/screens/main/map/PinIcons.kt @@ -9,6 +9,7 @@ import de.westnordost.streetcomplete.quests.getNameLabel "atm" -> return R.drawable.ic_pin_money "bench" -> return R.drawable.ic_pin_bench "bicycle_parking" -> return R.drawable.ic_pin_bicycle_parking + "bicycle_rental" -> return R.drawable.ic_pin_bicycle_rental "bicycle_repair_station" -> { if (map["service:bicycle:pump"] == "yes") return R.drawable.ic_pin_bicycle_pump } diff --git a/app/src/main/res/drawable/ic_pin_bicycle_rental.xml b/app/src/main/res/drawable/ic_pin_bicycle_rental.xml new file mode 100644 index 0000000000..29cbce0f04 --- /dev/null +++ b/app/src/main/res/drawable/ic_pin_bicycle_rental.xml @@ -0,0 +1,19 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_quest_bicycle_rental_capacity.xml b/app/src/main/res/drawable/ic_quest_bicycle_rental_capacity.xml new file mode 100644 index 0000000000..a0797037f5 --- /dev/null +++ b/app/src/main/res/drawable/ic_quest_bicycle_rental_capacity.xml @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 922a8fd70a..9277133c9b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -657,6 +657,9 @@ However, before uploading your changes, the app checks with a <a href=\"https Building Handlebar holder + + How many rental bike spaces are here? + What type of bicycle rental is this? Docking station which locks bikes Designated spot (bikes locked individually) diff --git a/res/graphics/pins/bicycle_rental.svg b/res/graphics/pins/bicycle_rental.svg new file mode 100644 index 0000000000..ce20d6410f --- /dev/null +++ b/res/graphics/pins/bicycle_rental.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/res/graphics/quest/bicycle_rental_capacity.svg b/res/graphics/quest/bicycle_rental_capacity.svg new file mode 100644 index 0000000000..1aa0a1230b --- /dev/null +++ b/res/graphics/quest/bicycle_rental_capacity.svg @@ -0,0 +1,9 @@ + + + + + + + + +