mirror of
https://github.com/recloudstream/cloudstream.git
synced 2026-03-13 15:19:43 +08:00
Fixed shared pool, closes #2082
This commit is contained in:
@@ -234,19 +234,8 @@ object CommonActivity {
|
||||
fun init(act: Activity) {
|
||||
setActivityInstance(act)
|
||||
ioSafe { Torrent.deleteAllFiles() }
|
||||
|
||||
// Clear all pools to apply the correct theme
|
||||
for (pool in arrayOf(
|
||||
PluginAdapter.sharedPool, HomeChildItemAdapter.sharedPool,
|
||||
ParentItemAdapter.sharedPool, ActorAdaptor.sharedPool, EpisodeAdapter.sharedPool,
|
||||
SearchAdapter.sharedPool, ImageAdapter.sharedPool
|
||||
)) {
|
||||
pool.clear()
|
||||
}
|
||||
|
||||
val componentActivity = activity as? ComponentActivity ?: return
|
||||
|
||||
|
||||
componentActivity.updateLocale()
|
||||
componentActivity.updateTv()
|
||||
AccountManager.initMainAPI()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.lagradost.cloudstream3.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
@@ -11,6 +12,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import coil3.dispose
|
||||
import java.util.WeakHashMap
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
open class ViewHolderState<T>(val view: ViewBinding) : ViewHolder(view.root) {
|
||||
@@ -22,6 +24,33 @@ abstract class NoStateAdapter<T : Any>(
|
||||
diffCallback: DiffUtil.ItemCallback<T> = BaseDiffCallback()
|
||||
) : BaseAdapter<T, Any>(0, diffCallback)
|
||||
|
||||
/** Creates a new shared pool, using the supplied lambda as a constructor.
|
||||
*
|
||||
* The reason for this complicated structure is that a pool should not be shared between contexts
|
||||
* as it makes coil fuck up, and theming.
|
||||
* */
|
||||
fun newSharedPool(lambda: RecyclerView.RecycledViewPool.() -> Unit = { }): Pair<WeakHashMap<Context, RecyclerView.RecycledViewPool>, RecyclerView.RecycledViewPool.() -> Unit> =
|
||||
WeakHashMap<Context, RecyclerView.RecycledViewPool>() to lambda
|
||||
|
||||
/** Sets the shared pool of the recyclerview */
|
||||
fun RecyclerView.setRecycledViewPool(pool: Pair<WeakHashMap<Context, RecyclerView.RecycledViewPool>, RecyclerView.RecycledViewPool.() -> Unit>) {
|
||||
val ctx = context ?: return
|
||||
synchronized(pool.first) {
|
||||
this.setRecycledViewPool(pool.first.getOrPut(ctx) {
|
||||
RecyclerView.RecycledViewPool().apply(pool.second)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/** Clears the shared pool of views */
|
||||
fun Pair<WeakHashMap<Context, RecyclerView.RecycledViewPool>, RecyclerView.RecycledViewPool.() -> Unit>.clear() {
|
||||
synchronized(this.first) {
|
||||
for (pool in this.first.values) {
|
||||
pool?.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* BaseAdapter is a persistent state stored adapter that supports headers and footers.
|
||||
* This should be used for restoring eg scroll or focus related to a view when it is recreated.
|
||||
|
||||
@@ -5,12 +5,8 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import coil3.load
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.SearchResponse
|
||||
import com.lagradost.cloudstream3.databinding.HomeRemoveGridBinding
|
||||
@@ -20,6 +16,7 @@ import com.lagradost.cloudstream3.databinding.HomeResultGridExpandedBinding
|
||||
import com.lagradost.cloudstream3.ui.BaseAdapter
|
||||
import com.lagradost.cloudstream3.ui.BaseDiffCallback
|
||||
import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_LOAD
|
||||
import com.lagradost.cloudstream3.ui.search.SearchClickCallback
|
||||
import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
|
||||
@@ -165,7 +162,7 @@ open class HomeChildItemAdapter(
|
||||
// The vast majority of the lag comes from creating the view
|
||||
// This simply shares the views between all HomeChildItemAdapter
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool().apply { this.setMaxRecycledViews(CONTENT, 20) }
|
||||
newSharedPool { setMaxRecycledViews(CONTENT, 20) }
|
||||
|
||||
var minPosterSize: Int = 0
|
||||
var maxPosterSize: Int = 0
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_LOAD
|
||||
import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_PLAY_FILE
|
||||
import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper.handleSearchClickCallback
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
|
||||
@@ -6,10 +6,8 @@ import android.os.Parcelable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.lagradost.cloudstream3.HomePageList
|
||||
import com.lagradost.cloudstream3.LoadResponse
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.databinding.HomepageParentBinding
|
||||
@@ -17,9 +15,11 @@ import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.ui.BaseAdapter
|
||||
import com.lagradost.cloudstream3.ui.BaseDiffCallback
|
||||
import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
|
||||
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
|
||||
import com.lagradost.cloudstream3.ui.search.SearchClickCallback
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
@@ -48,7 +48,7 @@ open class ParentItemAdapter(
|
||||
) {
|
||||
companion object {
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool().apply { this.setMaxRecycledViews(CONTENT, 4) }
|
||||
newSharedPool { setMaxRecycledViews(CONTENT, 4) }
|
||||
}
|
||||
|
||||
data class ParentItemHolder(val binding: ViewBinding) : ViewHolderState<Bundle>(binding) {
|
||||
|
||||
@@ -60,6 +60,7 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbarMargin
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbarView
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.populateChips
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
|
||||
class HomeParentItemAdapterPreview(
|
||||
val fragment: LifecycleOwner,
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.lagradost.cloudstream3.HomePageList
|
||||
import com.lagradost.cloudstream3.LoadResponse
|
||||
import com.lagradost.cloudstream3.MainAPI
|
||||
import com.lagradost.cloudstream3.MainActivity
|
||||
import com.lagradost.cloudstream3.MainActivity.Companion.lastError
|
||||
import com.lagradost.cloudstream3.SearchResponse
|
||||
import com.lagradost.cloudstream3.amap
|
||||
import com.lagradost.cloudstream3.mvvm.Resource
|
||||
@@ -57,7 +56,6 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.util.EnumSet
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
import kotlin.collections.set
|
||||
|
||||
class HomeViewModel : ViewModel() {
|
||||
companion object {
|
||||
@@ -518,9 +516,6 @@ class HomeViewModel : ViewModel() {
|
||||
return@ioSafe
|
||||
}
|
||||
|
||||
HomeChildItemAdapter.sharedPool.clear()
|
||||
ParentItemAdapter.sharedPool.clear()
|
||||
|
||||
val api = getApiFromNameNull(preferredApiName)
|
||||
if (preferredApiName == noneApi.name) {
|
||||
// just set to random
|
||||
|
||||
@@ -90,6 +90,7 @@ import com.lagradost.cloudstream3.ui.result.ResultFragment
|
||||
import com.lagradost.cloudstream3.ui.result.ResultViewModel2
|
||||
import com.lagradost.cloudstream3.ui.result.SyncViewModel
|
||||
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
@@ -128,7 +129,6 @@ import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.Serializable
|
||||
import java.util.Calendar
|
||||
import kotlin.math.abs
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
class GeneratorPlayer : FullScreenPlayer() {
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchClickCallback
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||
import com.lagradost.cloudstream3.ui.search.SearchViewModel
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lagradost.cloudstream3.ActorData
|
||||
import com.lagradost.cloudstream3.ActorRole
|
||||
import com.lagradost.cloudstream3.R
|
||||
@@ -14,6 +13,7 @@ import com.lagradost.cloudstream3.databinding.CastItemBinding
|
||||
import com.lagradost.cloudstream3.ui.BaseDiffCallback
|
||||
import com.lagradost.cloudstream3.ui.NoStateAdapter
|
||||
import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
||||
@@ -26,7 +26,7 @@ class ActorAdaptor(
|
||||
})) {
|
||||
companion object {
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool().apply { this.setMaxRecycledViews(CONTENT, 10) }
|
||||
newSharedPool { setMaxRecycledViews(CONTENT, 10) }
|
||||
}
|
||||
|
||||
// Easier to store it here than to store it in the ActorData
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.lagradost.cloudstream3.ui.result
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
@@ -8,8 +7,6 @@ import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.setPadding
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil3.dispose
|
||||
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||
import com.lagradost.cloudstream3.CommonActivity
|
||||
@@ -24,6 +21,7 @@ import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD
|
||||
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_LONG_CLICK
|
||||
import com.lagradost.cloudstream3.ui.download.DownloadClickEvent
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
@@ -93,11 +91,10 @@ class EpisodeAdapter(
|
||||
}
|
||||
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool()
|
||||
.apply {
|
||||
this.setMaxRecycledViews(HAS_POSTER or CONTENT, 10)
|
||||
this.setMaxRecycledViews(HAS_NO_POSTER or CONTENT, 10)
|
||||
}
|
||||
newSharedPool {
|
||||
setMaxRecycledViews(HAS_POSTER or CONTENT, 10)
|
||||
setMaxRecycledViews(HAS_NO_POSTER or CONTENT, 10)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClearView(holder: ViewHolderState<Any>) {
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.lagradost.cloudstream3.ui.result
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lagradost.cloudstream3.databinding.ResultMiniImageBinding
|
||||
import com.lagradost.cloudstream3.ui.BaseDiffCallback
|
||||
import com.lagradost.cloudstream3.ui.NoStateAdapter
|
||||
import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
||||
@@ -27,7 +27,7 @@ class ImageAdapter(
|
||||
) {
|
||||
companion object {
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool().apply { this.setMaxRecycledViews(CONTENT, 10) }
|
||||
newSharedPool { setMaxRecycledViews(CONTENT, 10) }
|
||||
}
|
||||
|
||||
override fun onCreateContent(parent: ViewGroup): ViewHolderState<Any> {
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.discord.panels.PanelState
|
||||
import com.discord.panels.PanelsChildGestureRegionObserver
|
||||
import com.google.android.gms.cast.framework.CastButtonFactory
|
||||
import com.google.android.gms.cast.framework.CastContext
|
||||
import com.google.android.gms.cast.framework.CastState
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.lagradost.cloudstream3.APIHolder
|
||||
@@ -66,6 +65,7 @@ import com.lagradost.cloudstream3.ui.result.ResultFragment.getStoredData
|
||||
import com.lagradost.cloudstream3.ui.result.ResultFragment.updateUIEvent
|
||||
import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.utils.AppContextUtils.getNameFull
|
||||
import com.lagradost.cloudstream3.utils.AppContextUtils.isCastApiAvailable
|
||||
import com.lagradost.cloudstream3.utils.AppContextUtils.loadCache
|
||||
@@ -88,9 +88,9 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.popCurrentPage
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.populateChips
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
|
||||
import com.lagradost.cloudstream3.utils.downloader.DownloadObjects
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.setListViewHeightBasedOnItems
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.setNavigationBarColorCompat
|
||||
import com.lagradost.cloudstream3.utils.downloader.DownloadObjects
|
||||
import com.lagradost.cloudstream3.utils.downloader.VideoDownloadManager
|
||||
import com.lagradost.cloudstream3.utils.getImageFromDrawable
|
||||
import com.lagradost.cloudstream3.utils.setText
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.lagradost.cloudstream3.ui.result.ResultFragment.updateUIEvent
|
||||
import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_FOCUSED
|
||||
import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchHelper
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
@@ -61,7 +62,6 @@ import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.populateChips
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.setNavigationBarColorCompat
|
||||
import com.lagradost.cloudstream3.utils.UiImage
|
||||
import com.lagradost.cloudstream3.utils.getImageFromDrawable
|
||||
import com.lagradost.cloudstream3.utils.setText
|
||||
import com.lagradost.cloudstream3.utils.setTextHtml
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lagradost.cloudstream3.SearchResponse
|
||||
import com.lagradost.cloudstream3.databinding.SearchResultGridBinding
|
||||
import com.lagradost.cloudstream3.databinding.SearchResultGridExpandedBinding
|
||||
@@ -12,6 +11,7 @@ import com.lagradost.cloudstream3.ui.AutofitRecyclerView
|
||||
import com.lagradost.cloudstream3.ui.BaseDiffCallback
|
||||
import com.lagradost.cloudstream3.ui.NoStateAdapter
|
||||
import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.isBottomLayout
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@@ -43,7 +43,7 @@ class SearchAdapter(
|
||||
})) {
|
||||
companion object {
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool().apply { this.setMaxRecycledViews(CONTENT, 10) }
|
||||
newSharedPool { setMaxRecycledViews(CONTENT, 10) }
|
||||
}
|
||||
|
||||
var hasNext: Boolean = false
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.lagradost.cloudstream3.ui.home.HomeViewModel
|
||||
import com.lagradost.cloudstream3.ui.home.ParentItemAdapter
|
||||
import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
|
||||
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
|
||||
@@ -12,13 +12,13 @@ import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.SearchQuality
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.ui.BasePreferenceFragmentCompat
|
||||
import com.lagradost.cloudstream3.ui.clear
|
||||
import com.lagradost.cloudstream3.ui.home.HomeChildItemAdapter
|
||||
import com.lagradost.cloudstream3.ui.home.ParentItemAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchAdapter
|
||||
import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.PHONE
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.updateTv
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.getPref
|
||||
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.hideOn
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewbinding.ViewBinding
|
||||
import com.lagradost.cloudstream3.CloudStreamApp.Companion.getActivity
|
||||
import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN
|
||||
@@ -16,15 +15,13 @@ import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.TvType
|
||||
import com.lagradost.cloudstream3.databinding.RepositoryItemBinding
|
||||
import com.lagradost.cloudstream3.plugins.PluginManager
|
||||
import com.lagradost.cloudstream3.plugins.VotingApi.getVotes
|
||||
import com.lagradost.cloudstream3.ui.BaseDiffCallback
|
||||
import com.lagradost.cloudstream3.ui.NoStateAdapter
|
||||
import com.lagradost.cloudstream3.ui.ViewHolderState
|
||||
import com.lagradost.cloudstream3.ui.newSharedPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
import com.lagradost.cloudstream3.utils.AppContextUtils.html
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
|
||||
import com.lagradost.cloudstream3.utils.Coroutines.main
|
||||
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
|
||||
import com.lagradost.cloudstream3.utils.SubtitleHelper.getNameNextToFlagEmoji
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||
@@ -204,7 +201,7 @@ class PluginAdapter(
|
||||
companion object {
|
||||
// A high count as we can render in the entire list as the same time
|
||||
val sharedPool =
|
||||
RecyclerView.RecycledViewPool().apply { this.setMaxRecycledViews(CONTENT, 15) }
|
||||
newSharedPool { setMaxRecycledViews(CONTENT, 15) }
|
||||
|
||||
private tailrec fun findClosestBase2(target: Int, current: Int = 16, max: Int = 512): Int {
|
||||
if (current >= max) return max
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.lagradost.cloudstream3.ui.BaseFragment
|
||||
import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.bindChips
|
||||
import com.lagradost.cloudstream3.ui.result.FOCUS_SELF
|
||||
import com.lagradost.cloudstream3.ui.result.setLinearListLayout
|
||||
import com.lagradost.cloudstream3.ui.setRecycledViewPool
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.EMULATOR
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.TV
|
||||
import com.lagradost.cloudstream3.ui.settings.Globals.isLayout
|
||||
|
||||
Reference in New Issue
Block a user