Fix RP shadow in landscape

This commit is contained in:
crimean 2019-02-23 18:58:10 +03:00
parent ebe8e49531
commit ea69ecf2b6

View file

@ -10,6 +10,7 @@ import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.Gravity; import android.view.Gravity;
@ -237,35 +238,30 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
updateToolbar(); updateToolbar();
} }
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (moving) { if (moving) {
moving = false; moving = false;
int currentY = getViewY(); int currentY = getViewY();
int fullScreenTopPosY = getFullScreenTopPosY();
final VelocityTracker velocityTracker = this.velocityTracker; final VelocityTracker velocityTracker = this.velocityTracker;
velocityTracker.computeCurrentVelocity(1000, maximumVelocity); velocityTracker.computeCurrentVelocity(1000, maximumVelocity);
int initialVelocity = (int) velocityTracker.getYVelocity(); int initialVelocity = (int) velocityTracker.getYVelocity();
if ((Math.abs(initialVelocity) > minimumVelocity) && currentY != fullScreenTopPosY) {
if ((Math.abs(initialVelocity) > minimumVelocity)) {
scroller.abortAnimation(); scroller.abortAnimation();
scroller.fling(0, currentY, 0, initialVelocity, 0, 0, scroller.fling(0, currentY, 0, initialVelocity, 0, 0,
Math.min(viewHeight - menuFullHeightMax, getFullScreenTopPosY()), Math.min(viewHeight - menuFullHeightMax, fullScreenTopPosY),
screenHeight, screenHeight,
0, 0); 0, 0);
currentY = scroller.getFinalY(); currentY = scroller.getFinalY();
scroller.abortAnimation(); scroller.abortAnimation();
slidingUp = initialVelocity < -2000; slidingUp = initialVelocity < -2000;
slidingDown = initialVelocity > 2000; slidingDown = initialVelocity > 2000;
} else { } else {
slidingUp = false; slidingUp = false;
slidingDown = false; slidingDown = false;
} }
changeMenuState(currentY, slidingUp, slidingDown); changeMenuState(currentY, slidingUp, slidingDown);
} }
recycleVelocityTracker(); recycleVelocityTracker();
@ -403,7 +399,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
return; return;
} }
int y = getViewY(); int y = getViewY();
if (y < 0 || !portrait) { if (y < getFullScreenTopPosY()) {
ViewGroup parent = (ViewGroup) modesLayout.getParent(); ViewGroup parent = (ViewGroup) modesLayout.getParent();
if (parent != null && parent != modesLayoutToolbarContainer) { if (parent != null && parent != modesLayoutToolbarContainer) {
parent.removeView(modesLayout); parent.removeView(modesLayout);
@ -432,7 +428,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
} }
private int getFullScreenTopPosY() { private int getFullScreenTopPosY() {
return 0; return !portrait ? topScreenPosY : 0;
} }
private int addStatusBarHeightIfNeeded(int res) { private int addStatusBarHeightIfNeeded(int res) {