Merge pull request #10388 from osmandapp/HideDashboardByDefault

Hide Dashboard by default in drawer
This commit is contained in:
Vitaliy 2020-12-13 22:03:24 +02:00 committed by GitHub
commit 8355308765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View file

@ -13,7 +13,7 @@ public class ContextMenuItemsPreference extends CommonPreference<ContextMenuItem
@Override
protected ContextMenuItemsSettings getValue(Object prefs, ContextMenuItemsSettings defaultValue) {
String s = getSettingsAPI().getString(prefs, getId(), "");
String s = getSettingsAPI().getString(prefs, getId(), defaultValue.writeToJsonString(idScheme));
return readValue(s);
}

View file

@ -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<String> getOrderIds() {
return Collections.unmodifiableList(orderIds);
}
public static ContextMenuItemsSettings getDefaultInstanceForDrawer() {
ArrayList<String> hiddenByDefault = new ArrayList<>();
hiddenByDefault.add(DRAWER_DASHBOARD_ID);
return new ContextMenuItemsSettings(hiddenByDefault, new ArrayList<String>());
}
}

View file

@ -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 =

View file

@ -506,6 +506,7 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
mainActionItems.clear();
}
instantiateContextMenuAdapter();
initSavedIds(appMode);
initMainActionsIds(appMode);
rearrangeAdapter.updateItems(getAdapterItems());
}