diff --git a/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt
index 1e282cbf3..f2c26f449 100644
--- a/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/CommentsMainFragment.kt
@@ -55,7 +55,7 @@ class CommentsMainFragment : Fragment() {
commentsSheet?.binding?.btnScrollToTop?.isVisible = viewModel.currentCommentsPosition != 0
if (!viewBinding.commentsRV.canScrollVertically(1)) {
- viewModel.fetchNextComments()
+ viewModel.fetchNextComments(requireContext())
}
}
commentsSheet?.updateFragmentInfo(false, getString(R.string.comments))
diff --git a/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt
index a4f721f01..88ee2ed8a 100644
--- a/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt
+++ b/app/src/main/java/com/github/libretube/ui/fragments/CommentsRepliesFragment.kt
@@ -5,6 +5,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.Toast
import androidx.core.view.isGone
import androidx.core.view.isVisible
import androidx.core.view.updatePadding
@@ -78,10 +79,12 @@ class CommentsRepliesFragment : Fragment() {
binding.commentsRV.adapter = repliesAdapter
binding.commentsRV.viewTreeObserver.addOnScrollChangedListener {
- if (_binding?.commentsRV?.canScrollVertically(1) == false &&
- ::repliesPage.isInitialized &&
- repliesPage.nextpage != null
- ) {
+ if (_binding?.commentsRV?.canScrollVertically(1) == false && ::repliesPage.isInitialized) {
+ if (repliesPage.nextpage == null) {
+ Toast.makeText(context, R.string.bottom_reached, Toast.LENGTH_SHORT).show()
+ return@addOnScrollChangedListener
+ }
+
fetchReplies(videoId, repliesPage.nextpage!!)
}
}
diff --git a/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt b/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt
index c488dab0a..6dc47a2d8 100644
--- a/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt
+++ b/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt
@@ -1,12 +1,16 @@
package com.github.libretube.ui.models
+import android.content.Context
import android.util.Log
+import android.widget.Toast
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
+import com.github.libretube.R
import com.github.libretube.api.RetrofitInstance
import com.github.libretube.api.obj.CommentsPage
import com.github.libretube.extensions.TAG
+import com.github.libretube.extensions.toastFromMainDispatcher
import com.github.libretube.ui.extensions.filterNonEmptyComments
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -54,7 +58,11 @@ class CommentsViewModel : ViewModel() {
}
}
- fun fetchNextComments() {
+ fun fetchNextComments(context: Context) {
+ if (nextPage == null) {
+ Toast.makeText(context, R.string.bottom_reached, Toast.LENGTH_SHORT).show()
+ }
+
if (isLoading.value == true || nextPage == null || videoId == null) return
isLoading.value = true
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 4d2d67cd0..a7f66b5de 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -495,6 +495,7 @@
Successfully removed \"%1$s\" from the playlist.
Watched
There are no segments for this video yet.
+ Bottom reached!
Download Service