From f28cb759df41d5865a2f8ced623efdfa6e8ee40e Mon Sep 17 00:00:00 2001 From: aminecmi Date: Fri, 3 Mar 2023 20:39:20 +0100 Subject: [PATCH] fix: Canvas reused issue. --- androidApp/build.gradle.kts | 4 +-- .../android/fragments/FilterSheetFragment.kt | 30 +++++-------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index eaa0cd5..cebbfd0 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -145,8 +145,8 @@ dependencies { implementation("com.amulyakhare:com.amulyakhare.textdrawable:1.0.1") // glide - kapt("com.github.bumptech.glide:compiler:4.14.2") - implementation("com.github.bumptech.glide:okhttp3-integration:4.14.2") + kapt("com.github.bumptech.glide:compiler:4.15.0") + implementation("com.github.bumptech.glide:okhttp3-integration:4.15.0") // Themes implementation("com.github.rubensousa:floatingtoolbar:1.5.1") diff --git a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt index 2831031..c9e51fd 100644 --- a/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt +++ b/androidApp/src/main/java/bou/amine/apps/readerforselfossv2/android/fragments/FilterSheetFragment.kt @@ -20,10 +20,8 @@ import bou.amine.apps.readerforselfossv2.repository.Repository import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded import bou.amine.apps.readerforselfossv2.utils.getIcon import com.bumptech.glide.Glide -import com.bumptech.glide.load.DataSource -import com.bumptech.glide.load.engine.GlideException -import com.bumptech.glide.request.RequestListener -import com.bumptech.glide.request.target.Target +import com.bumptech.glide.request.target.ViewTarget +import com.bumptech.glide.request.transition.Transition import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.chip.Chip import kotlinx.coroutines.CoroutineScope @@ -90,31 +88,19 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware { Glide.with(context) .load(source.getIcon(repository.baseUrl)) - .listener(object : RequestListener { - override fun onLoadFailed( - e: GlideException?, - model: Any?, - target: Target?, - isFirstResource: Boolean - ): Boolean { - return false - } - + .into(object : ViewTarget(c) { override fun onResourceReady( - resource: Drawable?, - model: Any?, - target: Target?, - dataSource: DataSource?, - isFirstResource: Boolean - ): Boolean { + resource: Drawable, + transition: Transition? + ) { try { c.chipIcon = resource } catch (e: Exception) { e.sendSilentlyWithAcraWithName("sources > onResourceReady") } - return false } - }).preload() + + }) c.text = source.title.getHtmlDecoded()