Bunch of crash fixes
This commit is contained in:
+6
-1
@@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.util.view.visible
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
import timber.log.Timber
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
@@ -97,7 +98,11 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
|
||||
for (source in extension.sources) {
|
||||
if (source is ConfigurableSource) {
|
||||
addPreferencesForSource(screen, source, multiSource)
|
||||
try {
|
||||
addPreferencesForSource(screen, source, multiSource)
|
||||
} catch (e: AbstractMethodError) {
|
||||
Timber.e("Source did not implement [addPreferencesForSource]: ${source.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,10 +113,14 @@ class SourceController :
|
||||
}
|
||||
|
||||
override fun onItemClick(view: View, position: Int): Boolean {
|
||||
val item = adapter?.getItem(position) as? SourceItem ?: return false
|
||||
onItemClick(position)
|
||||
return false
|
||||
}
|
||||
|
||||
private fun onItemClick(position: Int) {
|
||||
val item = adapter?.getItem(position) as? SourceItem ?: return
|
||||
val source = item.source
|
||||
openCatalogue(source, BrowseSourceController(source))
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onItemLongClick(position: Int) {
|
||||
@@ -165,7 +169,7 @@ class SourceController :
|
||||
* Called when browse is clicked in [SourceAdapter]
|
||||
*/
|
||||
override fun onBrowseClick(position: Int) {
|
||||
onItemClick(view!!, position)
|
||||
onItemClick(position)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-3
@@ -41,8 +41,8 @@ import uy.kohesive.injekt.api.get
|
||||
* Presenter of [BrowseSourceController].
|
||||
*/
|
||||
open class BrowseSourcePresenter(
|
||||
sourceId: Long,
|
||||
sourceManager: SourceManager = Injekt.get(),
|
||||
private val sourceId: Long,
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val db: DatabaseHelper = Injekt.get(),
|
||||
private val prefs: PreferencesHelper = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get()
|
||||
@@ -51,7 +51,7 @@ open class BrowseSourcePresenter(
|
||||
/**
|
||||
* Selected source.
|
||||
*/
|
||||
val source = sourceManager.get(sourceId) as CatalogueSource
|
||||
lateinit var source: CatalogueSource
|
||||
|
||||
/**
|
||||
* Query from the view.
|
||||
@@ -109,6 +109,8 @@ open class BrowseSourcePresenter(
|
||||
override fun onCreate(savedState: Bundle?) {
|
||||
super.onCreate(savedState)
|
||||
|
||||
source = sourceManager.get(sourceId) as? CatalogueSource ?: return
|
||||
|
||||
sourceFilters = source.getFilterList()
|
||||
|
||||
if (savedState != null) {
|
||||
|
||||
Reference in New Issue
Block a user