Merge pull request #10697 from osmandapp/gpx_menu_fixes
GPX menu improvements
This commit is contained in:
commit
5b9d34f90d
2 changed files with 30 additions and 5 deletions
|
@ -42,6 +42,7 @@ public class SelectedGpxMenuController extends MenuController {
|
|||
leftTitleButtonController = new TitleButtonController() {
|
||||
@Override
|
||||
public void buttonPressed() {
|
||||
mapContextMenu.hide(false);
|
||||
TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -186,13 +186,17 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
|
||||
@Override
|
||||
public int getToolbarHeight() {
|
||||
return toolbarHeightPx;
|
||||
return isPortrait() ? toolbarHeightPx : 0;
|
||||
}
|
||||
|
||||
public float getMiddleStateKoef() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
public int getMinY() {
|
||||
return getFullScreenTopPosY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportedMenuStatesPortrait() {
|
||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||
|
@ -230,11 +234,18 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
if (getCurrentMenuState() != MenuState.HEADER_ONLY && isPortrait()) {
|
||||
openMenuHeaderOnly();
|
||||
} else {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null && mapActivity.getSupportFragmentManager().getBackStackEntryCount() == 1) {
|
||||
mapActivity.launchPrevActivityIntent();
|
||||
}
|
||||
dismiss();
|
||||
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
||||
if (contextMenu.isActive() && contextMenu.getPointDescription() != null
|
||||
&& contextMenu.getPointDescription().isGpxPoint()) {
|
||||
contextMenu.show();
|
||||
} else {
|
||||
mapActivity.launchPrevActivityIntent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -275,6 +286,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
setupToolbar();
|
||||
updateHeader();
|
||||
setupButtons(view);
|
||||
updateCardsLayout();
|
||||
calculateLayoutAndUpdateMenuState();
|
||||
}
|
||||
return view;
|
||||
|
@ -432,6 +444,17 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
}
|
||||
}
|
||||
|
||||
private void updateCardsLayout() {
|
||||
FrameLayout bottomContainer = getBottomContainer();
|
||||
if (menuType == TrackMenuType.OPTIONS) {
|
||||
AndroidUtils.setBackground(app, bottomContainer, isNightMode(),
|
||||
R.color.list_background_color_light, R.color.list_background_color_dark);
|
||||
} else {
|
||||
AndroidUtils.setBackground(app, bottomContainer, isNightMode(),
|
||||
R.color.activity_background_color_light, R.color.activity_background_color_dark);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void calculateLayout(View view, boolean initLayout) {
|
||||
menuTitleHeight = routeMenuTopShadowAll.getHeight()
|
||||
|
@ -841,6 +864,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
menuType = type;
|
||||
setupCards();
|
||||
updateHeader();
|
||||
updateCardsLayout();
|
||||
calculateLayoutAndUpdateMenuState();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue