Fix images in plugins list

This commit is contained in:
Blatzar 2022-08-11 18:54:21 +02:00
parent 46b88ba094
commit 0ca6c2a6e6
2 changed files with 18 additions and 2 deletions

View file

@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView
import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.plugins.PluginManager import com.lagradost.cloudstream3.plugins.PluginManager
import com.lagradost.cloudstream3.utils.GlideApp
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.utils.UIHelper.setImage
import kotlinx.android.synthetic.main.repository_item.view.* import kotlinx.android.synthetic.main.repository_item.view.*
@ -61,6 +62,14 @@ class PluginAdapter(
return PluginManager.getPluginsOnline().also { storedPlugins = it } return PluginManager.getPluginsOnline().also { storedPlugins = it }
}*/ }*/
// Clear glide image because setImageResource doesn't override
override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
holder.itemView.entry_icon?.let { pluginIcon ->
GlideApp.with(pluginIcon).clear(pluginIcon)
}
super.onViewRecycled(holder)
}
inner class PluginViewHolder(itemView: View) : inner class PluginViewHolder(itemView: View) :
RecyclerView.ViewHolder(itemView) { RecyclerView.ViewHolder(itemView) {
@ -98,8 +107,7 @@ class PluginAdapter(
} }
} }
if (metadata.iconUrl == null || if (itemView.entry_icon?.setImage(metadata.iconUrl, null) != true) {
itemView.entry_icon?.setImage(metadata.iconUrl, null) != true) {
itemView.entry_icon?.setImageResource(R.drawable.ic_baseline_extension_24) itemView.entry_icon?.setImageResource(R.drawable.ic_baseline_extension_24)
} }

View file

@ -30,6 +30,14 @@ class RepoAdapter(
} }
} }
// Clear glide image because setImageResource doesn't override
// override fun onViewRecycled(holder: RecyclerView.ViewHolder) {
// holder.itemView.entry_icon?.let { repoIcon ->
// GlideApp.with(repoIcon).clear(repoIcon)
// }
// super.onViewRecycled(holder)
// }
override fun getItemCount(): Int { override fun getItemCount(): Int {
return repositories.size return repositories.size
} }