mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
Simplify scroll listeners
This commit is contained in:
parent
22dce72e95
commit
f6a42cc8a0
@ -91,9 +91,7 @@ class ChannelFragment : BaseFragment() {
|
||||
|
||||
binding.channelScrollView.viewTreeObserver
|
||||
.addOnScrollChangedListener {
|
||||
if (binding.channelScrollView.getChildAt(0).bottom
|
||||
== (binding.channelScrollView.height + binding.channelScrollView.scrollY)
|
||||
) {
|
||||
if (!binding.channelScrollView.canScrollVertically(1)) {
|
||||
try {
|
||||
onScrollEnd.invoke()
|
||||
} catch (e: Exception) {
|
||||
|
@ -212,9 +212,7 @@ class PlaylistFragment : BaseFragment() {
|
||||
binding.playlistRecView.adapter = playlistAdapter
|
||||
binding.playlistScrollview.viewTreeObserver
|
||||
.addOnScrollChangedListener {
|
||||
if (binding.playlistScrollview.getChildAt(0).bottom
|
||||
== (binding.playlistScrollview.height + binding.playlistScrollview.scrollY)
|
||||
) {
|
||||
if (!binding.playlistScrollview.canScrollVertically(1)) {
|
||||
if (isLoading) return@addOnScrollChangedListener
|
||||
|
||||
// append more playlists to the recycler view
|
||||
|
@ -137,9 +137,7 @@ class SubscriptionsFragment : BaseFragment() {
|
||||
|
||||
binding.scrollviewSub.viewTreeObserver
|
||||
.addOnScrollChangedListener {
|
||||
if (binding.scrollviewSub.getChildAt(0).bottom
|
||||
== (binding.scrollviewSub.height + binding.scrollviewSub.scrollY)
|
||||
) {
|
||||
if (!binding.scrollviewSub.canScrollVertically(1)) {
|
||||
// scroll view is at bottom
|
||||
if (viewModel.videoFeed.value == null) return@addOnScrollChangedListener
|
||||
binding.subRefresh.isRefreshing = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user