Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New quest ref for emergency access points #4386

Merged
merged 39 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ef3f3a9
duplicate folder with quest of a similar design
mcliquid Sep 16, 2022
c76aa6d
add to QuestsModule
mcliquid Sep 16, 2022
bd2bb2b
Add quest string
mcliquid Sep 16, 2022
2d3b768
Shorten question and add other answer
mcliquid Sep 16, 2022
5657a2d
Add name to filter
mcliquid Sep 16, 2022
3b62e2f
Add access_point.svg as quest icon
mcliquid Sep 16, 2022
4d89c77
Cleaned the quest icon a little bit
mcliquid Sep 16, 2022
db89744
Add drawable icon
mcliquid Sep 16, 2022
f6bfcc6
Cleaned unused things and added icon
mcliquid Sep 16, 2022
576e1ff
Add DeleteElement
mcliquid Sep 16, 2022
f4c0fb9
Add "Other Answer": "It's an Assembly Point"
mcliquid Sep 16, 2022
002e7d2
Removed "emergency = assembly_point" from filter (was not intended)
mcliquid Sep 16, 2022
1d00d69
Remove highway tag only when emergency_access_point
mcliquid Sep 16, 2022
facdc3a
remove unnecessary brackets
westnordost Sep 17, 2022
8eab9da
add to "RARE" achievement
westnordost Sep 17, 2022
fd7c9fc
Moved the quest up to AddPostboxRef
mcliquid Sep 18, 2022
1631f32
Change wording
mcliquid Sep 18, 2022
c87804e
Remove text from quest icon
mcliquid Sep 18, 2022
53e609d
use nonBlankTextOrNull
mcliquid Sep 18, 2022
91c9db6
use nonBlankTextOrNull
mcliquid Sep 18, 2022
08f4fec
Merge branch 'streetcomplete:master' into new-quest-ref-for-access-po…
mcliquid Sep 18, 2022
0ad3a1c
Fixed wording
mcliquid Sep 18, 2022
2051f6a
always offer other answer option
mcliquid Sep 18, 2022
a4ac8c4
Merge branch 'new-quest-ref-for-access-points' of https://github.com/…
mcliquid Sep 18, 2022
30450f4
Created icon from scratch due to bad license
mcliquid Sep 18, 2022
7a90cd0
Added assembly_point.svg
mcliquid Sep 23, 2022
f9cf321
Create confirmation dialog
mcliquid Sep 23, 2022
573a01c
Add View and String
mcliquid Sep 23, 2022
a2cccad
Changed `noref` to `ref:signed`
mcliquid Sep 23, 2022
4157c44
Changed wikiLink
mcliquid Sep 23, 2022
62112ab
Merge branch 'streetcomplete:master' into new-quest-ref-for-access-po…
mcliquid Sep 23, 2022
253de55
remove fillType=evenOdd
westnordost Sep 24, 2022
95da252
fix picture does not show
westnordost Sep 24, 2022
461b7e1
Update app/src/main/res/values/strings.xml
mcliquid Sep 25, 2022
b22ec59
Merge branch 'streetcomplete:master' into new-quest-ref-for-access-po…
mcliquid Sep 25, 2022
af08529
Removed extra function
mcliquid Sep 25, 2022
86072b3
Merge branch 'new-quest-ref-for-access-points' of https://github.com/…
mcliquid Sep 25, 2022
cbdf467
Reduced image size of assembly icon
mcliquid Sep 25, 2022
03ccf4c
fix function name
westnordost Sep 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import de.westnordost.streetcomplete.data.osmnotes.notequests.OsmNoteQuestType
import de.westnordost.streetcomplete.data.quest.QuestTypeRegistry
import de.westnordost.streetcomplete.quests.accepts_cards.AddAcceptsCards
import de.westnordost.streetcomplete.quests.accepts_cash.AddAcceptsCash
import de.westnordost.streetcomplete.quests.access_point_ref.AddAccessPointRef
import de.westnordost.streetcomplete.quests.address.AddAddressStreet
import de.westnordost.streetcomplete.quests.address.AddHousenumber
import de.westnordost.streetcomplete.quests.air_conditioning.AddAirConditioning
Expand Down Expand Up @@ -363,6 +364,8 @@ fun questTypeRegistry(
AddPostboxRoyalCypher(), // can be glanced across the road (if postbox facing the right way)
AddPostboxRef(), // requires text input and to be very close to the collection plate

AddAccessPointRef(), // requires text input and to be very close to the collection plate

AddWheelchairAccessOutside(),

// road but information is visible usually at the beginning of the marked stretch of way
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.westnordost.streetcomplete.quests.access_point_ref

sealed interface AccessPointRefAnswer

object NoAccessPointRef : AccessPointRefAnswer
object IsAssemblyPointAnswer : AccessPointRefAnswer
data class AccessPointRef(val ref: String) : AccessPointRefAnswer
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package de.westnordost.streetcomplete.quests.access_point_ref

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.osmquests.OsmFilterQuestType
import de.westnordost.streetcomplete.data.user.achievements.EditTypeAchievement
import de.westnordost.streetcomplete.osm.Tags

class AddAccessPointRef : OsmFilterQuestType<AccessPointRefAnswer>() {

override val elementFilter = """
nodes with
(
highway = emergency_access_point
or emergency = access_point
)
and !name and !ref and noref != yes and ref:signed != no and !~"ref:.*"
"""

override val changesetComment = "Determine emergency access point refs"
override val wikiLink = "Key:ref"
override val icon = R.drawable.ic_quest_access_point
override val achievements = listOf(EditTypeAchievement.LIFESAVER, EditTypeAchievement.RARE)
override val isDeleteElementEnabled = true

override fun getTitle(tags: Map<String, String>) = R.string.quest_accessPointRef_title

override fun createForm() = AddAccessPointRefForm()

override fun applyAnswerTo(answer: AccessPointRefAnswer, tags: Tags, timestampEdited: Long) {
when (answer) {
is NoAccessPointRef -> tags["ref:signed"] = "no"
is AccessPointRef -> tags["ref"] = answer.ref
is IsAssemblyPointAnswer -> {
westnordost marked this conversation as resolved.
Show resolved Hide resolved
tags["emergency"] = "assembly_point"
if (tags["highway"] == "emergency_access_point") {
tags.remove("highway")
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package de.westnordost.streetcomplete.quests.access_point_ref

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.core.widget.doAfterTextChanged
import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.databinding.QuestRefBinding
import de.westnordost.streetcomplete.quests.AbstractOsmQuestForm
import de.westnordost.streetcomplete.quests.AnswerItem
import de.westnordost.streetcomplete.util.ktx.nonBlankTextOrNull

class AddAccessPointRefForm : AbstractOsmQuestForm<AccessPointRefAnswer>() {

override val contentLayoutResId = R.layout.quest_ref
private val binding by contentViewBinding(QuestRefBinding::bind)

override val otherAnswers get() = listOfNotNull(
AnswerItem(R.string.quest_ref_answer_noRef) { confirmNoRef() },
AnswerItem(R.string.quest_accessPointRef_answer_assembly_point) { AssemblyPointAnswer() }
)

private val ref get() = binding.refInput.nonBlankTextOrNull

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.refInput.doAfterTextChanged { checkIsFormComplete() }
}

override fun onClickOk() {
applyAnswer(AccessPointRef(ref!!))
}

private fun confirmNoRef() {
AlertDialog.Builder(requireContext())
.setTitle(R.string.quest_generic_confirmation_title)
.setPositiveButton(R.string.quest_generic_confirmation_yes) { _, _ -> applyAnswer(NoAccessPointRef) }
.setNegativeButton(R.string.quest_generic_confirmation_no, null)
.show()
}

private fun AssemblyPointAnswer() {
westnordost marked this conversation as resolved.
Show resolved Hide resolved
westnordost marked this conversation as resolved.
Show resolved Hide resolved
AlertDialog.Builder(requireContext())
.setTitle(R.string.quest_generic_confirmation_title)
.setView(R.layout.dialog_confirm_assembly_point)
.setPositiveButton(R.string.quest_generic_confirmation_yes) { _, _ -> applyAnswer(IsAssemblyPointAnswer) }
.setNegativeButton(R.string.quest_generic_confirmation_no, null)
.show()
}

override fun isFormComplete() = ref != null
}
39 changes: 39 additions & 0 deletions app/src/main/res/drawable/ic_assembly_point.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="400dp"
android:height="400dp"
android:viewportWidth="178"
android:viewportHeight="178">
<path
android:pathData="M0,0h178v178h-178z"
android:fillColor="#fff"/>
<path
android:pathData="M5,5h168v168h-168z"
android:fillColor="#008855"/>
<path
android:pathData="M44.9,117.94 L44.9,88.84C44.9,86.32 47.1,84.64 49.4,84.64H76.7C76.6,88.08 79,90.5 80.9,93.04H74C69,93.04 66.5,96.15 66.5,101.74V117.94H56.9V96.04H52.7V117.94zM70.7,127.84 L70.7,101.44C70.7,98.41 72.7,96.94 75.5,96.94H102.5C105.8,96.94 107.3,99.73 107.3,101.14V127.84H101.6V106.54H97.4V127.84H80.9V106.54H76.4V127.84zM133.1,117.94 L133.1,90.04C133.1,86.99 131.5,84.64 128.6,84.64H101.3C101.3,87.95 99,90.54 97.1,93.04H103.7C108.4,93.04 111.5,97.12 111.5,101.74V117.94H121.1V96.04H125.3V117.94z"
android:fillColor="#fff"/>
<path
android:pathData="M97.86,58.49A8.85,8.85 0,0 1,80.15 58.49,8.85 8.85,0 1,1 97.86,58.49z"
android:fillColor="#fff"/>
<path
android:pathData="M122.54,71.07A8.86,8.86 0,0 1,104.83 71.07,8.86 8.86,0 1,1 122.54,71.07z"
android:fillColor="#fff"/>
<path
android:pathData="M72.28,70.69A8.86,8.86 0,0 1,54.57 70.69,8.86 8.86,0 1,1 72.28,70.69z"
android:fillColor="#fff"/>
<path
android:pathData="M97.7,83.41A8.86,8.86 0,0 1,79.99 83.41,8.86 8.86,0 1,1 97.7,83.41z"
android:fillColor="#fff"/>
<path
android:pathData="M14.76,8.9 L8.9,14.5 35.28,41H16.71L24.53,48.95H48.95V25.1L41.14,17.15V35.4L14.76,8.9"
android:fillColor="#fff"/>
<path
android:pathData="M163.24,8.9 L169.1,14.49 142.72,41H161.28L153.47,48.95H129.05V25.09L136.86,17.14V35.4L163.24,8.9"
android:fillColor="#fff"/>
<path
android:pathData="M14.76,169.1 L8.9,163.5 35.28,137H16.71L24.53,129.05H48.95V152.9L41.14,160.85V142.59L14.76,169.1"
android:fillColor="#fff"/>
<path
android:pathData="M163.24,169.1 L169.1,163.51 142.72,137H161.28L153.47,129.05H129.05V152.91L136.86,160.86V142.6L163.24,169.1"
android:fillColor="#fff"/>
</vector>
28 changes: 28 additions & 0 deletions app/src/main/res/drawable/ic_quest_access_point.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<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="M119.42,95.99c-17.67,30.6 -56.81,41.09 -87.41,23.42S-9.09,62.61 8.58,32.01 65.39,-9.09 95.99,8.58c30.61,17.67 41.09,56.81 23.42,87.41"
android:fillColor="#9bbe55"/>
<path
android:fillColor="#FF000000"
android:pathData="M92.3,27.29L35.66,27.29c-4.86,0 -9.42,4.56 -9.42,9.43v56.62c0,4.86 4.57,9.45 9.44,9.45h56.62c4.86,0 9.44,-4.56 9.44,-9.43L101.74,36.72c0,-4.86 -4.58,-9.43 -9.45,-9.43h0ZM94.23,75.11h-20.15v20.13h-20.15v-20.13h-20.16v-20.15h20.16v-20.13h20.15v20.13h20.15v20.15Z"
android:strokeAlpha="0.25"
android:fillAlpha="0.25"/>
<path
android:pathData="M92.3,24.21L35.66,24.21c-4.86,0 -9.42,4.56 -9.42,9.43v56.62c0,4.86 4.57,9.45 9.44,9.45h56.62c4.86,0 9.44,-4.56 9.44,-9.43L101.74,33.64c0,-4.86 -4.58,-9.43 -9.45,-9.43h0ZM94.23,72.03h-20.15v20.13h-20.15v-20.13h-20.16v-20.15h20.16L53.93,31.75h20.15v20.13h20.15v20.15Z"
android:fillColor="#fff"/>
<path
android:pathData="M119.42,95.99c-17.67,30.6 -56.81,41.09 -87.41,23.42S-9.09,62.61 8.58,32.01 65.39,-9.09 95.99,8.58c30.61,17.67 41.09,56.81 23.42,87.41"
android:fillColor="#9bbe55"/>
<path
android:fillColor="#FF000000"
android:pathData="M107.84,53.54l-29.23,0l0,-29.2l-29.22,0l0,29.2l-29.24,0l0,29.22l29.24,0l0,29.19l29.22,0l0,-29.19l29.23,0l0,-29.22z"
android:strokeAlpha="0.2"
android:fillAlpha="0.2"/>
<path
android:pathData="M107.84,46.29l-29.23,0l0,-29.2l-29.22,0l0,29.2l-29.24,0l0,29.22l29.24,0l0,29.19l29.22,0l0,-29.19l29.23,0l0,-29.22z"
android:fillColor="#fff"/>
</vector>
23 changes: 23 additions & 0 deletions app/src/main/res/layout/dialog_confirm_assembly_point.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dialog_horizontal_margin">

<TextView
android:text="@string/quest_accessPointRef_detailed_answer_impossible_confirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@android:style/TextAppearance.Theme.Dialog" />

<ImageView
android:id="@+id/assemblyPointImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_assembly_point"
android:contentDescription="@string/quest_accessPointRef_answer_assembly_point" />

</LinearLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1551,4 +1551,8 @@ Partially means that a wheelchair can enter and use the restroom, but no handrai
<string name="overlay_sidewalk">Sidewalks</string>

<string name="overlay_street_parking">Street parking</string>

<string name="quest_accessPointRef_title">What’s the identification number here?</string>
<string name="quest_accessPointRef_answer_assembly_point">It’s an Assembly Point</string>
<string name="quest_accessPointRef_detailed_answer_impossible_confirmation">An Emergency Assembly Point is where people assemble in case of an emergency. It usually looks similar to this:</string>
</resources>
32 changes: 32 additions & 0 deletions res/graphics/assembly point/assembly_point.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions res/graphics/authors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ app icon/
ic_launcher.png https://www.elegantthemes.com/blog/freebie-of-the-week/beautiful-flat-icons-for-free (GPL 2.0) with trivial changes by Mateusz Konieczny (recolour)
ic_launcher_round.png https://www.elegantthemes.com/blog/freebie-of-the-week/beautiful-flat-icons-for-free (GPL 2.0) with trivial changes by Mateusz Konieczny (recolour)

assembly_point/
assembly_point.svg Epop, License: Public domain; https://commons.wikimedia.org/wiki/File:E011.svg

bridge structure/
arch.svg Jay Turner, License: CC0 1.0
beam.svg Jay Turner, License: CC0 1.0
Expand Down Expand Up @@ -253,6 +256,7 @@ italian police type/
polizia.svg modified from https://commons.wikimedia.org/wiki/File:Italian_traffic_signs_-_icona_polizia.svg, Gigillo83, License: CC-BY-SA 3.0

quest/
access_point.svg
westnordost marked this conversation as resolved.
Show resolved Hide resolved
apple.svg
baby.svg modified from Twemoji: U+1F6BC
barrier.svg Tobias Zwick (CC-BY-SA 4.0) (based on road_construction.svg)
Expand Down
1 change: 1 addition & 0 deletions res/graphics/quest/access_point.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.