Jump to top if swipe/refresh while preferring newest-first order

This commit is contained in:
Nik Clayton 2022-12-12 13:31:18 +01:00
parent edaa54b9d8
commit 1480c6aa3a
No known key found for this signature in database
GPG Key ID: 25CE4DAD1F5DD164
1 changed files with 3 additions and 1 deletions

View File

@ -237,7 +237,9 @@ class TimelineFragment :
if (positionStart == 0 && adapter.itemCount != itemCount) {
binding.recyclerView.post {
if (getView() != null) {
if (isSwipeToRefreshEnabled) {
// Swiping and prefer oldest-first? Stay at the same position.
// Otherwise jump to the top.
if (isSwipeToRefreshEnabled && readingOrder == ReadingOrder.OLDEST_FIRST) {
binding.recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30))
} else binding.recyclerView.scrollToPosition(0)
}