Bruno_
03/21/2020, 10:58 AMupdate publisher
(new items are being pushed into it)
• refresh the view model data every let's say 1s
• try to implement it so that if the user get's to the end of the list, more items are loadedatlantis210
03/24/2020, 6:43 AMkyleg
03/25/2020, 4:41 AMMediatorLiveData
. Suppose you have 10 websites to crawl.
data class Website(val url: String)
val sitesToCrawl: List<Website> = TODO()
fun crawl(url: String): LiveData<List<PageData>> = TODO()
val observer = MediatorLiveData<List<PageData>>().apply { value = list() }
sitesToCrawl.forEach { site ->
val ld = crawl(site.url)
observer.addSource(ld) { list ->
observer.value = observer.value+list
}
}
Something like that. Can’t remember if I’m doing list concat correctly.Bruno_
03/25/2020, 9:48 AM