From 976aebe4596747c2617697a158f51141b7328081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Wed, 13 May 2020 19:30:28 +0300 Subject: [PATCH] [android] Added showing guides tutorial toast only once --- .../com/mapswithme/maps/maplayer/guides/GuidesState.java | 4 ++++ .../src/com/mapswithme/util/SharedPropertiesUtils.java | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/android/src/com/mapswithme/maps/maplayer/guides/GuidesState.java b/android/src/com/mapswithme/maps/maplayer/guides/GuidesState.java index 102ec60031..82f8b11761 100644 --- a/android/src/com/mapswithme/maps/maplayer/guides/GuidesState.java +++ b/android/src/com/mapswithme/maps/maplayer/guides/GuidesState.java @@ -5,6 +5,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import com.mapswithme.maps.R; +import com.mapswithme.util.SharedPropertiesUtils; import com.mapswithme.util.UiUtils; public enum GuidesState @@ -16,6 +17,9 @@ public enum GuidesState @Override public void activate(@NonNull Context context) { + if (!SharedPropertiesUtils.shouldShowHowToUseGuidesLayerToast(context)) + return; + UiUtils.showToastAtTop(context, R.string.routes_layer_is_on_toast); } }, diff --git a/android/src/com/mapswithme/util/SharedPropertiesUtils.java b/android/src/com/mapswithme/util/SharedPropertiesUtils.java index 9a1023e9cc..d34ead367e 100644 --- a/android/src/com/mapswithme/util/SharedPropertiesUtils.java +++ b/android/src/com/mapswithme/util/SharedPropertiesUtils.java @@ -26,6 +26,8 @@ public final class SharedPropertiesUtils private static final String PREFS_BOOKMARK_CATEGORIES_LAST_VISIBLE_PAGE = "BookmarkCategoriesLastVisiblePage"; private static final String PREFS_SHOULD_SHOW_LAYER_MARKER_FOR = "ShouldShowGuidesLayerMarkerFor"; private static final String PREFS_SHOULD_SHOW_LAYER_TUTORIAL_TOAST = "ShouldShowLayerTutorialToast"; + private static final String PREFS_SHOULD_SHOW_HOW_TO_USE_GUIDES_LAYER_TOAST + = "ShouldShowHowToUseGuidesLayerToast"; private static final SharedPreferences PREFS = PreferenceManager.getDefaultSharedPreferences(MwmApplication.get()); @@ -154,6 +156,13 @@ public final class SharedPropertiesUtils return result; } + public static boolean shouldShowHowToUseGuidesLayerToast(@NonNull Context context) + { + boolean result = getBoolean(context, PREFS_SHOULD_SHOW_HOW_TO_USE_GUIDES_LAYER_TOAST, true); + putBoolean(context, PREFS_SHOULD_SHOW_HOW_TO_USE_GUIDES_LAYER_TOAST, false); + return result; + } + public static void setLayerMarkerShownForLayerMode(@NonNull Context context, @NonNull Mode mode) { putBoolean(context, PREFS_SHOULD_SHOW_LAYER_MARKER_FOR + mode.name()