mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-14 21:18:56 +01:00
Fix some crashes
This commit is contained in:
@@ -8,6 +8,7 @@ import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
data class DownloadHeaderItem(
|
||||
val id: Long,
|
||||
val name: String,
|
||||
val size: Int
|
||||
) : AbstractExpandableHeaderItem<DownloadHeaderHolder, DownloadItem>() {
|
||||
@@ -41,7 +42,7 @@ data class DownloadHeaderItem(
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return name.hashCode()
|
||||
return id.hashCode()
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
@@ -33,7 +33,7 @@ class DownloadPresenter : BasePresenter<DownloadController>() {
|
||||
downloads
|
||||
.groupBy { it.source }
|
||||
.map { entry ->
|
||||
DownloadHeaderItem(entry.key.name, entry.value.size).apply {
|
||||
DownloadHeaderItem(entry.key.id, entry.key.name, entry.value.size).apply {
|
||||
addSubItems(0, entry.value.map { DownloadItem(it, this) })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
||||
|
||||
// Close BrowseSourceController and its MangaController child when incognito mode is disabled
|
||||
if (!it) {
|
||||
val fg = router.backstack.last().controller
|
||||
val fg = router.backstack.lastOrNull()?.controller
|
||||
if (fg is BrowseSourceController || fg is MangaController && fg.fromSource) {
|
||||
router.popToRoot()
|
||||
}
|
||||
|
||||
@@ -338,6 +338,9 @@ class MangaController :
|
||||
}
|
||||
|
||||
private fun updateToolbarTitleAlpha(@FloatRange(from = 0.0, to = 1.0) alpha: Float? = null) {
|
||||
// Controller may actually already be destroyed by the time this gets run
|
||||
binding ?: return
|
||||
|
||||
val scrolledList = binding.fullRecycler ?: binding.infoRecycler!!
|
||||
(activity as? MainActivity)?.binding?.appbar?.titleTextAlpha = when {
|
||||
// Specific alpha provided
|
||||
|
||||
Reference in New Issue
Block a user