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 LatLon latLon;
|
||||||
private PointDescription pointDescription;
|
private PointDescription pointDescription;
|
||||||
private Object object;
|
private Object object;
|
||||||
|
private int order;
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private MenuController controller;
|
private MenuController controller;
|
||||||
|
@ -107,8 +108,6 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
||||||
this.selectedObjects.clear();
|
this.selectedObjects.clear();
|
||||||
this.selectedObjects.putAll(selectedObjects);
|
this.selectedObjects.putAll(selectedObjects);
|
||||||
objects.clear();
|
objects.clear();
|
||||||
int order = Integer.MAX_VALUE;
|
|
||||||
MenuObject topObject = null;
|
|
||||||
for (Map.Entry<Object, IContextMenuProvider> e : selectedObjects.entrySet()) {
|
for (Map.Entry<Object, IContextMenuProvider> e : selectedObjects.entrySet()) {
|
||||||
Object selectedObj = e.getKey();
|
Object selectedObj = e.getKey();
|
||||||
IContextMenuProvider contextObject = selectedObjects.get(selectedObj);
|
IContextMenuProvider contextObject = selectedObjects.get(selectedObj);
|
||||||
|
@ -130,25 +129,20 @@ public class MapMultiSelectionMenu extends BaseMenuController {
|
||||||
objects.add(menuObject);
|
objects.add(menuObject);
|
||||||
|
|
||||||
if (contextObject instanceof ContextMenuLayer.IContextMenuProviderSelection) {
|
if (contextObject instanceof ContextMenuLayer.IContextMenuProviderSelection) {
|
||||||
int i = ((ContextMenuLayer.IContextMenuProviderSelection) contextObject).getOrder(selectedObj);
|
menuObject.order = ((ContextMenuLayer.IContextMenuProviderSelection) contextObject).getOrder(selectedObj);
|
||||||
if (i < order) {
|
|
||||||
topObject = menuObject;
|
|
||||||
order = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.sort(objects, new Comparator<MenuObject>() {
|
Collections.sort(objects, new Comparator<MenuObject>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(MenuObject obj1, MenuObject obj2) {
|
public int compare(MenuObject obj1, MenuObject obj2) {
|
||||||
|
if (obj1.order == obj2.order) {
|
||||||
return obj1.getTitleStr().compareToIgnoreCase(obj2.getTitleStr());
|
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() {
|
private void clearMenu() {
|
||||||
|
|
Loading…
Reference in a new issue