From 6d784b8129a33bfcec0eb5e6050646571caa3033 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Fri, 11 Dec 2020 21:59:41 +0200 Subject: [PATCH] Hide Dashboard by default in drawer --- .../plus/settings/backend/ContextMenuItemsSettings.java | 8 ++++++++ .../net/osmand/plus/settings/backend/OsmandSettings.java | 2 +- .../settings/fragments/ConfigureMenuItemsFragment.java | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ContextMenuItemsSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/ContextMenuItemsSettings.java index 2c51f2607d..54e64ba045 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ContextMenuItemsSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ContextMenuItemsSettings.java @@ -15,6 +15,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID; + public class ContextMenuItemsSettings implements Serializable { private static final Log LOG = PlatformUtil.getLog(ContextMenuItemsSettings.class.getName()); @@ -99,4 +101,10 @@ public class ContextMenuItemsSettings implements Serializable { public List getOrderIds() { return Collections.unmodifiableList(orderIds); } + + public static ContextMenuItemsSettings getDefaultInstanceForDrawer() { + ArrayList hiddenByDefault = new ArrayList<>(); + hiddenByDefault.add(DRAWER_DASHBOARD_ID); + return new ContextMenuItemsSettings(hiddenByDefault, new ArrayList()); + } } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 90c63d3334..c6ac142060 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -2518,7 +2518,7 @@ public class OsmandSettings { new ListStringPreference(this, "inactive_poi_filters", null, ",,").makeProfile().cache(); public final ContextMenuItemsPreference DRAWER_ITEMS = - (ContextMenuItemsPreference) new ContextMenuItemsPreference(this, "drawer_items", DRAWER_ITEM_ID_SCHEME, new ContextMenuItemsSettings()) + (ContextMenuItemsPreference) new ContextMenuItemsPreference(this, "drawer_items", DRAWER_ITEM_ID_SCHEME, ContextMenuItemsSettings.getDefaultInstanceForDrawer()) .makeProfile().cache(); public final ContextMenuItemsPreference CONFIGURE_MAP_ITEMS = diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java index ee8e11b970..3ba64d544a 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java @@ -506,6 +506,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment mainActionItems.clear(); } instantiateContextMenuAdapter(); + initSavedIds(appMode); initMainActionsIds(appMode); rearrangeAdapter.updateItems(getAdapterItems()); }