Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
99a84a84d5
1 changed files with 7 additions and 13 deletions
|
@ -30,6 +30,7 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
|||
private LatLon latLon;
|
||||
private PointDescription pointDescription;
|
||||
private Object object;
|
||||
private int order;
|
||||
|
||||
private MapActivity mapActivity;
|
||||
private MenuController controller;
|
||||
|
@ -107,8 +108,6 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
|||
this.selectedObjects.clear();
|
||||
this.selectedObjects.putAll(selectedObjects);
|
||||
objects.clear();
|
||||
int order = Integer.MAX_VALUE;
|
||||
MenuObject topObject = null;
|
||||
for (Map.Entry<Object, IContextMenuProvider> e : selectedObjects.entrySet()) {
|
||||
Object selectedObj = e.getKey();
|
||||
IContextMenuProvider contextObject = selectedObjects.get(selectedObj);
|
||||
|
@ -130,25 +129,20 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
|||
objects.add(menuObject);
|
||||
|
||||
if (contextObject instanceof ContextMenuLayer.IContextMenuProviderSelection) {
|
||||
int i = ((ContextMenuLayer.IContextMenuProviderSelection) contextObject).getOrder(selectedObj);
|
||||
if (i < order) {
|
||||
topObject = menuObject;
|
||||
order = i;
|
||||
}
|
||||
menuObject.order = ((ContextMenuLayer.IContextMenuProviderSelection) contextObject).getOrder(selectedObj);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(objects, new Comparator<MenuObject>() {
|
||||
@Override
|
||||
public int compare(MenuObject obj1, MenuObject obj2) {
|
||||
return obj1.getTitleStr().compareToIgnoreCase(obj2.getTitleStr());
|
||||
if (obj1.order == obj2.order) {
|
||||
return obj1.getTitleStr().compareToIgnoreCase(obj2.getTitleStr());
|
||||
} else {
|
||||
return obj1.order - obj2.order;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (topObject != null) {
|
||||
objects.remove(topObject);
|
||||
objects.add(0, topObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearMenu() {
|
||||
|
|
Loading…
Reference in a new issue