From 25b042fb83618834a57ae989823e5e80e28c575e Mon Sep 17 00:00:00 2001 From: IndusAryan <125901294+IndusAryan@users.noreply.github.com> Date: Fri, 8 Dec 2023 02:21:42 +0530 Subject: [PATCH] refactor(bump): update glide module and fix regressions (#789) * upgrade glide module and glide ksp * fix glide breaking changes and regressions --- app/build.gradle.kts | 6 +++--- .../com/lagradost/cloudstream3/utils/GlideApp.kt | 2 +- .../com/lagradost/cloudstream3/utils/UIHelper.kt | 13 ++++++------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 13cd828d..73c1dd80 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -172,9 +172,9 @@ dependencies { implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") // Glide Module - ksp("com.github.bumptech.glide:ksp:4.15.1") - implementation("com.github.bumptech.glide:glide:4.15.1") - implementation("com.github.bumptech.glide:okhttp3-integration:4.15.1") + ksp("com.github.bumptech.glide:ksp:4.16.0") + implementation("com.github.bumptech.glide:glide:4.16.0") + implementation("com.github.bumptech.glide:okhttp3-integration:4.16.0") // For KSP -> Official Annotation Processors are Not Yet Supported for KSP ksp("dev.zacsweers.autoservice:auto-service-ksp:1.1.0") diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/GlideApp.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/GlideApp.kt index 8d73db3d..38d3fe9e 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/GlideApp.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/GlideApp.kt @@ -30,7 +30,7 @@ class GlideModule : AppGlideModule() { .signature(ObjectKey(System.currentTimeMillis().toShort())) }.setDiskCache { // Possible to make this a setting in the future. - val memoryCacheSizeBytes: Long = 1024 * 1024 * 100; // 100mb + val memoryCacheSizeBytes: Long = 1024 * 1024 * 100 // 100mb InternalCacheDiskCacheFactory(context, memoryCacheSizeBytes).build() } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt index 134d7127..09ea151d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt @@ -316,15 +316,15 @@ object UIHelper { if (colorCallback != null) { builder = builder.listener(object : RequestListener { - @SuppressLint("CheckResult") + override fun onResourceReady( - resource: Drawable?, - model: Any?, + resource: Drawable, + model: Any, target: Target?, - dataSource: DataSource?, + dataSource: DataSource, isFirstResource: Boolean ): Boolean { - resource?.toBitmapOrNull() + resource.toBitmapOrNull() ?.let { bitmap -> createPaletteAsync( identifier, @@ -335,11 +335,10 @@ object UIHelper { return false } - @SuppressLint("CheckResult") override fun onLoadFailed( e: GlideException?, model: Any?, - target: Target?, + target: Target, isFirstResource: Boolean ): Boolean { return false