fix: popup spam

This commit is contained in:
rebelonion 2024-03-10 03:59:24 -05:00
parent 913d74b285
commit 867a4f36b3

View file

@ -176,10 +176,10 @@ class CommentsFragment : Fragment() {
object : View.OnTouchListener { object : View.OnTouchListener {
override fun onTouch(v: View?, event: MotionEvent?): Boolean { override fun onTouch(v: View?, event: MotionEvent?): Boolean {
if (event?.action == MotionEvent.ACTION_UP) { if (event?.action == MotionEvent.ACTION_UP) {
if (pagesLoaded < totalPages) {
if (!binding.commentsList.canScrollVertically(1) && !isFetching && if (!binding.commentsList.canScrollVertically(1) && !isFetching &&
(binding.commentsList.layoutManager as LinearLayoutManager).findLastVisibleItemPosition() == (binding.commentsList.adapter!!.itemCount - 1) (binding.commentsList.layoutManager as LinearLayoutManager).findLastVisibleItemPosition() == (binding.commentsList.adapter!!.itemCount - 1)
) { ) {
if (pagesLoaded < totalPages) {
binding.commentBottomRefresh.visibility = View.VISIBLE binding.commentBottomRefresh.visibility = View.VISIBLE
loadMoreComments() loadMoreComments()
lifecycleScope.launch { lifecycleScope.launch {
@ -188,11 +188,11 @@ class CommentsFragment : Fragment() {
binding.commentBottomRefresh.visibility = View.GONE binding.commentBottomRefresh.visibility = View.GONE
} }
} }
}
} else { } else {
snackString("No more comments") snackString("No more comments")
} }
} }
}
return false return false
} }