Skip to content

Commit

Permalink
Merge pull request #115 from skydoves/coil/requestListener
Browse files Browse the repository at this point in the history
New Feature:  RequestListener for CoilImage
  • Loading branch information
skydoves committed Mar 12, 2022
2 parents e83956f + 598cc8d commit 4a66101
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
8 changes: 4 additions & 4 deletions coil/api/coil.api
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
public final class com/skydoves/landscapist/coil/CoilImage {
public static final fun CoilImage (Lcoil/request/ImageRequest;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;FLandroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/ShimmerParams;Lcom/skydoves/landscapist/palette/BitmapPalette;ILkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Lcoil/request/ImageRequest;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;FLandroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/palette/BitmapPalette;ILkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Alignment;FLandroidx/compose/ui/layout/ContentScale;Ljava/lang/String;Lcom/skydoves/landscapist/CircularReveal;Landroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/ShimmerParams;Lcom/skydoves/landscapist/palette/BitmapPalette;Ljava/lang/Object;ILandroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Alignment;FLandroidx/compose/ui/layout/ContentScale;Ljava/lang/String;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/palette/BitmapPalette;Landroidx/compose/ui/graphics/ColorFilter;Ljava/lang/Object;Ljava/lang/Object;ILandroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;FLandroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/ShimmerParams;Lcom/skydoves/landscapist/palette/BitmapPalette;ILkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;FLandroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/palette/BitmapPalette;ILkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Lcoil/request/ImageRequest$Listener;Landroidx/compose/ui/Alignment;FLandroidx/compose/ui/layout/ContentScale;Ljava/lang/String;Lcom/skydoves/landscapist/CircularReveal;Landroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/ShimmerParams;Lcom/skydoves/landscapist/palette/BitmapPalette;Ljava/lang/Object;ILandroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Lcoil/request/ImageRequest$Listener;Landroidx/compose/ui/Alignment;FLandroidx/compose/ui/layout/ContentScale;Ljava/lang/String;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/palette/BitmapPalette;Landroidx/compose/ui/graphics/ColorFilter;Ljava/lang/Object;Ljava/lang/Object;ILandroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Lcoil/request/ImageRequest$Listener;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;FLandroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/ShimmerParams;Lcom/skydoves/landscapist/palette/BitmapPalette;ILkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V
public static final fun CoilImage (Ljava/lang/Object;Landroidx/compose/ui/Modifier;Landroid/content/Context;Landroidx/lifecycle/LifecycleOwner;Lkotlin/jvm/functions/Function2;Lcoil/request/ImageRequest$Listener;Landroidx/compose/ui/Alignment;Landroidx/compose/ui/layout/ContentScale;Ljava/lang/String;FLandroidx/compose/ui/graphics/ColorFilter;Lcom/skydoves/landscapist/CircularReveal;Lcom/skydoves/landscapist/palette/BitmapPalette;ILkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V
}

public abstract class com/skydoves/landscapist/coil/CoilImageState {
Expand Down
36 changes: 18 additions & 18 deletions coil/src/main/kotlin/com/skydoves/landscapist/coil/CoilImage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ import kotlinx.coroutines.suspendCancellableCoroutine
* @param context The context for creating the [ImageRequest.Builder].
* @param lifecycleOwner The [LifecycleOwner] for constructing the [ImageRequest.Builder].
* @param imageLoader The [ImageLoader] to use when requesting the image.
* Defaults to [LocalCoilProvider.getCoilImageLoader].
* @param requestListener A class for monitoring the status of a request while images load.
* @param alignment The alignment parameter used to place the loaded [ImageBitmap] in the image container.
* @param alpha The alpha parameter used to apply for the image when it is rendered onscreen.
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be
* used for the loaded [ImageBitmap].
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be used for the loaded [ImageBitmap].
* @param contentDescription The content description used to provide accessibility to describe the image.
* @param circularReveal circular reveal parameters for running reveal animation when images are successfully loaded.
* @param colorFilter The colorFilter parameter used to apply for the image when it is rendered onscreen.
Expand All @@ -105,6 +104,7 @@ public fun CoilImage(
context: Context = LocalContext.current,
lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current,
imageLoader: @Composable () -> ImageLoader = { LocalCoilProvider.getCoilImageLoader() },
requestListener: ImageRequest.Listener? = null,
alignment: Alignment = Alignment.Center,
alpha: Float = DefaultAlpha,
contentScale: ContentScale = ContentScale.Crop,
Expand All @@ -121,6 +121,7 @@ public fun CoilImage(
context = context,
lifecycleOwner = lifecycleOwner,
imageLoader = imageLoader,
requestListener = requestListener,
modifier = modifier,
alignment = alignment,
contentScale = contentScale,
Expand Down Expand Up @@ -169,11 +170,10 @@ public fun CoilImage(
* @param context The context for creating the [ImageRequest.Builder].
* @param lifecycleOwner The [LifecycleOwner] for constructing the [ImageRequest.Builder].
* @param imageLoader The [ImageLoader] to use when requesting the image.
* Defaults to [LocalCoilProvider.getCoilImageLoader].
* @param requestListener A class for monitoring the status of a request while images load.
* @param alignment The alignment parameter used to place the loaded [ImageBitmap] in the image container.
* @param alpha The alpha parameter used to apply for the image when it is rendered onscreen.
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be
* used for the loaded [ImageBitmap].
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be used for the loaded [ImageBitmap].
* @param contentDescription The content description used to provide accessibility to describe the image.
* @param circularReveal circular reveal parameters for running reveal animation when images are successfully loaded.
* @param bitmapPalette A [Palette] generator for extracting major (theme) colors from images.
Expand All @@ -189,6 +189,7 @@ public fun CoilImage(
context: Context = LocalContext.current,
lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current,
imageLoader: @Composable () -> ImageLoader = { LocalCoilProvider.getCoilImageLoader() },
requestListener: ImageRequest.Listener? = null,
alignment: Alignment = Alignment.Center,
alpha: Float = DefaultAlpha,
contentScale: ContentScale = ContentScale.Crop,
Expand All @@ -205,6 +206,7 @@ public fun CoilImage(
context = context,
lifecycleOwner = lifecycleOwner,
imageLoader = imageLoader,
requestListener = requestListener,
modifier = modifier,
alignment = alignment,
contentScale = contentScale,
Expand Down Expand Up @@ -263,11 +265,10 @@ public fun CoilImage(
* @param context The context for creating the [ImageRequest.Builder].
* @param lifecycleOwner The [LifecycleOwner] for constructing the [ImageRequest.Builder].
* @param imageLoader The [ImageLoader] to use when requesting the image.
* Defaults to [LocalCoilProvider.getCoilImageLoader].
* @param requestListener A class for monitoring the status of a request while images load.
* @param alignment The alignment parameter used to place the loaded [ImageBitmap] in the image container.
* @param alpha The alpha parameter used to apply for the image when it is rendered onscreen.
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be
* used for the loaded [ImageBitmap].
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be used for the loaded [ImageBitmap].
* @param contentDescription The content description used to provide accessibility to describe the image.
* @param circularReveal circular reveal parameters for running reveal animation when images are successfully loaded.
* @param bitmapPalette A [Palette] generator for extracting major (theme) colors from images.
Expand All @@ -283,6 +284,7 @@ public fun CoilImage(
context: Context = LocalContext.current,
lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current,
imageLoader: @Composable () -> ImageLoader = { LocalCoilProvider.getCoilImageLoader() },
requestListener: ImageRequest.Listener? = null,
alignment: Alignment = Alignment.Center,
contentScale: ContentScale = ContentScale.Crop,
contentDescription: String? = null,
Expand All @@ -298,6 +300,7 @@ public fun CoilImage(
CoilImage(
imageRequest = ImageRequest.Builder(context)
.data(imageModel)
.listener(requestListener)
.lifecycle(lifecycleOwner)
.build(),
imageLoader = imageLoader,
Expand Down Expand Up @@ -340,11 +343,10 @@ public fun CoilImage(
* @param context The context for creating the [ImageRequest.Builder].
* @param lifecycleOwner The [LifecycleOwner] for constructing the [ImageRequest.Builder].
* @param imageLoader The [ImageLoader] to use when requesting the image.
* Defaults to [LocalCoilProvider.getCoilImageLoader].
* @param requestListener A class for monitoring the status of a request while images load.
* @param alignment The alignment parameter used to place the loaded [ImageBitmap] in the image container.
* @param alpha The alpha parameter used to apply for the image when it is rendered onscreen.
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be
* used for the loaded [ImageBitmap].
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be used for the loaded [ImageBitmap].
* @param contentDescription The content description used to provide accessibility to describe the image.
* @param circularReveal circular reveal parameters for running reveal animation when images are successfully loaded.
* @param bitmapPalette A [Palette] generator for extracting major (theme) colors from images.
Expand All @@ -361,6 +363,7 @@ public fun CoilImage(
context: Context = LocalContext.current,
lifecycleOwner: LifecycleOwner = LocalLifecycleOwner.current,
imageLoader: @Composable () -> ImageLoader = { LocalCoilProvider.getCoilImageLoader() },
requestListener: ImageRequest.Listener? = null,
alignment: Alignment = Alignment.Center,
contentScale: ContentScale = ContentScale.Crop,
contentDescription: String? = null,
Expand All @@ -376,6 +379,7 @@ public fun CoilImage(
CoilImage(
imageRequest = ImageRequest.Builder(context)
.data(imageModel)
.listener(requestListener)
.lifecycle(lifecycleOwner)
.build(),
imageLoader = imageLoader,
Expand Down Expand Up @@ -416,11 +420,9 @@ public fun CoilImage(
* @param imageRequest The request to execute.
* @param modifier [Modifier] used to adjust the layout or drawing content.
* @param imageLoader The [ImageLoader] to use when requesting the image.
* Defaults to [LocalCoilProvider.getCoilImageLoader].
* @param alignment The alignment parameter used to place the loaded [ImageBitmap] in the image container.
* @param alpha The alpha parameter used to apply for the image when it is rendered onscreen.
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be
* used for the loaded [ImageBitmap].
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be used for the loaded [ImageBitmap].
* @param contentDescription The content description used to provide accessibility to describe the image.
* @param circularReveal circular reveal parameters for running reveal animation when images are successfully loaded.
* @param bitmapPalette A [Palette] generator for extracting major (theme) colors from images.
Expand Down Expand Up @@ -525,11 +527,9 @@ public fun CoilImage(
* @param imageRequest The request to execute.
* @param modifier [Modifier] used to adjust the layout or drawing content.
* @param imageLoader The [ImageLoader] to use when requesting the image.
* Defaults to [LocalCoilProvider.getCoilImageLoader].
* @param alignment The alignment parameter used to place the loaded [ImageBitmap] in the image container.
* @param alpha The alpha parameter used to apply for the image when it is rendered onscreen.
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be
* used for the loaded [ImageBitmap].
* @param contentScale The scale parameter used to determine the aspect ratio scaling to be used for the loaded [ImageBitmap].
* @param contentDescription The content description used to provide accessibility to describe the image.
* @param circularReveal circular reveal parameters for running reveal animation when images are successfully loaded.
* @param bitmapPalette A [Palette] generator for extracting major (theme) colors from images.
Expand Down
11 changes: 3 additions & 8 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@ ext.versions = [
versionCode : 30,
versionName : '1.3.0',

gradleBuildTool : '7.1.0',
gradleBuildTool : '7.1.2',
spotlessGradle : '6.2.1',
dokkaGradle : '1.6.0',
binaryValidator : '0.8.0',
mavenPublish : '0.18.0',

// di
hiltCoreVersion : '2.40.5',
mavenPublish : '0.19.0',

kotlin : '1.6.10',
coreKtxVersion : '1.5.0-beta01',
composeVersion : '1.1.1',
constraintVersion: '1.0.0-alpha07',
activityVersion : '1.3.0-alpha08',
coroutinesVersion: '1.6.0',
multidex : '2.0.1',

frescoVersion : '2.6.0',
glideVersion : '4.13.0',
Expand All @@ -33,6 +27,7 @@ ext.versions = [
androidxTestJunit: '1.1.3',

// for demo
hiltCoreVersion : '2.40.5',
constraintVersion: '1.0.0-alpha07',
activityVersion : '1.3.0-alpha08',
multidex : '2.0.1',
Expand Down

0 comments on commit 4a66101

Please sign in to comment.