Update parsers
This commit is contained in:
@@ -307,15 +307,13 @@ class ReaderActivity :
|
||||
private fun onPageSaved(uri: Uri?) {
|
||||
if (uri != null) {
|
||||
Snackbar.make(viewBinding.container, R.string.page_saved, Snackbar.LENGTH_LONG)
|
||||
.setAnchorView(viewBinding.appbarBottom)
|
||||
.setAction(R.string.share) {
|
||||
ShareHelper(this).shareImage(uri)
|
||||
}.show()
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(viewBinding.container, R.string.error_occurred, Snackbar.LENGTH_SHORT)
|
||||
.setAnchorView(viewBinding.appbarBottom)
|
||||
.show()
|
||||
}
|
||||
}.setAnchorView(viewBinding.appbarBottom)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun setWindowSecure(isSecure: Boolean) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.plus
|
||||
import org.koitharu.kotatsu.BuildConfig
|
||||
import org.koitharu.kotatsu.R
|
||||
import org.koitharu.kotatsu.bookmarks.domain.Bookmark
|
||||
import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository
|
||||
@@ -255,10 +256,13 @@ class ReaderViewModel @Inject constructor(
|
||||
@MainThread
|
||||
fun onCurrentPageChanged(position: Int) {
|
||||
val prevJob = stateChangeJob
|
||||
val pages = content.value.pages // capture immediately
|
||||
stateChangeJob = launchJob(Dispatchers.Default) {
|
||||
prevJob?.cancelAndJoin()
|
||||
loadingJob?.join()
|
||||
val pages = content.value.pages
|
||||
if (BuildConfig.DEBUG && pages.size != content.value.pages.size) {
|
||||
throw IllegalStateException("Concurrent pages modification")
|
||||
}
|
||||
pages.getOrNull(position)?.let { page ->
|
||||
currentState.update { cs ->
|
||||
cs?.copy(chapterId = page.chapterId, page = page.index)
|
||||
|
||||
Reference in New Issue
Block a user