mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
Fix [ChannelFragment]: resolve stuttering at bottom of scroll
-Removed ScrollView. RecyclerView itself handles scrolling, nesting it inside a ScrollView is possibly leading to conflicting scrolling behavior effecting performance(i.e stuttering when scrolling at bottom and updating list with new data items). -Used AppBarLayout and CollapsingToolbarLayout as containers for content(banner etc) above list of videos items. Together with CoordinatorLayout, these components streamline scrolling behavior and UI interactions with each other and RecyclerView.
This commit is contained in:
parent
85bd7a951e
commit
5d65725ead
@ -90,10 +90,10 @@ class ChannelFragment : DynamicLayoutManagerFragment() {
|
||||
fetchChannel()
|
||||
}
|
||||
|
||||
binding.channelScrollView.viewTreeObserver.addOnScrollChangedListener {
|
||||
binding.channelRecView.viewTreeObserver.addOnScrollChangedListener {
|
||||
val binding = _binding ?: return@addOnScrollChangedListener
|
||||
|
||||
if (binding.channelScrollView.canScrollVertically(1) || isLoading) return@addOnScrollChangedListener
|
||||
if (binding.channelRecView.canScrollVertically(1) || isLoading) return@addOnScrollChangedListener
|
||||
|
||||
loadNextPage()
|
||||
}
|
||||
@ -199,7 +199,6 @@ class ChannelFragment : DynamicLayoutManagerFragment() {
|
||||
isLoading = false
|
||||
binding.channelRefresh.isRefreshing = false
|
||||
|
||||
binding.channelScrollView.isVisible = true
|
||||
binding.channelName.text = response.name
|
||||
if (response.verified) {
|
||||
binding.channelName
|
||||
|
@ -6,18 +6,27 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/channel_scrollView"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="invisible"
|
||||
tools:context=".ui.fragments.ChannelFragment">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/channel_app_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
||||
android:id="@+id/channel_collapsing_tb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_scrollFlags="scroll"
|
||||
app:titleCollapseMode="scale">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
app:layout_collapseMode="pin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/channel_banner"
|
||||
@ -72,15 +81,15 @@
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/channel_share"
|
||||
android:tooltipText="@string/share"
|
||||
style="@style/ElevatedIconButton"
|
||||
android:tooltipText="@string/share"
|
||||
app:icon="@drawable/ic_share"
|
||||
tools:targetApi="m" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/notification_bell"
|
||||
android:tooltipText="@string/notifications"
|
||||
style="@style/ElevatedIconButton"
|
||||
android:tooltipText="@string/notifications"
|
||||
app:icon="@drawable/ic_notification"
|
||||
tools:targetApi="m" />
|
||||
|
||||
@ -153,18 +162,17 @@
|
||||
|
||||
</HorizontalScrollView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/channel_recView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
</com.github.libretube.ui.views.CustomSwipeToRefresh>
|
||||
|
Loading…
x
Reference in New Issue
Block a user