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

TV: Update browsers on storages (un)plugged

parent 3f048549
No related branches found
No related tags found
No related merge requests found
......@@ -123,7 +123,10 @@ object ExternalMonitor : BroadcastReceiver(), LifecycleObserver, CoroutineScope
}
Intent.ACTION_MEDIA_MOUNTED -> {
if (AndroidDevices.watchDevices || storageObserver != null && storageObserver!!.get() != null) {
intent.data?.let { actor.offer(MediaMounted(it)) }
intent.data?.let {
actor.offer(MediaMounted(it))
storagePlugged.postValue(it)
}
}
}
Intent.ACTION_MEDIA_UNMOUNTED,
......@@ -172,6 +175,7 @@ object ExternalMonitor : BroadcastReceiver(), LifecycleObserver, CoroutineScope
val connected = MutableLiveData<Boolean>()
val storageUnplugged = LiveEvent<Uri>()
val storagePlugged = LiveEvent<Uri>()
@Volatile
var isMobile = true
private set
......
......@@ -160,6 +160,8 @@ class MainTvFragment : BrowseSupportFragment(), OnItemViewSelectedListener, OnIt
(requireActivity() as MainTvActivity).hideLoading()
})
ExternalMonitor.connected.observe(this, Observer { updateActor.offer(Browsers) })
ExternalMonitor.storageUnplugged.observe(this, Observer { updateActor.offer(Browsers) })
ExternalMonitor.storagePlugged.observe(this, Observer { updateActor.offer(Browsers) })
onItemViewClickedListener = this
onItemViewSelectedListener = this
}
......
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