diff --git a/app/src/main/assets/country_metadata/AZ.yml b/app/src/main/assets/country_metadata/AZ.yml index 2d1265dc22..3c9489b865 100644 --- a/app/src/main/assets/country_metadata/AZ.yml +++ b/app/src/main/assets/country_metadata/AZ.yml @@ -1,4 +1,5 @@ # Do not edit. Source files are in /res/country_metadata +isLivingStreetKnown: true mobileCountryCode: 400 officialLanguages: [az] orchardProduces: [apple, tomatoe, hazelnut, grape, persimmon, pear, chilli_pepper, sweet_pepper, plum, diff --git a/app/src/main/assets/country_metadata/IL.yml b/app/src/main/assets/country_metadata/IL.yml index 0fb6acb0aa..83daa26481 100644 --- a/app/src/main/assets/country_metadata/IL.yml +++ b/app/src/main/assets/country_metadata/IL.yml @@ -1,6 +1,7 @@ # Do not edit. Source files are in /res/country_metadata additionalStreetsignLanguages: [en] firstDayOfWorkweek: Su +isLivingStreetKnown: true isSlowZoneKnown: true mobileCountryCode: 425 officialLanguages: [heb, ar] diff --git a/app/src/main/assets/country_metadata/MU.yml b/app/src/main/assets/country_metadata/MU.yml index 416899eff4..477802f99a 100644 --- a/app/src/main/assets/country_metadata/MU.yml +++ b/app/src/main/assets/country_metadata/MU.yml @@ -1,6 +1,7 @@ # Do not edit. Source files are in /res/country_metadata isLeftHandTraffic: true isLivingStreetKnown: true +isSlowZoneKnown: true mobileCountryCode: 617 officialLanguages: [en, fr, mfe] orchardProduces: [tomatoe, tea, pineapple, coconut, banana, chilli_pepper, sweet_pepper] diff --git a/app/src/main/assets/country_metadata/NZ.yml b/app/src/main/assets/country_metadata/NZ.yml index 031d437481..661e4c8bf0 100644 --- a/app/src/main/assets/country_metadata/NZ.yml +++ b/app/src/main/assets/country_metadata/NZ.yml @@ -2,6 +2,7 @@ isAdvisorySpeedLimitKnown: true isLeftHandTraffic: true isLivingStreetKnown: true +isSlowZoneKnown: true mobileCountryCode: 530 officialLanguages: [en] orchardProduces: [grape, kiwi, apple, avocado, peach, tomatoe, orange, cherry, blueberry, pear, walnut, diff --git a/app/src/main/assets/country_metadata/US-NY.yml b/app/src/main/assets/country_metadata/US-NY.yml deleted file mode 100644 index 03573eb6e6..0000000000 --- a/app/src/main/assets/country_metadata/US-NY.yml +++ /dev/null @@ -1,2 +0,0 @@ -# Do not edit. Source files are in /res/country_metadata -isSlowZoneKnown: true diff --git a/app/src/main/assets/country_metadata/US.yml b/app/src/main/assets/country_metadata/US.yml index 40fbbb1e35..66ea725483 100644 --- a/app/src/main/assets/country_metadata/US.yml +++ b/app/src/main/assets/country_metadata/US.yml @@ -1,5 +1,6 @@ # Do not edit. Source files are in /res/country_metadata isAdvisorySpeedLimitKnown: true +isSlowZoneKnown: false mobileCountryCode: 310 officialLanguages: [en] orchardProduces: [grape, almond, tomatoe, apple, walnut, pistachio, peach, blueberry, grapefruit, plum, diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/AbstractQuestAnswerFragment.java b/app/src/main/java/de/westnordost/streetcomplete/quests/AbstractQuestAnswerFragment.java index 5aeef33474..5a5f0dcdd3 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/AbstractQuestAnswerFragment.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/AbstractQuestAnswerFragment.java @@ -1,6 +1,8 @@ package de.westnordost.streetcomplete.quests; +import android.content.ContextWrapper; import android.support.annotation.AnyThread; +import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; import android.content.Context; import android.content.res.Configuration; @@ -16,8 +18,7 @@ import android.widget.PopupMenu; import android.widget.TextView; -import org.xmlpull.v1.XmlPullParser; - +import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -64,6 +65,9 @@ public abstract class AbstractQuestAnswerFragment extends AbstractBottomSheetFra private List otherAnswers; + private WeakReference currentContext = new WeakReference<>(null); + private ContextWrapper currentCountryContext; + public AbstractQuestAnswerFragment() { super(); @@ -76,13 +80,6 @@ public AbstractQuestAnswerFragment() public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - osmElement = (OsmElement) getArguments().getSerializable(ARG_ELEMENT); - elementGeometry = (ElementGeometry) getArguments().getSerializable(ARG_GEOMETRY); - questType = questTypeRegistry.getByName(getArguments().getString(ARG_QUESTTYPE)); - countryInfo = null; - initialMapRotation = getArguments().getFloat(ARG_MAP_ROTATION); - initialMapTilt = getArguments().getFloat(ARG_MAP_TILT); - View view = inflater.inflate(R.layout.fragment_quest_answer, container, false); TextView title = view.findViewById(R.id.title); @@ -136,6 +133,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, { super.onCreate(inState); questAnswerComponent.onCreate(getArguments()); + osmElement = (OsmElement) getArguments().getSerializable(ARG_ELEMENT); + elementGeometry = (ElementGeometry) getArguments().getSerializable(ARG_GEOMETRY); + questType = questTypeRegistry.getByName(getArguments().getString(ARG_QUESTTYPE)); + countryInfo = null; + initialMapRotation = getArguments().getFloat(ARG_MAP_ROTATION); + initialMapTilt = getArguments().getFloat(ARG_MAP_TILT); } @Override public void onAttach(Context ctx) @@ -144,6 +147,37 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, questAnswerComponent.onAttach((OsmQuestAnswerListener) ctx); } + @NonNull @Override + public LayoutInflater onGetLayoutInflater(@Nullable Bundle savedInstanceState) + { + // will always return a layout inflater for the current country + return super.onGetLayoutInflater(savedInstanceState).cloneInContext(getContext()); + } + + @Override @Nullable public Context getContext() + { + Context context = super.getContext(); + if(currentContext.get() != context) + { + currentContext = new WeakReference<>(context); + currentCountryContext = context != null ? createCurrentCountryContextWrapper(context) : null; + } + return currentCountryContext; + } + + private ContextWrapper createCurrentCountryContextWrapper(Context context) + { + Configuration conf = new Configuration(context.getResources().getConfiguration()); + Integer mcc = getCountryInfo().getMobileCountryCode(); + conf.mcc = mcc != null ? mcc : 0; + Resources res = context.createConfigurationContext(conf).getResources(); + return new ContextWrapper(context) { + @Override public Resources getResources() + { + return res; + } + }; + } protected final void onClickCantSay() { @@ -159,18 +193,10 @@ private Resources getEnglishResources() { Configuration conf = new Configuration(getResources().getConfiguration()); conf.setLocale(Locale.ENGLISH); - Context localizedContext = getActivity().createConfigurationContext(conf); + Context localizedContext = super.getContext().createConfigurationContext(conf); return localizedContext.getResources(); } - protected final Resources getCurrentCountryResources() - { - Configuration conf = new Configuration(getResources().getConfiguration()); - Integer mcc = getCountryInfo().getMobileCountryCode(); - conf.mcc = mcc != null ? mcc : 0; - return getContext().createConfigurationContext(conf).getResources(); - } - protected final void applyImmediateAnswer(Bundle data) { questAnswerComponent.onAnswerQuest(data); @@ -187,16 +213,7 @@ protected final View setContentView(int resourceId) { content.removeAllViews(); } - return getActivity().getLayoutInflater().inflate(resourceId, content); - } - - protected final View setContentView(XmlPullParser parser) - { - if(content.getChildCount() > 0) - { - content.removeAllViews(); - } - return getActivity().getLayoutInflater().inflate(parser, content); + return LayoutInflater.from(getContext()).inflate(resourceId, content); } protected final View setButtonsView(int resourceId) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/bikeway/AddCyclewayForm.java b/app/src/main/java/de/westnordost/streetcomplete/quests/bikeway/AddCyclewayForm.java index a80bfc83b7..acbea882dd 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/bikeway/AddCyclewayForm.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/bikeway/AddCyclewayForm.java @@ -279,7 +279,7 @@ private ListAdapter createAdapter(List items, final OnCyclew ImageView iconView = itemView.findViewById(R.id.imageView); TextView textView = itemView.findViewById(R.id.textView); int resId = item.getIconResId(isLeftHandTraffic()); - iconView.setImageDrawable(getCurrentCountryResources().getDrawable(resId)); + iconView.setImageDrawable(getResources().getDrawable(resId)); textView.setText(item.nameResId); itemView.setOnClickListener(view -> callback.onCyclewaySelected(item)); } diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeed.java b/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeed.java index e7cd02c6ac..5e702fc921 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeed.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeed.java @@ -80,8 +80,8 @@ else if (maxspeed != null) { boolean hasName = tags.containsKey("name"); - if(hasName) return R.string.quest_maxspeed_name_title; - else return R.string.quest_maxspeed_title_short; + if(hasName) return R.string.quest_maxspeed_name_title2; + else return R.string.quest_maxspeed_title_short2; } @NonNull @Override public Countries getEnabledForCountries() diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.java b/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.java index e262d0d984..1aea6373e3 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/max_speed/AddMaxSpeedForm.java @@ -1,14 +1,17 @@ package de.westnordost.streetcomplete.quests.max_speed; -import android.graphics.drawable.Drawable; import android.os.Bundle; +import android.support.annotation.IdRes; +import android.support.annotation.LayoutRes; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; -import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.Spinner; import android.widget.Toast; @@ -23,129 +26,52 @@ public class AddMaxSpeedForm extends AbstractQuestFormAnswerFragment { public static final String - MAX_SPEED = "maxspeed", - ADVISORY_SPEED = "advisory_speed", - MAX_SPEED_IMPLICIT_COUNTRY = "maxspeed_country", - MAX_SPEED_IMPLICIT_ROADTYPE = "maxspeed_roadtype", - LIVING_STREET = "living_street"; - - private static final String IS_ADVISORY_SPEED_LIMIT = "is_advisory_speed_limit"; + MAX_SPEED_IMPLICIT_COUNTRY = "maxspeed_country", + MAX_SPEED_IMPLICIT_ROADTYPE = "maxspeed_roadtype", + ADVISORY_SPEED = "advisory_speed", + MAX_SPEED = "maxspeed", + LIVING_STREET = "living_street"; private static final Collection - URBAN_OR_RURAL_ROADS = Arrays.asList("primary","secondary","tertiary","unclassified", - "primary_link","secondary_link","tertiary_link","road"), - ROADS_WITH_DEFINITE_SPEED_LIMIT = Arrays.asList("trunk","motorway","living_street"), - POSSIBLY_SLOWZONE_ROADS = Arrays.asList("residential","unclassified"), - MAYBE_LIVING_STREET = Arrays.asList("residential"); + POSSIBLY_SLOWZONE_ROADS = Arrays.asList("residential","unclassified","tertiary" /*#1133*/), + MAYBE_LIVING_STREET = Arrays.asList("residential","unclassified"), + ROADS_WITH_DEFINITE_SPEED_LIMIT = Arrays.asList("trunk","motorway","living_street"); + + private RadioGroup speedTypeSelect; + private ViewGroup rightSide; private EditText speedInput; - private CheckBox zoneCheckbox; private Spinner speedUnitSelect; - private boolean isAdvisorySpeedLimit; + private enum SpeedType { SIGN, ZONE, ADVISORY, NO_SIGN } + private SpeedType speedType; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); - isAdvisorySpeedLimit = false; - if(savedInstanceState != null) - { - isAdvisorySpeedLimit = savedInstanceState.getBoolean(IS_ADVISORY_SPEED_LIMIT); - } + View contentView = setContentView(R.layout.quest_maxspeed); - if(isAdvisorySpeedLimit) - { - setStreetSignLayout(R.layout.quest_maxspeed_advisory); - } - else + boolean couldBeSlowZone = getCountryInfo().isSlowZoneKnown() && + POSSIBLY_SLOWZONE_ROADS.contains(getOsmElement().getTags().get("highway")); + RadioButton zoneBtn = contentView.findViewById(R.id.zone); + zoneBtn.setVisibility(couldBeSlowZone ? View.VISIBLE : View.GONE); + + rightSide = contentView.findViewById(R.id.right_side); + speedTypeSelect = contentView.findViewById(R.id.speedTypeSelect); + speedTypeSelect.setOnCheckedChangeListener((group, checkedId) -> { - setStreetSignLayout(R.layout.quest_maxspeed); - } + setSpeedType(getSpeedType(checkedId)); + }); addOtherAnswers(); return view; } - @Override public void onSaveInstanceState(Bundle outState) - { - super.onSaveInstanceState(outState); - outState.putBoolean(IS_ADVISORY_SPEED_LIMIT, isAdvisorySpeedLimit); - } - - private void setStreetSignLayout(int resourceId) - { - View contentView = setContentView(getCurrentCountryResources().getLayout(resourceId)); - - speedInput = contentView.findViewById(R.id.maxSpeedInput); - - speedUnitSelect = contentView.findViewById(R.id.speedUnitSelect); - initSpeedUnitSelect(); - - View zoneContainer = contentView.findViewById(R.id.zoneContainer); - if(zoneContainer != null) - { - initZoneCheckbox(zoneContainer); - } - } - - private void initSpeedUnitSelect() - { - List speedUnits = getCountryInfo().getSpeedUnits(); - speedUnitSelect.setVisibility(speedUnits.size() == 1 ? View.GONE : View.VISIBLE); - speedUnitSelect.setAdapter(new ArrayAdapter<>(getContext(), R.layout.spinner_item_centered, speedUnits)); - speedUnitSelect.setSelection(0); - } - - private void initZoneCheckbox(View zoneContainer) - { - boolean isResidential = POSSIBLY_SLOWZONE_ROADS.contains(getOsmElement().getTags().get("highway")); - boolean isSlowZoneKnown = getCountryInfo().isSlowZoneKnown(); - zoneContainer.setVisibility(isSlowZoneKnown && isResidential ? View.VISIBLE : View.GONE); - - zoneCheckbox = zoneContainer.findViewById(R.id.zoneCheckbox); - zoneCheckbox.setOnCheckedChangeListener((buttonView, isChecked) -> - { - if(isChecked && speedInput.getText().toString().isEmpty()) - { - // prefill speed input with normal "slow zone" value - String speedUnit = (String) speedUnitSelect.getSelectedItem(); - boolean isMph = speedUnit.equals("mph"); - speedInput.setText(isMph ? "20" : "30"); - } - }); - - zoneContainer.findViewById(R.id.zoneImg).setOnClickListener(v -> zoneCheckbox.toggle()); - } - private void addOtherAnswers() { - addOtherAnswer(R.string.quest_maxspeed_answer_noSign, () -> - { - final String highwayTag = getOsmElement().getTags().get("highway"); - if(URBAN_OR_RURAL_ROADS.contains(highwayTag)) - { - confirmNoSign(this::determineImplicitMaxspeedType); - } - else if(POSSIBLY_SLOWZONE_ROADS.contains(highwayTag)) - { - if(getCountryInfo().isSlowZoneKnown()) - { - confirmNoSignSlowZone(this::determineImplicitMaxspeedType); - } - else - { - confirmNoSign(this::determineImplicitMaxspeedType); - } - } - else if(ROADS_WITH_DEFINITE_SPEED_LIMIT.contains(highwayTag)) - { - confirmNoSign(() -> applyNoSignAnswer(highwayTag)); - } - }); - final String highwayTag = getOsmElement().getTags().get("highway"); if(getCountryInfo().isLivingStreetKnown() && MAYBE_LIVING_STREET.contains(highwayTag)) { @@ -164,190 +90,261 @@ else if(ROADS_WITH_DEFINITE_SPEED_LIMIT.contains(highwayTag)) { addOtherAnswer(R.string.quest_maxspeed_answer_advisory_speed_limit, () -> { - isAdvisorySpeedLimit = true; - setStreetSignLayout(R.layout.quest_maxspeed_advisory); + speedTypeSelect.clearCheck(); + for(int i = 0; i < speedTypeSelect.getChildCount(); i++){ + speedTypeSelect.getChildAt(i).setEnabled(false); + } + setSpeedType(SpeedType.ADVISORY); }); } } - private void determineImplicitMaxspeedType() + @Override protected void onClickOk() { - if(getCountryInfo().getCountryCode().equals("GB")) + if(!hasChanges()) + { + Toast.makeText(getActivity(), R.string.no_changes, Toast.LENGTH_SHORT).show(); + return; + } + + if(speedType == SpeedType.NO_SIGN) { - determineLit(() -> applyNoSignAnswer("nsl_restricted"), () -> askSingleOrDualCarriageway()); + boolean couldBeSlowZone = getCountryInfo().isSlowZoneKnown() && + POSSIBLY_SLOWZONE_ROADS.contains(getOsmElement().getTags().get("highway")); + + if(couldBeSlowZone) confirmNoSignSlowZone(this::determineImplicitMaxspeedType); + else confirmNoSign(this::determineImplicitMaxspeedType); } else { - askUrbanOrRural(); + if (userSelectedUnusualSpeed()) confirmUnusualInput(this::applySpeedLimitFormAnswer); + else applySpeedLimitFormAnswer(); } } - private void confirmLivingStreet(final Runnable callback) + @Override public boolean hasChanges() { - View view = LayoutInflater.from(getActivity()).inflate(R.layout.quest_maxspeed_living_street_confirmation, null, false); - - ImageView img = view.findViewById(R.id.imgLivingStreet); - img.setImageDrawable(getCurrentCountryResources().getDrawable(R.drawable.ic_living_street)); - - new AlertDialogBuilder(getActivity()) - .setView(view) - .setTitle(R.string.quest_maxspeed_answer_living_street_confirmation_title) - .setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> callback.run()) - .setNegativeButton(R.string.quest_generic_confirmation_no, null) - .show(); + return speedType == SpeedType.NO_SIGN + || speedInput != null && !speedInput.getText().toString().isEmpty(); } - private void confirmNoSignSlowZone(final Runnable callback) + /* ---------------------------------------- With sign --------------------------------------- */ + + private void setSpeedType(SpeedType speedType) { - View view = LayoutInflater.from(getActivity()).inflate(R.layout.quest_maxspeed_no_sign_no_slow_zone_confirmation, null, false); + this.speedType = speedType; - ImageView imgSlowZone = view.findViewById(R.id.imgSlowZone); - ImageView mainLayoutImgSlowZone = getView() != null ? (ImageView) getView().findViewById(R.id.zoneImg) : null; - if(mainLayoutImgSlowZone != null) + rightSide.removeAllViews(); + int layoutResId = getLayoutResId(speedType); + if(layoutResId != 0) { - Drawable slowZoneDrawable = mainLayoutImgSlowZone.getDrawable(); - imgSlowZone.setImageDrawable(slowZoneDrawable); + getLayoutInflater().inflate(layoutResId, rightSide, true); } - new AlertDialogBuilder(getActivity()) - .setView(view) - .setTitle(R.string.quest_maxspeed_answer_noSign_confirmation_title) - .setPositiveButton(R.string.quest_maxspeed_answer_noSign_confirmation_positive, (dialog, which) -> callback.run()) - .setNegativeButton(R.string.quest_generic_confirmation_no, null) - .show(); + speedInput = rightSide.findViewById(R.id.maxSpeedInput); + speedUnitSelect = rightSide.findViewById(R.id.speedUnitSelect); + if(speedUnitSelect != null) + { + List speedUnits = getCountryInfo().getSpeedUnits(); + speedUnitSelect.setVisibility(speedUnits.size() == 1 ? View.GONE : View.VISIBLE); + speedUnitSelect.setAdapter(new ArrayAdapter<>(getContext(), R.layout.spinner_item_centered, speedUnits)); + speedUnitSelect.setSelection(0); + } } - private void askUrbanOrRural() + private SpeedType getSpeedType(@IdRes int checkedId) { - new AlertDialogBuilder(getActivity()) - .setTitle(R.string.quest_maxspeed_answer_noSign_info_urbanOrRural) - .setMessage(R.string.quest_maxspeed_answer_noSign_urbanOrRural_description) - .setPositiveButton(R.string.quest_maxspeed_answer_noSign_urbanOk, (dialog, which) -> applyNoSignAnswer("urban")) - .setNeutralButton(R.string.quest_maxspeed_answer_noSign_ruralOk, (dialog, which) -> applyNoSignAnswer("rural")) - .show(); + switch (checkedId) + { + case R.id.sign: return SpeedType.SIGN; + case R.id.zone: return SpeedType.ZONE; + case R.id.no_sign: return SpeedType.NO_SIGN; + } + return null; } - private void determineLit(Runnable onYes, Runnable onNo) + @LayoutRes private int getLayoutResId(SpeedType speedType) { - String lit = getOsmElement().getTags().get("lit"); - if("yes".equals(lit)) onYes.run(); - else if("no".equals(lit)) onNo.run(); - else askLit(onYes, onNo); + if(speedType == null) return 0; + switch (speedType) + { + case SIGN: return R.layout.quest_maxspeed_sign; + case ZONE: return R.layout.quest_maxspeed_zone_sign; + case ADVISORY: return R.layout.quest_maxspeed_advisory; + } + return 0; } - private void askLit(Runnable onYes, Runnable onNo) + private boolean userSelectedUnusualSpeed() { - new AlertDialogBuilder(getActivity()) - .setMessage(R.string.quest_way_lit_road_title) - .setPositiveButton(R.string.quest_generic_hasFeature_yes, (dialog, which) -> onYes.run()) - .setNegativeButton(R.string.quest_generic_hasFeature_no, (dialog, which) -> onNo.run()) - .show(); + int speed = Integer.parseInt(speedInput.getText().toString()); + String speedUnit = (String) speedUnitSelect.getSelectedItem(); + double speedInKmh = speedUnit.equals("mph") ? mphToKmh(speed) : speed; + return speedInKmh > 140 || speed > 20 && speed % 5 != 0; } - private void askSingleOrDualCarriageway() + private static double mphToKmh(double mph) { - new AlertDialogBuilder(getActivity()) - .setMessage(R.string.quest_maxspeed_answer_noSign_singleOrDualCarriageway_description) - .setPositiveButton(R.string.quest_generic_hasFeature_yes, (dialog, which) -> applyNoSignAnswer("nsl_dual")) - .setNegativeButton(R.string.quest_generic_hasFeature_no, (dialog, which) -> applyNoSignAnswer("nsl_single")) - .show(); + return 1.60934 * mph; } - private void confirmNoSign(final Runnable callback) + private void confirmUnusualInput(final Runnable callback) { + if(getActivity() == null) return; new AlertDialogBuilder(getActivity()) - .setTitle(R.string.quest_maxspeed_answer_noSign_confirmation_title) - .setMessage(R.string.quest_maxspeed_answer_noSign_confirmation) - .setPositiveButton(R.string.quest_maxspeed_answer_noSign_confirmation_positive, (dialog, which) -> callback.run()) - .setNegativeButton(R.string.quest_generic_confirmation_no, null) - .show(); + .setTitle(R.string.quest_generic_confirmation_title) + .setMessage(R.string.quest_maxspeed_unusualInput_confirmation_description) + .setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> callback.run()) + .setNegativeButton(R.string.quest_generic_confirmation_no, null) + .show(); } - private void applyNoSignAnswer(String roadType) + private void applySpeedLimitFormAnswer() { - Bundle answer = new Bundle(); - String countryCode = getCountryInfo().getCountryCode(); - answer.putString(MAX_SPEED_IMPLICIT_COUNTRY, countryCode); - answer.putString(MAX_SPEED_IMPLICIT_ROADTYPE, roadType); - applyImmediateAnswer(answer); - } + int speed = Integer.parseInt(speedInput.getText().toString()); + String speedStr = String.valueOf(speed); - @Override protected void onClickOk() - { - if(!hasChanges()) + // km/h is the OSM default, is not mentioned + String speedUnit = (String) speedUnitSelect.getSelectedItem(); + if(!speedUnit.equals("km/h")) { - Toast.makeText(getActivity(), R.string.no_changes, Toast.LENGTH_SHORT).show(); - return; + speedStr += " " + speedUnit; } - if(userSelectedUnrealisticSpeedLimit()) + Bundle answer = new Bundle(); + if(speedType == SpeedType.ADVISORY) { - confirmUnusualInput(this::applySpeedLimitFormAnswer); + answer.putString(ADVISORY_SPEED, speedStr); } else { - applySpeedLimitFormAnswer(); + answer.putString(MAX_SPEED, speedStr); + if (speedType == SpeedType.ZONE) + { + answer.putString(MAX_SPEED_IMPLICIT_COUNTRY, getCountryInfo().getCountryCode()); + answer.putString(MAX_SPEED_IMPLICIT_ROADTYPE, "zone" + speed); + } } + applyFormAnswer(answer); } - private boolean userSelectedUnrealisticSpeedLimit() + /* ----------------------------------------- No sign ---------------------------------------- */ + + private void confirmLivingStreet(final Runnable callback) { - int speed = Integer.parseInt(speedInput.getText().toString()); - String speedUnit = (String) speedUnitSelect.getSelectedItem(); - double speedInKmh = speedUnit.equals("mph") ? mphToKmh(speed) : speed; - return speedInKmh > 140 || speed > 20 && speed % 5 != 0; + if(getActivity() == null) return; + View view = getLayoutInflater().inflate(R.layout.quest_maxspeed_living_street_confirmation, null, false); + // this is necessary because the inflated image view uses the activity context rather than + // the fragment / layout inflater context' resources to access it's drawable + ImageView img = view.findViewById(R.id.imgLivingStreet); + img.setImageDrawable(getResources().getDrawable(R.drawable.ic_living_street)); + new AlertDialogBuilder(getActivity()) + .setView(view) + .setTitle(R.string.quest_maxspeed_answer_living_street_confirmation_title) + .setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> callback.run()) + .setNegativeButton(R.string.quest_generic_confirmation_no, null) + .show(); } - private static double mphToKmh(double mph) + private void confirmNoSign(Runnable confirm) { - return 1.60934 * mph; + if(getActivity() == null) return; + new AlertDialogBuilder(getActivity()) + .setTitle(R.string.quest_maxspeed_answer_noSign_confirmation_title) + .setMessage(R.string.quest_maxspeed_answer_noSign_confirmation) + .setPositiveButton(R.string.quest_maxspeed_answer_noSign_confirmation_positive, (dialog, which) -> confirm.run()) + .setNegativeButton(R.string.quest_generic_confirmation_no, null) + .show(); } - private void applySpeedLimitFormAnswer() + private void confirmNoSignSlowZone(Runnable confirm) { - Bundle answer = new Bundle(); + if(getActivity() == null) return; + View view = getLayoutInflater().inflate(R.layout.quest_maxspeed_no_sign_no_slow_zone_confirmation, null, false); + EditText input = view.findViewById(R.id.maxSpeedInput); + input.setText("××"); + input.setInputType(EditorInfo.TYPE_NULL); - StringBuilder speedStr = new StringBuilder(); - int speed = Integer.parseInt(speedInput.getText().toString()); - speedStr.append(speed); - - // km/h is the OSM default, does not need to be mentioned - String speedUnit = (String) speedUnitSelect.getSelectedItem(); - if(!speedUnit.equals("km/h")) - { - speedStr.append(" " + speedUnit); - } + new AlertDialogBuilder(getActivity()) + .setTitle(R.string.quest_maxspeed_answer_noSign_confirmation_title) + .setView(view) + .setPositiveButton(R.string.quest_maxspeed_answer_noSign_confirmation_positive, (dialog, which) -> confirm.run()) + .setNegativeButton(R.string.quest_generic_confirmation_no, null) + .show(); + } - if (isAdvisorySpeedLimit) + private void determineImplicitMaxspeedType() + { + final String highwayTag = getOsmElement().getTags().get("highway"); + if(ROADS_WITH_DEFINITE_SPEED_LIMIT.contains(highwayTag)) { - answer.putString(ADVISORY_SPEED, speedStr.toString()); + applyNoSignAnswer(highwayTag); } else { - answer.putString(MAX_SPEED, speedStr.toString()); - if (zoneCheckbox != null && zoneCheckbox.isChecked()) + if(getCountryInfo().getCountryCode().equals("GB")) { - String countryCode = getCountryInfo().getCountryCode(); - answer.putString(MAX_SPEED_IMPLICIT_COUNTRY, countryCode); - answer.putString(MAX_SPEED_IMPLICIT_ROADTYPE, "zone" + speed); + determineLit( + () -> applyNoSignAnswer("nsl_restricted"), + () -> askIsDualCarriageway( + () -> applyNoSignAnswer("nsl_dual"), + () -> applyNoSignAnswer("nsl_single")) + ); + } + else + { + askUrbanOrRural( + () -> applyNoSignAnswer("urban"), + () -> applyNoSignAnswer("rural")); } } + } - applyFormAnswer(answer); + private void askUrbanOrRural(Runnable onUrban, Runnable onRural) + { + if(getActivity() == null) return; + new AlertDialogBuilder(getActivity()) + .setTitle(R.string.quest_maxspeed_answer_noSign_info_urbanOrRural) + .setMessage(R.string.quest_maxspeed_answer_noSign_urbanOrRural_description) + .setPositiveButton(R.string.quest_maxspeed_answer_noSign_urbanOk, (dialog, which) -> onUrban.run()) + .setNegativeButton(R.string.quest_maxspeed_answer_noSign_ruralOk, (dialog, which) -> onRural.run()) + .show(); } - private void confirmUnusualInput(final Runnable callback) + private void determineLit(Runnable onYes, Runnable onNo) { + String lit = getOsmElement().getTags().get("lit"); + if("yes".equals(lit)) onYes.run(); + else if("no".equals(lit)) onNo.run(); + else askLit(onYes, onNo); + } + + private void askLit(Runnable onYes, Runnable onNo) + { + if(getActivity() == null) return; new AlertDialogBuilder(getActivity()) - .setTitle(R.string.quest_generic_confirmation_title) - .setMessage(R.string.quest_maxspeed_unusualInput_confirmation_description) - .setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) -> callback.run()) - .setNegativeButton(R.string.quest_generic_confirmation_no, null) - .show(); + .setMessage(R.string.quest_way_lit_road_title) + .setPositiveButton(R.string.quest_generic_hasFeature_yes, (dialog, which) -> onYes.run()) + .setNegativeButton(R.string.quest_generic_hasFeature_no, (dialog, which) -> onNo.run()) + .show(); } - @Override public boolean hasChanges() + private void askIsDualCarriageway(Runnable onYes, Runnable onNo) { - return !speedInput.getText().toString().isEmpty(); + if(getActivity() == null) return; + new AlertDialogBuilder(getActivity()) + .setMessage(R.string.quest_maxspeed_answer_noSign_singleOrDualCarriageway_description) + .setPositiveButton(R.string.quest_generic_hasFeature_yes, (dialog, which) -> onYes.run()) + .setNegativeButton(R.string.quest_generic_hasFeature_no, (dialog, which) -> onNo.run()) + .show(); + } + + private void applyNoSignAnswer(String roadType) + { + Bundle answer = new Bundle(); + String countryCode = getCountryInfo().getCountryCode(); + answer.putString(MAX_SPEED_IMPLICIT_COUNTRY, countryCode); + answer.putString(MAX_SPEED_IMPLICIT_ROADTYPE, roadType); + applyImmediateAnswer(answer); } } diff --git a/app/src/main/res/drawable-mcc425/ic_living_street.xml b/app/src/main/res/drawable-mcc425/ic_living_street.xml deleted file mode 100644 index c963f447cf..0000000000 --- a/app/src/main/res/drawable-mcc425/ic_living_street.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/background_maxspeed_sign.xml b/app/src/main/res/drawable/background_maxspeed_sign.xml index 8f9bcbe8aa..9e14d121a3 100644 --- a/app/src/main/res/drawable/background_maxspeed_sign.xml +++ b/app/src/main/res/drawable/background_maxspeed_sign.xml @@ -2,21 +2,18 @@ - - + + - + - - + - + diff --git a/app/src/main/res/drawable/background_maxspeed_sign_no_frame_small.xml b/app/src/main/res/drawable/background_maxspeed_sign_no_frame_small.xml new file mode 100644 index 0000000000..6d02bb4949 --- /dev/null +++ b/app/src/main/res/drawable/background_maxspeed_sign_no_frame_small.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/background_maxspeed_slow_zone_sign_israel.xml b/app/src/main/res/drawable/background_maxspeed_slow_zone_sign_israel.xml new file mode 100644 index 0000000000..33af04ce02 --- /dev/null +++ b/app/src/main/res/drawable/background_maxspeed_slow_zone_sign_israel.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/background_rectangular_sign_blue.xml b/app/src/main/res/drawable/background_rectangular_sign_blue.xml index 86a7d90473..b0c2799f03 100644 --- a/app/src/main/res/drawable/background_rectangular_sign_blue.xml +++ b/app/src/main/res/drawable/background_rectangular_sign_blue.xml @@ -2,17 +2,20 @@ - - + + + - + - + diff --git a/app/src/main/res/drawable/background_rectangular_sign_white.xml b/app/src/main/res/drawable/background_rectangular_sign_white.xml index 681a5f96f7..c83fb680eb 100644 --- a/app/src/main/res/drawable/background_rectangular_sign_white.xml +++ b/app/src/main/res/drawable/background_rectangular_sign_white.xml @@ -2,20 +2,20 @@ - + - + - + - + android:color="@color/traffic_black" + android:width="3dp"/> + diff --git a/app/src/main/res/drawable/background_rectangular_sign_yellow.xml b/app/src/main/res/drawable/background_rectangular_sign_yellow.xml index a056243f21..8d32c26791 100644 --- a/app/src/main/res/drawable/background_rectangular_sign_yellow.xml +++ b/app/src/main/res/drawable/background_rectangular_sign_yellow.xml @@ -2,17 +2,20 @@ - - + + + - + - + diff --git a/app/src/main/res/drawable/background_roadname.xml b/app/src/main/res/drawable/background_roadname.xml index 6f1c4194d7..f8bac618b0 100644 --- a/app/src/main/res/drawable/background_roadname.xml +++ b/app/src/main/res/drawable/background_roadname.xml @@ -3,13 +3,16 @@ android:paddingLeft="20dp"> - + + - + diff --git a/app/src/main/res/drawable/ic_living_street.xml b/app/src/main/res/drawable/ic_living_street.xml index 376e1438ad..e6fb1c3ad3 100644 --- a/app/src/main/res/drawable/ic_living_street.xml +++ b/app/src/main/res/drawable/ic_living_street.xml @@ -5,13 +5,13 @@ android:viewportHeight="100.0"> + android:fillColor="#2255BB"/> + android:fillColor="#2255BB"/> diff --git a/app/src/main/res/drawable/ic_living_street_australia.xml b/app/src/main/res/drawable/ic_living_street_australia.xml index 1bd7168c3d..077c672b9e 100644 --- a/app/src/main/res/drawable/ic_living_street_australia.xml +++ b/app/src/main/res/drawable/ic_living_street_australia.xml @@ -14,7 +14,7 @@ android:fillColor="#fff"/> + android:fillColor="#C1121C"/> diff --git a/app/src/main/res/drawable/ic_living_street_france.xml b/app/src/main/res/drawable/ic_living_street_france.xml index b39992cf19..e082f49ac4 100644 --- a/app/src/main/res/drawable/ic_living_street_france.xml +++ b/app/src/main/res/drawable/ic_living_street_france.xml @@ -5,13 +5,13 @@ android:viewportHeight="26.458334"> + android:fillColor="#2255BB"/> + android:fillColor="#2255BB"/> diff --git a/app/src/main/res/drawable/ic_living_street_israel.xml b/app/src/main/res/drawable/ic_living_street_israel.xml deleted file mode 100644 index ecde0bb9d7..0000000000 --- a/app/src/main/res/drawable/ic_living_street_israel.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_living_street_russian.xml b/app/src/main/res/drawable/ic_living_street_russian.xml index 0f55303f14..4875d98cba 100644 --- a/app/src/main/res/drawable/ic_living_street_russian.xml +++ b/app/src/main/res/drawable/ic_living_street_russian.xml @@ -5,13 +5,13 @@ android:viewportHeight="38.62917"> + android:fillColor="#2255BB"/> + android:fillColor="#2255BB"/> diff --git a/app/src/main/res/drawable/ic_living_street_sadc.xml b/app/src/main/res/drawable/ic_living_street_sadc.xml index 2ab1f7b7d6..f1e966b083 100644 --- a/app/src/main/res/drawable/ic_living_street_sadc.xml +++ b/app/src/main/res/drawable/ic_living_street_sadc.xml @@ -5,13 +5,13 @@ android:viewportHeight="35.454166"> + android:fillColor="#2255BB"/> + android:fillColor="#C1121C"/> + android:fillColor="#2255BB"/> diff --git a/app/src/main/res/drawable/ic_housenumber_street.xml b/app/src/main/res/drawable/ic_quest_housenumber_street.xml similarity index 100% rename from app/src/main/res/drawable/ic_housenumber_street.xml rename to app/src/main/res/drawable/ic_quest_housenumber_street.xml diff --git a/app/src/main/res/drawable/ic_roadtype_dual_carriageway.xml b/app/src/main/res/drawable/ic_roadtype_dual_carriageway.xml new file mode 100644 index 0000000000..85edcad64d --- /dev/null +++ b/app/src/main/res/drawable/ic_roadtype_dual_carriageway.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_roadtype_lit.xml b/app/src/main/res/drawable/ic_roadtype_lit.xml new file mode 100644 index 0000000000..35e66cf9f5 --- /dev/null +++ b/app/src/main/res/drawable/ic_roadtype_lit.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_roadtype_lit_no.xml b/app/src/main/res/drawable/ic_roadtype_lit_no.xml new file mode 100644 index 0000000000..ce3a935411 --- /dev/null +++ b/app/src/main/res/drawable/ic_roadtype_lit_no.xml @@ -0,0 +1,57 @@ + + + + + + + + diff --git a/app/src/main/res/drawable/ic_roadtype_urban.xml b/app/src/main/res/drawable/ic_roadtype_urban.xml new file mode 100644 index 0000000000..761681ad13 --- /dev/null +++ b/app/src/main/res/drawable/ic_roadtype_urban.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable/ic_roadtype_urban_no.xml b/app/src/main/res/drawable/ic_roadtype_urban_no.xml new file mode 100644 index 0000000000..befe86dafc --- /dev/null +++ b/app/src/main/res/drawable/ic_roadtype_urban_no.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/app/src/main/res/drawable/ic_slow_zone.xml b/app/src/main/res/drawable/ic_slow_zone.xml deleted file mode 100644 index 2e0d5c834c..0000000000 --- a/app/src/main/res/drawable/ic_slow_zone.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_slow_zone_us.xml b/app/src/main/res/drawable/ic_slow_zone_us.xml deleted file mode 100644 index 79880b7e39..0000000000 --- a/app/src/main/res/drawable/ic_slow_zone_us.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-mcc302/quest_maxspeed.xml b/app/src/main/res/layout-mcc302/quest_maxspeed.xml deleted file mode 100644 index b6f56c71ed..0000000000 --- a/app/src/main/res/layout-mcc302/quest_maxspeed.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/app/src/main/res/layout-mcc302/quest_maxspeed_sign.xml b/app/src/main/res/layout-mcc302/quest_maxspeed_sign.xml new file mode 100644 index 0000000000..16f4e3605a --- /dev/null +++ b/app/src/main/res/layout-mcc302/quest_maxspeed_sign.xml @@ -0,0 +1,2 @@ + + diff --git a/app/src/main/res/layout-mcc310/quest_maxspeed.xml b/app/src/main/res/layout-mcc310/quest_maxspeed.xml deleted file mode 100644 index dfbe67bfa3..0000000000 --- a/app/src/main/res/layout-mcc310/quest_maxspeed.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/app/src/main/res/layout-mcc310/quest_maxspeed_sign.xml b/app/src/main/res/layout-mcc310/quest_maxspeed_sign.xml new file mode 100644 index 0000000000..95dec341b7 --- /dev/null +++ b/app/src/main/res/layout-mcc310/quest_maxspeed_sign.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/layout-mcc425/quest_maxspeed_zone_sign.xml b/app/src/main/res/layout-mcc425/quest_maxspeed_zone_sign.xml new file mode 100644 index 0000000000..4c9e9f8461 --- /dev/null +++ b/app/src/main/res/layout-mcc425/quest_maxspeed_zone_sign.xml @@ -0,0 +1,39 @@ + + + + + + + + diff --git a/app/src/main/res/layout/quest_housename.xml b/app/src/main/res/layout/quest_housename.xml index fd7caefb11..bfcdf9e981 100644 --- a/app/src/main/res/layout/quest_housename.xml +++ b/app/src/main/res/layout/quest_housename.xml @@ -27,7 +27,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/background_housenumber_frame" - app:backgroundTint="#495aad" + app:backgroundTint="@color/housenumber_background" android:inputType="text" android:imeOptions="actionDone" tools:text="My Cool House" @@ -36,4 +36,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_housenumber.xml b/app/src/main/res/layout/quest_housenumber.xml index 37b8898cd4..178334cd29 100644 --- a/app/src/main/res/layout/quest_housenumber.xml +++ b/app/src/main/res/layout/quest_housenumber.xml @@ -17,7 +17,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/background_housenumber_frame" - app:backgroundTint="#495aad" + app:backgroundTint="@color/housenumber_background" android:imeOptions="actionDone" tools:text="12" android:digits="0123456789.,- /" @@ -34,4 +34,4 @@ android:layout_alignParentEnd="true" tools:text="ABC"/> - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_housenumber_slovak.xml b/app/src/main/res/layout/quest_housenumber_slovak.xml index 98ee6f4228..d2c6acc61e 100644 --- a/app/src/main/res/layout/quest_housenumber_slovak.xml +++ b/app/src/main/res/layout/quest_housenumber_slovak.xml @@ -35,8 +35,8 @@ android:id="@+id/inputConscriptionNumber" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textColor="#333" - app:backgroundTint="#333" + android:textColor="@color/conscriptionnumber_background_slovak" + app:backgroundTint="@color/conscriptionnumber_background_slovak" android:background="@drawable/background_housenumber_frame_slovak" android:imeOptions="actionNext" tools:text="1234" @@ -65,8 +65,8 @@ android:id="@+id/inputStreetNumber" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textColor="#c63a2b" - app:backgroundTint="#c63a2b" + android:textColor="@color/streetnumber_background_slovak" + app:backgroundTint="@color/streetnumber_background_slovak" android:background="@drawable/background_housenumber_frame_slovak" android:imeOptions="actionDone" tools:text="12" @@ -86,4 +86,4 @@ android:layout_alignParentEnd="true" tools:text="abc"/> - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_maxspeed.xml b/app/src/main/res/layout/quest_maxspeed.xml index e3d3cae484..5f3fac1fd2 100644 --- a/app/src/main/res/layout/quest_maxspeed.xml +++ b/app/src/main/res/layout/quest_maxspeed.xml @@ -1,66 +1,67 @@ - + + android:orientation="vertical"> - + android:text="@string/quest_maxspeed_sign_question"/> + + - + + + + + + + - - - - + android:layout_gravity="center" + tools:ignore="UselessParent"> + + - + - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_maxspeed_advisory_blue.xml b/app/src/main/res/layout/quest_maxspeed_advisory_blue.xml index 098618e4ae..7cf796050b 100644 --- a/app/src/main/res/layout/quest_maxspeed_advisory_blue.xml +++ b/app/src/main/res/layout/quest_maxspeed_advisory_blue.xml @@ -1,38 +1,34 @@ - + - + android:textStyle="bold" + android:maxLength="3" + android:textSize="48dp" + tools:text="50"/> - + - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_maxspeed_advisory_white.xml b/app/src/main/res/layout/quest_maxspeed_advisory_white.xml index 372ad81cb4..165fe2cbf0 100644 --- a/app/src/main/res/layout/quest_maxspeed_advisory_white.xml +++ b/app/src/main/res/layout/quest_maxspeed_advisory_white.xml @@ -1,39 +1,35 @@ - + - + android:textStyle="bold" + android:maxLength="3" + android:textSize="48dp" + tools:text="50"/> - + - + - - - \ No newline at end of file diff --git a/app/src/main/res/layout/quest_maxspeed_advisory_yellow.xml b/app/src/main/res/layout/quest_maxspeed_advisory_yellow.xml index b899ef10e0..1975f7791f 100644 --- a/app/src/main/res/layout/quest_maxspeed_advisory_yellow.xml +++ b/app/src/main/res/layout/quest_maxspeed_advisory_yellow.xml @@ -1,39 +1,34 @@ - + - + android:textStyle="bold" + android:maxLength="3" + android:textSize="48dp" + tools:text="50"/> - + - - - - - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_maxspeed_ca.xml b/app/src/main/res/layout/quest_maxspeed_ca.xml deleted file mode 100644 index 358446ddfc..0000000000 --- a/app/src/main/res/layout/quest_maxspeed_ca.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/quest_maxspeed_no_sign_no_slow_zone_confirmation.xml b/app/src/main/res/layout/quest_maxspeed_no_sign_no_slow_zone_confirmation.xml index 9a37f602a0..ba8c14a470 100644 --- a/app/src/main/res/layout/quest_maxspeed_no_sign_no_slow_zone_confirmation.xml +++ b/app/src/main/res/layout/quest_maxspeed_no_sign_no_slow_zone_confirmation.xml @@ -32,16 +32,17 @@ android:layout_toStartOf="@+id/imgSlowZone" /> - + android:layout_alignParentEnd="true" + layout="@layout/quest_maxspeed_zone_sign" + /> - \ No newline at end of file + diff --git a/app/src/main/res/layout/quest_maxspeed_sign.xml b/app/src/main/res/layout/quest_maxspeed_sign.xml new file mode 100644 index 0000000000..a20e3a16c7 --- /dev/null +++ b/app/src/main/res/layout/quest_maxspeed_sign.xml @@ -0,0 +1,37 @@ + + + + + + + + diff --git a/app/src/main/res/layout/quest_maxspeed_sign_ca.xml b/app/src/main/res/layout/quest_maxspeed_sign_ca.xml new file mode 100644 index 0000000000..1d304eb952 --- /dev/null +++ b/app/src/main/res/layout/quest_maxspeed_sign_ca.xml @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/quest_maxspeed_sign_us.xml b/app/src/main/res/layout/quest_maxspeed_sign_us.xml new file mode 100644 index 0000000000..c9933aa924 --- /dev/null +++ b/app/src/main/res/layout/quest_maxspeed_sign_us.xml @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/quest_maxspeed_us.xml b/app/src/main/res/layout/quest_maxspeed_us.xml deleted file mode 100644 index 281517b390..0000000000 --- a/app/src/main/res/layout/quest_maxspeed_us.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/quest_maxspeed_zone_sign.xml b/app/src/main/res/layout/quest_maxspeed_zone_sign.xml new file mode 100644 index 0000000000..421bebbb3d --- /dev/null +++ b/app/src/main/res/layout/quest_maxspeed_zone_sign.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 334e0ea50b..f69a8c56ec 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -15,4 +15,20 @@ #ccc + #495aad + + #c63a2b + #333 + + #C1121C + #2255BB + #008351 + #ffd520 + + #fff + #000 + + #8e9291 + #4f5250 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 70bd12acf9..223ddb3f76 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -204,9 +204,11 @@ However, before uploading your changes, the app checks with a <a href=\"https "Only on western side" "Only on eastern side" "Yes" - "What is the speed limit sign for this street?" + "What is the speed limit for this street?" "This speed limit looks implausible." - "There is no sign" + "A sign" + "It's within a (slow) zone" + "No sign, defaults apply" "Are you sure no limit is posted?" "Did you check at the ends of the street? If there are no signs along the whole street which apply for the highlighted section, default speed limits apply." @@ -514,7 +516,7 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards Is this building completed? Never shown in %s Does this rest area have restroom facilities? - What is the speed limit sign for %s? + What is the speed limit for %s here? Reset both quest enablement and order to the default? "What was this building constructed as?" @@ -607,6 +609,7 @@ 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? + What defines the speed limit? "Download" Is this playground publicly accessible? diff --git a/res/country_metadata/isSlowZoneKnown.yml b/res/country_metadata/isSlowZoneKnown.yml index addd46835b..d6438b0a0a 100644 --- a/res/country_metadata/isSlowZoneKnown.yml +++ b/res/country_metadata/isSlowZoneKnown.yml @@ -44,11 +44,10 @@ SI: true SM: true SK: true UA: true -# only in NYC so far -US-NY: true # according to research, there are only "school zones". This is a different concept -# if this is ever enabled, the quest_maxspeed_ca.xml layout needs to be extended CA: false +US: false # according to wikipedia MX: true PE: true +NZ: true diff --git a/res/living_street.svg b/res/living_street.svg index d2f52745be..ef072109aa 100644 --- a/res/living_street.svg +++ b/res/living_street.svg @@ -14,8 +14,8 @@ viewBox="0 0 38.629166 26.458334" version="1.1" id="svg4540" - inkscape:version="0.92.0 r15299" - sodipodi:docname="living_street2.svg"> + inkscape:version="0.92.1 r15371" + sodipodi:docname="living_street.svg"> @@ -50,7 +50,7 @@ image/svg+xml - + @@ -70,7 +70,7 @@ height="100" width="146" id="rect6068" - style="opacity:1;vector-effect:none;fill:#495aad;fill-opacity:1;stroke:none;stroke-width:3.4000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" + style="opacity:1;vector-effect:none;fill:#2255bb;fill-opacity:1;stroke:none;stroke-width:3.4000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" rx="8.0807343" /> - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/living_street_russian.svg b/res/living_street_russian.svg index d0671565f0..0644a553a9 100644 --- a/res/living_street_russian.svg +++ b/res/living_street_russian.svg @@ -14,7 +14,7 @@ viewBox="0 0 26.458333 38.629168" version="1.1" id="svg4540" - inkscape:version="0.92.0 r15299" + inkscape:version="0.92.1 r15371" sodipodi:docname="living_street_russian.svg"> @@ -25,16 +25,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="2.5455844" - inkscape:cx="35.203837" - inkscape:cy="60.323762" + inkscape:zoom="1.2727922" + inkscape:cx="-181.91452" + inkscape:cy="47.699913" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" units="px" inkscape:window-width="1920" - inkscape:window-height="1018" - inkscape:window-x="1358" + inkscape:window-height="1017" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"> image/svg+xml - + @@ -69,7 +69,7 @@ height="26.458332" width="38.629166" id="rect6068" - style="opacity:1;vector-effect:none;fill:#495aad;fill-opacity:1;stroke:none;stroke-width:0.89958334;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" + style="opacity:1;vector-effect:none;fill:#2255bb;fill-opacity:1;stroke:none;stroke-width:0.89958334;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers" rx="2.1380277" /> @@ -25,16 +25,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="1.8" - inkscape:cx="106.7991" - inkscape:cy="149.18885" + inkscape:zoom="3.6" + inkscape:cx="39.787534" + inkscape:cy="30.897634" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="true" units="px" inkscape:window-width="1920" - inkscape:window-height="1018" - inkscape:window-x="1358" + inkscape:window-height="1017" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"> image/svg+xml - + @@ -61,7 +61,7 @@ transform="translate(0,-261.54582)"> + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/res/roadtype_lit.svg b/res/roadtype_lit.svg new file mode 100644 index 0000000000..b4175be61c --- /dev/null +++ b/res/roadtype_lit.svg @@ -0,0 +1,81 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/res/roadtype_lit_no.svg b/res/roadtype_lit_no.svg new file mode 100644 index 0000000000..2d256c67ed --- /dev/null +++ b/res/roadtype_lit_no.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/res/roadtype_urban.svg b/res/roadtype_urban.svg new file mode 100644 index 0000000000..aaab5bce50 --- /dev/null +++ b/res/roadtype_urban.svg @@ -0,0 +1,71 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/res/slow_zone.svg b/res/slow_zone.svg deleted file mode 100644 index b27bff5b35..0000000000 --- a/res/slow_zone.svg +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - -