[Android] Contrast & Seek Gesture : fix seekbar display

Alexandre Perraud git at videolan.org
Mon Aug 20 17:20:14 CEST 2012


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Mon Aug 20 14:04:42 2012 +0200| [6104bb4644a5c7198b99f13cd23ff737abeb2380] | committer: Jean-Baptiste Kempf

Contrast & Seek Gesture : fix seekbar display

Always show the seekbar when searching but hide it when changing the
brightness (as in volume)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 .../videolan/vlc/gui/video/VideoPlayerActivity.java |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 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 24adb6d..e2b5704 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -150,10 +150,12 @@ public class VideoPlayerActivity extends Activity {
     private int mAudioMax;
     private int mAudioDisplayRange;
     private float mTouchY, mTouchX, mVol;
-    private boolean mIsAudioChanged;
     private String[] mAudioTracks;
     private String[] mSubtitleTracks;
 
+    //Audio Or Contrast
+    private boolean mIsAudioOrContrastChanged;
+
     @Override
     @TargetApi(11)
     protected void onCreate(Bundle savedInstanceState) {
@@ -680,7 +682,7 @@ public class VideoPlayerActivity extends Activity {
             // Audio
             mTouchY = event.getRawY();
             mVol = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
-            mIsAudioChanged = false;
+            mIsAudioOrContrastChanged = false;
             // Seek
             mTouchX = event.getRawX();
             break;
@@ -695,7 +697,7 @@ public class VideoPlayerActivity extends Activity {
                     if (delta != 0) {
                         mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
                                 vol, AudioManager.FLAG_SHOW_UI);
-                        mIsAudioChanged = true;
+                        mIsAudioOrContrastChanged = true;
                     }
                 }
                 // Contrast (Up or Down - Left side)
@@ -708,8 +710,8 @@ public class VideoPlayerActivity extends Activity {
             break;
 
         case MotionEvent.ACTION_UP:
-            // Audio
-            if (!mIsAudioChanged) {
+            // Audio or Contrast
+            if (!mIsAudioOrContrastChanged) {
                 if (!mShowing) {
                     showOverlay();
                 } else {
@@ -724,7 +726,7 @@ public class VideoPlayerActivity extends Activity {
             evalTouchSeek(coef, xgesturesize, true);
             break;
         }
-        return mIsAudioChanged;
+        return mIsAudioOrContrastChanged;
     }
 
     private void evalTouchSeek(float coef, float gesturesize, boolean seek) {
@@ -732,6 +734,9 @@ public class VideoPlayerActivity extends Activity {
         if (mEnableWheelbar || coef > 0.5 || Math.abs(gesturesize) < 1)
             return;
 
+        // Always show seekbar when searching
+        if (!mShowing) showOverlay();
+
         long length = mLibVLC.getLength();
         long time = mLibVLC.getTime();
 
@@ -759,6 +764,8 @@ public class VideoPlayerActivity extends Activity {
         // No contrast action if gesturesize < 0.4 cm
         if (Math.abs(gesturesize) < 0.4)
             return;
+
+        mIsAudioOrContrastChanged = true;
         WindowManager.LayoutParams lp = getWindow().getAttributes();
         lp.screenBrightness += Math.signum(gesturesize) * 0.05f;
         // Adjust contrast



More information about the Android mailing list