From 674423b0581c31e059c9ed293b7d41718fc26ab5 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 8 Oct 2020 20:36:19 +0300 Subject: [PATCH] Fix sorting menu items --- .../src/net/osmand/plus/ContextMenuAdapter.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index 26e173d568..102234a3cf 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -137,14 +137,18 @@ 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())) { + 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())) { + } else if (DRAWER_SWITCH_PROFILE_ID.equals(item1.getId()) + && DRAWER_CONFIGURE_PROFILE_ID.equals(item2.getId())) { return -1; + } else if (DRAWER_SWITCH_PROFILE_ID.equals(item1.getId()) + || DRAWER_CONFIGURE_PROFILE_ID.equals(item1.getId())) { + return -1; + } else if (DRAWER_SWITCH_PROFILE_ID.equals(item2.getId()) + || DRAWER_CONFIGURE_PROFILE_ID.equals(item2.getId())) { + return 1; } int order1 = item1.getOrder(); int order2 = item2.getOrder();