Fix context menu
This commit is contained in:
parent
f14a84dc19
commit
09e4e6bba8
2 changed files with 34 additions and 16 deletions
|
@ -94,6 +94,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
private int menuTopShadowAllHeight;
|
private int menuTopShadowAllHeight;
|
||||||
private int menuTitleHeight;
|
private int menuTitleHeight;
|
||||||
private int menuBottomViewHeight;
|
private int menuBottomViewHeight;
|
||||||
|
private int menuButtonsHeight;
|
||||||
private int menuFullHeight;
|
private int menuFullHeight;
|
||||||
private int menuFullHeightMax;
|
private int menuFullHeightMax;
|
||||||
private int menuTopViewHeightExcludingTitle;
|
private int menuTopViewHeightExcludingTitle;
|
||||||
|
@ -606,8 +607,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
private float getToolbarAlpha(int y) {
|
private float getToolbarAlpha(int y) {
|
||||||
float a = 0;
|
float a = 0;
|
||||||
if (menu != null && !menu.isLandscapeLayout()) {
|
if (menu != null && !menu.isLandscapeLayout()) {
|
||||||
if (y < minHalfY) {
|
if (y < bottomToolbarPosY) {
|
||||||
a = 1f - (y - bottomToolbarPosY) * (1f / (minHalfY - bottomToolbarPosY));
|
a = 1f - (y - topScreenPosY) * (1f / (bottomToolbarPosY - topScreenPosY));
|
||||||
}
|
}
|
||||||
if (a < 0) {
|
if (a < 0) {
|
||||||
a = 0;
|
a = 0;
|
||||||
|
@ -714,7 +715,8 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
|
|
||||||
int oldMenuState = menu.getCurrentMenuState();
|
int oldMenuState = menu.getCurrentMenuState();
|
||||||
if (!menu.isLandscapeLayout()) {
|
if (!menu.isLandscapeLayout()) {
|
||||||
if (slidingDown && !skipScreenState && oldMenuState == MenuState.FULL_SCREEN && currentY < topScreenPosY) {
|
if (slidingDown && !skipScreenState && oldMenuState == MenuState.FULL_SCREEN
|
||||||
|
&& currentY < (-menuTitleHeight + menuButtonsHeight)) {
|
||||||
slidingDown = false;
|
slidingDown = false;
|
||||||
}
|
}
|
||||||
if (menuBottomViewHeight > 0 && slidingUp) {
|
if (menuBottomViewHeight > 0 && slidingUp) {
|
||||||
|
@ -1198,6 +1200,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
menuTopShadowAllHeight = newMenuTopShadowAllHeight;
|
menuTopShadowAllHeight = newMenuTopShadowAllHeight;
|
||||||
menuTitleHeight = menuTopShadowAllHeight + dy;
|
menuTitleHeight = menuTopShadowAllHeight + dy;
|
||||||
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
menuBottomViewHeight = view.findViewById(R.id.context_menu_bottom_view).getHeight();
|
||||||
|
menuButtonsHeight = view.findViewById(R.id.context_menu_bottom_buttons).getHeight() + view.findViewById(R.id.buttons_bottom_border).getHeight() + view.findViewById(R.id.context_menu_buttons).getHeight();
|
||||||
|
|
||||||
menuFullHeightMax = menuTitleHeight + menuBottomViewHeight;
|
menuFullHeightMax = menuTitleHeight + menuBottomViewHeight;
|
||||||
|
|
||||||
|
@ -1416,7 +1419,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
case MenuState.FULL_SCREEN:
|
case MenuState.FULL_SCREEN:
|
||||||
if (currentY != CURRENT_Y_UNDEFINED) {
|
if (currentY != CURRENT_Y_UNDEFINED) {
|
||||||
int maxPosY = viewHeight - menuFullHeightMax;
|
int maxPosY = viewHeight - menuFullHeightMax;
|
||||||
int minPosY = topScreenPosY;
|
int minPosY;
|
||||||
|
if (menu.isLandscapeLayout()) {
|
||||||
|
minPosY = topScreenPosY;
|
||||||
|
} else {
|
||||||
|
minPosY = -menuTitleHeight + menuButtonsHeight + bottomToolbarPosY;
|
||||||
|
}
|
||||||
if (maxPosY > minPosY) {
|
if (maxPosY > minPosY) {
|
||||||
maxPosY = minPosY;
|
maxPosY = minPosY;
|
||||||
}
|
}
|
||||||
|
@ -1428,7 +1436,11 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
posY = currentY;
|
posY = currentY;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
posY = topScreenPosY;
|
if (menu.isLandscapeLayout()) {
|
||||||
|
posY = topScreenPosY;
|
||||||
|
} else {
|
||||||
|
posY = -menuTitleHeight + menuButtonsHeight + bottomToolbarPosY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -806,12 +806,12 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
|
||||||
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
|
||||||
boolean contextMenuOpened = mapActivity.getContextMenu().shouldShowTopControls();
|
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||||
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || !contextMenuOpened);
|
updateMyLocation(rh, routeDialogOpened || trackDialogOpened || contextMenuOpened);
|
||||||
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
|
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
|
||||||
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && contextMenuOpened;
|
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened;
|
||||||
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
|
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
|
||||||
if (rh.isFollowingMode()) {
|
if (rh.isFollowingMode()) {
|
||||||
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
|
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
|
||||||
|
@ -826,18 +826,20 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
routePlanningBtn.updateVisibility(showButtons);
|
routePlanningBtn.updateVisibility(showButtons);
|
||||||
menuControl.updateVisibility(showButtons);
|
menuControl.updateVisibility(showButtons);
|
||||||
|
|
||||||
mapZoomIn.updateVisibility(!routeDialogOpened && contextMenuOpened);
|
mapZoomIn.updateVisibility(!routeDialogOpened && !contextMenuOpened);
|
||||||
mapZoomOut.updateVisibility(!routeDialogOpened && contextMenuOpened);
|
mapZoomOut.updateVisibility(!routeDialogOpened && !contextMenuOpened);
|
||||||
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
|
boolean forceHideCompass = routeDialogOpened || trackDialogOpened
|
||||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && contextMenuOpened);
|
|| isInMeasurementToolMode() || isInPlanRouteMode() || contextMenuOpened;
|
||||||
|
compassHud.forceHideCompass = forceHideCompass;
|
||||||
|
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
|
||||||
|
|
||||||
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
|
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
|
||||||
layersHud.update(app, isNight);
|
layersHud.update(app, isNight);
|
||||||
}
|
}
|
||||||
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
|
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
|
||||||
&& contextMenuOpened);
|
&& !contextMenuOpened);
|
||||||
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
|
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode()
|
||||||
&& contextMenuOpened);
|
&& !contextMenuOpened);
|
||||||
|
|
||||||
if (!routePlanningMode && !routeFollowingMode) {
|
if (!routePlanningMode && !routeFollowingMode) {
|
||||||
if (mapView.isZooming()) {
|
if (mapView.isZooming()) {
|
||||||
|
@ -854,7 +856,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
mapRouteInfoMenu.setVisible(showRouteCalculationControls);
|
mapRouteInfoMenu.setVisible(showRouteCalculationControls);
|
||||||
updateCompass(isNight);
|
if (!forceHideCompass) {
|
||||||
|
updateCompass(isNight);
|
||||||
|
}
|
||||||
|
|
||||||
for (MapHudButton mc : controls) {
|
for (MapHudButton mc : controls) {
|
||||||
mc.update(mapActivity.getMyApplication(), isNight);
|
mc.update(mapActivity.getMyApplication(), isNight);
|
||||||
|
@ -1027,6 +1031,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
boolean f = true;
|
boolean f = true;
|
||||||
boolean compass;
|
boolean compass;
|
||||||
boolean compassOutside;
|
boolean compassOutside;
|
||||||
|
boolean forceHideCompass;
|
||||||
ViewPropertyAnimatorCompat hideAnimator;
|
ViewPropertyAnimatorCompat hideAnimator;
|
||||||
|
|
||||||
public MapHudButton setRoundTransparent() {
|
public MapHudButton setRoundTransparent() {
|
||||||
|
@ -1088,9 +1093,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
iv.setVisibility(View.VISIBLE);
|
iv.setVisibility(View.VISIBLE);
|
||||||
iv.invalidate();
|
iv.invalidate();
|
||||||
} else if (hideAnimator == null) {
|
} else if (hideAnimator == null) {
|
||||||
if (compass) {
|
if (compass && !forceHideCompass) {
|
||||||
hideDelayed(5000);
|
hideDelayed(5000);
|
||||||
} else {
|
} else {
|
||||||
|
forceHideCompass = false;
|
||||||
iv.setVisibility(View.GONE);
|
iv.setVisibility(View.GONE);
|
||||||
iv.invalidate();
|
iv.invalidate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue