mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Various crash fixes
This commit is contained in:
parent
fd7f87b2eb
commit
d32a902a57
5 changed files with 22 additions and 13 deletions
|
@ -7,6 +7,7 @@ import kotlinx.coroutines.cancel
|
|||
|
||||
open class BaseCoroutinePresenter<T> {
|
||||
lateinit var presenterScope: CoroutineScope
|
||||
val isScopeInitialized get() = this::presenterScope.isInitialized
|
||||
protected var controller: T? = null
|
||||
|
||||
/**
|
||||
|
|
|
@ -1225,7 +1225,7 @@ class LibraryPresenter(
|
|||
val mangaFetcher = MangaFetcher()
|
||||
val libraryManga = db.getFavoriteMangas().executeOnIO()
|
||||
libraryManga.forEach { manga ->
|
||||
mangaFetcher.setRatioAndColors(manga)
|
||||
try { withUIContext { mangaFetcher.setRatioAndColors(manga) } } catch (_: Exception) { }
|
||||
}
|
||||
MangaCoverMetadata.savePrefs()
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
|||
import eu.kanade.tachiyomi.ui.base.controller.BaseController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryController
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryPresenter
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
|
||||
import eu.kanade.tachiyomi.ui.more.AboutController
|
||||
import eu.kanade.tachiyomi.ui.more.OverflowDialog
|
||||
|
@ -468,6 +469,9 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
}
|
||||
}
|
||||
}
|
||||
lifecycleScope.launchIO {
|
||||
LibraryPresenter.updateRatiosAndColors()
|
||||
}
|
||||
}
|
||||
getExtensionUpdates(true)
|
||||
|
||||
|
|
|
@ -556,17 +556,20 @@ class MangaDetailsController :
|
|||
//region Lifecycle methods
|
||||
override fun onActivityResumed(activity: Activity) {
|
||||
super.onActivityResumed(activity)
|
||||
presenter.isLockedFromSearch = shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
||||
presenter.headerItem.isLocked = presenter.isLockedFromSearch
|
||||
manga!!.thumbnail_url = presenter.refreshMangaFromDb().thumbnail_url
|
||||
presenter.fetchChapters(refreshTracker == null)
|
||||
if (refreshTracker != null) {
|
||||
trackingBottomSheet?.refreshItem(refreshTracker ?: 0)
|
||||
presenter.refreshTracking()
|
||||
refreshTracker = null
|
||||
if (presenter.isScopeInitialized) {
|
||||
presenter.isLockedFromSearch =
|
||||
shouldLockIfNeeded && SecureActivityDelegate.shouldBeLocked()
|
||||
presenter.headerItem.isLocked = presenter.isLockedFromSearch
|
||||
manga!!.thumbnail_url = presenter.refreshMangaFromDb().thumbnail_url
|
||||
presenter.fetchChapters(refreshTracker == null)
|
||||
if (refreshTracker != null) {
|
||||
trackingBottomSheet?.refreshItem(refreshTracker ?: 0)
|
||||
presenter.refreshTracking()
|
||||
refreshTracker = null
|
||||
}
|
||||
// fetch cover again in case the user set a new cover while reading
|
||||
setPaletteColor()
|
||||
}
|
||||
// fetch cover again in case the user set a new cover while reading
|
||||
setPaletteColor()
|
||||
val isCurrentController = router?.backstack?.lastOrNull()?.controller ==
|
||||
this
|
||||
if (isCurrentController) {
|
||||
|
|
|
@ -478,9 +478,10 @@ fun Controller.scrollViewWith(
|
|||
preferences.hideBottomNavOnScroll().get()
|
||||
) closerToBottom else closerToTop
|
||||
lastY = activityBinding!!.appBar.snapAppBarY(recycler) {
|
||||
val activityBinding = activityBinding ?: return@snapAppBarY
|
||||
swipeCircle?.translationY = max(
|
||||
activityBinding!!.appBar.y,
|
||||
-activityBinding!!.appBar.height + activityBinding!!.appBar.paddingTop.toFloat()
|
||||
activityBinding.appBar.y,
|
||||
-activityBinding.appBar.height + activityBinding.appBar.paddingTop.toFloat()
|
||||
)
|
||||
}
|
||||
if (activityBinding!!.bottomNav?.isVisible == true &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue