[Android] Atomic update for progress value

Geoffrey Métais geoffrey.metais at gmail.com
Wed Feb 18 11:39:31 CET 2015


It happens sometimes in VLC, like in some browser fragments with
CyclicBarrier.

I agree it's not for the best. I'll have a look this afternoon

On Wed, Feb 18, 2015 at 11:23 AM, Steve Lhomme <robux4 at gmail.com> wrote:

> 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
>>
>
>
> _______________________________________________
> 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/47ea58f9/attachment-0001.html>


More information about the Android mailing list