Add "gpx waypoint action" to the right position
This commit is contained in:
parent
f7e688023e
commit
daddcdbece
1 changed files with 13 additions and 0 deletions
|
@ -304,12 +304,14 @@ public class MapActivityActions implements DialogProvider {
|
|||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.context_menu_item_edit_waypoint, mapActivity)
|
||||
.setIcon(R.drawable.ic_action_edit_dark)
|
||||
.setPosition(getPositionForGpxAction(adapter))
|
||||
.setListener(listener).createItem());
|
||||
} else if (!getMyApplication().getSelectedGpxHelper().getSelectedGPXFiles().isEmpty()
|
||||
|| (OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class) != null)) {
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setTitleId(R.string.context_menu_item_add_waypoint, mapActivity)
|
||||
.setIcon(R.drawable.ic_action_gnew_label_dark)
|
||||
.setPosition(getPositionForGpxAction(adapter))
|
||||
.setListener(listener).createItem());
|
||||
}
|
||||
|
||||
|
@ -346,6 +348,17 @@ public class MapActivityActions implements DialogProvider {
|
|||
actionsBottomSheetDialogFragment.show(mapActivity.getSupportFragmentManager(), AdditionalActionsBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
|
||||
private int getPositionForGpxAction(ContextMenuAdapter adapter) {
|
||||
for (int i = 0; i < adapter.length(); i++) {
|
||||
int titleId = adapter.getItem(i).getTitleId();
|
||||
if (titleId == R.string.context_menu_item_add_parking_point
|
||||
|| titleId == R.string.context_menu_item_update_map) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return adapter.length();
|
||||
}
|
||||
|
||||
public void setGPXRouteParams(GPXFile result) {
|
||||
if (result == null) {
|
||||
mapActivity.getRoutingHelper().setGpxParams(null);
|
||||
|
|
Loading…
Reference in a new issue