A fully functional Android app built entirely with Kotlin and Jetpack Compose
Replace empty `AuthorItem`'s picture with `Icons.Filled.Person`
Simon Marquise5b2b22b03ef
diff --git a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/AuthorsCarousel.kt b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/AuthorsCarousel.ktindex df6b8bbda..a56fc08bb 100644--- a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/AuthorsCarousel.kt+++ b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/AuthorsCarousel.kt@@ -16,6 +16,7 @@package com.google.samples.apps.nowinandroid.feature.foryou+import androidx.compose.foundation.backgroundimport androidx.compose.foundation.layout.Boximport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Spacer@@ -28,6 +29,10 @@ import androidx.compose.foundation.lazy.LazyRowimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.selection.toggleableimport androidx.compose.foundation.shape.CircleShape+import androidx.compose.material.icons.Icons+import androidx.compose.material.icons.filled.Android+import androidx.compose.material.icons.filled.Person+import androidx.compose.material3.Iconimport androidx.compose.material3.MaterialThemeimport androidx.compose.material3.Surfaceimport androidx.compose.material3.Text@@ -95,15 +100,29 @@ fun AuthorItem(stateDescription = "$followDescription ${author.name}"}) {- Box(modifier = Modifier.fillMaxWidth()) {- AsyncImage(- modifier = Modifier- .size(48.dp)- .clip(CircleShape),- model = author.imageUrl,- contentScale = ContentScale.Fit,- contentDescription = null- )+ Box(+ modifier = Modifier.fillMaxWidth(),+ contentAlignment = Alignment.Center,+ ) {+ val authorImageModifier = Modifier+ .size(48.dp)+ .clip(CircleShape)+ if (author.imageUrl.isEmpty()) {+ Icon(+ modifier = authorImageModifier+ .background(MaterialTheme.colorScheme.surface)+ .padding(4.dp),+ imageVector = Icons.Filled.Person,+ contentDescription = null // decorative image+ )+ } else {+ AsyncImage(+ modifier = authorImageModifier,+ model = author.imageUrl,+ contentScale = ContentScale.Fit,+ contentDescription = null+ )+ }FollowButton(following = following,backgroundColor = MaterialTheme.colorScheme.surface,