Fix chapters preloading
This commit is contained in:
@@ -229,7 +229,7 @@ class DetailsActivity : BaseActivity<ActivityDetailsBinding>(),
|
||||
override fun onSupportActionModeFinished(mode: ActionMode) {
|
||||
super.onSupportActionModeFinished(mode)
|
||||
binding.pager.isUserInputEnabled = true
|
||||
window?.statusBarColor = getThemeColor(androidx.appcompat.R.attr.colorPrimaryDark)
|
||||
window?.statusBarColor = getThemeColor(android.R.attr.statusBarColor)
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -100,12 +100,13 @@ class ReaderViewModel(
|
||||
readerMode.postValue(mode)
|
||||
|
||||
val pages = loadChapter(requireNotNull(currentState.value).chapterId)
|
||||
content.postValue(ReaderContent(pages, currentState.value))
|
||||
// save state
|
||||
currentState.value?.let {
|
||||
historyRepository.addOrUpdate(manga, it.chapterId, it.page, it.scroll)
|
||||
shortcutsRepository.updateShortcuts()
|
||||
}
|
||||
|
||||
content.postValue(ReaderContent(pages, currentState.value))
|
||||
}
|
||||
|
||||
subscribeToSettings()
|
||||
|
||||
@@ -74,13 +74,11 @@ class ReversedReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
items.await() ?: return@launchWhenCreated
|
||||
if (position != -1) {
|
||||
binding.pager.setCurrentItem(position, false)
|
||||
notifyPageChanged(position)
|
||||
}
|
||||
} else {
|
||||
items.await()
|
||||
}
|
||||
binding.pager.post {
|
||||
bindingOrNull()?.pager?.callOnPageChaneListeners()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,13 +63,11 @@ class PagerReaderFragment : BaseReader<FragmentReaderStandardBinding>() {
|
||||
items.await() ?: return@launchWhenCreated
|
||||
if (position != -1) {
|
||||
binding.pager.setCurrentItem(position, false)
|
||||
notifyPageChanged(position)
|
||||
}
|
||||
} else {
|
||||
items.await()
|
||||
}
|
||||
binding.pager.post {
|
||||
bindingOrNull()?.pager?.callOnPageChaneListeners()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,13 +55,11 @@ class WebtoonReaderFragment : BaseReader<FragmentReaderWebtoonBinding>() {
|
||||
?.restoreScroll(pendingState.scroll)
|
||||
}
|
||||
}
|
||||
notifyPageChanged(position)
|
||||
}
|
||||
} else {
|
||||
setItems.await()
|
||||
}
|
||||
binding.recyclerView.post {
|
||||
binding.recyclerView.callOnScrollListeners()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ inline fun RecyclerView.doOnCurrentItemChanged(crossinline callback: (Int) -> Un
|
||||
})
|
||||
}
|
||||
|
||||
@Deprecated("Reflection")
|
||||
fun RecyclerView.callOnScrollListeners() {
|
||||
try {
|
||||
val field = RecyclerView::class.java.getDeclaredField("mScrollListeners")
|
||||
@@ -190,6 +191,7 @@ fun RecyclerView.callOnScrollListeners() {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Reflection")
|
||||
fun ViewPager2.callOnPageChaneListeners() {
|
||||
try {
|
||||
val field = ViewPager2::class.java.getDeclaredField("mExternalPageChangeCallbacks")
|
||||
|
||||
Reference in New Issue
Block a user