|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
|
|
|
|
|
package com.google.samples.apps.nowinandroid.feature.foryou
|
|
|
|
|
|
|
|
|
|
import androidx.compose.foundation.background
|
|
|
|
|
import androidx.compose.foundation.layout.Box
|
|
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
|
|
import androidx.compose.foundation.layout.Spacer
|
|
|
|
@ -28,6 +29,10 @@ import androidx.compose.foundation.lazy.LazyRow
|
|
|
|
|
import androidx.compose.foundation.lazy.items
|
|
|
|
|
import androidx.compose.foundation.selection.toggleable
|
|
|
|
|
import 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.Icon
|
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
|
import androidx.compose.material3.Surface
|
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
@ -95,15 +100,29 @@ fun AuthorItem(
|
|
|
|
|
stateDescription = "$followDescription ${author.name}"
|
|
|
|
|
}
|
|
|
|
|
) {
|
|
|
|
|
Box(modifier = Modifier.fillMaxWidth()) {
|
|
|
|
|
AsyncImage(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
Box(
|
|
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
|
|
contentAlignment = Alignment.Center,
|
|
|
|
|
) {
|
|
|
|
|
val authorImageModifier = Modifier
|
|
|
|
|
.size(48.dp)
|
|
|
|
|
.clip(CircleShape),
|
|
|
|
|
.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,
|
|
|
|
|