From e083c3958df2762f0f3601dd0d24298983533cd3 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 8 Oct 2020 12:50:33 +0300 Subject: [PATCH] Fix wrong place of configure profile --- OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java | 12 ++++++++++++ .../fragments/ConfigureMenuItemsFragment.java | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index 7263f119bd..26e173d568 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -53,6 +53,9 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; +import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_PROFILE_ID; +import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SWITCH_PROFILE_ID; + public class ContextMenuAdapter { private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class); @@ -134,6 +137,15 @@ public class ContextMenuAdapter { Collections.sort(items, new Comparator() { @Override public int compare(ContextMenuItem item1, ContextMenuItem item2) { + if (DRAWER_SWITCH_PROFILE_ID.equals(item1.getId())) { + return -1; + } + if (DRAWER_CONFIGURE_PROFILE_ID.equals(item1.getId()) && DRAWER_SWITCH_PROFILE_ID.equals(item2.getId())) { + return 1; + } + if (DRAWER_CONFIGURE_PROFILE_ID.equals(item1.getId())) { + return -1; + } int order1 = item1.getOrder(); int order2 = item2.getOrder(); if (order1 < order2) { diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java index 44fb4bf7f6..4d2309af82 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ConfigureMenuItemsFragment.java @@ -51,6 +51,8 @@ import java.util.HashMap; import java.util.List; import static net.osmand.aidlapi.OsmAndCustomizationConstants.APP_PROFILES_ID; +import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_PROFILE_ID; +import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SWITCH_PROFILE_ID; import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MORE_ID; import static net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.AdapterItemType.BUTTON; import static net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.AdapterItemType.DESCRIPTION; @@ -183,7 +185,9 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment public static List getCustomizableDefaultItems(List defItems) { List items = new ArrayList<>(); for (ContextMenuItem item : defItems) { - if (!APP_PROFILES_ID.equals(item.getId())) { + if (!APP_PROFILES_ID.equals(item.getId()) + && !DRAWER_CONFIGURE_PROFILE_ID.equals(item.getId()) + && !DRAWER_SWITCH_PROFILE_ID.equals(item.getId())) { items.add(item); } }