[Android] Atomic update for progress value

Steve Lhomme robux4 at gmail.com
Wed Feb 18 11:23:01 CET 2015


You're in the UI thread, you shouldn't have to do that. Other access to
setProgress() should also be done in the UI thread.

On Wed, Feb 18, 2015 at 11:13 AM, Geoffrey Métais <git at videolan.org> wrote:

> 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;
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20150218/b9f350d0/attachment.html>


More information about the Android mailing list