mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-09-10 20:53:14 +02:00
Instantly show check on tab for tracked manga
This commit is contained in:
parent
2b1752de09
commit
343fad39b6
@ -144,10 +144,22 @@ class MangaController : RxController, TabbedController {
|
||||
super.onChangeStarted(handler, type)
|
||||
if (type.isEnter) {
|
||||
tabLayout()?.setupWithViewPager(manga_pager)
|
||||
checkInitialTrackState()
|
||||
trackingIconSubscription = trackingIconRelay.subscribe { setTrackingIconInternal(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkInitialTrackState() {
|
||||
val manga = manga ?: return
|
||||
val loggedServices by lazy { Injekt.get<TrackManager>().services.filter { it.isLogged } }
|
||||
val db = Injekt.get<DatabaseHelper>()
|
||||
val tracks = db.getTracks(manga).executeAsBlocking()
|
||||
|
||||
if (loggedServices.any { service -> tracks.any { it.sync_id == service.id } }) {
|
||||
setTrackingIcon(true)
|
||||
}
|
||||
}
|
||||
|
||||
fun tabLayout():TabLayout? {
|
||||
return if (activity is SearchActivity) activity?.sTabs
|
||||
else activity?.tabs
|
||||
|
Loading…
Reference in New Issue
Block a user