Skip to content
Snippets Groups Projects
Commit c4c6499b authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

TV: Scan mounted devices

parent d8b28adb
Branches master
No related tags found
No related merge requests found
......@@ -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
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment