From 6841f85a9b33b6b04f7e5fb9d1833a595a34eca0 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Fri, 18 May 2018 20:35:57 +0200 Subject: [PATCH 1/6] allow marking objects as without opening hours sign fixes #1076 --- .../quests/opening_hours/AddOpeningHours.java | 7 ++++++- .../opening_hours/AddOpeningHoursForm.java | 16 ++++++++++++++++ app/src/main/res/values/strings.xml | 5 +++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHours.java b/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHours.java index 8cfd3adbf0..d664f3f8a2 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHours.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHours.java @@ -55,7 +55,7 @@ public class AddOpeningHours extends SimpleOverpassQuestType " tourism = information and information = office or" + " leisure ~ " + TextUtils.join("|",leisures) + " or" + " office ~ " + TextUtils.join("|",offices) + ")" + - " and !opening_hours and name" + + " and !opening_hours and name and opening_hours:signed != no" + " and (access !~ private|no)"; // exclude ones without access to general public } @@ -67,6 +67,11 @@ public class AddOpeningHours extends SimpleOverpassQuestType @Override public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) { String openingHours = answer.getString(AddOpeningHoursForm.OPENING_HOURS); + if(answer.getBoolean(AddOpeningHoursForm.NO_SIGN)) + { + changes.add("opening_hours:signed", "no"); + return; + } if(openingHours != null) { changes.add("opening_hours", openingHours); diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java b/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java index 6595b9f449..59f65c2989 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java @@ -31,6 +31,7 @@ public class AddOpeningHoursForm extends AbstractQuestFormAnswerFragment { public static final String OPENING_HOURS = "opening_hours"; + public static final String NO_SIGN = "no_sign"; private static final String OPENING_HOURS_DATA = "oh_data", IS_ADD_MONTHS_MODE = "oh_add_months"; @@ -84,6 +85,7 @@ private void initOpeningHoursAdapter(View contentView, Bundle savedInstanceState private void addOtherAnswers() { + addOtherAnswer(R.string.quest_openingHours_no_sign, this::confirmNoSign); addOtherAnswer(R.string.quest_openingHours_answer_no_regular_opening_hours, this::showInputCommentDialog); addOtherAnswer(R.string.quest_openingHours_answer_247, this::showConfirm24_7Dialog); addOtherAnswer(R.string.quest_openingHours_answer_seasonal_opening_hours, this::changeToMonthsMode); @@ -168,6 +170,20 @@ private void showConfirm24_7Dialog() .show(); } + private void confirmNoSign() + { + new AlertDialogBuilder(getActivity()) + .setTitle(R.string.quest_openingHours_answer_noSign_confirmation_title) + .setPositiveButton(R.string.quest_openingHours_noSign_confirmation_positive, (dialog, which) -> + { + Bundle data = new Bundle(); + data.putBoolean(NO_SIGN, true); + applyImmediateAnswer(data); + }) + .setNegativeButton(R.string.quest_generic_confirmation_no, null) + .show(); + } + private void changeToMonthsMode() { isAlsoAddingMonths = true; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5bf6558b81..4a4673b070 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -453,6 +453,9 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards Invalidate Invalidating the cache causes the quests to be updated next time they are downloaded. The quest cache is invalidated automatically after one week and immediately when a quest you solved turns out to be already answered by someone else. You need to describe what is on the sign. If there is no sign, you should ask for the opening hours inside. + Opening hours are unknown + Are you sure that you are unable to collect opening hours info? + Yes, no sign. none, but cyclists may use road in both directions Usually looks like this: Metal @@ -607,7 +610,5 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards It has no house number The building was tagged as: Is this correct and is it not just part of a building? - "Download" - From a335f3c1d60867b78a73012dbf37cc4435b2f3b4 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Tue, 3 Jul 2018 21:58:18 +0200 Subject: [PATCH 2/6] tweak again wording of question --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4a4673b070..fb2f23a8f0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -454,7 +454,7 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards Invalidating the cache causes the quests to be updated next time they are downloaded. The quest cache is invalidated automatically after one week and immediately when a quest you solved turns out to be already answered by someone else. You need to describe what is on the sign. If there is no sign, you should ask for the opening hours inside. Opening hours are unknown - Are you sure that you are unable to collect opening hours info? + Are you sure that there is no sign with opening hours info? Yes, no sign. none, but cyclists may use road in both directions Usually looks like this: From f51ace7454e2a305cf8abe2d3667c34333684fae Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Wed, 18 Jul 2018 22:08:28 +0200 Subject: [PATCH 3/6] switch from 'note:collection_times' to 'collection_times:signed'='no' --- .../postbox_collection_times/AddPostboxCollectionTimes.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/postbox_collection_times/AddPostboxCollectionTimes.java b/app/src/main/java/de/westnordost/streetcomplete/quests/postbox_collection_times/AddPostboxCollectionTimes.java index d09b2aedeb..bb60527ab9 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/postbox_collection_times/AddPostboxCollectionTimes.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/postbox_collection_times/AddPostboxCollectionTimes.java @@ -18,7 +18,7 @@ public class AddPostboxCollectionTimes extends SimpleOverpassQuestType @Override protected String getTagFilters() { - return "nodes with amenity=post_box and !collection_times and !note:collection_times and (access !~ private|no)"; + return "nodes with amenity=post_box and !collection_times and collection_times:signed != no and (access !~ private|no)"; } @Override public AbstractQuestAnswerFragment createForm() @@ -31,7 +31,7 @@ public class AddPostboxCollectionTimes extends SimpleOverpassQuestType boolean noTimes = answer.getBoolean(AddCollectionTimesForm.NO_TIMES_SPECIFIED); if(noTimes) { - changes.add("note:collection_times","no times specified on the box"); + changes.add("collection_times:signed","no"); } else { From b03b17492eb29203a8308c46177ac56cb035eea8 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Wed, 18 Jul 2018 22:09:56 +0200 Subject: [PATCH 4/6] stop encouraging to ask about opening hours --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fb2f23a8f0..59832fa26a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -453,7 +453,7 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards Invalidate Invalidating the cache causes the quests to be updated next time they are downloaded. The quest cache is invalidated automatically after one week and immediately when a quest you solved turns out to be already answered by someone else. You need to describe what is on the sign. If there is no sign, you should ask for the opening hours inside. - Opening hours are unknown + No opening hours sign Are you sure that there is no sign with opening hours info? Yes, no sign. none, but cyclists may use road in both directions From 289cbf6892030102e2a35c077cda84c60a25a09c Mon Sep 17 00:00:00 2001 From: Tobias Zwick Date: Wed, 15 Aug 2018 22:09:17 +0200 Subject: [PATCH 5/6] fix test --- .../streetcomplete/quests/AddPostboxCollectionTimesTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/androidTest/java/de/westnordost/streetcomplete/quests/AddPostboxCollectionTimesTest.java b/app/src/androidTest/java/de/westnordost/streetcomplete/quests/AddPostboxCollectionTimesTest.java index c72f27aa79..d770912ad4 100644 --- a/app/src/androidTest/java/de/westnordost/streetcomplete/quests/AddPostboxCollectionTimesTest.java +++ b/app/src/androidTest/java/de/westnordost/streetcomplete/quests/AddPostboxCollectionTimesTest.java @@ -11,7 +11,7 @@ public void testNoTimes() { bundle.putBoolean(AddCollectionTimesForm.NO_TIMES_SPECIFIED, true); verify( - new StringMapEntryAdd("note:collection_times","no times specified on the box")); + new StringMapEntryAdd("collection_times:signed","no")); } public void testTimes() From b17950ae77318d471a5ada41ccf7e9124f260e49 Mon Sep 17 00:00:00 2001 From: Tobias Zwick Date: Wed, 15 Aug 2018 22:22:37 +0200 Subject: [PATCH 6/6] remove superfluous (IMO) strings --- .../quests/opening_hours/AddOpeningHoursForm.java | 5 ++--- app/src/main/res/values/strings.xml | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java b/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java index 59f65c2989..079565392f 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/opening_hours/AddOpeningHoursForm.java @@ -10,7 +10,6 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; -import android.widget.Toast; import java.util.ArrayList; import java.util.List; @@ -173,8 +172,8 @@ private void showConfirm24_7Dialog() private void confirmNoSign() { new AlertDialogBuilder(getActivity()) - .setTitle(R.string.quest_openingHours_answer_noSign_confirmation_title) - .setPositiveButton(R.string.quest_openingHours_noSign_confirmation_positive, (dialog, which) -> + .setTitle(R.string.quest_generic_confirmation_title) + .setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> { Bundle data = new Bundle(); data.putBoolean(NO_SIGN, true); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 44ba65bc16..b6ff471773 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -456,8 +456,6 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards Invalidating the cache causes the quests to be updated next time they are downloaded. The quest cache is invalidated automatically after one week and immediately when a quest you solved turns out to be already answered by someone else. You need to describe what is on the sign. If there is no sign, you should ask for the opening hours inside. No opening hours sign - Are you sure that there is no sign with opening hours info? - Yes, no sign. none, but cyclists may use road in both directions Usually looks like this: Metal