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