mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
fix subscriptions
This commit is contained in:
parent
cd43515277
commit
e3f538422e
@ -19,8 +19,17 @@ class SubscriptionAdapter(
|
||||
) : RecyclerView.Adapter<SubscriptionViewHolder>() {
|
||||
private val TAG = "SubscriptionAdapter"
|
||||
|
||||
var i = 0
|
||||
override fun getItemCount(): Int {
|
||||
return videoFeed.size
|
||||
return i
|
||||
}
|
||||
|
||||
fun updateItems() {
|
||||
i += 10
|
||||
if (i > videoFeed.size) {
|
||||
i = videoFeed.size
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SubscriptionViewHolder {
|
||||
|
@ -85,6 +85,20 @@ class SubscriptionsFragment : Fragment() {
|
||||
binding.subFeed.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
binding.scrollviewSub.viewTreeObserver
|
||||
.addOnScrollChangedListener {
|
||||
if (binding.scrollviewSub.getChildAt(0).bottom
|
||||
== (binding.scrollviewSub.height + binding.scrollviewSub.scrollY)
|
||||
) {
|
||||
// scroll view is at bottom
|
||||
if (isLoaded) {
|
||||
binding.subRefresh.isRefreshing = true
|
||||
subscriptionAdapter?.updateItems()
|
||||
binding.subRefresh.isRefreshing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
binding.subRefresh.isEnabled = false
|
||||
}
|
||||
@ -108,6 +122,7 @@ class SubscriptionsFragment : Fragment() {
|
||||
if (response.isNotEmpty()) {
|
||||
subscriptionAdapter = SubscriptionAdapter(response, childFragmentManager)
|
||||
feedRecView.adapter = subscriptionAdapter
|
||||
subscriptionAdapter?.updateItems()
|
||||
} else {
|
||||
runOnUiThread {
|
||||
with(binding.boogh) {
|
||||
|
@ -94,18 +94,33 @@
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/sub_channels"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:visibility="gone" />
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/sub_feed"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/sub_channels"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/sub_feed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</com.github.libretube.views.CustomSwipeToRefresh>
|
||||
|
Loading…
x
Reference in New Issue
Block a user