mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-11 10:19:22 +01: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)
|
super.onChangeStarted(handler, type)
|
||||||
if (type.isEnter) {
|
if (type.isEnter) {
|
||||||
tabLayout()?.setupWithViewPager(manga_pager)
|
tabLayout()?.setupWithViewPager(manga_pager)
|
||||||
|
checkInitialTrackState()
|
||||||
trackingIconSubscription = trackingIconRelay.subscribe { setTrackingIconInternal(it) }
|
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? {
|
fun tabLayout():TabLayout? {
|
||||||
return if (activity is SearchActivity) activity?.sTabs
|
return if (activity is SearchActivity) activity?.sTabs
|
||||||
else activity?.tabs
|
else activity?.tabs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user