in ComposeAdvanced/app/src/main/java/com/example/android/wearable/composeadvanced/presentation/ui/landing/LandingScreen.kt [56:133]
fun LandingScreen(
onClickWatchList: () -> Unit,
proceedingTimeTextEnabled: Boolean,
onClickProceedingTimeText: (Boolean) -> Unit,
) {
Box(modifier = Modifier.fillMaxSize()) {
// Places both Chips (button and toggle) in the middle of the screen.
Column(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = 10.dp),
verticalArrangement = Arrangement.Center
) {
CompactChip(
onClick = onClickWatchList,
label = {
Text(
stringResource(R.string.list_of_watches_button_label),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
)
Spacer(modifier = Modifier.size(4.dp))
ToggleChip(
modifier = Modifier.height(32.dp),
checked = proceedingTimeTextEnabled,
onCheckedChange = onClickProceedingTimeText,
label = {
Text(
text = stringResource(R.string.proceeding_text_toggle_chip_label),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
}
)
}
// Places curved text at the bottom of round devices and straight text at the bottom of
// non-round devices.
if (LocalConfiguration.current.isScreenRound) {
CurvedRow(
// 90 degrees is bottom (6 o'clock).
anchor = 90F,
anchorType = AnchorType.Center,
modifier = Modifier.fillMaxSize()
) {
CurvedText(
text = stringResource(R.string.watch_shape),
clockwise = false,
style = CurvedTextStyle(
fontSize = 18.sp,
color = MaterialTheme.colors.primary,
)
)
}
} else {
Row(
modifier = Modifier.fillMaxSize(),
verticalAlignment = Alignment.Bottom
) {
Text(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 2.dp),
textAlign = TextAlign.Center,
color = MaterialTheme.colors.primary,
text = stringResource(R.string.watch_shape),
fontSize = 18.sp
)
}
}
}
}