Update typography

This commit is contained in:
MM20 2021-09-26 00:28:42 +02:00
parent 036aaba2e5
commit 817a867309
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
15 changed files with 103 additions and 42 deletions

View File

@ -12,7 +12,6 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import de.mm20.launcher2.ui.locals.LocalColorScheme import de.mm20.launcher2.ui.locals.LocalColorScheme
import de.mm20.launcher2.ui.locals.LocalWallpaperColors
val lightPalette = lightColors( val lightPalette = lightColors(
primary = Color(0, 114, 255) primary = Color(0, 114, 255)
@ -37,25 +36,51 @@ val Inter = FontFamily(
val typography = Typography( val typography = Typography(
h1 = TextStyle( h1 = TextStyle(
fontSize = 18.sp, fontSize = 96.sp,
fontWeight = FontWeight.ExtraBold, fontWeight = FontWeight.Light,
fontFamily = Inter fontFamily = Inter
), ),
h2 = TextStyle( h2 = TextStyle(
fontSize = 15.sp, fontSize = 60.sp,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Light,
fontFamily = Inter fontFamily = Inter
), ),
h3 = TextStyle( h3 = TextStyle(
fontSize = 13.sp, fontSize = 48.sp,
fontWeight = FontWeight.Normal,
fontFamily = Inter
),
h4 = TextStyle(
fontSize = 34.sp,
fontWeight = FontWeight.Normal,
fontFamily = Inter
),
h5 = TextStyle(
fontSize = 24.sp,
fontWeight = FontWeight.Medium,
fontFamily = Inter
),
h6 = TextStyle(
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
fontFamily = Inter fontFamily = Inter
), ),
caption = TextStyle( caption = TextStyle(
fontFamily = Inter, fontFamily = Inter,
fontSize = 13.sp fontSize = 13.sp
), ),
subtitle1 = TextStyle(
fontFamily = Inter,
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
),
subtitle2 = TextStyle(
fontFamily = Inter,
fontWeight = FontWeight.SemiBold,
fontSize = 14.sp,
),
body1 = TextStyle( body1 = TextStyle(
fontSize = 13.sp fontSize = 14.sp
), ),
body2 = TextStyle( body2 = TextStyle(
fontSize = 13.sp fontSize = 13.sp

View File

@ -12,21 +12,42 @@ import androidx.compose.ui.unit.sp
val legacyTypography = Typography( val legacyTypography = Typography(
h1 = TextStyle( h1 = TextStyle(
fontSize = 18.sp, fontSize = 96.sp,
fontWeight = FontWeight.Medium, fontWeight = FontWeight.Light,
), ),
h2 = TextStyle( h2 = TextStyle(
fontSize = 15.sp, fontSize = 60.sp,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Light,
), ),
h3 = TextStyle( h3 = TextStyle(
fontSize = 13.sp, fontSize = 48.sp,
fontWeight = FontWeight.Normal,
),
h4 = TextStyle(
fontSize = 34.sp,
fontWeight = FontWeight.Normal,
),
h5 = TextStyle(
fontSize = 24.sp,
fontWeight = FontWeight.Medium,
),
h6 = TextStyle(
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
), ),
caption = TextStyle( caption = TextStyle(
fontSize = 13.sp fontSize = 13.sp
), ),
subtitle1 = TextStyle(
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
),
subtitle2 = TextStyle(
fontWeight = FontWeight.SemiBold,
fontSize = 14.sp,
),
body1 = TextStyle( body1 = TextStyle(
fontSize = 13.sp fontSize = 14.sp
), ),
body2 = TextStyle( body2 = TextStyle(
fontSize = 13.sp fontSize = 13.sp
@ -38,6 +59,6 @@ fun LegacyLauncherTheme(content: @Composable () -> Unit) {
MaterialTheme( MaterialTheme(
typography = legacyTypography, typography = legacyTypography,
content = content, content = content,
colors = if(isSystemInDarkTheme()) darkColors() else lightColors() colors = if (isSystemInDarkTheme()) darkColors() else lightColors()
) )
} }

View File

@ -109,7 +109,7 @@ fun AnalogClock(time: Long) {
Text( Text(
text = "12", text = "12",
style = MaterialTheme.typography.h1.copy( style = MaterialTheme.typography.subtitle1.copy(
fontSize = 32.sp, fontSize = 32.sp,
lineHeight = 32.sp, lineHeight = 32.sp,
), ),
@ -120,7 +120,7 @@ fun AnalogClock(time: Long) {
) )
Text( Text(
text = "3", text = "3",
style = MaterialTheme.typography.h1.copy( style = MaterialTheme.typography.subtitle1.copy(
fontSize = 32.sp fontSize = 32.sp
), ),
color = textColor, color = textColor,
@ -130,7 +130,7 @@ fun AnalogClock(time: Long) {
) )
Text( Text(
text = "6", text = "6",
style = MaterialTheme.typography.h1.copy( style = MaterialTheme.typography.subtitle1.copy(
fontSize = 32.sp fontSize = 32.sp
), ),
color = textColor, color = textColor,
@ -140,7 +140,7 @@ fun AnalogClock(time: Long) {
) )
Text( Text(
text = "9", text = "9",
style = MaterialTheme.typography.h1.copy( style = MaterialTheme.typography.subtitle1.copy(
fontSize = 32.sp fontSize = 32.sp
), ),
color = textColor, color = textColor,

View File

@ -132,7 +132,10 @@ fun SearchBar(
DropdownMenuItem(onClick = { DropdownMenuItem(onClick = {
navController?.navigate("settings") navController?.navigate("settings")
}) { }) {
Text(stringResource(id = R.string.title_activity_settings)) Text(
stringResource(id = R.string.title_activity_settings),
style = MaterialTheme.typography.subtitle2
)
} }
} }
} }

View File

@ -100,7 +100,10 @@ fun ColumnScope.OverflowMenuItems(items: List<ToolbarAction>, onDismiss: () -> U
DropdownMenuItem( DropdownMenuItem(
onClick = { selectedSubMenu = i }, onClick = { selectedSubMenu = i },
) { ) {
Text(action.label, modifier = Modifier.weight(1f)) Text(
action.label, modifier = Modifier.weight(1f),
style = MaterialTheme.typography.subtitle2
)
Icon(imageVector = Icons.Rounded.ArrowRight, contentDescription = null) Icon(imageVector = Icons.Rounded.ArrowRight, contentDescription = null)
} }
} }
@ -108,7 +111,10 @@ fun ColumnScope.OverflowMenuItems(items: List<ToolbarAction>, onDismiss: () -> U
DropdownMenuItem( DropdownMenuItem(
onClick = { action.onCheckedChange(!action.isChecked) }, onClick = { action.onCheckedChange(!action.isChecked) },
) { ) {
Text(action.label) Text(
action.label,
style = MaterialTheme.typography.subtitle2
)
} }
} }
is DefaultToolbarAction -> { is DefaultToolbarAction -> {
@ -116,7 +122,10 @@ fun ColumnScope.OverflowMenuItems(items: List<ToolbarAction>, onDismiss: () -> U
action.action action.action
onDismiss() onDismiss()
}) { }) {
Text(action.label) Text(
action.label,
style = MaterialTheme.typography.subtitle2
)
} }
} }
} }

View File

@ -62,7 +62,7 @@ fun ApplicationItem(
Column { Column {
Text( Text(
text = app.label, text = app.label,
style = MaterialTheme.typography.h1, style = MaterialTheme.typography.subtitle1,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )

View File

@ -37,7 +37,7 @@ fun calculatorItem(): LazyListScope.() -> Unit {
} }
Text( Text(
text = "= ${it.formattedString}", text = "= ${it.formattedString}",
style = MaterialTheme.typography.h1, style = MaterialTheme.typography.subtitle1,
modifier = Modifier.align(Alignment.End), modifier = Modifier.align(Alignment.End),
) )
if (it.term.matches(Regex("(0x|0b)?[0-9]+"))) { if (it.term.matches(Regex("(0x|0b)?[0-9]+"))) {

View File

@ -74,7 +74,7 @@ fun FileItem(
Column { Column {
Text( Text(
text = file.label, text = file.label,
style = MaterialTheme.typography.h2, style = MaterialTheme.typography.subtitle2,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
) )

View File

@ -22,7 +22,7 @@ fun ColumnScope.GridItemLabel(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Center, textAlign = TextAlign.Center,
style = MaterialTheme.typography.body1, style = MaterialTheme.typography.body2,
softWrap = false, softWrap = false,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()

View File

@ -36,7 +36,7 @@ fun WikipediaItem(
) { ) {
Text( Text(
text = wikipedia.label, text = wikipedia.label,
style = MaterialTheme.typography.h1, style = MaterialTheme.typography.subtitle1,
) )
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text( Text(

View File

@ -80,7 +80,7 @@ fun CalendarEventItem(
) { ) {
Text( Text(
text = event.label, text = event.label,
style = MaterialTheme.typography.h2 style = MaterialTheme.typography.subtitle2
) )
AnimatedVisibility( AnimatedVisibility(
representation == Representation.List representation == Representation.List

View File

@ -122,7 +122,7 @@ fun CalendarWidget() {
if (pinnedEvents.isNotEmpty()) { if (pinnedEvents.isNotEmpty()) {
Text( Text(
text = stringResource(id = R.string.calendar_widget_pinned_events), text = stringResource(id = R.string.calendar_widget_pinned_events),
style = MaterialTheme.typography.h1 style = MaterialTheme.typography.subtitle1
) )
DeprecatedSearchableList( DeprecatedSearchableList(
items = pinnedEvents, items = pinnedEvents,
@ -178,7 +178,7 @@ fun DaySelector(
modifier = Modifier modifier = Modifier
.wrapContentWidth(), .wrapContentWidth(),
text = formatDay(LocalContext.current, selectedDay), text = formatDay(LocalContext.current, selectedDay),
style = MaterialTheme.typography.h1 style = MaterialTheme.typography.subtitle1
) )
Icon( Icon(
imageVector = Icons.Rounded.ArrowDropDown, imageVector = Icons.Rounded.ArrowDropDown,
@ -196,7 +196,10 @@ fun DaySelector(
menuExpanded = false menuExpanded = false
onSelectDay(selectedDay) onSelectDay(selectedDay)
}) { }) {
Text(text = formatDay(LocalContext.current, day)) Text(
text = formatDay(LocalContext.current, day),
style = MaterialTheme.typography.subtitle2
)
} }
} }
} }

View File

@ -67,7 +67,7 @@ fun MusicWidget() {
) { ) {
Text( Text(
text = title ?: "---", text = title ?: "---",
style = MaterialTheme.typography.h1, style = MaterialTheme.typography.subtitle1,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )

View File

@ -81,7 +81,7 @@ fun WeatherWidget() {
) { ) {
Text( Text(
text = selectedForecast.location, text = selectedForecast.location,
style = MaterialTheme.typography.h1 style = MaterialTheme.typography.subtitle1
) )
Text( Text(
text = convertTemperature( text = convertTemperature(
@ -239,7 +239,7 @@ fun WeatherDaySelector(
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
Text( Text(
text = dateFormat.format(selectedDay.timestamp), text = dateFormat.format(selectedDay.timestamp),
style = MaterialTheme.typography.h2, style = MaterialTheme.typography.subtitle2,
modifier = Modifier modifier = Modifier
.align(Alignment.CenterVertically) .align(Alignment.CenterVertically)
.padding(start = 16.dp, end = 8.dp) .padding(start = 16.dp, end = 8.dp)
@ -279,7 +279,7 @@ fun WeatherDaySelector(
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
Text( Text(
text = dateFormat.format(d.timestamp), text = dateFormat.format(d.timestamp),
style = MaterialTheme.typography.h2, style = MaterialTheme.typography.subtitle2,
softWrap = false, softWrap = false,
modifier = Modifier modifier = Modifier
.align(Alignment.CenterVertically) .align(Alignment.CenterVertically)
@ -330,7 +330,7 @@ fun WeatherTimeSelector(
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
Text( Text(
text = dateFormat.format(selectedForecast.timestamp), text = dateFormat.format(selectedForecast.timestamp),
style = MaterialTheme.typography.h2, style = MaterialTheme.typography.subtitle2,
modifier = Modifier.align(Alignment.CenterVertically) modifier = Modifier.align(Alignment.CenterVertically)
) )
} }
@ -356,7 +356,7 @@ fun WeatherTimeSelector(
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
Text( Text(
text = dateFormat.format(fc.timestamp), text = dateFormat.format(fc.timestamp),
style = MaterialTheme.typography.h2, style = MaterialTheme.typography.subtitle2,
softWrap = false, softWrap = false,
modifier = Modifier modifier = Modifier
.align(Alignment.CenterVertically) .align(Alignment.CenterVertically)

View File

@ -9,6 +9,6 @@ import de.mm20.launcher2.ui.component.TextClock
fun DatePart() { fun DatePart() {
TextClock( TextClock(
formatFlags = DateUtils.FORMAT_SHOW_WEEKDAY or DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_YEAR, formatFlags = DateUtils.FORMAT_SHOW_WEEKDAY or DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_YEAR,
style = MaterialTheme.typography.h2 style = MaterialTheme.typography.subtitle1
) )
} }