Improve menu state

This commit is contained in:
Victor Shcherb 2020-02-12 21:48:06 +01:00
parent b7063062f8
commit 0dc7743251

View file

@ -57,7 +57,8 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
}
public static final int ANIMATION_DURATION = 200;
public static final float MIDDLE_STATE_KOEF = .75f;
public static final float MIDDLE_STATE_KOEF = .7f;
public static final int MIDDLE_STATE_MIN_HEIGHT_DP = 520;
public static final String MENU_STATE_KEY = "menu_state_key";
private InterceptorLinearLayout mainView;
@ -294,7 +295,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
}
processScreenHeight(container);
minHalfY = viewHeight - (int) (viewHeight * MIDDLE_STATE_KOEF);
minHalfY = getMinHalfY(mapActivity);
final GestureDetector swipeDetector = new GestureDetector(app, new HorizontalSwipeConfirm(true));
@ -597,10 +598,15 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment {
if (mapActivity != null) {
screenHeight = container.getHeight() + statusBarHeight;
viewHeight = screenHeight - statusBarHeight;
minHalfY = viewHeight - (int) (viewHeight * MIDDLE_STATE_KOEF);
minHalfY = getMinHalfY(mapActivity);
}
}
private int getMinHalfY(MapActivity mapActivity) {
return viewHeight - (int) Math.min(viewHeight * MIDDLE_STATE_KOEF,
MIDDLE_STATE_MIN_HEIGHT_DP * mapActivity.getMapView().getDensity() );
}
public boolean isMoving() {
return moving;
}