-
-
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.
- Loading branch information
1 parent
5d54acb
commit 23e7ffb
Showing
5 changed files
with
94 additions
and
1 deletion.
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
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
66 changes: 66 additions & 0 deletions
66
...src/main/java/de/westnordost/streetcomplete/quests/segregated/AddCyclewaySegregation.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,66 @@ | ||
package de.westnordost.streetcomplete.quests.segregated; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.text.TextUtils; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import javax.inject.Inject; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
import de.westnordost.streetcomplete.data.meta.OsmTaggings; | ||
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; | ||
|
||
public class AddCyclewaySegregation extends SimpleOverpassQuestType { | ||
|
||
@Inject | ||
public AddCyclewaySegregation(OverpassMapDataDao overpassServer) { | ||
super(overpassServer); | ||
} | ||
|
||
@Override | ||
protected String getTagFilters() { | ||
return | ||
"ways with " + | ||
"(" + | ||
"(highway = path and bicycle = designated and foot = designated)" + | ||
" or (highway = footway and bicycle = designated)" + | ||
" or (highway = cycleway and foot = designated)" + | ||
")" + | ||
" and surface ~" + TextUtils.join("|", OsmTaggings.ANYTHING_PAVED) + | ||
" and !segregated"; | ||
} | ||
|
||
@Override | ||
public AbstractQuestAnswerFragment createForm() { | ||
return new AddCyclewaySegregationForm(); | ||
} | ||
|
||
@Override | ||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) { | ||
List<String> values = answer.getStringArrayList(AddCyclewaySegregationForm.OSM_VALUES); | ||
if (values != null && values.size() == 1) { | ||
changes.add("segregated", values.get(0)); | ||
} | ||
} | ||
|
||
@Override | ||
public String getCommitMessage() { | ||
return "Add segregated status for combined footway with cycleway"; | ||
} | ||
|
||
@Override | ||
public int getIcon() { | ||
return R.drawable.ic_quest_path_segregation; | ||
} | ||
|
||
@Override | ||
public int getTitle(@NonNull Map<String, String> tags) { | ||
return R.string.quest_segregated_title; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...main/java/de/westnordost/streetcomplete/quests/segregated/AddCyclewaySegregationForm.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,17 @@ | ||
package de.westnordost.streetcomplete.quests.segregated; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
import de.westnordost.streetcomplete.quests.ImageListQuestAnswerFragment; | ||
import de.westnordost.streetcomplete.view.Item; | ||
|
||
public class AddCyclewaySegregationForm extends ImageListQuestAnswerFragment { | ||
@Override | ||
protected Item[] getItems() { | ||
return new Item[]{ | ||
new Item("yes", R.drawable.ic_path_segregated, R.string.quest_segregated_separated), | ||
new Item("no", R.drawable.ic_path_segregated_no, R.string.quest_segregated_mixed), | ||
}; | ||
} | ||
|
||
@Override protected int getItemsPerRow() { return 2; } | ||
} |
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