[Android] Fix opening of empty audio player
Geoffrey Métais
git at videolan.org
Wed Jan 21 15:39:16 CET 2015
vlc-ports/android | branch: 1.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 21 15:22:18 2015 +0100| [7ecd97635efed3b2f3210a225717c88d9c22fc7e] | committer: Geoffrey Métais
Fix opening of empty audio player
(cherry picked from commit e219c5aae3587b3246109d37c70a0f076e6d9c98)
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7ecd97635efed3b2f3210a225717c88d9c22fc7e
---
.../org/videolan/vlc/widget/SlidingPaneLayout.java | 42 ++++++++++----------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
index b6693f9..a7d83ce 100644
--- a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
+++ b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
@@ -517,33 +517,31 @@ public class SlidingPaneLayout extends ViewGroup {
return false;
}
+ float x,y;
switch (action) {
- case MotionEvent.ACTION_DOWN: {
- mIsUnableToDrag = false;
- final float x = ev.getX();
- final float y = ev.getY();
- mInitialMotionX = x;
- mInitialMotionY = y;
- break;
- }
-
- case MotionEvent.ACTION_MOVE: {
- final float x = ev.getX();
- final float y = ev.getY();
- final float adx = Math.abs(x - mInitialMotionX);
- final float ady = Math.abs(y - mInitialMotionY);
- final int slop = mDragHelper.getTouchSlop();
- if (ady > slop && adx > ady) {
- mDragHelper.cancel();
- mIsUnableToDrag = true;
- return false;
- }
- }
+ case MotionEvent.ACTION_DOWN:
+ mIsUnableToDrag = false;
+ x = ev.getX();
+ y = ev.getY();
+ mInitialMotionX = x;
+ mInitialMotionY = y;
+ break;
+ case MotionEvent.ACTION_MOVE:
+ x = ev.getX();
+ y = ev.getY();
+ final float adx = Math.abs(x - mInitialMotionX);
+ final float ady = Math.abs(y - mInitialMotionY);
+ final int slop = mDragHelper.getTouchSlop();
+ if (ady > slop && adx > ady) {
+ mDragHelper.cancel();
+ mIsUnableToDrag = true;
+ return false;
+ }
}
final boolean interceptForDrag = mDragHelper.shouldInterceptTouchEvent(ev)
// Intercept touch events only in the overhang area.
- && ev.getY() <= mSlideOffset * mSlideRange + mOverhangSize;
+ && (ev.getY() <= mSlideOffset * mSlideRange + mOverhangSize && mState != STATE_OPENED_ENTIRELY);
return interceptForDrag;
}
More information about the Android
mailing list