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

Hairdresser quest #4909

Merged
merged 11 commits into from
May 2, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import de.westnordost.streetcomplete.quests.foot.AddProhibitedForPedestrians
import de.westnordost.streetcomplete.quests.fuel_service.AddFuelSelfService
import de.westnordost.streetcomplete.quests.general_fee.AddGeneralFee
import de.westnordost.streetcomplete.quests.grit_bin_seasonal.AddGritBinSeasonal
import de.westnordost.streetcomplete.quests.hairdresser.AddHairdresser
import de.westnordost.streetcomplete.quests.handrail.AddHandrail
import de.westnordost.streetcomplete.quests.incline_direction.AddBicycleIncline
import de.westnordost.streetcomplete.quests.incline_direction.AddStepsIncline
Expand Down Expand Up @@ -366,6 +367,7 @@ fun questTypeRegistry(
78 to SpecifyShopType(), // above add place name as some brand presets will set the name too
79 to CheckShopType(),
80 to AddPlaceName(featureDictionaryFuture),
157 to AddHairdresser(), // almost always marked on sign outside
81 to AddOpeningHours(featureDictionaryFuture),
82 to AddSeating(), // easily visible from outside, but only seasonally
83 to AddBicyclePump(), // visible from the outside, but only during opening hours
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package de.westnordost.streetcomplete.quests.hairdresser

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.data.osm.geometry.ElementGeometry
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.user.achievements.EditTypeAchievement.CITIZEN
import de.westnordost.streetcomplete.osm.IS_SHOP_OR_DISUSED_SHOP_EXPRESSION
import de.westnordost.streetcomplete.osm.Tags
import de.westnordost.streetcomplete.util.ktx.toYesNo

class AddHairdresser : OsmFilterQuestType<Hairdresser>() {
mnalis marked this conversation as resolved.
Show resolved Hide resolved

override val elementFilter = """
nodes, ways with
(
shop = hairdresser
and !female and !male and !unisex
mnalis marked this conversation as resolved.
Show resolved Hide resolved
and !male:signed and !female:signed
)
"""
override val changesetComment = "Survey hairdresser's customers"
override val wikiLink = "Tag:shop=hairdresser"
override val icon = R.drawable.ic_quest_hairdresser
override val isReplaceShopEnabled = true
override val achievements = listOf(CITIZEN)

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

override fun getHighlightedElements(element: Element, getMapData: () -> MapDataWithGeometry) =
getMapData().filter(IS_SHOP_OR_DISUSED_SHOP_EXPRESSION)

override fun createForm() = AddHairdresserForm()

override fun applyAnswerTo(answer: Hairdresser, tags: Tags, geometry: ElementGeometry, timestampEdited: Long) {
if (answer == Hairdresser.NOT_SIGNED) {
tags["male:signed"] = "no"
tags["female:signed"] = "no"
} else {
if (answer.isMale) tags["male"] = "yes"
if (answer.isFemale) tags["female"] = "yes"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package de.westnordost.streetcomplete.quests.hairdresser

import de.westnordost.streetcomplete.R
import de.westnordost.streetcomplete.quests.AListQuestForm
import de.westnordost.streetcomplete.quests.TextItem
import de.westnordost.streetcomplete.quests.hairdresser.Hairdresser.MALE_AND_FEMALE
import de.westnordost.streetcomplete.quests.hairdresser.Hairdresser.NOT_SIGNED
import de.westnordost.streetcomplete.quests.hairdresser.Hairdresser.ONLY_FEMALE
import de.westnordost.streetcomplete.quests.hairdresser.Hairdresser.ONLY_MALE

class AddHairdresserForm : AListQuestForm<Hairdresser>() {
override val items = listOf(
TextItem(MALE_AND_FEMALE, R.string.quest_hairdresser_male_and_female),
TextItem(ONLY_FEMALE, R.string.quest_hairdresser_female_only),
TextItem(ONLY_MALE, R.string.quest_hairdresser_male_only),
TextItem(NOT_SIGNED, R.string.quest_hairdresser_not_signed),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package de.westnordost.streetcomplete.quests.hairdresser

enum class Hairdresser(val isMale: Boolean, val isFemale: Boolean) {
NOT_SIGNED(false, false),
ONLY_FEMALE(false, true),
ONLY_MALE(true, false),
MALE_AND_FEMALE(true, true),
}
westnordost marked this conversation as resolved.
Show resolved Hide resolved
35 changes: 35 additions & 0 deletions app/src/main/res/drawable/ic_quest_hairdresser.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
mnalis marked this conversation as resolved.
Show resolved Hide resolved
android:viewportWidth="504"
android:viewportHeight="504"
android:width="800dp"
android:height="800dp">
<path
android:pathData="M504 252A252 252 0 0 1 0 252A252 252 0 0 1 504 252Z"
android:fillColor="#E9A66F" />
<group
android:rotation="-0"
android:scaleX="-10.269"
android:scaleY="-10.269"
android:translateX="399.12"
android:translateY="475.1">
<path
android:pathData="M6.9994 8.9917c2.3906 4 1.9361 3.2881 3 5 -0.1925 1.5267 -1 4 -1 4 -0.97582 -1.3862 -8 0 -11 -3s-2 -7 0 -9 6.6094 -1 9 3zm-7 4c2 2 5.88 1.1144 6 1 0.62337 -0.5944 -0.37663 -1.6953 -2 -4s-3 -3 -4 -2 -2 3 0 5z"
android:fillColor="#DD2E44" />
<path
android:pathData="M23.999 38.992c1.163 -0.657 1.658 -2.836 1 -4l-9 -16c-1 -2 -5 -3 -6 -5 -1.103 0.496 -0.394 2.401 -1 4z"
android:fillColor="#99AAB5" />
<path
android:pathData="M20.999 8.9917c-2.3906 4 -1.9361 3.2881 -3 5 0.1925 1.5267 1 4 1 4 0.97582 -1.3862 8 0 11 -3s2 -7 0 -9 -6.6094 -1 -9 3zm7 4c-2 2 -5.88 1.1144 -6 1 -0.62337 -0.5944 0.37663 -1.6953 2 -4s3 -3 4 -2 2 3 0 5z"
android:fillColor="#DD2E44" />
<path
android:pathData="M3.9994 38.992c-1.163 -0.657 -1.658 -2.836 -1 -4l9 -16c1 -2 5 -3 6 -5 1.103 0.496 0.394 2.401 1 4z"
android:fillColor="#CCD6DD" />
<group
android:scaleX="-1"
android:scaleY="-1">
<path
android:pathData="M-12.6268 -20.992A1.3722 1.3722 0 0 1 -15.3712 -20.992A1.3722 1.3722 0 0 1 -12.6268 -20.992Z"
android:fillColor="#99AAB5" />
</group>
</group>
</vector>
6 changes: 6 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,12 @@ Before uploading your changes, the app checks with a &lt;a href=\"https://www.we

<string name="quest_gritBinSeasonal_title">Is this also here outside of winter?</string>

<string name="quest_hairdresser_title">Which customers visit this hairdresser?</string>
<string name="quest_hairdresser_male_and_female">Anyone</string>
<string name="quest_hairdresser_female_only">Women</string>
<string name="quest_hairdresser_male_only">Men</string>
<string name="quest_hairdresser_not_signed">Not signed</string>

<string name="quest_handrail_title">Do these steps have a handrail?</string>

<string name="quest_internet_access_title">What kind of internet connection does this place offer?</string>
Expand Down