mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 22:00:30 +05:30
Load channels only once
This commit is contained in:
parent
6a69fef2b6
commit
a3cec2027c
@ -17,6 +17,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import com.github.libretube.adapters.SubscriptionAdapter
|
import com.github.libretube.adapters.SubscriptionAdapter
|
||||||
import com.github.libretube.adapters.SubscriptionChannelAdapter
|
import com.github.libretube.adapters.SubscriptionChannelAdapter
|
||||||
|
import org.chromium.base.ThreadUtils.runOnUiThread
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
@ -67,10 +68,14 @@ class Subscriptions : Fragment() {
|
|||||||
|
|
||||||
var toggleSubs = view.findViewById<RelativeLayout>(R.id.toggle_subs)
|
var toggleSubs = view.findViewById<RelativeLayout>(R.id.toggle_subs)
|
||||||
toggleSubs.visibility = View.VISIBLE
|
toggleSubs.visibility = View.VISIBLE
|
||||||
|
var loadedSubbedChannels = false
|
||||||
toggleSubs.setOnClickListener {
|
toggleSubs.setOnClickListener {
|
||||||
if (!channelRecView.isVisible) {
|
if (!channelRecView.isVisible) {
|
||||||
|
if (!loadedSubbedChannels) {
|
||||||
channelRecView?.layoutManager = GridLayoutManager(context, 4)
|
channelRecView?.layoutManager = GridLayoutManager(context, 4)
|
||||||
fetchChannels(channelRecView)
|
fetchChannels(channelRecView)
|
||||||
|
loadedSubbedChannels = true
|
||||||
|
}
|
||||||
channelRecView.visibility = View.VISIBLE
|
channelRecView.visibility = View.VISIBLE
|
||||||
feedRecView.visibility = View.GONE
|
feedRecView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
android:id="@+id/toggle_subs"
|
android:id="@+id/toggle_subs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="12dp"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
Loading…
Reference in New Issue
Block a user