[Android] TV: Scan mounted devices
Geoffrey Métais
git at videolan.org
Fri Jan 6 17:56:17 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jan 6 10:57:09 2017 +0100| [c4c6499bf1e36d4f24a6bcbf55cb68bf8a49a93c] | committer: Geoffrey Métais
TV: Scan mounted devices
> https://code.videolan.org/videolan/vlc-android/commit/c4c6499bf1e36d4f24a6bcbf55cb68bf8a49a93c
---
.../src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
index caf9030..cd31883 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
@@ -95,8 +95,6 @@ public abstract class BaseTvActivity extends PlaybackServiceActivity {
protected final BroadcastReceiver mExternalDevicesReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (mMediaLibrary.isWorking())
- return;
if (mRegistering) {
mRegistering = false;
return;
@@ -109,8 +107,13 @@ public abstract class BaseTvActivity extends PlaybackServiceActivity {
onNetworkUpdated();
} else if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_MOUNTED)) {
+ String path = intent.getData().getPath();
+ mMediaLibrary.addDevice(path, path, true);
+ mMediaLibrary.discover(path);
mStorageHandlerHandler.sendEmptyMessageDelayed(ACTION_MEDIA_MOUNTED, 500);
} else if (action.equalsIgnoreCase(Intent.ACTION_MEDIA_EJECT) || action.equalsIgnoreCase(Intent.ACTION_MEDIA_REMOVED)) {
+ mMediaLibrary.removeDevice(intent.getData().getPath());
+ mMediaLibrary.reload();
mStorageHandlerHandler.sendEmptyMessageDelayed(ACTION_MEDIA_UNMOUNTED, 2000); //Delay to cancel it in case of MOUNT
}
}
More information about the Android
mailing list