private void changeMenuState( int currentY, boolean skipHalfScreenState, boolean slidingUp, boolean slidingDown) { boolean needCloseMenu = false; int oldMenuState = menu.getCurrentMenuState(); if (menuBottomViewHeight > 0 && slidingUp) { menu.slideUp(); if (skipHalfScreenState) { menu.slideUp(); } } else if (slidingDown) { needCloseMenu = !menu.slideDown(); if (!needCloseMenu && skipHalfScreenState) { menu.slideDown(); } } int newMenuState = menu.getCurrentMenuState(); boolean needMapAdjust = false; // oldMenuState != newMenuState && newMenuState != MenuState.FULL_SCREEN; if (newMenuState != oldMenuState) { doBeforeMenuStateChange(oldMenuState, newMenuState); } applyPosY(currentY, needCloseMenu, needMapAdjust, oldMenuState, newMenuState); }
private int getPosY(boolean needCloseMenu) { if (needCloseMenu) { return screenHeight; } int destinationState; int minHalfY; if (menu.isExtended()) { destinationState = menu.getCurrentMenuState(); minHalfY = viewHeight - (int) (viewHeight * menu.getHalfScreenMaxHeightKoef()); } else { destinationState = MenuState.HEADER_ONLY; minHalfY = viewHeight; } int posY = 0; switch (destinationState) { case MenuState.HEADER_ONLY: posY = viewHeight - menuTitleHeight; break; case MenuState.HALF_SCREEN: posY = viewHeight - menuFullHeightMax; posY = Math.max(posY, minHalfY); break; case MenuState.FULL_SCREEN: posY = -menuTopShadowHeight - dpToPx(SHADOW_HEIGHT_TOP_DP); break; default: break; } return posY; }
public void openMenuHalfScreen() { int oldMenuState = menu.getCurrentMenuState(); if (oldMenuState == MenuState.HEADER_ONLY) { changeMenuState(getViewY(), false, true, false); } else if (oldMenuState == MenuState.FULL_SCREEN && !menu.isLandscapeLayout()) { changeMenuState(getViewY(), false, false, true); } }
private void updateCompassVisibility() { View compassView = view.findViewById(R.id.compass_layout); boolean gpsFixed = getMyApplication().getLocationProvider().getGPSInfo().fixed; if (gpsFixed && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) { updateDistanceDirection(); compassView.setVisibility(View.VISIBLE); } else { if (!menu.displayDistanceDirection()) { compassView.setVisibility(View.GONE); } else { compassView.setVisibility(View.INVISIBLE); } } }
private void updateCompassVisibility() { View compassView = view.findViewById(R.id.compass_layout); Location ll = getMyApplication().getLocationProvider().getLastKnownLocation(); boolean gpsFixed = ll != null && System.currentTimeMillis() - ll.getTime() < 1000 * 60 * 60 * 20; if (gpsFixed && menu.displayDistanceDirection() && menu.getCurrentMenuState() != MenuState.FULL_SCREEN) { updateDistanceDirection(); compassView.setVisibility(View.VISIBLE); } else { if (!menu.displayDistanceDirection()) { compassView.setVisibility(View.GONE); } else { compassView.setVisibility(View.INVISIBLE); } } }