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

adding traffic_signals:sound tag [ready for review] #1268

Merged
merged 3 commits into from Nov 20, 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 @@ -60,6 +60,7 @@
import de.westnordost.streetcomplete.quests.surface.AddRoadSurface;
import de.westnordost.streetcomplete.quests.roof_shape.AddRoofShape;
import de.westnordost.streetcomplete.quests.sport.AddSport;
import de.westnordost.streetcomplete.quests.traffic_signals_sound.AddTrafficSignalsSound;
import de.westnordost.streetcomplete.quests.way_lit.AddWayLit;
import de.westnordost.streetcomplete.quests.wheelchair_access.AddWheelChairAccessPublicTransport;
import de.westnordost.streetcomplete.quests.wheelchair_access.AddWheelChairAccessToilets;
Expand Down Expand Up @@ -122,6 +123,7 @@ public class QuestModule
// ↓ 6. may be shown as possibly missing in QA tools

// ↓ 7. data useful for only a specific use case
new AddTrafficSignalsSound(o),
new AddRoofShape(o),
new AddWheelChairAccessPublicTransport(o),
new AddTactilePavingBusStop(o),
Expand Down
@@ -0,0 +1,45 @@
package de.westnordost.streetcomplete.quests.traffic_signals_sound;

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 AddTrafficSignalsSound extends SimpleOverpassQuestType {
@Inject public AddTrafficSignalsSound(OverpassMapDataDao overpassServer) { super(overpassServer); }

@Override protected String getTagFilters()
{
return "nodes with highway=crossing and crossing=traffic_signals and !traffic_signals:sound";
}

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

public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes)
{
if(answer.getBoolean(YesNoQuestAnswerFragment.ANSWER)){
changes.add("traffic_signals:sound", "yes");
} else {
changes.add("traffic_signals:sound", "no");
}
}

@Override public String getCommitMessage() { return "add traffic_signals:sound tag"; }
@Override public int getIcon() { return R.drawable.ic_quest_blind_traffic_lights; }
@Override public int getTitle(@NonNull Map<String, String> tags)
{
return R.string.quest_traffic_signals_sound_title;
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Expand Up @@ -624,5 +624,5 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_tracktype_grade5">Soft</string>
<string name="quest_building_underground_name_title">Is %s completely underground?</string>
<string name="quest_building_underground_title">Is this building completely underground?</string>

<string name="quest_traffic_signals_sound_title">Are there sound signals for the blind here?</string>
</resources>