[Android] Filter touch events to prevent accidental seeking
Geoffrey Métais
git at videolan.org
Tue Feb 24 11:11:21 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 24 11:10:40 2015 +0100| [551c1b3e40a7d06e487c91bc306f0d863cd8a714] | committer: Geoffrey Métais
Filter touch events to prevent accidental seeking
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=551c1b3e40a7d06e487c91bc306f0d863cd8a714
---
.../videolan/vlc/gui/video/VideoPlayerActivity.java | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 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 89dc374..ae27071 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1587,8 +1587,15 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
if (mSurfaceYDisplayRange == 0)
mSurfaceYDisplayRange = Math.min(screen.widthPixels, screen.heightPixels);
- float y_changed = event.getRawY() - mTouchY;
- float x_changed = event.getRawX() - mTouchX;
+ float x_changed, y_changed;
+ if (mTouchX != -1 && mTouchY != -1) {
+ y_changed = event.getRawY() - mTouchY;
+ x_changed = event.getRawX() - mTouchX;
+ } else {
+ x_changed = 0f;
+ y_changed = 0f;
+ }
+
// coef is the gradient's move to determine a neutral zone
float coef = Math.abs (y_changed / x_changed);
@@ -1653,7 +1660,10 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay
showOverlay(true);
}
// Seek
- doSeekTouch(coef, xgesturesize, true);
+ if (mTouchAction == TOUCH_SEEK)
+ doSeekTouch(coef, xgesturesize, true);
+ mTouchX = -1f;
+ mTouchY = -1f;
break;
}
return mTouchAction != TOUCH_NONE;
More information about the Android
mailing list