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() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
|
mapContextMenu.hide(false);
|
||||||
TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile());
|
TrackMenuFragment.showInstance(mapActivity, selectedGpxPoint.getSelectedGpxFile());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -186,13 +186,17 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getToolbarHeight() {
|
public int getToolbarHeight() {
|
||||||
return toolbarHeightPx;
|
return isPortrait() ? toolbarHeightPx : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getMiddleStateKoef() {
|
public float getMiddleStateKoef() {
|
||||||
return 0.5f;
|
return 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMinY() {
|
||||||
|
return getFullScreenTopPosY();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSupportedMenuStatesPortrait() {
|
public int getSupportedMenuStatesPortrait() {
|
||||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
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()) {
|
if (getCurrentMenuState() != MenuState.HEADER_ONLY && isPortrait()) {
|
||||||
openMenuHeaderOnly();
|
openMenuHeaderOnly();
|
||||||
} else {
|
} else {
|
||||||
MapActivity mapActivity = getMapActivity();
|
|
||||||
if (mapActivity != null && mapActivity.getSupportFragmentManager().getBackStackEntryCount() == 1) {
|
|
||||||
mapActivity.launchPrevActivityIntent();
|
|
||||||
}
|
|
||||||
dismiss();
|
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();
|
setupToolbar();
|
||||||
updateHeader();
|
updateHeader();
|
||||||
setupButtons(view);
|
setupButtons(view);
|
||||||
|
updateCardsLayout();
|
||||||
calculateLayoutAndUpdateMenuState();
|
calculateLayoutAndUpdateMenuState();
|
||||||
}
|
}
|
||||||
return view;
|
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
|
@Override
|
||||||
protected void calculateLayout(View view, boolean initLayout) {
|
protected void calculateLayout(View view, boolean initLayout) {
|
||||||
menuTitleHeight = routeMenuTopShadowAll.getHeight()
|
menuTitleHeight = routeMenuTopShadowAll.getHeight()
|
||||||
|
@ -841,6 +864,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
menuType = type;
|
menuType = type;
|
||||||
setupCards();
|
setupCards();
|
||||||
updateHeader();
|
updateHeader();
|
||||||
|
updateCardsLayout();
|
||||||
calculateLayoutAndUpdateMenuState();
|
calculateLayoutAndUpdateMenuState();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue