forked from organicmaps/organicmaps
[android] Added tutorial and layer is on toasts and adding the updating of layers recycler view when menu opened
This commit is contained in:
parent
4dc4bbed20
commit
0c8f430ca3
5 changed files with 31 additions and 13 deletions
|
@ -138,6 +138,7 @@ import com.mapswithme.util.Counters;
|
|||
import com.mapswithme.util.InputUtils;
|
||||
import com.mapswithme.util.NetworkPolicy;
|
||||
import com.mapswithme.util.PermissionsUtils;
|
||||
import com.mapswithme.util.SharedPropertiesUtils;
|
||||
import com.mapswithme.util.ThemeSwitcher;
|
||||
import com.mapswithme.util.ThemeUtils;
|
||||
import com.mapswithme.util.UTM;
|
||||
|
@ -2780,6 +2781,10 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
public void onMenuOpen()
|
||||
{
|
||||
mFadeView.fadeIn();
|
||||
if (!SharedPropertiesUtils.shouldShowLayerTutorialToast(getApplicationContext()))
|
||||
return;
|
||||
|
||||
UiUtils.showToastAtTop(getApplicationContext(), R.string.routes_layer_in_menu_toast);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,11 +5,19 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
|
||||
public enum GuidesState
|
||||
{
|
||||
DISABLED,
|
||||
ENABLED,
|
||||
ENABLED
|
||||
{
|
||||
@Override
|
||||
public void activate(@NonNull Context context)
|
||||
{
|
||||
UiUtils.showToastAtTop(context, R.string.routes_layer_is_on_toast);
|
||||
}
|
||||
},
|
||||
NO_DATA
|
||||
{
|
||||
@Override
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package com.mapswithme.maps.widget.menu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -47,6 +43,7 @@ public class MainMenuRenderer implements MenuRenderer
|
|||
@Override
|
||||
public void render()
|
||||
{
|
||||
mLayersAdapter.notifyDataSetChanged();
|
||||
renderDownloadMapsCounter();
|
||||
}
|
||||
|
||||
|
@ -115,14 +112,6 @@ public class MainMenuRenderer implements MenuRenderer
|
|||
mScrollView.scrollTo(0, 0);
|
||||
}
|
||||
|
||||
// TODO: use this method to show layer toast.
|
||||
private static void showToast(@NonNull Context context, @StringRes int stringId)
|
||||
{
|
||||
Toast toast = Toast.makeText(context, stringId, Toast.LENGTH_LONG);
|
||||
toast.setGravity(Gravity.TOP, 0, 0);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
private class SubwayItemClickListener extends DefaultClickListener
|
||||
{
|
||||
SubwayItemClickListener()
|
||||
|
|
|
@ -25,6 +25,7 @@ public final class SharedPropertiesUtils
|
|||
private static final String PREFS_CATALOG_CATEGORIES_HEADER_CLOSED = "CatalogCategoriesHeaderClosed";
|
||||
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 SharedPreferences PREFS
|
||||
= PreferenceManager.getDefaultSharedPreferences(MwmApplication.get());
|
||||
|
||||
|
@ -146,6 +147,13 @@ public final class SharedPropertiesUtils
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean shouldShowLayerTutorialToast(@NonNull Context context)
|
||||
{
|
||||
boolean result = getBoolean(context, PREFS_SHOULD_SHOW_LAYER_TUTORIAL_TOAST, true);
|
||||
putBoolean(context, PREFS_SHOULD_SHOW_LAYER_TUTORIAL_TOAST, false);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void setLayerMarkerShownForLayerMode(@NonNull Context context, @NonNull Mode mode)
|
||||
{
|
||||
putBoolean(context, PREFS_SHOULD_SHOW_LAYER_MARKER_FOR + mode.name()
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.view.animation.Animation.AnimationListener;
|
|||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.AnyRes;
|
||||
import androidx.annotation.AttrRes;
|
||||
|
@ -552,6 +553,13 @@ public final class UiUtils
|
|||
return context.getResources().getColor(R.color.notification);
|
||||
}
|
||||
|
||||
public static void showToastAtTop(@NonNull Context context, @StringRes int stringId)
|
||||
{
|
||||
Toast toast = Toast.makeText(context, stringId, Toast.LENGTH_LONG);
|
||||
toast.setGravity(Gravity.TOP, 0, 0);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
// utility class
|
||||
private UiUtils() {}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue