Fix sorting menu items

This commit is contained in:
Dima-1 2020-10-08 20:36:19 +03:00
parent 800ffe1819
commit 674423b058

View file

@ -137,14 +137,18 @@ public class ContextMenuAdapter {
Collections.sort(items, new Comparator<ContextMenuItem>() { Collections.sort(items, new Comparator<ContextMenuItem>() {
@Override @Override
public int compare(ContextMenuItem item1, ContextMenuItem item2) { public int compare(ContextMenuItem item1, ContextMenuItem item2) {
if (DRAWER_SWITCH_PROFILE_ID.equals(item1.getId())) { if (DRAWER_CONFIGURE_PROFILE_ID.equals(item1.getId())
return -1; && DRAWER_SWITCH_PROFILE_ID.equals(item2.getId())) {
}
if (DRAWER_CONFIGURE_PROFILE_ID.equals(item1.getId()) && DRAWER_SWITCH_PROFILE_ID.equals(item2.getId())) {
return 1; return 1;
} } else if (DRAWER_SWITCH_PROFILE_ID.equals(item1.getId())
if (DRAWER_CONFIGURE_PROFILE_ID.equals(item1.getId())) { && DRAWER_CONFIGURE_PROFILE_ID.equals(item2.getId())) {
return -1; 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 order1 = item1.getOrder();
int order2 = item2.getOrder(); int order2 = item2.getOrder();