Fix wrong place of configure profile

This commit is contained in:
Dima-1 2020-10-08 12:50:33 +03:00
parent 57e971a1bb
commit e083c3958d
2 changed files with 17 additions and 1 deletions

View file

@ -53,6 +53,9 @@ import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Set; 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 { public class ContextMenuAdapter {
private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class); private static final Log LOG = PlatformUtil.getLog(ContextMenuAdapter.class);
@ -134,6 +137,15 @@ 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())) {
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 order1 = item1.getOrder();
int order2 = item2.getOrder(); int order2 = item2.getOrder();
if (order1 < order2) { if (order1 < order2) {

View file

@ -51,6 +51,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import static net.osmand.aidlapi.OsmAndCustomizationConstants.APP_PROFILES_ID; 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.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.BUTTON;
import static net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.AdapterItemType.DESCRIPTION; import static net.osmand.plus.settings.fragments.RearrangeMenuItemsAdapter.AdapterItemType.DESCRIPTION;
@ -183,7 +185,9 @@ public class ConfigureMenuItemsFragment extends BaseOsmAndFragment
public static List<ContextMenuItem> getCustomizableDefaultItems(List<ContextMenuItem> defItems) { public static List<ContextMenuItem> getCustomizableDefaultItems(List<ContextMenuItem> defItems) {
List<ContextMenuItem> items = new ArrayList<>(); List<ContextMenuItem> items = new ArrayList<>();
for (ContextMenuItem item : defItems) { 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); items.add(item);
} }
} }