Merge pull request #10697 from osmandapp/gpx_menu_fixes

GPX menu improvements
This commit is contained in:
vshcherb 2021-01-28 16:15:45 +01:00 committed by GitHub
commit 5b9d34f90d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 5 deletions

View file

@ -42,6 +42,7 @@ public class SelectedGpxMenuController extends MenuController {
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
mapContextMenu.hide(false);
TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile());
}
};

View file

@ -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 {
dismiss();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null && mapActivity.getSupportFragmentManager().getBackStackEntryCount() == 1) {
if (mapActivity != null) {
MapContextMenu contextMenu = mapActivity.getContextMenu();
if (contextMenu.isActive() && contextMenu.getPointDescription() != null
&& contextMenu.getPointDescription().isGpxPoint()) {
contextMenu.show();
} else {
mapActivity.launchPrevActivityIntent();
}
dismiss();
}
}
}
});
@ -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;
}