mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix library bug and remove it from TV
This commit is contained in:
parent
daaab9d35b
commit
20ada8da0d
5 changed files with 20 additions and 9 deletions
|
@ -439,6 +439,11 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
|
|
||||||
nav_view?.isVisible = isNavVisible && !landscape
|
nav_view?.isVisible = isNavVisible && !landscape
|
||||||
nav_rail_view?.isVisible = isNavVisible && landscape
|
nav_rail_view?.isVisible = isNavVisible && landscape
|
||||||
|
|
||||||
|
// Hide library on TV since it is not supported yet :(
|
||||||
|
val isTrueTv = isTrueTvSettings()
|
||||||
|
nav_view?.menu?.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
||||||
|
nav_rail_view?.menu?.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
||||||
}
|
}
|
||||||
|
|
||||||
//private var mCastSession: CastSession? = null
|
//private var mCastSession: CastSession? = null
|
||||||
|
|
|
@ -7,7 +7,8 @@ import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
class GrdLayoutManager(val context: Context, _spanCount: Int) : GridLayoutManager(context, _spanCount) {
|
class GrdLayoutManager(val context: Context, _spanCount: Int) :
|
||||||
|
GridLayoutManager(context, _spanCount) {
|
||||||
override fun onFocusSearchFailed(
|
override fun onFocusSearchFailed(
|
||||||
focused: View,
|
focused: View,
|
||||||
focusDirection: Int,
|
focusDirection: Int,
|
||||||
|
@ -34,7 +35,7 @@ class GrdLayoutManager(val context: Context, _spanCount: Int) : GridLayoutManage
|
||||||
val pos = maxOf(0, getPosition(focused!!) - 2)
|
val pos = maxOf(0, getPosition(focused!!) - 2)
|
||||||
parent.scrollToPosition(pos)
|
parent.scrollToPosition(pos)
|
||||||
super.onRequestChildFocus(parent, state, child, focused)
|
super.onRequestChildFocus(parent, state, child, focused)
|
||||||
} catch (e: Exception){
|
} catch (e: Exception) {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ class PageAdapter(
|
||||||
|
|
||||||
// See searchAdaptor for this, it basically fixes the height
|
// See searchAdaptor for this, it basically fixes the height
|
||||||
if (!compactView) {
|
if (!compactView) {
|
||||||
// println("HEIGHT $coverHeight")
|
|
||||||
cardView.apply {
|
cardView.apply {
|
||||||
layoutParams = FrameLayout.LayoutParams(
|
layoutParams = FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.os.Build
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.view.doOnAttach
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import androidx.recyclerview.widget.RecyclerView.OnFlingListener
|
import androidx.recyclerview.widget.RecyclerView.OnFlingListener
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
@ -36,13 +37,19 @@ class ViewpagerAdapter(
|
||||||
RecyclerView.ViewHolder(itemViewTest) {
|
RecyclerView.ViewHolder(itemViewTest) {
|
||||||
fun bind(page: SyncAPI.Page) {
|
fun bind(page: SyncAPI.Page) {
|
||||||
if (itemViewTest.page_recyclerview?.adapter == null) {
|
if (itemViewTest.page_recyclerview?.adapter == null) {
|
||||||
|
itemView.page_recyclerview?.spanCount =
|
||||||
|
this@PageViewHolder.itemView.context.getSpanCount() ?: 3
|
||||||
|
|
||||||
|
// Only add the items after it has been attached since the items rely on ItemWidth
|
||||||
|
// Which is only determined after the recyclerview is attached.
|
||||||
|
// If this fails then item height becomes 0 when there is only one item
|
||||||
|
itemViewTest.page_recyclerview?.doOnAttach {
|
||||||
itemViewTest.page_recyclerview?.adapter = PageAdapter(
|
itemViewTest.page_recyclerview?.adapter = PageAdapter(
|
||||||
page.items.toMutableList(),
|
page.items.toMutableList(),
|
||||||
itemViewTest.page_recyclerview,
|
itemViewTest.page_recyclerview,
|
||||||
clickCallback
|
clickCallback
|
||||||
)
|
)
|
||||||
itemView.page_recyclerview?.spanCount =
|
}
|
||||||
this@PageViewHolder.itemView.context.getSpanCount() ?: 3
|
|
||||||
} else {
|
} else {
|
||||||
(itemViewTest.page_recyclerview?.adapter as? PageAdapter)?.updateList(page.items)
|
(itemViewTest.page_recyclerview?.adapter as? PageAdapter)?.updateList(page.items)
|
||||||
itemViewTest.page_recyclerview?.scrollToPosition(0)
|
itemViewTest.page_recyclerview?.scrollToPosition(0)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_home"
|
android:id="@+id/navigation_home"
|
||||||
android:icon="@drawable/home_alt"
|
android:icon="@drawable/home_alt"
|
||||||
|
|
Loading…
Reference in a new issue