Skip to content

Commit 620715f

Browse files
authoredMar 25, 2021
[Jetsnack] Add preview placeholder to images (android#453)
Use CoilImage's new previewPlaceholder to display a placeholder when in preview mode
1 parent 7a1bcf8 commit 620715f

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed
 

‎Jetsnack/app/src/main/java/com/example/jetsnack/ui/components/Snacks.kt

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import androidx.compose.ui.text.style.TextOverflow
5151
import androidx.compose.ui.tooling.preview.Preview
5252
import androidx.compose.ui.unit.Dp
5353
import androidx.compose.ui.unit.dp
54+
import com.example.jetsnack.R
5455
import com.example.jetsnack.model.CollectionType
5556
import com.example.jetsnack.model.Snack
5657
import com.example.jetsnack.model.SnackCollection
@@ -281,6 +282,7 @@ fun SnackImage(
281282
CoilImage(
282283
data = imageUrl,
283284
contentDescription = contentDescription,
285+
previewPlaceholder = R.drawable.placeholder,
284286
contentScale = ContentScale.Crop,
285287
modifier = Modifier.fillMaxSize()
286288
)
Loading

‎Jetsnack/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ subprojects {
4040

4141
if (!Libs.AndroidX.Compose.snapshot.isEmpty()) {
4242
maven { url "https://androidx.dev/snapshots/builds/${Libs.AndroidX.Compose.snapshot}/artifacts/repository/" }
43+
}
44+
if (Libs.Accompanist.version.endsWith("SNAPSHOT")) {
4345
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
4446
}
4547
}

‎Jetsnack/buildSrc/src/main/java/com/example/jetsnack/buildsrc/Dependencies.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object Libs {
2424
const val androidGradlePlugin = "com.android.tools.build:gradle:7.0.0-alpha11"
2525

2626
object Accompanist {
27-
private const val version = "0.7.0"
27+
const val version = "0.7.1-SNAPSHOT"
2828
const val coil = "com.google.accompanist:accompanist-coil:$version"
2929
const val insets = "com.google.accompanist:accompanist-insets:$version"
3030
}

0 commit comments

Comments
 (0)
Please sign in to comment.