From 2850322a94818e4e5e90ac0f988141b1f078071b Mon Sep 17 00:00:00 2001 From: veliymolfar Date: Mon, 18 May 2020 15:37:45 +0300 Subject: [PATCH] not count divider item --- .../plus/settings/ConfigureMenuRootFragment.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java index 8dda7cf446..f8c84a2e75 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ConfigureMenuRootFragment.java @@ -29,8 +29,8 @@ import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.plus.ApplicationMode; import net.osmand.plus.ContextMenuAdapter; +import net.osmand.plus.ContextMenuItem; import net.osmand.plus.OsmandApplication; -import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; @@ -47,8 +47,11 @@ import org.apache.commons.logging.Log; import java.util.ArrayList; import java.util.Arrays; +import java.util.Iterator; import java.util.List; +import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DIVIDER_ID; + public class ConfigureMenuRootFragment extends BaseOsmAndFragment { public static final String TAG = ConfigureMenuRootFragment.class.getName(); @@ -287,7 +290,16 @@ public class ConfigureMenuRootFragment extends BaseOsmAndFragment { break; } int hiddenCount = ConfigureMenuItemsFragment.getSettingForScreen(app, type).getModeValue(appMode).getHiddenIds().size(); - int allCount = ConfigureMenuItemsFragment.getCustomizableDefaultItems(contextMenuAdapter.getDefaultItems()).size(); + List allItems = ConfigureMenuItemsFragment.getCustomizableDefaultItems(contextMenuAdapter.getDefaultItems()); + if (type == ScreenType.DRAWER) { + Iterator iterator = allItems.iterator(); + while (iterator.hasNext()) { + if (DRAWER_DIVIDER_ID.equals(iterator.next().getId())) { + iterator.remove(); + } + } + } + int allCount = allItems.size(); String amount = getString(R.string.n_items_of_z, String.valueOf(allCount - hiddenCount), String.valueOf(allCount)); return getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.shared_string_items), amount); }