[Android] Ensure 'isWorking' variable is up-to-date

Geoffrey Métais git at videolan.org
Fri Dec 29 11:16:25 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec 29 10:33:03 2017 +0100| [5d0fa41f46655fe9301708992c857c4526ac3d5e] | committer: Geoffrey Métais

Ensure 'isWorking' variable is up-to-date

(cherry picked from commit 47f9f65d69bf300951c11fa7bc69f43e76f97c67)

> https://code.videolan.org/videolan/vlc-android/commit/5d0fa41f46655fe9301708992c857c4526ac3d5e
---

 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 9c8e1e244..32c19d090 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -61,7 +61,7 @@ public class Medialibrary {
 
     private long mInstanceID;
     private volatile boolean mIsInitiated = false;
-    private boolean mIsWorking = false;
+    private volatile boolean mIsWorking = false;
 
     private MediaUpdatedCb mediaUpdatedCb = null;
     private MediaAddedCb mediaAddedCb = null;
@@ -413,8 +413,8 @@ public class Medialibrary {
 
     @SuppressWarnings("unused")
     public void onBackgroundTasksIdleChanged(boolean isIdle) {
-        LocalBroadcastManager.getInstance(sContext).sendBroadcast(new Intent(ACTION_IDLE).putExtra(STATE_IDLE, isIdle));
         mIsWorking = !isIdle;
+        LocalBroadcastManager.getInstance(sContext).sendBroadcast(new Intent(ACTION_IDLE).putExtra(STATE_IDLE, isIdle));
     }
 
     void onReloadStarted(String entryPoint) {



More information about the Android mailing list