ImageSource
A sealed class representing the source of the image to be loaded.
sealed class ImageSource {
data class Url(val value: String) : ImageSource()
data class Resources(val resId: Int) : ImageSource()
data class Progressive(
val finalUrl: String,
val thumbnailUrl: String? = null,
val blurHash: String? = null
) : ImageSource()
}
ImageSource.Url​
Load an image from a remote or local URL string.
ImageSource.Url("https://example.com/photo.jpg")
Supports: http://, https://, file://, content://
Animated formats (.gif, .webp, .svg) are auto-detected.
ImageSource.Resources​
Load a drawable resource by resource ID.
ImageSource.Resources(R.drawable.my_image)
Works with any Android drawable resource.
ImageSource.Progressive​
Load a low-res thumbnail first, then replace with the full-resolution image.
ImageSource.Progressive(
finalUrl = "https://example.com/photo-4k.jpg",
thumbnailUrl = "https://example.com/photo-40w.jpg",
blurHash = null // reserved for future use
)
| Field | Type | Description |
|---|---|---|
finalUrl | String | Full-resolution image URL (required) |
thumbnailUrl | String? | Low-res preview URL shown immediately |
blurHash | String? | Reserved — future BlurHash support |
PlaceholderType​
enum class PlaceholderType {
SHIMMER, // Animated gradient shimmer (default)
SKELETON, // Pulsing solid block
NONE // No placeholder
}
Used via the placeholderType parameter on AsyncPic.
ShimmerDirection​
enum class ShimmerDirection {
DIAGONAL, // Top-left to bottom-right (default)
LTR, // Left to right
RTL, // Right to left
TTB, // Top to bottom
BTT // Bottom to top
}
Used via the shimmerDirection parameter on AsyncPic.