File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
app/src/main/java/me/devsaki/hentoid/viewmodels Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -562,8 +562,6 @@ class ReaderViewModel(
562562 startingIndex: Int,
563563 imageFiles: List<ImageFile>
564564 ) {
565- setViewerStartingIndex(startingIndex)
566-
567565 // Init the read pages write cache
568566 readPageNumbers.clear()
569567
@@ -653,7 +651,7 @@ class ReaderViewModel(
653651 viewerImagesInternal.clear()
654652 viewerImagesInternal.addAll(imgs)
655653 }
656- if (startIndex > -1) onPageChange(startIndex - 1, 1)
654+ if (startIndex > -1) onPageChange(startIndex - 1, 1, true )
657655 else viewerImages.postValue(viewerImagesInternal.toList())
658656 }
659657 }
@@ -1201,10 +1199,11 @@ class ReaderViewModel(
12011199 * @param viewerIndex Viewer index of the page that has just been displayed
12021200 * @param direction Direction the viewer is going to (1 : forward; -1 : backward; 0 : no movement)
12031201 */
1204- fun onPageChange(viewerIndex: Int, direction: Int) {
1202+ fun onPageChange(viewerIndex: Int, direction: Int, setIndex: Boolean = false ) {
12051203 onPageChange(viewerIndex, direction) {
12061204 // Instanciate a new list to trigger an actual Adapter UI refresh
12071205 viewerImages.postValue(ArrayList(viewerImagesInternal))
1206+ if (setIndex) setViewerStartingIndex(viewerIndex + 1)
12081207 }
12091208 }
12101209
You can’t perform that action at this time.
0 commit comments