1
0
mirror of https://github.com/accelforce/Yuito synced 2024-12-26 07:42:42 +01:00

Fix crash in TimelineFragment (#2317)

This commit is contained in:
Konrad Pozniak 2022-02-07 20:04:40 +01:00 committed by GitHub
parent db1cc02fb8
commit d2d52da717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -208,12 +208,14 @@ class TimelineFragment :
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) { override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
if (positionStart == 0 && adapter.itemCount != itemCount) { if (positionStart == 0 && adapter.itemCount != itemCount) {
binding.recyclerView.post { binding.recyclerView.post {
if (getView() != null) {
if (isSwipeToRefreshEnabled) { if (isSwipeToRefreshEnabled) {
binding.recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30)) binding.recyclerView.scrollBy(0, Utils.dpToPx(requireContext(), -30))
} else binding.recyclerView.scrollToPosition(0) } else binding.recyclerView.scrollToPosition(0)
} }
} }
} }
}
}) })
lifecycleScope.launch { lifecycleScope.launch {