diff --git a/compose/snippets/build.gradle.kts b/compose/snippets/build.gradle.kts index 5d2b661f..de47ea8b 100644 --- a/compose/snippets/build.gradle.kts +++ b/compose/snippets/build.gradle.kts @@ -144,6 +144,8 @@ dependencies { implementation(libs.googlemaps.maps) implementation(libs.hilt.android) + implementation(libs.glide.compose) + kapt(libs.hilt.compiler) testImplementation(libs.junit) diff --git a/compose/snippets/src/main/java/com/example/compose/snippets/images/LoadingImagesSnippets.kt b/compose/snippets/src/main/java/com/example/compose/snippets/images/LoadingImagesSnippets.kt index 4ca5d70d..879b2f9a 100644 --- a/compose/snippets/src/main/java/com/example/compose/snippets/images/LoadingImagesSnippets.kt +++ b/compose/snippets/src/main/java/com/example/compose/snippets/images/LoadingImagesSnippets.kt @@ -22,6 +22,8 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import coil.compose.AsyncImage +import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi +import com.bumptech.glide.integration.compose.GlideImage import com.example.compose.snippets.R /* @@ -53,7 +55,7 @@ fun LoadingImageFromDisk() { @Preview @Composable -fun LoadingImageFromInternet() { +fun LoadingImageFromInternetCoil() { // [START android_compose_images_load_internet_coil] AsyncImage( model = "https://example.com/image.jpg", @@ -61,3 +63,15 @@ fun LoadingImageFromInternet() { ) // [END android_compose_images_load_internet_coil] } + +@OptIn(ExperimentalGlideComposeApi::class) +@Preview +@Composable +fun LoadingImageFromInternetGlide() { + // [START android_compose_images_load_internet_glide] + GlideImage( + model = "https://example.com/image.jpg", + contentDescription = "Translated description of what the image contains" + ) + // [END android_compose_images_load_internet_glide] +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8649031d..5b8ae659 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -50,6 +50,7 @@ version-catalog-update = "0.8.3" wearComposeFoundation = "1.4.0" wearComposeMaterial = "1.4.0" composeUiTooling = "1.4.0" +glide= "1.0.0-beta01" [libraries] accompanist-adaptive = { module = "com.google.accompanist:accompanist-adaptive", version.ref = "accompanist" } @@ -126,6 +127,7 @@ androidx-media3-exoplayer = { group = "androidx.media3", name = "media3-exoplaye play-services-wearable = { module = "com.google.android.gms:play-services-wearable", version.ref = "playServicesWearable" } compose-ui-tooling = { group = "androidx.wear.compose", name = "compose-ui-tooling", version.ref = "composeUiTooling" } androidx-material-icons-core = { module = "androidx.compose.material:material-icons-core" } +glide-compose = { module = "com.github.bumptech.glide:compose" , version.ref = "glide"} [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }