This commit is contained in:
Horis
2025-03-05 22:22:02 +08:00
parent 3699219ad2
commit d4c20a1e83
2 changed files with 13 additions and 21 deletions
@@ -58,7 +58,6 @@ import io.legado.app.utils.fromJsonObject
import io.legado.app.utils.getCompatColor import io.legado.app.utils.getCompatColor
import io.legado.app.utils.gone import io.legado.app.utils.gone
import io.legado.app.utils.observeEvent import io.legado.app.utils.observeEvent
import io.legado.app.utils.printOnDebug
import io.legado.app.utils.showDialogFragment import io.legado.app.utils.showDialogFragment
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import io.legado.app.utils.toggleStatusBar import io.legado.app.utils.toggleStatusBar
@@ -208,26 +207,19 @@ class ReadMangaActivity : VMBaseActivity<ActivityMangaBinding, MangaViewModel>()
} }
} }
setNestedPreScrollListener { _, _, _, position -> setNestedPreScrollListener { _, _, _, position ->
if (mAdapter.getCurrentList().isNotEmpty() if (mAdapter.isNotEmpty()) {
&& position <= mAdapter.getCurrentList().lastIndex val content = mAdapter.getItem(position)
) { if (content is MangaContent) {
try { ReadManga.durChapterIndex = content.mChapterIndex
val content = mAdapter.getCurrentList()[position] ReadManga.durChapterPos = content.mDurChapterPos
if (content is MangaContent) { upInfoBar(
ReadManga.durChapterIndex = content.mChapterIndex content.mChapterIndex + 1,
ReadManga.durChapterPos = content.mDurChapterPos content.chapterSize,
upInfoBar( content.mDurChapterPos + 1,
content.mChapterIndex + 1, content.mDurChapterCount,
content.chapterSize, content.mChapterName
content.mDurChapterPos + 1, )
content.mDurChapterCount,
content.mChapterName
)
}
} catch (e: Exception) {
e.printOnDebug()
} }
} }
} }
addRecyclerViewPreloader(AppConfig.mangaPreDownloadNum) addRecyclerViewPreloader(AppConfig.mangaPreDownloadNum)
@@ -59,7 +59,7 @@ class MangaAdapter(private val context: Context) :
private val mDiffer = AsyncListDiffer(this, mDiffCallback) private val mDiffer = AsyncListDiffer(this, mDiffCallback)
private fun getItem(@IntRange(from = 0) position: Int) = mDiffer.currentList[position] fun getItem(@IntRange(from = 0) position: Int) = mDiffer.currentList.getOrNull(position)
fun getCurrentList() = mDiffer.currentList fun getCurrentList() = mDiffer.currentList