Skip to content

Commit

Permalink
Merge pull request #1134 from matkoniecz/playground_access
Browse files Browse the repository at this point in the history
AddPlaygroundAccess [finished, ready for merging]
  • Loading branch information
westnordost authored Jul 22, 2018
2 parents 3e09e5b + c243fe8 commit 54a4697
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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<String, String> tags)
{
return R.string.quest_playground_access_title;
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -609,5 +609,6 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_address_answer_no_housenumber_message2">Is this correct and is it not just part of a building?</string>

<string name="notification_channel_download">"Download"</string>
<string name="quest_playground_access_title">Is this playground publicly accessible?</string>

</resources>

0 comments on commit 54a4697

Please sign in to comment.