-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1134 from matkoniecz/playground_access
AddPlaygroundAccess [finished, ready for merging]
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...main/java/de/westnordost/streetcomplete/quests/playground_access/AddPlaygroundAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters