From c243fe813b9e225353527a51198bb395699bc4c9 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Thu, 12 Jul 2018 07:58:02 +0200 Subject: [PATCH] AddPlaygroundAccess fixes #1114 --- .../streetcomplete/quests/QuestModule.java | 2 + .../AddPlaygroundAccess.java | 45 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 48 insertions(+) create mode 100644 app/src/main/java/de/westnordost/streetcomplete/quests/playground_access/AddPlaygroundAccess.java diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestModule.java b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestModule.java index aecf58b865..3fc769ea86 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/QuestModule.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/QuestModule.java @@ -34,6 +34,7 @@ import de.westnordost.streetcomplete.quests.parking_access.AddParkingAccess; import de.westnordost.streetcomplete.quests.parking_fee.AddParkingFee; import de.westnordost.streetcomplete.quests.parking_type.AddParkingType; +import de.westnordost.streetcomplete.quests.playground_access.AddPlaygroundAccess; import de.westnordost.streetcomplete.quests.postbox_collection_times.AddPostboxCollectionTimes; import de.westnordost.streetcomplete.quests.powerpoles_material.AddPowerPolesMaterial; import de.westnordost.streetcomplete.quests.orchard_produce.AddOrchardProduce; @@ -102,6 +103,7 @@ public class QuestModule new AddParkingFee(o), new AddBusStopName(o), new AddPathSurface(o), + new AddPlaygroundAccess(o), //late as in many areas all needed access=private is already mapped // ↓ 4. definitely shown as errors in QA tools diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/playground_access/AddPlaygroundAccess.java b/app/src/main/java/de/westnordost/streetcomplete/quests/playground_access/AddPlaygroundAccess.java new file mode 100644 index 0000000000..f83c9c4c63 --- /dev/null +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/playground_access/AddPlaygroundAccess.java @@ -0,0 +1,45 @@ +package de.westnordost.streetcomplete.quests.playground_access; + +import android.os.Bundle; +import android.support.annotation.NonNull; + +import java.util.Map; + +import javax.inject.Inject; + +import de.westnordost.streetcomplete.R; +import de.westnordost.streetcomplete.data.osm.SimpleOverpassQuestType; +import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder; +import de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao; +import de.westnordost.streetcomplete.quests.AbstractQuestAnswerFragment; +import de.westnordost.streetcomplete.quests.YesNoQuestAnswerFragment; + +public class AddPlaygroundAccess extends SimpleOverpassQuestType +{ + @Inject public AddPlaygroundAccess(OverpassMapDataDao overpassServer) { super(overpassServer); } + + @Override protected String getTagFilters() + { + return "nodes, ways, relations with leisure=playground and (!access or access=unknown)"; + } + + public AbstractQuestAnswerFragment createForm() + { + return new YesNoQuestAnswerFragment(); + } + + public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) + { + if(answer.getBoolean(YesNoQuestAnswerFragment.ANSWER)){ + changes.add("access", "yes"); + } else { + changes.add("access", "private"); + } + } + @Override public String getCommitMessage() { return "Add playground access"; } + @Override public int getIcon() { return R.drawable.ic_quest_playground; } + @Override public int getTitle(@NonNull Map tags) + { + return R.string.quest_playground_access_title; + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5bf6558b81..70bd12acf9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -609,5 +609,6 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards Is this correct and is it not just part of a building? "Download" + Is this playground publicly accessible?