Skip to content

Commit

Permalink
Reader : Fix page details panel showing up (cont'ed)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbWatershed committed Dec 3, 2024
1 parent 9324e15 commit ed53366
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ class ImagePagerAdapter(context: Context) :
this.isScrollLTR = isScrollLTR
}

fun adjustBehaviourForPosition(position: Int) {
fun adjustBehaviourForPosition(position: Int, immediate : Boolean = false) {
recyclerView?.lifecycleScope?.launch {
withContext(Dispatchers.Default) {
// Account for items being refreshed just after that call
// NB : A cleaner implementation would be to intercept all notifyxxxChanged calls and set a debouncer on them,
// but it would add complexity for little perceived value
pause(500)
if (!immediate) {
withContext(Dispatchers.Default) {
// Account for items being refreshed just after that call
// NB : A cleaner implementation would be to intercept all notifyxxxChanged calls and set a debouncer on them,
// but it would add complexity for little perceived value
pause(500)
}
}
(recyclerView?.findViewHolderForAdapterPosition(position) as ImageViewHolder?)?.apply {
Timber.d("adjustBehaviourForPosition $position")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ class ReaderPagerFragment : Fragment(R.layout.fragment_reader_pager),
adjustDisplay(bookPreferences, absImageIndex)
}
}
adapter.adjustBehaviourForPosition(absImageIndex, true)
if (VIEWER_ORIENTATION_VERTICAL == displayParams?.orientation)
slideshowMgr.onPageChange(true)
viewModel.onPageChange(absImageIndex, scrollDirection)
Expand All @@ -886,7 +887,7 @@ class ReaderPagerFragment : Fragment(R.layout.fragment_reader_pager),
private fun onScrollPositionReached(position: Int) {
if (position == absImageIndex || position == reachedPosition) return
reachedPosition = position
adapter.adjustBehaviourForPosition(position)
adapter.adjustBehaviourForPosition(position, true)
}

/**
Expand Down

0 comments on commit ed53366

Please sign in to comment.