Merge pull request #280 from RepoDevil/semi-auto

Automatically search through sources
This commit is contained in:
rebel onion 2024-03-23 19:06:56 -05:00 committed by GitHub
commit 89e18b0e2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 78 additions and 5 deletions

View file

@ -481,6 +481,22 @@ class MangaReadAdapter(
val sourceFound = media.manga.chapters!!.isNotEmpty()
binding.animeSourceNotFound.isGone = sourceFound
binding.faqbutton.isGone = sourceFound
if (!sourceFound && PrefManager.getVal(PrefName.SearchSources)) {
if (binding.animeSource.adapter.count > media.selected!!.sourceIndex + 1) {
val nextIndex = media.selected!!.sourceIndex + 1
binding.animeSource.setText(binding.animeSource.adapter
.getItem(nextIndex).toString(), false)
fragment.onSourceChange(nextIndex).apply {
binding.animeSourceTitle.text = showUserText
showUserTextListener = { MainScope().launch { binding.animeSourceTitle.text = it } }
setLanguageList(0, nextIndex)
}
subscribeButton(false)
// invalidate if it's the last source
val invalidate = nextIndex == mangaReadSources.names.size - 1
fragment.loadChapters(nextIndex, invalidate)
}
}
} else {
binding.animeSourceContinue.visibility = View.GONE
binding.animeSourceNotFound.visibility = View.GONE