Skip to content

Commit

Permalink
Merge pull request #340 from android/glide
Browse files Browse the repository at this point in the history
Docs: Adds a Glide snippet for the "Loading Images" Quick Guide at
  • Loading branch information
thedmail authored Sep 12, 2024
2 parents 1ae14b4 + e1999d2 commit 351fcb4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions compose/snippets/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ dependencies {
implementation(libs.googlemaps.maps)

implementation(libs.hilt.android)
implementation(libs.glide.compose)

kapt(libs.hilt.compiler)

testImplementation(libs.junit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/*
Expand Down Expand Up @@ -53,11 +55,23 @@ fun LoadingImageFromDisk() {

@Preview
@Composable
fun LoadingImageFromInternet() {
fun LoadingImageFromInternetCoil() {
// [START android_compose_images_load_internet_coil]
AsyncImage(
model = "https://example.com/image.jpg",
contentDescription = "Translated description of what the image contains"
)
// [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]
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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" }
Expand Down

0 comments on commit 351fcb4

Please sign in to comment.