|
|
|
|
@ -27,6 +27,7 @@ public class CustomKeyDownVod extends GestureDetector.SimpleOnGestureListener { |
|
|
|
|
private boolean changeVolume; |
|
|
|
|
private boolean changeSpeed; |
|
|
|
|
private boolean changeTime; |
|
|
|
|
private boolean animating; |
|
|
|
|
private boolean center; |
|
|
|
|
private boolean touch; |
|
|
|
|
private boolean lock; |
|
|
|
|
@ -109,7 +110,7 @@ public class CustomKeyDownVod extends GestureDetector.SimpleOnGestureListener { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean onFling(MotionEvent e1, @NonNull MotionEvent e2, float velocityX, float velocityY) { |
|
|
|
|
if (isEdge(e1) || !center) return true; |
|
|
|
|
if (isEdge(e1) || !center || animating) return true; |
|
|
|
|
checkFunc(e1, e2, velocityY); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
@ -130,9 +131,9 @@ public class CustomKeyDownVod extends GestureDetector.SimpleOnGestureListener { |
|
|
|
|
|
|
|
|
|
private void checkFunc(MotionEvent e1, MotionEvent e2, float velocityY) { |
|
|
|
|
if (e1.getY() - e2.getY() > DISTANCE && Math.abs(velocityY) > VELOCITY) { |
|
|
|
|
videoView.animate().translationYBy(-80).setDuration(150).withEndAction(() -> videoView.animate().translationY(0).setDuration(100).withEndAction(listener::onFlingUp).start()).start(); |
|
|
|
|
videoView.animate().translationYBy(-ResUtil.dp2px(24)).setDuration(150).withStartAction(() -> animating = true).withEndAction(() -> videoView.animate().translationY(0).setDuration(100).withStartAction(listener::onFlingUp).withEndAction(() -> animating = false).start()).start(); |
|
|
|
|
} else if (e2.getY() - e1.getY() > DISTANCE && Math.abs(velocityY) > VELOCITY) { |
|
|
|
|
videoView.animate().translationYBy(80).setDuration(150).withEndAction(() -> videoView.animate().translationY(0).setDuration(100).withEndAction(listener::onFlingDown).start()).start(); |
|
|
|
|
videoView.animate().translationYBy(ResUtil.dp2px(24)).setDuration(150).withStartAction(() -> animating = true).withEndAction(() -> videoView.animate().translationY(0).setDuration(100).withStartAction(listener::onFlingDown).withEndAction(() -> animating = false).start()).start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|