[Android] Fix opening of empty audio player
Geoffrey Métais
git at videolan.org
Wed Jan 21 15:35:20 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan 21 15:22:18 2015 +0100| [e219c5aae3587b3246109d37c70a0f076e6d9c98] | committer: Geoffrey Métais
Fix opening of empty audio player
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e219c5aae3587b3246109d37c70a0f076e6d9c98
---
.../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