Skip to content

[Reply] Contrast aware updates. #1284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.example.reply.data.local.LocalEmailsDataProvider
import com.example.reply.ui.theme.ContrastAwareReplyTheme
import com.example.reply.ui.theme.ReplyTheme
import com.google.accompanist.adaptive.calculateDisplayFeatures

Expand All @@ -44,7 +45,7 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)

setContent {
ReplyTheme {
ContrastAwareReplyTheme {
val windowSize = calculateWindowSizeClass(this)
val displayFeatures = calculateDisplayFeatures(this)
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
Expand Down
2 changes: 1 addition & 1 deletion Reply/app/src/main/java/com/example/reply/ui/ReplyApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fun ReplyAppContent(
Column(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.inverseOnSurface)
.background(MaterialTheme.colorScheme.surfaceContainerLow)
) {
ReplyNavHost(
navController = navController,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fun ReplyEmailList(
},
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.padding(horizontal = 16.dp, vertical = 16.dp)
)

LazyColumn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ fun ReplyEmailListItem(
Text(
text = email.createdAt,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.outline
)
}
IconButton(
onClick = { /*TODO*/ },
modifier = Modifier
.clip(CircleShape)
.background(MaterialTheme.colorScheme.surface)
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
) {
Icon(
imageVector = Icons.Default.StarBorder,
Expand All @@ -135,15 +134,12 @@ fun ReplyEmailListItem(
Text(
text = email.subject,
style = MaterialTheme.typography.bodyLarge,
color = if (isSelected) MaterialTheme.colorScheme.onPrimaryContainer
else MaterialTheme.colorScheme.onSurface,
modifier = Modifier.padding(top = 12.dp, bottom = 8.dp),
)
Text(
text = email.body,
style = MaterialTheme.typography.bodyMedium,
maxLines = 2,
color = MaterialTheme.colorScheme.onSurfaceVariant,
overflow = TextOverflow.Ellipsis
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.StarBorder
Expand Down Expand Up @@ -50,7 +52,9 @@ fun ReplyEmailThreadItem(
) {
Card(
modifier = modifier.padding(horizontal = 16.dp, vertical = 4.dp),
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface)
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh
)
) {
Column(
modifier = Modifier
Expand Down Expand Up @@ -82,7 +86,7 @@ fun ReplyEmailThreadItem(
onClick = { /*TODO*/ },
modifier = Modifier
.clip(CircleShape)
.background(MaterialTheme.colorScheme.surface)
.background(MaterialTheme.colorScheme.surfaceContainer)
) {
Icon(
imageVector = Icons.Default.StarBorder,
Expand All @@ -107,31 +111,32 @@ fun ReplyEmailThreadItem(
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 20.dp),
.padding(top = 20.dp, bottom = 8.dp),
horizontalArrangement = Arrangement.spacedBy(4.dp),
) {
Button(
onClick = { /*TODO*/ },
modifier = Modifier.weight(1f),
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.inverseOnSurface
containerColor = MaterialTheme.colorScheme.surfaceBright
)
) {
Text(
text = stringResource(id = R.string.reply),
color = MaterialTheme.colorScheme.onSurfaceVariant
color = MaterialTheme.colorScheme.onSurface
)
}
Spacer(modifier = Modifier.width(8.dp))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This spacing is a combination of line 115 and line 129. I'd combine them to just do 12dp in one place, probably 115, but I don't have a strong preference whether it's that or a spacer with no horizontalArrangement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Button(
onClick = { /*TODO*/ },
modifier = Modifier.weight(1f),
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.inverseOnSurface
containerColor = MaterialTheme.colorScheme.surfaceBright
)
) {
Text(
text = stringResource(id = R.string.reply_all),
color = MaterialTheme.colorScheme.onSurfaceVariant
color = MaterialTheme.colorScheme.onSurface
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.sizeIn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.MenuOpen
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material.icons.filled.Menu
import androidx.compose.material.icons.filled.MenuOpen
Expand Down Expand Up @@ -157,12 +158,12 @@ fun PermanentNavigationDrawerContent(
) {
PermanentDrawerSheet(
modifier = Modifier.sizeIn(minWidth = 200.dp, maxWidth = 300.dp),
drawerContainerColor = MaterialTheme.colorScheme.inverseOnSurface,
drawerContainerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
) {
// TODO remove custom nav drawer content positioning when NavDrawer component supports it. ticket : b/232495216
Layout(
modifier = Modifier
.background(MaterialTheme.colorScheme.inverseOnSurface)
.background(MaterialTheme.colorScheme.surfaceContainerHigh)
.padding(16.dp),
content = {
Column(
Expand All @@ -188,7 +189,7 @@ fun PermanentNavigationDrawerContent(
Icon(
imageVector = Icons.Default.Edit,
contentDescription = stringResource(id = R.string.edit),
modifier = Modifier.size(18.dp)
modifier = Modifier.size(24.dp)
)
Text(
text = stringResource(id = R.string.compose),
Expand Down Expand Up @@ -268,7 +269,7 @@ fun ModalNavigationDrawerContent(
)
IconButton(onClick = onDrawerClicked) {
Icon(
imageVector = Icons.Default.MenuOpen,
imageVector = Icons.AutoMirrored.Filled.MenuOpen,
contentDescription = stringResource(id = R.string.navigation_drawer)
)
}
Expand Down
Loading