[Android] Atomic update for progress value

Geoffrey Métais git at videolan.org
Wed Feb 18 11:13:04 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 18 10:58:20 2015 +0100| [0d6164aa63212f15d68c07173dba0e8daf77379d] | committer: Geoffrey Métais

Atomic update for progress value

CID #1226287

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

 vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java b/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java
index 360cd64..6dc2806 100644
--- a/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java
+++ b/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java
@@ -99,9 +99,11 @@ public class VerticalSeekBar extends SeekBar {
                 break;
             case MotionEvent.ACTION_MOVE:
                 if (mIsMovingThumb) {
-                    final int max = getMax();
-                    final int progress = max - (int) (max* event.getY() / getHeight());
-                    setProgress(progress);
+                    synchronized (this) {
+                        final int max = getMax();
+                        final int progress = max - (int) (max* event.getY() / getHeight());
+                        setProgress(progress);
+                    }
                     handled = true;
                 }
                 break;



More information about the Android mailing list