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

Add new quest to determine the tracktype #959

Merged
merged 9 commits into from Oct 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -51,6 +51,7 @@
import de.westnordost.streetcomplete.quests.tactile_paving.AddTactilePavingCrosswalk;
import de.westnordost.streetcomplete.quests.toilet_availability.AddToiletAvailability;
import de.westnordost.streetcomplete.quests.toilets_fee.AddToiletsFee;
import de.westnordost.streetcomplete.quests.tracktype.AddTracktype;
import de.westnordost.streetcomplete.quests.housenumber.AddHousenumber;
import de.westnordost.streetcomplete.quests.max_speed.AddMaxSpeed;
import de.westnordost.streetcomplete.quests.opening_hours.AddOpeningHours;
Expand Down Expand Up @@ -107,6 +108,7 @@ public class QuestModule
new AddParkingFee(o),
new AddBusStopName(o),
new AddPathSurface(o),
new AddTracktype(o),
new AddBikeParkingType(o), // used by OsmAnd
new AddPlaygroundAccess(o), //late as in many areas all needed access=private is already mapped

Expand Down
@@ -0,0 +1,41 @@
package de.westnordost.streetcomplete.quests.tracktype;

import android.os.Bundle;
import android.support.annotation.NonNull;

import java.util.List;
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;

public class AddTracktype extends SimpleOverpassQuestType
{
@Inject public AddTracktype(OverpassMapDataDao overpassServer) { super(overpassServer); }

@Override
protected String getTagFilters() { return "ways with highway=track and !tracktype" +
" and (access !~ private|no or (foot and foot !~ private|no))"; }

public AbstractQuestAnswerFragment createForm() { return new AddTracktypeForm(); }

public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes)
{
List<String> values = answer.getStringArrayList(AddTracktypeForm.OSM_VALUES);
if(values != null && values.size() == 1)
{
changes.add("tracktype", values.get(0));
}
}

@Override public String getCommitMessage() { return "Add tracktype"; }
@Override public int getIcon() { return R.drawable.ic_quest_tractor; }
@Override public int getTitle(@NonNull Map<String, String> tags) {
return R.string.quest_tracktype_title;
}
}
@@ -0,0 +1,20 @@
package de.westnordost.streetcomplete.quests.tracktype;

import de.westnordost.streetcomplete.R;
import de.westnordost.streetcomplete.quests.ImageListQuestAnswerFragment;
import de.westnordost.streetcomplete.view.Item;

public class AddTracktypeForm extends ImageListQuestAnswerFragment
{
private final Item[] TYPES = new Item[] {
new Item("grade1", R.drawable.tracktype_grade1, R.string.quest_tracktype_grade1),
new Item("grade2", R.drawable.tracktype_grade2, R.string.quest_tracktype_grade2),
new Item("grade3", R.drawable.tracktype_grade3, R.string.quest_tracktype_grade3),
new Item("grade4", R.drawable.tracktype_grade4, R.string.quest_tracktype_grade4),
new Item("grade5", R.drawable.tracktype_grade5, R.string.quest_tracktype_grade5),
};

@Override protected Item[] getItems() { return TYPES; }

@Override protected int getItemsPerRow() { return 3; }
}
6 changes: 6 additions & 0 deletions app/src/main/res/authors.txt
Expand Up @@ -118,3 +118,9 @@ surface_metal.jpg Public Domain https://commons.wikimedia.org/w
tactile_paving_illustration... CC-BY 2.0 https://www.flickr.com/photos/jeanlouis_zimmermann/10072029534/in/album-72157635218804514/
CC-BY 2.0 https://www.flickr.com/photos/jeanlouis_zimmermann/10493532264/in/album-72157635218804514/
CC-BY 2.0 https://www.flickr.com/photos/jeanlouis_zimmermann/10473021344/in/album-72157635218804514/

tracktype_grade1 Public Domain https://github.com/westnordost/StreetComplete/pull/959#issuecomment-427905219 (Bjorn Rasmussen)
tracktype_grade2 CC-BY 4.0 https://github.com/westnordost/StreetComplete/issues/133#issuecomment-393650654 (Bjorn Rasmussen)
tracktype_grade3 CC0 https://pixabay.com/en/field-away-nature-meadow-lane-406183/
tracktype_grade4 Public Domain https://github.com/westnordost/StreetComplete/pull/959#issuecomment-427905219 (Bjorn Rasmussen)
tracktype_grade5 CC-BY-SA 4.0 https://commons.wikimedia.org/wiki/File:Zandpad_aan_buitenkant_van_het_gebied._Locatie,_Stuttebosch_in_de_lendevallei._Provincie_Friesland_01.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/src/main/res/values/strings.xml
Expand Up @@ -615,4 +615,10 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="action_deselect_all">Deselect all</string>
<string name="quest_buildingType_retail_description">including buildings for restaurants, cafés, …</string>

<string name="quest_tracktype_title">What is the surface firmness of this track?</string>
<string name="quest_tracktype_grade1">Solid</string>
<string name="quest_tracktype_grade2">Mostly solid</string>
<string name="quest_tracktype_grade3">Mixture</string>
<string name="quest_tracktype_grade4">Mostly soft</string>
<string name="quest_tracktype_grade5">Soft</string>
</resources>