Skip to content

Commit

Permalink
fix library palette
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-light42 authored Dec 6, 2024
1 parent 79f5d1a commit 680030d
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.core.view.isVisible
import androidx.palette.graphics.Palette
import androidx.preference.PreferenceManager
import coil3.request.error
import coil3.toBitmap
import com.lagradost.cloudstream3.AnimeSearchResponse
import com.lagradost.cloudstream3.DubStatus
import com.lagradost.cloudstream3.LiveSearchResponse
Expand All @@ -26,6 +27,7 @@ import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
import com.lagradost.cloudstream3.utils.SubtitleHelper
import com.lagradost.cloudstream3.utils.UIHelper.createPaletteAsync
import com.lagradost.cloudstream3.utils.getImageFromDrawable

object SearchResultBuilder {
Expand Down Expand Up @@ -122,8 +124,17 @@ object SearchResultBuilder {
cardText?.text = card.name
cardText?.isVisible = showTitle
cardView.isVisible = true
cardView.loadImage(card.posterUrl) { error { getImageFromDrawable(itemView.context, R.drawable.default_cover) } }

cardView.loadImage(card.posterUrl) {
error { getImageFromDrawable(itemView.context, R.drawable.default_cover) }
val posterUrl = card.posterUrl
if (posterUrl != null && colorCallback != null) {
this.listener(onSuccess = { _,success ->
val bitmap = success.image.toBitmap()
createPaletteAsync(posterUrl, bitmap, colorCallback)
})
}
}

fun click(view: View?) {
clickCallback.invoke(
SearchClickCallback(
Expand Down

0 comments on commit 680030d

Please sign in to comment.