[Android] FlingViewGroup : Simplify code
Alexandre Perraud
git at videolan.org
Thu May 15 16:43:40 CEST 2014
vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Wed May 14 11:46:11 2014 +0200| [89a7de08ae3256ca934980700aeaa5b9bee3fa75] | committer: Jean-Baptiste Kempf
FlingViewGroup : Simplify code
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=89a7de08ae3256ca934980700aeaa5b9bee3fa75
---
vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index 46147a1..243dea3 100644
--- a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
+++ b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
@@ -201,12 +201,10 @@ public class FlingViewGroup extends ViewGroup {
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocityX = (int) velocityTracker.getXVelocity();
- ViewConfiguration config = ViewConfiguration.get(getContext());
- final int slop = config.getScaledTouchSlop();
final float dx = x - mInitialMotionX;
final float dy = y - mInitialMotionY;
- if (dx > 0 && mCurrentView == 0 && dx > slop) {
+ if (dx > 0 && mCurrentView == 0 && dx > mTouchSlop) {
if (mViewSwitchListener != null)
mViewSwitchListener.onBackSwitched();
} else if (velocityX > 1000 && mCurrentView > 0) {
@@ -225,7 +223,7 @@ public class FlingViewGroup extends ViewGroup {
if (mViewSwitchListener != null) {
mViewSwitchListener.onTouchUp();
- if (dx * dx + dy * dy < slop * slop)
+ if (dx * dx + dy * dy < mTouchSlop * mTouchSlop)
mViewSwitchListener.onTouchClick();
}
More information about the Android
mailing list