[Android] Seek gesture : no need to test x/y_changed values, coef is enough

Sébastien Toque git at videolan.org
Tue Aug 14 22:58:59 CEST 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Tue Aug 14 21:07:53 2012 +0200| [0d50bf8c296bdb469c80de2cd383cbebc3248c6e] | committer: Sébastien Toque

Seek gesture : no need to test x/y_changed values, coef is enough

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=0d50bf8c296bdb469c80de2cd383cbebc3248c6e
---

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java      |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 97e7f74..9ae5503 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -664,7 +664,7 @@ public class VideoPlayerActivity extends Activity {
         case MotionEvent.ACTION_MOVE:
             // Audio
             // No audio action if coef < 2
-            if ((Math.abs(y_changed) > Math.abs(x_changed)) && (coef > 2)){
+            if (coef > 2) {
                 int delta = -(int) ((y_changed / mAudioDisplayRange) * mAudioMax);
                 int vol = (int) Math.min(Math.max(mVol + delta, 0), mAudioMax);
                 if (delta != 0) {
@@ -692,9 +692,7 @@ public class VideoPlayerActivity extends Activity {
             // Seek
             float gesturesize = (float) ((x_changed / screen.xdpi) * 2.54);
             // No seek action if coef > 0.5 and gesturesize < 1cm
-            if ((Math.abs(y_changed) < Math.abs(x_changed))
-                    && (coef < 0.5)
-                    && (Math.abs(gesturesize) > 1)) {
+            if (coef < 0.5 && Math.abs(gesturesize) > 1) {
 
                 // Size of the jump, 10 minutes max (600000), with a bi-cubic progression, for a 8cm gesture
                 int jump = (int) (Math.signum(gesturesize) * ((600000 * Math.pow((gesturesize / 8), 4)) + 3000));



More information about the Android mailing list