diff --git a/coil/api/coil.api b/coil/api/coil.api index 986970e9..28c5adf6 100644 --- a/coil/api/coil.api +++ b/coil/api/coil.api @@ -24,11 +24,17 @@ public final class com/skydoves/landscapist/coil/CoilImageState$Failure : com/sk public final class com/skydoves/landscapist/coil/CoilImageState$Loading : com/skydoves/landscapist/coil/CoilImageState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/coil/CoilImageState$Loading; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/coil/CoilImageState$None : com/skydoves/landscapist/coil/CoilImageState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/coil/CoilImageState$None; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/coil/CoilImageState$Success : com/skydoves/landscapist/coil/CoilImageState { diff --git a/coil/src/main/kotlin/com/skydoves/landscapist/coil/CoilImageState.kt b/coil/src/main/kotlin/com/skydoves/landscapist/coil/CoilImageState.kt index 2d32e2ef..d7af8b40 100644 --- a/coil/src/main/kotlin/com/skydoves/landscapist/coil/CoilImageState.kt +++ b/coil/src/main/kotlin/com/skydoves/landscapist/coil/CoilImageState.kt @@ -30,11 +30,11 @@ public sealed class CoilImageState : ImageState { /** Request not started. */ @Immutable - public object None : CoilImageState() + public data object None : CoilImageState() /** Request is currently in progress. */ @Immutable - public object Loading : CoilImageState() + public data object Loading : CoilImageState() /** Request is completed successfully and ready to use an [ImageBitmap]. */ @Immutable diff --git a/fresco/api/fresco.api b/fresco/api/fresco.api index 80f4977f..5bc06f27 100644 --- a/fresco/api/fresco.api +++ b/fresco/api/fresco.api @@ -30,11 +30,17 @@ public final class com/skydoves/landscapist/fresco/FrescoImageState$Failure : co public final class com/skydoves/landscapist/fresco/FrescoImageState$Loading : com/skydoves/landscapist/fresco/FrescoImageState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/fresco/FrescoImageState$Loading; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/fresco/FrescoImageState$None : com/skydoves/landscapist/fresco/FrescoImageState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/fresco/FrescoImageState$None; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/fresco/FrescoImageState$Success : com/skydoves/landscapist/fresco/FrescoImageState { diff --git a/fresco/src/main/kotlin/com/skydoves/landscapist/fresco/FrescoImageState.kt b/fresco/src/main/kotlin/com/skydoves/landscapist/fresco/FrescoImageState.kt index 656355b8..3973203d 100644 --- a/fresco/src/main/kotlin/com/skydoves/landscapist/fresco/FrescoImageState.kt +++ b/fresco/src/main/kotlin/com/skydoves/landscapist/fresco/FrescoImageState.kt @@ -31,11 +31,11 @@ public sealed class FrescoImageState : ImageState { /** Request not started. */ @Immutable - public object None : FrescoImageState() + public data object None : FrescoImageState() /** Request is currently in progress. */ @Immutable - public object Loading : FrescoImageState() + public data object Loading : FrescoImageState() /** Request is completed successfully and ready to use an [ImageBitmap]. */ @Immutable diff --git a/glide/api/glide.api b/glide/api/glide.api index 8b18938f..6eb678e9 100644 --- a/glide/api/glide.api +++ b/glide/api/glide.api @@ -30,11 +30,17 @@ public final class com/skydoves/landscapist/glide/GlideImageState$Failure : com/ public final class com/skydoves/landscapist/glide/GlideImageState$Loading : com/skydoves/landscapist/glide/GlideImageState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/glide/GlideImageState$Loading; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/glide/GlideImageState$None : com/skydoves/landscapist/glide/GlideImageState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/glide/GlideImageState$None; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/glide/GlideImageState$Success : com/skydoves/landscapist/glide/GlideImageState { diff --git a/glide/src/main/kotlin/com/skydoves/landscapist/glide/GlideImageState.kt b/glide/src/main/kotlin/com/skydoves/landscapist/glide/GlideImageState.kt index ce70d9f9..dcf59616 100644 --- a/glide/src/main/kotlin/com/skydoves/landscapist/glide/GlideImageState.kt +++ b/glide/src/main/kotlin/com/skydoves/landscapist/glide/GlideImageState.kt @@ -28,11 +28,11 @@ public sealed class GlideImageState : ImageState { /** Request not started. */ @Immutable - public object None : GlideImageState() + public data object None : GlideImageState() /** Request is currently in progress. */ @Immutable - public object Loading : GlideImageState() + public data object Loading : GlideImageState() /** Request is completed successfully and ready to use an [ImageBitmap]. */ @Immutable @@ -63,6 +63,7 @@ public fun ImageLoadState.toGlideImageState(glideRequestType: GlideRequestType): dataSource = dataSource, glideRequestType = glideRequestType, ) + is ImageLoadState.Failure -> GlideImageState.Failure( errorDrawable = data as? Drawable, reason = reason, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1e3675b7..e530bdb4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,6 +47,7 @@ androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTestRules" } androidx-test-junit = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "androidxJunit" } androidx-test-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "androidxUiAutomator" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } diff --git a/landscapist/api/landscapist.api b/landscapist/api/landscapist.api index 86559fa1..df18e4d1 100644 --- a/landscapist/api/landscapist.api +++ b/landscapist/api/landscapist.api @@ -38,11 +38,17 @@ public final class com/skydoves/landscapist/ImageLoadState$Failure : com/skydove public final class com/skydoves/landscapist/ImageLoadState$Loading : com/skydoves/landscapist/ImageLoadState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/ImageLoadState$Loading; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/ImageLoadState$None : com/skydoves/landscapist/ImageLoadState { public static final field $stable I public static final field INSTANCE Lcom/skydoves/landscapist/ImageLoadState$None; + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; } public final class com/skydoves/landscapist/ImageLoadState$Success : com/skydoves/landscapist/ImageLoadState { diff --git a/landscapist/build.gradle.kts b/landscapist/build.gradle.kts index a6d52897..bd69aca6 100644 --- a/landscapist/build.gradle.kts +++ b/landscapist/build.gradle.kts @@ -54,11 +54,10 @@ baselineProfile { } } - dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.compose.ui) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.compose.foundation) - implementation(libs.kotlinx.coroutines.android) + implementation(libs.kotlinx.coroutines.core) } diff --git a/landscapist/src/main/kotlin/com/skydoves/landscapist/DrawablePainter.kt b/landscapist/src/main/kotlin/com/skydoves/landscapist/DrawablePainter.kt index 54229343..cc8b1c97 100644 --- a/landscapist/src/main/kotlin/com/skydoves/landscapist/DrawablePainter.kt +++ b/landscapist/src/main/kotlin/com/skydoves/landscapist/DrawablePainter.kt @@ -26,6 +26,7 @@ import android.view.View import androidx.compose.runtime.Composable import androidx.compose.runtime.RememberObserver import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -58,7 +59,7 @@ import kotlin.math.roundToInt internal class DrawablePainter( val drawable: Drawable, ) : Painter(), RememberObserver { - private var drawInvalidateTick by mutableStateOf(0) + private var drawInvalidateTick by mutableIntStateOf(0) private var drawableIntrinsicSize by mutableStateOf(drawable.intrinsicSize) private val callback: Drawable.Callback by lazy { diff --git a/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageLoadState.kt b/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageLoadState.kt index 29de14c9..9110993a 100644 --- a/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageLoadState.kt +++ b/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageLoadState.kt @@ -24,11 +24,11 @@ public sealed class ImageLoadState { /** Request not started. */ @Immutable - public object None : ImageLoadState() + public data object None : ImageLoadState() /** Request is currently in progress. */ @Immutable - public object Loading : ImageLoadState() + public data object Loading : ImageLoadState() /** Request is completed successfully and ready to use an [ImageBitmap]. */ @Immutable diff --git a/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageState.kt b/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageState.kt index ede2096e..bf2d63ef 100644 --- a/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageState.kt +++ b/landscapist/src/main/kotlin/com/skydoves/landscapist/ImageState.kt @@ -15,5 +15,8 @@ */ package com.skydoves.landscapist +import androidx.compose.runtime.Stable + /** The highest level interface of the image loading states. */ +@Stable public interface ImageState diff --git a/landscapist/src/main/kotlin/com/skydoves/landscapist/InternalLandscapistApi.kt b/landscapist/src/main/kotlin/com/skydoves/landscapist/InternalLandscapistApi.kt index b6cde744..b146a8af 100644 --- a/landscapist/src/main/kotlin/com/skydoves/landscapist/InternalLandscapistApi.kt +++ b/landscapist/src/main/kotlin/com/skydoves/landscapist/InternalLandscapistApi.kt @@ -22,6 +22,7 @@ package com.skydoves.landscapist AnnotationTarget.FUNCTION, AnnotationTarget.TYPEALIAS, ) +@Retention(AnnotationRetention.BINARY) @RequiresOptIn( message = "This is internal API for the landscapist libraries. Do not depend on " + "this API in your own client code.", diff --git a/landscapist/src/main/kotlin/com/skydoves/landscapist/StableHolder.kt b/landscapist/src/main/kotlin/com/skydoves/landscapist/StableHolder.kt index 3feef8ee..68b96c20 100644 --- a/landscapist/src/main/kotlin/com/skydoves/landscapist/StableHolder.kt +++ b/landscapist/src/main/kotlin/com/skydoves/landscapist/StableHolder.kt @@ -15,8 +15,8 @@ */ package com.skydoves.landscapist -import androidx.compose.runtime.Stable +import androidx.compose.runtime.Immutable -@Stable +@Immutable @InternalLandscapistApi public data class StableHolder(public val value: T)