mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-13 13:50:30 +05:30
Lazy Load Subs and hide when not logged in
This commit is contained in:
parent
229fd46675
commit
395720a882
@ -8,6 +8,7 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
@ -52,8 +53,6 @@ class Subscriptions : Fragment() {
|
||||
progressBar.visibility=View.VISIBLE
|
||||
|
||||
var channelRecView = view.findViewById<RecyclerView>(R.id.sub_channels)
|
||||
channelRecView?.layoutManager = GridLayoutManager(context, 4)
|
||||
fetchChannels(channelRecView)
|
||||
|
||||
var feedRecView = view.findViewById<RecyclerView>(R.id.sub_feed)
|
||||
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(requireContext())
|
||||
@ -67,9 +66,18 @@ class Subscriptions : Fragment() {
|
||||
}
|
||||
|
||||
var toggleSubs = view.findViewById<RelativeLayout>(R.id.toggle_subs)
|
||||
toggleSubs.visibility = View.VISIBLE
|
||||
toggleSubs.setOnClickListener {
|
||||
channelRecView.visibility = if (channelRecView.visibility == View.GONE) View.VISIBLE else View.GONE
|
||||
feedRecView.visibility = if (feedRecView.visibility == View.GONE) View.VISIBLE else View.GONE
|
||||
if (!channelRecView.isVisible) {
|
||||
channelRecView?.layoutManager = GridLayoutManager(context, 4)
|
||||
fetchChannels(channelRecView)
|
||||
channelRecView.visibility = View.VISIBLE
|
||||
feedRecView.visibility = View.GONE
|
||||
}
|
||||
else {
|
||||
channelRecView.visibility = View.GONE
|
||||
feedRecView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
val scrollView = view.findViewById<ScrollView>(R.id.scrollview_sub)
|
||||
|
@ -58,7 +58,8 @@
|
||||
android:id="@+id/toggle_subs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp">
|
||||
android:layout_margin="10dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user