mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 00:35:26 +02:00
parent
9288f19f6d
commit
e821f26ad9
@ -47,8 +47,8 @@ import com.sadellie.unitto.core.ui.common.open
|
||||
import com.sadellie.unitto.core.ui.common.rememberUnittoDrawerState
|
||||
import com.sadellie.unitto.core.ui.model.DrawerItems
|
||||
import com.sadellie.unitto.core.ui.pushDynamicShortcut
|
||||
import com.sadellie.unitto.core.ui.theme.AppTypographySystem
|
||||
import com.sadellie.unitto.core.ui.theme.AppTypographyUnitto
|
||||
import com.sadellie.unitto.core.ui.theme.TypographySystem
|
||||
import com.sadellie.unitto.core.ui.theme.TypographyUnitto
|
||||
import com.sadellie.unitto.core.ui.theme.DarkThemeColors
|
||||
import com.sadellie.unitto.core.ui.theme.LightThemeColors
|
||||
import com.sadellie.unitto.data.userprefs.AppPreferences
|
||||
@ -107,7 +107,7 @@ internal fun UnittoApp(prefs: AppPreferences) {
|
||||
|
||||
Themmo(
|
||||
themmoController = themmoController,
|
||||
typography = if (prefs.systemFont) AppTypographySystem else AppTypographyUnitto,
|
||||
typography = if (prefs.systemFont) TypographySystem else TypographyUnitto,
|
||||
animationSpec = tween(250)
|
||||
) {
|
||||
val backgroundColor = MaterialTheme.colorScheme.background
|
||||
|
@ -59,7 +59,7 @@ import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.unit.Constraints
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.sadellie.unitto.core.ui.theme.NumbersTextStyleDisplayLarge
|
||||
import com.sadellie.unitto.core.ui.theme.numbersDisplayLarge
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@ -105,7 +105,7 @@ fun ExpressionTextField(
|
||||
modifier = modifier,
|
||||
value = value,
|
||||
formattedValue = value.text.formatExpression(formatterSymbols),
|
||||
textStyle = NumbersTextStyleDisplayLarge.copy(color = textColor),
|
||||
textStyle = MaterialTheme.typography.numbersDisplayLarge.copy(color = textColor),
|
||||
minRatio = minRatio,
|
||||
onValueChange = { onCursorChange(it.selection) },
|
||||
readOnly = readOnly,
|
||||
@ -157,7 +157,7 @@ fun UnformattedTextField(
|
||||
AutoSizableTextField(
|
||||
modifier = modifier,
|
||||
value = value,
|
||||
textStyle = NumbersTextStyleDisplayLarge.copy(color = textColor),
|
||||
textStyle = MaterialTheme.typography.numbersDisplayLarge.copy(color = textColor),
|
||||
minRatio = minRatio,
|
||||
onValueChange = { onCursorChange(it.selection) },
|
||||
readOnly = readOnly,
|
||||
|
@ -27,232 +27,146 @@ import androidx.compose.ui.unit.em
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.sadellie.unitto.core.base.R
|
||||
|
||||
val Montserrat = FontFamily(
|
||||
Font(R.font.montserrat_light, weight = FontWeight.Light),
|
||||
Font(R.font.montserrat_regular, weight = FontWeight.Normal),
|
||||
Font(R.font.montserrat_medium, weight = FontWeight.Medium),
|
||||
Font(R.font.montserrat_semibold, weight = FontWeight.SemiBold),
|
||||
)
|
||||
|
||||
val Lato = FontFamily(
|
||||
Font(R.font.lato_regular)
|
||||
)
|
||||
|
||||
// This text style is used for text field
|
||||
val NumbersTextStyleDisplayLarge = TextStyle(
|
||||
fontFamily = Lato,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = (1.4).em,
|
||||
letterSpacing = (-0.25).sp,
|
||||
)
|
||||
val Typography.numbersDisplayLarge by lazy {
|
||||
TextStyle(
|
||||
fontFamily = latoFamily,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = (1.4).em,
|
||||
letterSpacing = (-0.25).sp,
|
||||
)
|
||||
}
|
||||
|
||||
// This text style is used for secondary text field
|
||||
val NumbersTextStyleDisplayMedium = TextStyle(
|
||||
fontFamily = Lato,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 38.sp,
|
||||
lineHeight = 42.sp,
|
||||
letterSpacing = (-0.25).sp,
|
||||
)
|
||||
|
||||
val AppTypographyUnitto = Typography(
|
||||
displayLarge = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = 64.sp,
|
||||
val Typography.numbersDisplayMedium by lazy {
|
||||
TextStyle(
|
||||
fontFamily = latoFamily,
|
||||
fontWeight = FontWeight.W400,
|
||||
fontSize = 38.sp,
|
||||
lineHeight = 42.sp,
|
||||
letterSpacing = (-0.25).sp,
|
||||
),
|
||||
displayMedium = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 45.sp,
|
||||
lineHeight = 52.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
displaySmall = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 36.sp,
|
||||
lineHeight = 44.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineLarge = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 40.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineMedium = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
lineHeight = 36.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineSmall = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 32.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleMedium = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 18.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
titleSmall = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
bodyMedium = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.25.sp,
|
||||
),
|
||||
bodySmall = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.4.sp,
|
||||
),
|
||||
labelLarge = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
labelMedium = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = Montserrat,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 10.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val TypographyUnitto by lazy {
|
||||
Typography(
|
||||
displayLarge = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = 64.sp,
|
||||
letterSpacing = (-0.25).sp,
|
||||
),
|
||||
displayMedium = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 45.sp,
|
||||
lineHeight = 52.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
displaySmall = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 36.sp,
|
||||
lineHeight = 44.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineLarge = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 40.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineMedium = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
lineHeight = 36.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineSmall = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 32.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleMedium = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 18.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
titleSmall = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
bodyMedium = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.25.sp,
|
||||
),
|
||||
bodySmall = TextStyle(
|
||||
fontFamily = montserratFamily,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.4.sp,
|
||||
),
|
||||
labelLarge = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
labelMedium = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 10.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
val AppTypographySystem = Typography(
|
||||
displayLarge = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 57.sp,
|
||||
lineHeight = 64.sp,
|
||||
letterSpacing = (-0.25).sp,
|
||||
),
|
||||
displayMedium = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 45.sp,
|
||||
lineHeight = 52.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
displaySmall = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 36.sp,
|
||||
lineHeight = 44.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineLarge = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 40.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineMedium = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 28.sp,
|
||||
lineHeight = 36.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
headlineSmall = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 24.sp,
|
||||
lineHeight = 32.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleLarge = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
titleMedium = TextStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 18.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
titleSmall = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
bodyLarge = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
bodyMedium = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.25.sp,
|
||||
),
|
||||
bodySmall = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.4.sp,
|
||||
),
|
||||
labelLarge = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 20.sp,
|
||||
letterSpacing = 0.1.sp,
|
||||
),
|
||||
labelMedium = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp,
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 10.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.sp,
|
||||
),
|
||||
)
|
||||
val TypographySystem by lazy { Typography() }
|
||||
|
||||
private val montserratFamily by lazy {
|
||||
FontFamily(
|
||||
Font(R.font.montserrat_light, weight = FontWeight.Light),
|
||||
Font(R.font.montserrat_regular, weight = FontWeight.Normal),
|
||||
Font(R.font.montserrat_medium, weight = FontWeight.Medium),
|
||||
Font(R.font.montserrat_semibold, weight = FontWeight.SemiBold),
|
||||
)
|
||||
}
|
||||
|
||||
private val latoFamily by lazy {
|
||||
FontFamily(Font(R.font.lato_regular))
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ import com.sadellie.unitto.core.ui.common.textfield.FormatterSymbols
|
||||
import com.sadellie.unitto.core.ui.common.textfield.UnittoTextToolbar
|
||||
import com.sadellie.unitto.core.ui.common.textfield.clearAndFilterExpression
|
||||
import com.sadellie.unitto.core.ui.common.textfield.copyWithoutGrouping
|
||||
import com.sadellie.unitto.core.ui.theme.NumbersTextStyleDisplayMedium
|
||||
import com.sadellie.unitto.core.ui.theme.numbersDisplayMedium
|
||||
import com.sadellie.unitto.data.model.HistoryItem
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
@ -212,7 +212,7 @@ private fun HistoryListItem(
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp)
|
||||
.horizontalScroll(rememberScrollState(), reverseScrolling = true),
|
||||
textStyle = NumbersTextStyleDisplayMedium.copy(color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End),
|
||||
textStyle = MaterialTheme.typography.numbersDisplayMedium.copy(color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.End),
|
||||
readOnly = true,
|
||||
visualTransformation = ExpressionTransformer(formatterSymbols),
|
||||
interactionSource = expressionInteractionSource
|
||||
@ -237,7 +237,7 @@ private fun HistoryListItem(
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp)
|
||||
.horizontalScroll(rememberScrollState(), reverseScrolling = true),
|
||||
textStyle = NumbersTextStyleDisplayMedium.copy(color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.5f), textAlign = TextAlign.End),
|
||||
textStyle = MaterialTheme.typography.numbersDisplayMedium.copy(color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.5f), textAlign = TextAlign.End),
|
||||
readOnly = true,
|
||||
visualTransformation = ExpressionTransformer(formatterSymbols),
|
||||
interactionSource = resultInteractionSource
|
||||
|
@ -62,7 +62,7 @@ import com.sadellie.unitto.core.ui.common.UnittoScreenWithLargeTopBar
|
||||
import com.sadellie.unitto.core.ui.common.UnittoSlider
|
||||
import com.sadellie.unitto.core.ui.common.squashable
|
||||
import com.sadellie.unitto.core.ui.common.textfield.formatExpression
|
||||
import com.sadellie.unitto.core.ui.theme.NumbersTextStyleDisplayMedium
|
||||
import com.sadellie.unitto.core.ui.theme.numbersDisplayMedium
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@Composable
|
||||
@ -135,7 +135,7 @@ fun FormattingScreen(
|
||||
)
|
||||
Text(
|
||||
text = uiState.preview,
|
||||
style = NumbersTextStyleDisplayMedium,
|
||||
style = MaterialTheme.typography.numbersDisplayMedium,
|
||||
maxLines = 1,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
@ -85,7 +85,7 @@ import com.sadellie.unitto.core.ui.common.UnittoScreenWithTopBar
|
||||
import com.sadellie.unitto.core.ui.common.squashable
|
||||
import com.sadellie.unitto.core.ui.datetime.UnittoDateTimeFormatter
|
||||
import com.sadellie.unitto.core.ui.datetime.formatLocal
|
||||
import com.sadellie.unitto.core.ui.theme.AppTypographyUnitto
|
||||
import com.sadellie.unitto.core.ui.theme.TypographyUnitto
|
||||
import com.sadellie.unitto.core.ui.theme.DarkThemeColors
|
||||
import com.sadellie.unitto.core.ui.theme.LightThemeColors
|
||||
import com.sadellie.unitto.data.model.UnittoTimeZone
|
||||
@ -355,7 +355,7 @@ fun PreviewTimeZoneScreen() {
|
||||
lightColorScheme = LightThemeColors,
|
||||
darkColorScheme = DarkThemeColors,
|
||||
),
|
||||
typography = AppTypographyUnitto,
|
||||
typography = TypographyUnitto,
|
||||
) {
|
||||
TimeZoneScreen(
|
||||
uiState = TimeZoneUIState(
|
||||
|
Loading…
x
Reference in New Issue
Block a user