Extension function instead of redefining uiScope everywhere

This commit is contained in:
arkon
2020-04-17 20:06:33 -04:00
parent 088160ed32
commit d9f44c1f7d
17 changed files with 57 additions and 59 deletions
@@ -25,9 +25,9 @@ import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.manga.MangaController
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import eu.kanade.tachiyomi.util.lang.launchInUI
import eu.kanade.tachiyomi.util.system.notificationManager
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import reactivecircus.flowbinding.recyclerview.scrollStateChanges
import reactivecircus.flowbinding.swiperefreshlayout.refreshes
@@ -100,7 +100,7 @@ class UpdatesController : NucleusController<UpdatesPresenter>(),
val firstPos = layoutManager.findFirstCompletelyVisibleItemPosition()
binding.swipeRefresh.isEnabled = firstPos <= 0
}
.launchIn(uiScope)
.launchInUI()
binding.swipeRefresh.setDistanceToTriggerSync((2 * 64 * view.resources.displayMetrics.density).toInt())
binding.swipeRefresh.refreshes()
@@ -110,7 +110,7 @@ class UpdatesController : NucleusController<UpdatesPresenter>(),
// It can be a very long operation, so we disable swipe refresh and show a toast.
binding.swipeRefresh.isRefreshing = false
}
.launchIn(uiScope)
.launchInUI()
}
override fun onDestroyView(view: View) {