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

Quest for bus stop names (see #551) #986

Merged
merged 7 commits into from
Mar 30, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import de.westnordost.streetcomplete.quests.bikeway.AddCycleway;
import de.westnordost.streetcomplete.quests.bridge_structure.AddBridgeStructure;
import de.westnordost.streetcomplete.quests.building_levels.AddBuildingLevels;
import de.westnordost.streetcomplete.quests.bus_stop_name.AddBusStopName;
import de.westnordost.streetcomplete.quests.bus_stop_shelter.AddBusStopShelter;
import de.westnordost.streetcomplete.quests.car_wash_type.AddCarWashType;
import de.westnordost.streetcomplete.quests.crossing_type.AddCrossingType;
Expand Down Expand Up @@ -86,6 +87,7 @@ public class QuestModule
new AddInternetAccess(o),
new AddParkingAccess(o),
new AddParkingFee(o),
new AddBusStopName(o),

// ↓ 4. definitely shown as errors in QA tools

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package de.westnordost.streetcomplete.quests.bus_stop_name;

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;

public class AddBusStopName extends SimpleOverpassQuestType
{

@Inject public AddBusStopName(OverpassMapDataDao overpassServer) { super(overpassServer); }

@Override protected String getTagFilters()
{
return " nodes, ways with !name and noname != yes" +
" and (public_transport=platform or (highway=bus_stop and public_transport!=stop_position))";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would include any kind of public transport platform (i.e. also train stations and metro stops).

I think it would make sense if the query is the same as for AddBusStopShelter:
https://github.com/westnordost/StreetComplete/blob/master/app/src/main/java/de/westnordost/streetcomplete/quests/bus_stop_shelter/AddBusStopShelter.java#L24-L26

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As tram was named in the original issue, it was making sense to include them as well. So is it better to only show bus stops ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well answer is below.

}

@Override public AbstractQuestAnswerFragment createForm()
{
return new AddBusStopNameForm();
}

@Override public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes)
{
if(answer.getBoolean(AddBusStopNameForm.NO_NAME))
{
changes.add("noname", "yes");
return;
}

String name = answer.getString(AddBusStopNameForm.NAME);
if(name != null) changes.add("name", name);
}

@Override public String getCommitMessage() { return "Determine bus stop names"; }
@Override public int getIcon() { return R.drawable.ic_quest_bus_stop_name; }
@Override public int getTitle(@NonNull Map<String, String> tags)
{
return R.string.quest_busStopName_title;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now this includes any kind of public transport platform. It would be odd if the quest asked that question for a tram, railway or metro stop. The question should be different for every different type of included public transport platform. I suggest to only include bus and tram stops and then have two strings. See
https://github.com/westnordost/StreetComplete/blob/master/app/src/main/java/de/westnordost/streetcomplete/quests/bus_stop_shelter/AddBusStopShelter.java#L24-L26

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package de.westnordost.streetcomplete.quests.bus_stop_name;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;

import de.westnordost.streetcomplete.R;
import de.westnordost.streetcomplete.quests.AbstractQuestFormAnswerFragment;
import de.westnordost.streetcomplete.view.dialogs.AlertDialogBuilder;

public class AddBusStopNameForm extends AbstractQuestFormAnswerFragment
{
public static final String NO_NAME = "no_name";
public static final String NAME = "name";

private EditText nameInput;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = super.onCreateView(inflater, container, savedInstanceState);

View contentView = setContentView(R.layout.quest_placename);
nameInput = contentView.findViewById(R.id.nameInput);

addOtherAnswer(R.string.quest_name_answer_noName, this::confirmNoName);

return view;
}

@Override protected void onClickOk()
{
Bundle data = new Bundle();
String name = nameInput.getText().toString().trim();
data.putString(NAME, name);
applyFormAnswer(data);
}

private void confirmNoName()
{
new AlertDialogBuilder(getActivity())
.setTitle(R.string.quest_name_answer_noName_confirmation_title)
.setPositiveButton(R.string.quest_name_noName_confirmation_positive, (dialog, which) ->
{
Bundle data = new Bundle();
data.putBoolean(NO_NAME, true);
applyImmediateAnswer(data);
})
.setNegativeButton(R.string.quest_generic_confirmation_no, null)
.show();
}

@Override public boolean hasChanges()
{
return !nameInput.getText().toString().trim().isEmpty();
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this exactly the same as the AddPlaceNameForm? Couldn't that be used instead? (And rename to AddNameForm perhaps)

170 changes: 170 additions & 0 deletions app/src/main/res/drawable/ic_quest_bus_stop_name.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportWidth="128"
android:viewportHeight="128"
android:width="128.00002dp"
android:height="128dp">
<group
android:translateX="716.9999"
android:translateY="144.0002">
<path
android:pathData="M-588.99992 -80.000218c0 35.346 -28.654 63.999998 -64.00002 63.999998 -35.346 0 -64 -28.653998 -64 -63.999998 0 -35.346002 28.654 -64.000002 64 -64.000002 35.34602 0 64.00002 28.654 64.00002 64.000002"
android:fillColor="#529add" />
<path
android:pathData="M-657.0217 -85.11746c0 1 1 2 2 2l2 0.12695 0 23.03711 -0.5605 0c-0.9718 0.00066 -1.4088 0.46836 -1.4355 1.44727l-0.029 1.04882c-0.027 0.97891 0.493 1.50288 1.4648 1.50196l2.6172 -0.002 -0.024 3.50782c-0.016 2.50081 0.9958 3.49593 3.0293 3.49023l5.9297 -0.0156c2.0358 -0.006 2.99 -0.97391 3.0078 -3.59571l0.022 -3.39843 20.0352 -0.0195 -0.024 3.49219c-0.016 2.50081 0.9958 3.49594 3.0293 3.49024l5.9297 -0.0156c2.0358 -0.006 2.99 -0.97391 3.0078 -3.5957l0.022 -3.38281 2.5215 -0.002c0.9735 -0.00092 1.4637 -0.48364 1.4707 -1.46289l0.01 -1.01758c0.01 -0.97924 -0.4972 -1.50652 -1.4707 -1.50586l-0.5489 0 0 -21.87695 2 -0.125c1 0 2 -1 2 -2l0.0174 -4.00972 -56 0z"
android:fillColor="#000000"
android:fillAlpha="0.2" />
<group
android:scaleX="0.75"
android:scaleY="0.75"
android:translateX="-1439"
android:translateY="336.5935">
<group
android:scaleX="2.672129"
android:scaleY="-2.373164"
android:translateX="1065.372"
android:translateY="-524.6691">
<path
android:pathData="M0.48437385 -0.18433573C0.47547871 -1.6573583 0 -2.201327 -1.0158148 -2.2045228l-2.9592582 -0.00931c-1.0147067 -0.00319 -1.5193078 0.5564745 -1.5111709 1.96152614L-5.4739779 1.865731 0.4966399 1.846906Z"
android:fillColor="#555555" />
</group>
<group
android:scaleX="2.347221"
android:scaleY="-2.361111"
android:translateX="1123.768"
android:translateY="-564.8232">
<path
android:pathData="M-2.7413129 0.55134212c0 -0.56470589 -0.5680476 -1.12941177 -1.1360953 -1.12941177l-1.1360954 -0.0710908 0 9.03529415 1.1360954 0.071091c0.5680477 0 1.1360953 -0.5774118 1.1360953 -1.1294118z"
android:fillColor="#99aab5" />
</group>
<group
android:scaleX="2.347221"
android:scaleY="-2.361111"
android:translateX="1096.167"
android:translateY="-600.3889">
<group
android:scaleX="0.4260358"
android:scaleY="-0.4235294"
android:translateX="-467.0062"
android:translateY="-254.2823">
<path
android:pathData="M1069.3333 -603.45833c-2.6666 0 -5.3333 2.66667 -5.3333 5.33334l-8 -0.00001c-5.1849 0.0256 -8 0.90931 -8 6.125l0 28 64 0 0 -28c0 -5.21569 -2.6935 -6.13605 -8 -6.125l-7.873 0c-0.1982 -2.79971 -2.7937 -5.33333 -5.4603 -5.33333z"
android:fillColor="#ccd6dd" />
</group>
</group>
<path
android:pathData="M1112 -532l-64 0 0 -32 64 0z"
android:fillColor="#ffcc4d" />
<path
android:pathData="M1112 -534l-64 0 0 -13.45833 64 0z"
android:fillColor="#ffac33" />
<group
android:scaleX="2.672129"
android:scaleY="-2.373164"
android:translateX="1108.039"
android:translateY="-524.7322">
<path
android:pathData="M0.48437385 -0.18433573C0.47547871 -1.6573583 0 -2.201327 -1.0158148 -2.2045228l-2.9592582 -0.00931c-1.0147067 -0.00319 -1.5193078 0.5564745 -1.5111709 1.96152614L-5.4739779 1.865731 0.4966399 1.846906Z"
android:fillColor="#555555" />
</group>
<group
android:scaleX="2.347221"
android:scaleY="-2.361111"
android:translateX="1117.292"
android:translateY="-529.5555">
<path
android:pathData="M-1.1106087 0.50944593c-0.004 -0.55298567 -0.2820778 -0.82582563 -0.8350776 -0.82634673L-29.838909 -0.343185c-0.552 -0.00052015 -0.846547 0.29544991 -0.831369 0.84824406l0.01625 0.59184604c0.01518 0.5527945 0.263259 0.8173793 0.815259 0.8177537l27.8966029 0.018922c0.5529999 0.0003751 0.8397095 -0.297274 0.835709 -0.8502598z"
android:fillColor="#66757f" />
</group>
<group
android:scaleX="2.347221"
android:scaleY="-2.361111"
android:translateX="1114.944"
android:translateY="-564.9722">
<path
android:pathData="M-1.2544623 -0.64117553c0 -1.69411767 -0.6151907 -2.25882357 -2.2721907 -2.25882357l-22.721907 0c-1.657 0 -2.272191 0.6018235 -2.272191 2.25882357l0 7.90588143c0 1.657 0.615191 2.2588245 2.272191 2.2588245l22.721907 0c1.704143 0 2.2721907 -0.5647059 2.2721907 -2.2588235z"
android:fillColor="#66757f" />
</group>
<group
android:scaleX="2.347221"
android:scaleY="-2.361111"
android:translateX="1108"
android:translateY="-567.2072">
<path
android:pathData="M0 -0.52941177C0 -1.4735265 -0.56804768 -2.15244 -1.704143 -2.15244L-22.15386 -2.210765c-1.104 0 -1.748324 0.6493164 -1.704143 1.75244234l0 5.87647096c0.04418 1.1031259 0.600143 1.4647059 1.704143 1.4647059l20.449717 0C-0.59914308 6.8828542 0 6.5221483 0 5.4181483Z"
android:fillColor="#88c9f9" />
</group>
<path
android:pathData="M1090.6667 -536.79167l-21.3334 0 0 -8 21.3334 0z"
android:fillColor="#99aab5" />
<group
android:scaleX="2.991308"
android:scaleY="-2.236111"
android:translateX="1092"
android:translateY="-596.6597">
<path
android:pathData="M-0.89147169 -1.1335394l-6.24030181 0c-0.4457359 0 -0.8914717 0.59627331 -0.8914717 1.19254661 0 0.59627329 0.5473856 1.19254659 0.8914717 1.19254659l6.24030181 0C-0.44573585 1.2515538 0 0.6552805 0 0.05900721 0 -0.53726609 -0.44573585 -1.1335394 -0.89147169 -1.1335394Z"
android:fillColor="#555555" />
</group>
<path
android:pathData="M1061.4412 -540.84747a5.3050718 5.3050718 0 0 1 -5.3051 5.30507 5.3050718 5.3050718 0 0 1 -5.3051 -5.30507 5.3050718 5.3050718 0 0 1 5.3051 -5.30507 5.3050718 5.3050718 0 0 1 5.3051 5.30507z"
android:fillColor="#ffffff"
android:strokeLineJoin="bevel"
android:strokeLineCap="round"
android:strokeMiterLimit="4" />
<path
android:pathData="M1109.1526 -540.84747a5.3050718 5.3050718 0 0 1 -5.3051 5.30507 5.3050718 5.3050718 0 0 1 -5.305 -5.30507 5.3050718 5.3050718 0 0 1 5.305 -5.30507 5.3050718 5.3050718 0 0 1 5.3051 5.30507z"
android:fillColor="#ffffff"
android:strokeLineJoin="bevel"
android:strokeLineCap="round"
android:strokeMiterLimit="4" />
<path
android:pathData="M1042.6667 -567.6262c0 1.33333 1.3333 2.66666 2.6667 2.66666l2.6666 0.16786 0 -21.33334 -2.6666 -0.16785c-1.3334 0 -2.6667 1.36333 -2.6667 2.66667z"
android:fillColor="#99aab5" />
</group>
<path
android:pathData="M-684.9999 -43.90647l0 19.32227c2.5609 1.48206 5.2305 2.7926 8 3.91406l0 -23.23633z"
android:fillColor="#666666" />
<group
android:translateY="4">
<path
android:pathData="M-660.99986 -52.107489l0 4.861359c0 1.850171 -1.48948 3.339659 -3.33965 3.339659l-33.32071 0c-1.85017 0 -3.33966 -1.489488 -3.33966 -3.339659l0 -4.861359z"
android:fillColor="#000000"
android:strokeLineJoin="round"
android:strokeLineCap="round"
android:strokeMiterLimit="4"
android:fillAlpha="0.2" />
<path
android:pathData="M-696.99988 -101.90647l32.00002 0c2.216 0 4 1.784 4 4l0 46.000013c0 2.216 -1.784 4.000001 -4 4.000001l-32.00002 0c-2.216 0 -4 -1.784001 -4 -4.000001l0 -46.000013c0 -2.216 1.784 -4 4 -4z"
android:fillColor="#ffffff"
android:strokeLineJoin="round"
android:strokeLineCap="round"
android:strokeMiterLimit="4" />
<group
android:translateY="2.90625">
<path
android:pathData="M-665.99204 -84.84156a15.000022 15.062499 0 0 1 -15.00003 15.062499 15.000022 15.062499 0 0 1 -15.00002 -15.062499 15.000022 15.062499 0 0 1 15.00002 -15.062499 15.000022 15.062499 0 0 1 15.00003 15.062499z"
android:fillColor="#495aad"
android:strokeLineJoin="round"
android:strokeLineCap="round"
android:strokeMiterLimit="4" />
<group
android:translateX="-1613"
android:translateY="-661.9065">
<path
android:pathData="M926 567.07192c-1.108 0 -2 0.892 -2 2L924 583c0 0.74107 0.4042 1.37905 1 1.72461l0 3.27539 4 0 0 -3 6 0 0 3 4 0 0 -3.27539c0.5958 -0.34556 1 -0.98354 1 -1.72461l0 -13.92808c0 -1.108 -0.892 -2 -2 -2zm3 2.92808l6 0c1.108 0 2.01718 0.89213 2 2l0 5 -10 0 0 -5c0 -1.108 0.892 -2 2 -2zm-0.95581 9.04699c1.10457 0 2 0.89543 2 2 0 1.10457 -0.89543 2 -2 2 -1.10457 0 -2 -0.89543 -2 -2 0 -1.10457 0.89543 -2 2 -2zm8 0c1.10457 0 2 0.89543 2 2 0 1.10457 -0.89543 2 -2 2 -1.10457 0 -2 -0.89543 -2 -2 0 -1.10457 0.89543 -2 2 -2z"
android:fillColor="#ffffff"
android:strokeLineJoin="round"
android:strokeLineCap="round"
android:strokeMiterLimit="4" />
</group>
</group>
<path
android:pathData="M-695.99988 -64.000221l30.00002 0 0 10.999999 -30.00002 0z"
android:fillColor="#cbcbcb"
android:strokeLineJoin="round"
android:strokeLineCap="round"
android:strokeMiterLimit="4" />
</group>
</group>
</vector>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will likely have to be reimported using the method I described because I made the experience that Android does not handle groups well.

1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ To display the map, vector tiles are retrieved from the &lt;a href=\"https://map
<string name="quest_surface_value_sett">"Sett"</string>
<string name="quest_surface_value_wood">"Wood"</string>
<string name="quest_placeName_title">"What is the name of this place?"</string>
<string name="quest_busStopName_title">"What is the name of this bus stop?"</string>
<string name="quest_sidewalk_title">"Is there a sidewalk in this street?"</string>
<string name="map_orientation_info">"The map is oriented north up."</string>
<string name="quest_sidewalk_onlyNorth">"Only on northern side"</string>
Expand Down