-
Notifications
You must be signed in to change notification settings - Fork 3
MVP Push #5
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
base: master
Are you sure you want to change the base?
MVP Push #5
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,18 +10,16 @@ | |
import de.westnordost.streetcomplete.data.QuestTypes; | ||
import de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao; | ||
import de.westnordost.streetcomplete.data.osmnotes.OsmNoteQuestType; | ||
import de.westnordost.streetcomplete.quests.baby_changing_table.AddBabyChangingTable; | ||
import de.westnordost.streetcomplete.quests.bike_parking_capacity.AddBikeParkingCapacity; | ||
import de.westnordost.streetcomplete.quests.bike_parking_cover.AddBikeParkingCover; | ||
import de.westnordost.streetcomplete.quests.building_levels.AddBuildingLevels; | ||
import de.westnordost.streetcomplete.quests.bus_stop_lit.AddBusStopLit; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unused quests! e.g. baby_changing_table |
||
import de.westnordost.streetcomplete.quests.bus_stop_bench.AddBusStopBench; | ||
import de.westnordost.streetcomplete.quests.bus_stop_shelter.AddBusStopShelter; | ||
import de.westnordost.streetcomplete.quests.passenger_information_display.AddPassengerInformationDisplay; | ||
import de.westnordost.streetcomplete.quests.crossing_type.AddCrossingType; | ||
import de.westnordost.streetcomplete.quests.curb_ramps_tactile_pavings.CheckCurbRamps_TactilePavings; | ||
import de.westnordost.streetcomplete.quests.road_name.data.PutRoadNameSuggestionsHandler; | ||
import de.westnordost.streetcomplete.quests.road_name.data.RoadNameSuggestionsDao; | ||
import de.westnordost.streetcomplete.quests.tactile_paving.AddTactilePavingBusStop; | ||
import de.westnordost.streetcomplete.quests.sidewalk_lit.SidewalkLit; | ||
import de.westnordost.streetcomplete.quests.sidewalk_surface.AddFootwaySurface; | ||
import de.westnordost.streetcomplete.quests.bin.AddBin; | ||
|
||
@Module | ||
|
@@ -32,18 +30,17 @@ public class QuestModule | |
RoadNameSuggestionsDao roadNameSuggestionsDao, | ||
PutRoadNameSuggestionsHandler putRoadNameSuggestionsHandler) | ||
{ | ||
QuestType[] questTypesOrderedByImportance = { | ||
QuestType[] questTypesOrderedByImportance = new QuestType[]{ | ||
// ↓ notes | ||
osmNoteQuestType, | ||
|
||
new SidewalkLit(o), | ||
new AddFootwaySurface(o), | ||
new CheckCurbRamps_TactilePavings(o), | ||
new AddBusStopBench(o), | ||
new AddBusStopShelter(o), | ||
new AddBusStopLit(o), | ||
new AddBin(o), | ||
new AddPassengerInformationDisplay(o), | ||
new AddTactilePavingBusStop(o) | ||
new AddBin(o) | ||
}; | ||
|
||
return new QuestTypes(Arrays.asList(questTypesOrderedByImportance)); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package de.westnordost.streetcomplete.quests.crossing_markings; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please disable for now - we will want to add as ways, hopefully under a different schema. |
||
|
||
import android.os.Bundle; | ||
|
||
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 AddCrossingMarkings extends SimpleOverpassQuestType | ||
{ | ||
@Inject public AddCrossingMarkings(OverpassMapDataDao overpassServer) { super(overpassServer); } | ||
|
||
@Override | ||
protected String getTagFilters() { return "nodes with highway=crossing and !crossing"; } | ||
|
||
public AbstractQuestAnswerFragment createForm() | ||
{ | ||
return new AddCrossingMarkingsForm(); | ||
} | ||
|
||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) | ||
{ | ||
List<String> values = answer.getStringArrayList(AddCrossingMarkingsForm.OSM_VALUES); | ||
if(values != null && values.size() == 1) | ||
{ | ||
|
||
changes.add("crossing", values.get(0)); | ||
} | ||
} | ||
|
||
@Override public String getCommitMessage() { return "Add crossing type"; } | ||
@Override public int getIcon() { return R.drawable.ic_quest_pedestrian_crossing; } | ||
@Override public int getTitle(Map<String, String> tags) | ||
{ | ||
return R.string.quest_crossing_type_title; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.westnordost.streetcomplete.quests.crossing_markings; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
import de.westnordost.streetcomplete.quests.ImageListQuestAnswerFragment; | ||
|
||
public class AddCrossingMarkingsForm extends ImageListQuestAnswerFragment | ||
{ | ||
private final OsmItem[] TYPES = new OsmItem[] { | ||
new OsmItem("traffic_signals", R.drawable.crossing_type_signals, R.string.quest_crossing_type_signals), | ||
new OsmItem("uncontrolled", R.drawable.crossing_type_zebra, R.string.quest_crossing_type_uncontrolled), | ||
new OsmItem("unmarked", R.drawable.crossing_type_unmarked, R.string.quest_crossing_type_unmarked) | ||
}; | ||
|
||
@Override protected OsmItem[] getItems() { return TYPES; } | ||
@Override protected int getItemsPerRow() { return 3; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package de.westnordost.streetcomplete.quests.curb_ramps_tactile_pavings; | ||
|
||
import android.os.Bundle; | ||
|
||
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 CheckCurbRamps_TactilePavings extends SimpleOverpassQuestType | ||
{ | ||
@Inject public CheckCurbRamps_TactilePavings(OverpassMapDataDao overpassServer) | ||
{ super(overpassServer); } | ||
|
||
@Override protected String getTagFilters() | ||
{ | ||
//return "nodes, ways with "(("footway"="crossing") "and" ("kerb"="lowered"))"; | ||
|
||
return "nodes with (" + | ||
"(kerb=lowered)" + | ||
"and (!tactile_paving))"; | ||
} | ||
|
||
public AbstractQuestAnswerFragment createForm() | ||
{ | ||
return new YesNoQuestAnswerFragment(); | ||
} | ||
|
||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) | ||
{ | ||
String yesno = answer.getBoolean(YesNoQuestAnswerFragment.ANSWER) ? "yes" : "no"; | ||
changes.add("curb_ramps", yesno); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this have an image? Would be handy for users to know what counts as 'tactile paving'. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this isn't necessary to change before release - only if it's super super easy and fast. |
||
@Override public String getCommitMessage() { return "Add curb ramps"; } | ||
@Override public int getIcon() { return R.drawable.ic_quest_street_surface_paved_detail; } | ||
@Override public int getTitle(Map<String, String> tags) | ||
{ | ||
boolean hasName = tags.containsKey("name"); | ||
if(hasName) return R.string.quest_curb_ramps; | ||
else return R.string.quest_curb_ramps; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package de.westnordost.streetcomplete.quests.sidewalk_lit; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
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.RangeQuestAnswerFragment; | ||
//import de.westnordost.streetcomplete.quests.TwoLevelQuestAnswerFragment; | ||
import de.westnordost.streetcomplete.quests.YesNoQuestAnswerFragment; | ||
|
||
public class SidewalkLit extends SimpleOverpassQuestType | ||
{ | ||
@Inject public SidewalkLit(OverpassMapDataDao overpassServer) { super(overpassServer); } | ||
|
||
@Override protected String getTagFilters() | ||
{ | ||
return "ways with (" + | ||
"((highway=footway) and (footway=sidewalk)" + | ||
" or foot=yes" + | ||
") and !lit)"; | ||
} | ||
|
||
|
||
public AbstractQuestAnswerFragment createForm() | ||
{ | ||
return new YesNoQuestAnswerFragment(); | ||
} | ||
|
||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) | ||
{ | ||
String yesno = answer.getBoolean(SidewalkLitForm.ANSWER) ? "yes" : "no"; | ||
changes.add("lit", yesno); | ||
} | ||
|
||
@Override public String getCommitMessage() { return "Add sidewalk lit"; } | ||
@Override public int getIcon() { return R.drawable.ic_quest_lantern; } | ||
@Override public int getTitle(Map<String, String> tags) | ||
{ | ||
boolean hasName = tags.containsKey("name"); | ||
if(hasName) return R.string.quest_SidewalkLit_title; | ||
else return R.string.quest_SidewalkLit_title; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.westnordost.streetcomplete.quests.sidewalk_lit; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
import de.westnordost.streetcomplete.quests.YesNoQuestAnswerFragment; | ||
|
||
public class SidewalkLitForm extends YesNoQuestAnswerFragment | ||
{ | ||
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) | ||
{ | ||
View view = super.onCreateView(inflater, container, savedInstanceState); | ||
setContentView(R.layout.sidewalk_lit); | ||
|
||
|
||
return view; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine to leave the logging so long as the debug level (Log.d?) is disabled in production!