mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
Some crash fixes
This commit is contained in:
parent
91fa1ec6b2
commit
fd2028557e
@ -137,7 +137,7 @@ class DownloadPendingDeleter(context: Context) {
|
|||||||
val id: Long,
|
val id: Long,
|
||||||
val url: String,
|
val url: String,
|
||||||
val name: String,
|
val name: String,
|
||||||
val scanlator: String?
|
val scanlator: String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,7 @@ data class ALUserManga(
|
|||||||
"DROPPED" -> Anilist.DROPPED
|
"DROPPED" -> Anilist.DROPPED
|
||||||
"PLANNING" -> Anilist.PLANNING
|
"PLANNING" -> Anilist.PLANNING
|
||||||
"REPEATING" -> Anilist.REPEATING
|
"REPEATING" -> Anilist.REPEATING
|
||||||
else -> throw NotImplementedError("Unknown status")
|
else -> throw NotImplementedError("Unknown status: $list_status")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ fun Track.toAnilistStatus() = when (status) {
|
|||||||
Anilist.DROPPED -> "DROPPED"
|
Anilist.DROPPED -> "DROPPED"
|
||||||
Anilist.PLANNING -> "PLANNING"
|
Anilist.PLANNING -> "PLANNING"
|
||||||
Anilist.REPEATING -> "REPEATING"
|
Anilist.REPEATING -> "REPEATING"
|
||||||
else -> throw NotImplementedError("Unknown status")
|
else -> throw NotImplementedError("Unknown status: $status")
|
||||||
}
|
}
|
||||||
|
|
||||||
private val preferences: PreferencesHelper by injectLazy()
|
private val preferences: PreferencesHelper by injectLazy()
|
||||||
@ -102,5 +102,5 @@ fun Track.toAnilistScore(): String = when (preferences.anilistScoreType().get())
|
|||||||
}
|
}
|
||||||
// 10 point decimal
|
// 10 point decimal
|
||||||
"POINT_10_DECIMAL" -> (score / 10).toString()
|
"POINT_10_DECIMAL" -> (score / 10).toString()
|
||||||
else -> throw Exception("Unknown score type")
|
else -> throw NotImplementedError("Unknown score type")
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ fun Track.toBangumiStatus() = when (status) {
|
|||||||
Bangumi.ON_HOLD -> "on_hold"
|
Bangumi.ON_HOLD -> "on_hold"
|
||||||
Bangumi.DROPPED -> "dropped"
|
Bangumi.DROPPED -> "dropped"
|
||||||
Bangumi.PLANNING -> "wish"
|
Bangumi.PLANNING -> "wish"
|
||||||
else -> throw NotImplementedError("Unknown status")
|
else -> throw NotImplementedError("Unknown status: $status")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toTrackStatus(status: String) = when (status) {
|
fun toTrackStatus(status: String) = when (status) {
|
||||||
@ -17,6 +17,5 @@ fun toTrackStatus(status: String) = when (status) {
|
|||||||
"on_hold" -> Bangumi.ON_HOLD
|
"on_hold" -> Bangumi.ON_HOLD
|
||||||
"dropped" -> Bangumi.DROPPED
|
"dropped" -> Bangumi.DROPPED
|
||||||
"wish" -> Bangumi.PLANNING
|
"wish" -> Bangumi.PLANNING
|
||||||
|
else -> throw NotImplementedError("Unknown status: $status")
|
||||||
else -> throw Exception("Unknown status")
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ fun Track.toShikimoriStatus() = when (status) {
|
|||||||
Shikimori.DROPPED -> "dropped"
|
Shikimori.DROPPED -> "dropped"
|
||||||
Shikimori.PLANNING -> "planned"
|
Shikimori.PLANNING -> "planned"
|
||||||
Shikimori.REPEATING -> "rewatching"
|
Shikimori.REPEATING -> "rewatching"
|
||||||
else -> throw NotImplementedError("Unknown status")
|
else -> throw NotImplementedError("Unknown status: $status")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun toTrackStatus(status: String) = when (status) {
|
fun toTrackStatus(status: String) = when (status) {
|
||||||
@ -19,6 +19,5 @@ fun toTrackStatus(status: String) = when (status) {
|
|||||||
"dropped" -> Shikimori.DROPPED
|
"dropped" -> Shikimori.DROPPED
|
||||||
"planned" -> Shikimori.PLANNING
|
"planned" -> Shikimori.PLANNING
|
||||||
"rewatching" -> Shikimori.REPEATING
|
"rewatching" -> Shikimori.REPEATING
|
||||||
|
else -> throw NotImplementedError("Unknown status: $status")
|
||||||
else -> throw Exception("Unknown status")
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.ui.browse.source.browse
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import eu.davidea.flexibleadapter.items.IFlexible
|
import eu.davidea.flexibleadapter.items.IFlexible
|
||||||
import eu.davidea.flexibleadapter.items.ISectionable
|
|
||||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
import eu.kanade.tachiyomi.data.database.models.Category
|
||||||
@ -321,7 +320,7 @@ open class BrowseSourcePresenter(
|
|||||||
is Filter.Text -> TextSectionItem(it)
|
is Filter.Text -> TextSectionItem(it)
|
||||||
is Filter.Select<*> -> SelectSectionItem(it)
|
is Filter.Select<*> -> SelectSectionItem(it)
|
||||||
else -> null
|
else -> null
|
||||||
} as? ISectionable<*, *>
|
}
|
||||||
}
|
}
|
||||||
subItems.forEach { it.header = group }
|
subItems.forEach { it.header = group }
|
||||||
group.subItems = subItems
|
group.subItems = subItems
|
||||||
|
@ -143,7 +143,7 @@ class LibraryController(
|
|||||||
if (preferences.categoryTabs().get()) {
|
if (preferences.categoryTabs().get()) {
|
||||||
currentTitle = resources?.getString(R.string.label_library)
|
currentTitle = resources?.getString(R.string.label_library)
|
||||||
} else {
|
} else {
|
||||||
adapter?.categories?.get(binding.libraryPager.currentItem)?.let {
|
adapter?.categories?.getOrNull(binding.libraryPager.currentItem)?.let {
|
||||||
currentTitle = it.name
|
currentTitle = it.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -923,7 +923,7 @@ class MangaController :
|
|||||||
private fun markPreviousAsRead(chapters: List<ChapterItem>) {
|
private fun markPreviousAsRead(chapters: List<ChapterItem>) {
|
||||||
val adapter = chaptersAdapter ?: return
|
val adapter = chaptersAdapter ?: return
|
||||||
val prevChapters = if (presenter.sortDescending()) adapter.items.reversed() else adapter.items
|
val prevChapters = if (presenter.sortDescending()) adapter.items.reversed() else adapter.items
|
||||||
val chapterPos = prevChapters.indexOf(chapters.last())
|
val chapterPos = prevChapters.indexOf(chapters.lastOrNull())
|
||||||
if (chapterPos != -1) {
|
if (chapterPos != -1) {
|
||||||
markAsRead(prevChapters.take(chapterPos))
|
markAsRead(prevChapters.take(chapterPos))
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ open class BaseWebViewActivity : BaseActivity<WebviewActivityBinding>() {
|
|||||||
try {
|
try {
|
||||||
binding = WebviewActivityBinding.inflate(layoutInflater)
|
binding = WebviewActivityBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
} catch (e: Exception) {
|
} catch (e: Throwable) {
|
||||||
// Potentially throws errors like "Error inflating class android.webkit.WebView"
|
// Potentially throws errors like "Error inflating class android.webkit.WebView"
|
||||||
toast(R.string.information_webview_required, Toast.LENGTH_LONG)
|
toast(R.string.information_webview_required, Toast.LENGTH_LONG)
|
||||||
finish()
|
finish()
|
||||||
|
Loading…
Reference in New Issue
Block a user