From a40acf533b96d12451c969f3e077c75e7fbd6f82 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 3 May 2022 15:27:34 +0200 Subject: [PATCH 01/11] Add bicycle rental capacity quest --- .../streetcomplete/quests/QuestsModule.kt | 4 +- .../AddBikeRentalCapacity.kt | 38 +++++++++++++++++++ .../AddBikeRentalCapacityForm.kt | 28 ++++++++++++++ .../res/drawable/ic_quest_bicycle_rental.xml | 33 ++++++++++++++++ .../res/layout/quest_bike_rental_capacity.xml | 38 +++++++++++++++++++ app/src/main/res/values/strings.xml | 2 + 6 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacity.kt create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt create mode 100644 app/src/main/res/drawable/ic_quest_bicycle_rental.xml create mode 100644 app/src/main/res/layout/quest_bike_rental_capacity.xml 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..e76624bbda 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.board_type.AddBoardType import de.westnordost.streetcomplete.quests.bollard_type.AddBollardType import de.westnordost.streetcomplete.quests.bridge_structure.AddBridgeStructure @@ -316,12 +317,13 @@ 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 AddBikeParkingType(), // used by OsmAnd AddBikeParkingAccess(), AddBikeParkingFee(), AddBikeParkingCapacity(), // used by cycle map layer on osm.org, OsmAnd + AddBikeRentalCapacity(), // address: usually only visible when just in front + sometimes requires to take "other answer" AddHousenumber(), 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..6f06cdd438 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacity.kt @@ -0,0 +1,38 @@ +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 + +class AddBikeRentalCapacity : OsmFilterQuestType() { + + override val elementFilter = """ + nodes, ways with + amenity = bicycle_rental + and access !~ private|no + and bicycle_rental ~ docking_station|dropoff_point + 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 + 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_parking") + + override fun createForm() = AddBikeRentalCapacityForm() + + 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_rental_capacity/AddBikeRentalCapacityForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt new file mode 100644 index 0000000000..d777c8cc64 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt @@ -0,0 +1,28 @@ +package de.westnordost.streetcomplete.quests.bike_rental_capacity + +import android.os.Bundle +import android.view.View +import androidx.core.widget.doAfterTextChanged +import de.westnordost.streetcomplete.R +import de.westnordost.streetcomplete.databinding.QuestBikeRentalCapacityBinding +import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment +import de.westnordost.streetcomplete.util.ktx.intOrNull + +class AddBikeRentalCapacityForm : AbstractQuestFormAnswerFragment() { + + override val contentLayoutResId = R.layout.quest_bike_rental_capacity + private val binding by contentViewBinding(QuestBikeRentalCapacityBinding::bind) + + private val capacity get() = binding.capacityInput.intOrNull ?: 0 + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + binding.capacityInput.doAfterTextChanged { checkIsFormComplete() } + } + + override fun isFormComplete() = capacity > 0 + + override fun onClickOk() { + applyAnswer(capacity) + } +} 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/layout/quest_bike_rental_capacity.xml b/app/src/main/res/layout/quest_bike_rental_capacity.xml new file mode 100644 index 0000000000..1bf6f4e772 --- /dev/null +++ b/app/src/main/res/layout/quest_bike_rental_capacity.xml @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index adae119619..fef08426b5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -657,6 +657,8 @@ However, before uploading your changes, the app checks with a <a href=\"https Building Handlebar holder + How many bikes can be rented or returned here? + "How many bikes can be parked here?" "Note that most normal stands can be used from both sides to park each one bike." From 21551f6f5feb79978411b0010054d43b05239f57 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 3 May 2022 15:48:38 +0200 Subject: [PATCH 02/11] Highlight nearby bicycle rentals --- .../AddBikeParkingCapacity.kt | 2 +- .../AddBikeRentalCapacity.kt | 2 +- .../screens/main/map/PinIcons.kt | 1 + .../res/drawable/ic_pin_bicycle_rental.xml | 19 +++++++++++++++++++ res/graphics/pins/bicycle_rental.svg | 6 ++++++ 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/drawable/ic_pin_bicycle_rental.xml create mode 100644 res/graphics/pins/bicycle_rental.svg 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..87c7a0fc27 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 @@ -34,7 +34,7 @@ class AddBikeParkingCapacity : OsmFilterQuestType() { override fun getTitle(tags: Map) = R.string.quest_bikeParkingCapacity_title override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = - getMapData().filter("nodes, ways with amenity = bicycle_parking") + getMapData().filter("nodes, ways with amenity ~ bicycle_parking|bicycle_rental") override fun createForm() = AddBikeParkingCapacityForm() 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 index 6f06cdd438..7823a091a0 100644 --- 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 @@ -28,7 +28,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { 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_parking") + getMapData().filter("nodes, ways with amenity ~ bicycle_parking|bicycle_rental") override fun createForm() = AddBikeRentalCapacityForm() 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/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 @@ + + + + + + From 3773f50cbf7865d76cb8fbcb32331c6f7243e469 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 3 May 2022 16:16:03 +0200 Subject: [PATCH 03/11] Restrict to `bicycle_rental=docking_station` --- .../quests/bike_rental_capacity/AddBikeRentalCapacity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 7823a091a0..14d51cc2a4 100644 --- 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 @@ -15,7 +15,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { nodes, ways with amenity = bicycle_rental and access !~ private|no - and bicycle_rental ~ docking_station|dropoff_point + and bicycle_rental = docking_station and (!capacity or capacity older today -6 years) """ From 46e23213ebd3ecea70ce2638891dcede79685cb3 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Tue, 3 May 2022 16:23:33 +0200 Subject: [PATCH 04/11] Improve quest order Co-authored-by: Peter Newman --- .../java/de/westnordost/streetcomplete/quests/QuestsModule.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e76624bbda..278d5cb2cd 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestsModule.kt @@ -322,8 +322,8 @@ fun questTypeRegistry( AddBikeParkingType(), // used by OsmAnd AddBikeParkingAccess(), AddBikeParkingFee(), + AddBikeRentalCapacity(), // less ambiguous than bike parking AddBikeParkingCapacity(), // used by cycle map layer on osm.org, OsmAnd - AddBikeRentalCapacity(), // address: usually only visible when just in front + sometimes requires to take "other answer" AddHousenumber(), From 396dfbb7b6805f28de893eaf1e77960f85e177e2 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Wed, 4 May 2022 21:26:23 +0200 Subject: [PATCH 05/11] Add bicycle rental capacity quest icon --- .../AddBikeRentalCapacity.kt | 2 +- .../ic_quest_bicycle_rental_capacity.xml | 34 +++++++++++++++++++ .../quest/bicycle_rental_capacity.svg | 9 +++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/drawable/ic_quest_bicycle_rental_capacity.xml create mode 100644 res/graphics/quest/bicycle_rental_capacity.svg 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 index 14d51cc2a4..5178b0fe10 100644 --- 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 @@ -21,7 +21,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { override val changesetComment = "Add bicycle rental capacities" override val wikiLink = "Tag:amenity=bicycle_rental" - override val icon = R.drawable.ic_quest_bicycle_rental + override val icon = R.drawable.ic_quest_bicycle_rental_capacity override val isDeleteElementEnabled = true override val questTypeAchievements = listOf(BICYCLIST) 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/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 @@ + + + + + + + + + From 844328e02c45dc5b331202f47726e20a558327fe Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Wed, 4 May 2022 21:55:35 +0200 Subject: [PATCH 06/11] Reuse `AddBikeParkingCapacityForm` quest form --- .../AddBikeParkingCapacity.kt | 2 +- .../AddBikeParkingCapacityForm.kt | 5 ++- .../AddBikeRentalCapacity.kt | 3 +- .../AddBikeRentalCapacityForm.kt | 28 -------------- .../res/layout/quest_bike_rental_capacity.xml | 38 ------------------- 5 files changed, 7 insertions(+), 69 deletions(-) delete mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt delete mode 100644 app/src/main/res/layout/quest_bike_rental_capacity.xml 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 87c7a0fc27..2e216d9748 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|bicycle_rental") - override fun createForm() = AddBikeParkingCapacityForm() + override fun createForm() = AddBikeParkingCapacityForm(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..9d8a7a9c63 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,13 +2,15 @@ package de.westnordost.streetcomplete.quests.bike_parking_capacity import android.os.Bundle import android.view.View +import androidx.core.view.isGone import androidx.core.widget.doAfterTextChanged import de.westnordost.streetcomplete.R import de.westnordost.streetcomplete.databinding.QuestBikeParkingCapacityBinding import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment import de.westnordost.streetcomplete.util.ktx.intOrNull -class AddBikeParkingCapacityForm : AbstractQuestFormAnswerFragment() { +class AddBikeParkingCapacityForm(val showClarificationText: Boolean) : + AbstractQuestFormAnswerFragment() { override val contentLayoutResId = R.layout.quest_bike_parking_capacity private val binding by contentViewBinding(QuestBikeParkingCapacityBinding::bind) @@ -17,6 +19,7 @@ class AddBikeParkingCapacityForm : AbstractQuestFormAnswerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + binding.clarificationText.isGone = !showClarificationText binding.capacityInput.doAfterTextChanged { checkIsFormComplete() } } 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 index 5178b0fe10..aa469959fe 100644 --- 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 @@ -8,6 +8,7 @@ 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() { @@ -30,7 +31,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = getMapData().filter("nodes, ways with amenity ~ bicycle_parking|bicycle_rental") - override fun createForm() = AddBikeRentalCapacityForm() + override fun createForm() = AddBikeParkingCapacityForm(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/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt b/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt deleted file mode 100644 index d777c8cc64..0000000000 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/bike_rental_capacity/AddBikeRentalCapacityForm.kt +++ /dev/null @@ -1,28 +0,0 @@ -package de.westnordost.streetcomplete.quests.bike_rental_capacity - -import android.os.Bundle -import android.view.View -import androidx.core.widget.doAfterTextChanged -import de.westnordost.streetcomplete.R -import de.westnordost.streetcomplete.databinding.QuestBikeRentalCapacityBinding -import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment -import de.westnordost.streetcomplete.util.ktx.intOrNull - -class AddBikeRentalCapacityForm : AbstractQuestFormAnswerFragment() { - - override val contentLayoutResId = R.layout.quest_bike_rental_capacity - private val binding by contentViewBinding(QuestBikeRentalCapacityBinding::bind) - - private val capacity get() = binding.capacityInput.intOrNull ?: 0 - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - binding.capacityInput.doAfterTextChanged { checkIsFormComplete() } - } - - override fun isFormComplete() = capacity > 0 - - override fun onClickOk() { - applyAnswer(capacity) - } -} diff --git a/app/src/main/res/layout/quest_bike_rental_capacity.xml b/app/src/main/res/layout/quest_bike_rental_capacity.xml deleted file mode 100644 index 1bf6f4e772..0000000000 --- a/app/src/main/res/layout/quest_bike_rental_capacity.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - From 4515039b68a65d84cc6c7b8893aedc1bf70eab32 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Wed, 4 May 2022 21:55:48 +0200 Subject: [PATCH 07/11] Improve quest title --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fef08426b5..c0215f8707 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -657,7 +657,7 @@ However, before uploading your changes, the app checks with a <a href=\"https Building Handlebar holder - How many bikes can be rented or returned here? + How many rental bike spaces are there? "How many bikes can be parked here?" "Note that most normal stands can be used from both sides to park each one bike." From 04b3dac7e104cb786fccbdfb4dd6394855eb6501 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Thu, 5 May 2022 01:57:11 +0200 Subject: [PATCH 08/11] Switch to verbose but working way of passing arguments to form --- .../AddBikeParkingCapacity.kt | 2 +- .../AddBikeParkingCapacityForm.kt | 15 +++++++++++++-- .../bike_rental_capacity/AddBikeRentalCapacity.kt | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) 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 2e216d9748..0f01f2fad0 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|bicycle_rental") - override fun createForm() = AddBikeParkingCapacityForm(showClarificationText = true) + 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 9d8a7a9c63..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,7 @@ 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 @@ -9,8 +10,7 @@ import de.westnordost.streetcomplete.databinding.QuestBikeParkingCapacityBinding import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment import de.westnordost.streetcomplete.util.ktx.intOrNull -class AddBikeParkingCapacityForm(val showClarificationText: Boolean) : - AbstractQuestFormAnswerFragment() { +class AddBikeParkingCapacityForm : AbstractQuestFormAnswerFragment() { override val contentLayoutResId = R.layout.quest_bike_parking_capacity private val binding by contentViewBinding(QuestBikeParkingCapacityBinding::bind) @@ -19,6 +19,7 @@ class AddBikeParkingCapacityForm(val showClarificationText: Boolean) : 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() } } @@ -28,4 +29,14 @@ class AddBikeParkingCapacityForm(val showClarificationText: Boolean) : 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 index aa469959fe..9ceaeaa772 100644 --- 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 @@ -31,7 +31,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = getMapData().filter("nodes, ways with amenity ~ bicycle_parking|bicycle_rental") - override fun createForm() = AddBikeParkingCapacityForm(showClarificationText = false) + override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = false) override fun applyAnswerTo(answer: Int, tags: Tags, timestampEdited: Long) { tags.updateWithCheckDate("capacity", answer.toString()) From 497c62039b37e689fa8131997d33991d78d3f902 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Sun, 8 May 2022 16:59:02 +0200 Subject: [PATCH 09/11] Only highlight elements that the quest is asked for --- .../quests/bike_parking_capacity/AddBikeParkingCapacity.kt | 2 +- .../quests/bike_rental_capacity/AddBikeRentalCapacity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 0f01f2fad0..d294e2f7bf 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 @@ -34,7 +34,7 @@ class AddBikeParkingCapacity : OsmFilterQuestType() { override fun getTitle(tags: Map) = R.string.quest_bikeParkingCapacity_title override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = - getMapData().filter("nodes, ways with amenity ~ bicycle_parking|bicycle_rental") + getMapData().filter("nodes, ways with amenity ~ bicycle_parking") override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = true) 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 index 9ceaeaa772..bf5a7c6a46 100644 --- 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 @@ -29,7 +29,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { 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_parking|bicycle_rental") + getMapData().filter("nodes, ways with amenity ~ bicycle_rental") override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = false) From 85fb5e7687ac0b6efa6a7e58ba4b140253ef2392 Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Sun, 8 May 2022 17:00:09 +0200 Subject: [PATCH 10/11] Fix quest filter syntax --- .../quests/bike_parking_capacity/AddBikeParkingCapacity.kt | 2 +- .../quests/bike_rental_capacity/AddBikeRentalCapacity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 d294e2f7bf..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 @@ -34,7 +34,7 @@ class AddBikeParkingCapacity : OsmFilterQuestType() { override fun getTitle(tags: Map) = R.string.quest_bikeParkingCapacity_title override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) = - getMapData().filter("nodes, ways with amenity ~ bicycle_parking") + getMapData().filter("nodes, ways with amenity = bicycle_parking") override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = true) 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 index bf5a7c6a46..4d5b3c20a0 100644 --- 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 @@ -29,7 +29,7 @@ class AddBikeRentalCapacity : OsmFilterQuestType() { 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") + getMapData().filter("nodes, ways with amenity = bicycle_rental") override fun createForm() = AddBikeParkingCapacityForm.create(showClarificationText = false) From df83881d82c7cef2a8009ccd06a8c204054f7422 Mon Sep 17 00:00:00 2001 From: Tobias Zwick Date: Sun, 15 May 2022 16:29:27 +0200 Subject: [PATCH 11/11] use "here" instead of "there" to be consistent with wording of other quests --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c0215f8707..43b072b1b9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -657,7 +657,7 @@ However, before uploading your changes, the app checks with a <a href=\"https Building Handlebar holder - How many rental bike spaces are there? + How many rental bike spaces are here? "How many bikes can be parked here?" "Note that most normal stands can be used from both sides to park each one bike."