Merge branch 'github/main'

pull/58/head
kbuilder 3 years ago
commit 8d706d7062

@ -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,9 @@ 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.Person
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@ -95,15 +99,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,

@ -16,6 +16,7 @@
package com.google.samples.apps.nowinandroid.feature.interests
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -23,8 +24,8 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons.Filled
import androidx.compose.material.icons.filled.Android
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Person
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
@ -32,7 +33,6 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
@ -105,10 +105,11 @@ private fun InterestContent(name: String, description: String, modifier: Modifie
private fun InterestsIcon(topicImageUrl: String, modifier: Modifier = Modifier) {
if (topicImageUrl.isEmpty()) {
Icon(
imageVector = Filled.Android,
tint = Color.Magenta,
contentDescription = null,
modifier = modifier
.background(MaterialTheme.colorScheme.surface)
.padding(4.dp),
imageVector = Icons.Filled.Person,
contentDescription = null, // decorative image
)
} else {
AsyncImage(

Loading…
Cancel
Save