[Android] MediaParsingService: Finish LiveData migration

Geoffrey Métais git at videolan.org
Wed Apr 4 18:35:25 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 16 17:31:56 2018 +0100| [c6812f33188c67ce13a10862e360c02e0dad6aab] | committer: Geoffrey Métais

MediaParsingService: Finish LiveData migration

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

 vlc-android/src/org/videolan/vlc/ExternalMonitor.java   | 7 ++-----
 vlc-android/src/org/videolan/vlc/MediaParsingService.kt | 3 +--
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
index 1c7545e6d..fafa60f6c 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.java
@@ -41,7 +41,6 @@ import android.net.Uri;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
-import android.support.v4.content.LocalBroadcastManager;
 import android.support.v7.preference.PreferenceManager;
 import android.text.TextUtils;
 
@@ -147,14 +146,12 @@ public class ExternalMonitor extends BroadcastReceiver implements LifecycleObser
                         final String[] knownDevices = ml.getDevices();
                         if (!containsDevice(knownDevices, path) && ml.addDevice(uuid, path, true)) {
                             notifyStorageChanges(path);
-                        } else {
-                            LocalBroadcastManager.getInstance(appCtx).sendBroadcast(new Intent(Constants.ACTION_SERVICE_ENDED));
-                        }
+                        } else MediaParsingService.Companion.getStarted().setValue(false);
                     }
                     break;
                 case ACTION_MEDIA_UNMOUNTED:
                     VLCApplication.getMLInstance().removeDevice(uuid);
-                    LocalBroadcastManager.getInstance(appCtx).sendBroadcast(new Intent(Constants.ACTION_SERVICE_ENDED));
+                    MediaParsingService.Companion.getStarted().setValue(false);
                     break;
             }
         }
diff --git a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 2d736055e..b5bf96ade 100644
--- a/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -238,8 +238,7 @@ class MediaParsingService : Service(), DevicesDiscoveryCb {
                 }
                 val isNew = mMedialibrary.addDevice(uuid, device, true)
                 val isIgnored = sharedPreferences.getBoolean("ignore_$uuid", false)
-                if (!isIgnored && isNew)
-                    LocalBroadcastManager.getInstance(ctx).sendBroadcast(Intent(Constants.ACTION_NEW_STORAGE).putExtra(Constants.EXTRA_PATH, device))
+                if (!isIgnored && isNew) showStorageNotification(device)
             }
             for (device in missingDevices) mMedialibrary.removeDevice(FileUtils.getFileNameFromPath(device))
             serviceLock = false



More information about the Android mailing list