mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-18 16:25:27 +02:00
parent
ff81b2e79c
commit
24f03b9d3d
@ -32,9 +32,6 @@ import androidx.core.os.ConfigurationCompat
|
|||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.sadellie.unitto.core.ui.LocalLocale
|
import com.sadellie.unitto.core.ui.LocalLocale
|
||||||
import com.sadellie.unitto.core.ui.theme.LocalNumberTypography
|
|
||||||
import com.sadellie.unitto.core.ui.theme.NumberTypographySystem
|
|
||||||
import com.sadellie.unitto.core.ui.theme.NumberTypographyUnitto
|
|
||||||
import com.sadellie.unitto.data.model.repository.UserPreferencesRepository
|
import com.sadellie.unitto.data.model.repository.UserPreferencesRepository
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
@ -58,13 +55,8 @@ internal class MainActivity : AppCompatActivity() {
|
|||||||
ConfigurationCompat.getLocales(configuration).get(0) ?: Locale.getDefault()
|
ConfigurationCompat.getLocales(configuration).get(0) ?: Locale.getDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
val numbersTypography = remember(prefs?.systemFont) {
|
|
||||||
if (prefs?.systemFont == true) NumberTypographySystem else NumberTypographyUnitto
|
|
||||||
}
|
|
||||||
|
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalLocale provides locale,
|
LocalLocale provides locale
|
||||||
LocalNumberTypography provides numbersTypography
|
|
||||||
) {
|
) {
|
||||||
UnittoApp(prefs)
|
UnittoApp(prefs)
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ package com.sadellie.unitto
|
|||||||
|
|
||||||
import androidx.activity.compose.BackHandler
|
import androidx.activity.compose.BackHandler
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@ -53,7 +52,6 @@ import io.github.sadellie.themmo.Themmo
|
|||||||
import io.github.sadellie.themmo.ThemmoController
|
import io.github.sadellie.themmo.ThemmoController
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun UnittoApp(prefs: AppPreferences?) {
|
internal fun UnittoApp(prefs: AppPreferences?) {
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ import androidx.compose.ui.text.TextRange
|
|||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.sadellie.unitto.core.ui.theme.LocalNumberTypography
|
import com.sadellie.unitto.core.ui.theme.NumberTypographyUnitto
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun FixedInputTextField(
|
fun FixedInputTextField(
|
||||||
@ -83,7 +83,7 @@ fun FixedInputTextField(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 8.dp)
|
.padding(horizontal = 8.dp)
|
||||||
.horizontalScroll(rememberScrollState(), reverseScrolling = true),
|
.horizontalScroll(rememberScrollState(), reverseScrolling = true),
|
||||||
textStyle = LocalNumberTypography.current.displaySmall.copy(color = textColor, textAlign = TextAlign.End),
|
textStyle = NumberTypographyUnitto.displaySmall.copy(color = textColor, textAlign = TextAlign.End),
|
||||||
readOnly = true,
|
readOnly = true,
|
||||||
visualTransformation = ExpressionTransformer(formatterSymbols),
|
visualTransformation = ExpressionTransformer(formatterSymbols),
|
||||||
interactionSource = expressionInteractionSource
|
interactionSource = expressionInteractionSource
|
||||||
|
@ -59,7 +59,7 @@ import androidx.compose.ui.text.input.VisualTransformation
|
|||||||
import androidx.compose.ui.unit.Constraints
|
import androidx.compose.ui.unit.Constraints
|
||||||
import androidx.compose.ui.unit.TextUnit
|
import androidx.compose.ui.unit.TextUnit
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.sadellie.unitto.core.ui.theme.LocalNumberTypography
|
import com.sadellie.unitto.core.ui.theme.NumberTypographyUnitto
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ fun ExpressionTextField(
|
|||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
value = value,
|
value = value,
|
||||||
formattedValue = value.text.formatExpression(formatterSymbols),
|
formattedValue = value.text.formatExpression(formatterSymbols),
|
||||||
textStyle = LocalNumberTypography.current.displayLarge.copy(color = textColor),
|
textStyle = NumberTypographyUnitto.displayLarge.copy(color = textColor),
|
||||||
minRatio = minRatio,
|
minRatio = minRatio,
|
||||||
onValueChange = { onCursorChange(it.selection) },
|
onValueChange = { onCursorChange(it.selection) },
|
||||||
readOnly = readOnly,
|
readOnly = readOnly,
|
||||||
@ -157,7 +157,7 @@ fun UnformattedTextField(
|
|||||||
AutoSizableTextField(
|
AutoSizableTextField(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
value = value,
|
value = value,
|
||||||
textStyle = LocalNumberTypography.current.displayLarge.copy(color = textColor),
|
textStyle = NumberTypographyUnitto.displayLarge.copy(color = textColor),
|
||||||
minRatio = minRatio,
|
minRatio = minRatio,
|
||||||
onValueChange = { onCursorChange(it.selection) },
|
onValueChange = { onCursorChange(it.selection) },
|
||||||
readOnly = readOnly,
|
readOnly = readOnly,
|
||||||
|
@ -24,9 +24,7 @@ import androidx.compose.material3.MaterialTheme
|
|||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.Typography
|
import androidx.compose.material3.Typography
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.staticCompositionLocalOf
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.Font
|
import androidx.compose.ui.text.font.Font
|
||||||
@ -71,16 +69,6 @@ val NumberTypographyUnitto by lazy {
|
|||||||
|
|
||||||
val TypographySystem by lazy { Typography() }
|
val TypographySystem by lazy { Typography() }
|
||||||
|
|
||||||
val NumberTypographySystem by lazy {
|
|
||||||
NumberTypography(
|
|
||||||
displayLarge = TypographySystem.displayLarge,
|
|
||||||
displayMedium = TypographySystem.displayMedium,
|
|
||||||
displaySmall = TypographySystem.displaySmall,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val LocalNumberTypography = staticCompositionLocalOf { NumberTypographySystem }
|
|
||||||
|
|
||||||
private val FontFamily.Companion.lato: FontFamily
|
private val FontFamily.Companion.lato: FontFamily
|
||||||
get() = FontFamily(
|
get() = FontFamily(
|
||||||
Font(R.font.lato_regular, weight = FontWeight.Normal)
|
Font(R.font.lato_regular, weight = FontWeight.Normal)
|
||||||
@ -89,37 +77,32 @@ private val FontFamily.Companion.lato: FontFamily
|
|||||||
@Preview(widthDp = 480)
|
@Preview(widthDp = 480)
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewSystemTypography() {
|
private fun PreviewSystemTypography() {
|
||||||
MaterialTheme(
|
val textStyles = mapOf(
|
||||||
typography = TypographySystem
|
"displayLarge" to MaterialTheme.typography.displayLarge,
|
||||||
) {
|
"displayMedium" to MaterialTheme.typography.displayMedium,
|
||||||
val textStyles = mapOf(
|
"displaySmall" to MaterialTheme.typography.displaySmall,
|
||||||
"displayLarge" to MaterialTheme.typography.displayLarge,
|
"headlineLarge" to MaterialTheme.typography.headlineLarge,
|
||||||
"displayMedium" to MaterialTheme.typography.displayMedium,
|
"headlineMedium" to MaterialTheme.typography.headlineMedium,
|
||||||
"displaySmall" to MaterialTheme.typography.displaySmall,
|
"headlineSmall" to MaterialTheme.typography.headlineSmall,
|
||||||
"headlineLarge" to MaterialTheme.typography.headlineLarge,
|
"titleLarge" to MaterialTheme.typography.titleLarge,
|
||||||
"headlineMedium" to MaterialTheme.typography.headlineMedium,
|
"titleMedium" to MaterialTheme.typography.titleMedium,
|
||||||
"headlineSmall" to MaterialTheme.typography.headlineSmall,
|
"titleSmall" to MaterialTheme.typography.titleSmall,
|
||||||
"titleLarge" to MaterialTheme.typography.titleLarge,
|
"bodyLarge" to MaterialTheme.typography.bodyLarge,
|
||||||
"titleMedium" to MaterialTheme.typography.titleMedium,
|
"bodyMedium" to MaterialTheme.typography.bodyMedium,
|
||||||
"titleSmall" to MaterialTheme.typography.titleSmall,
|
"bodySmall" to MaterialTheme.typography.bodySmall,
|
||||||
"bodyLarge" to MaterialTheme.typography.bodyLarge,
|
"labelLarge" to MaterialTheme.typography.labelLarge,
|
||||||
"bodyMedium" to MaterialTheme.typography.bodyMedium,
|
"labelMedium" to MaterialTheme.typography.labelMedium,
|
||||||
"bodySmall" to MaterialTheme.typography.bodySmall,
|
"labelSmall" to MaterialTheme.typography.labelSmall,
|
||||||
"labelLarge" to MaterialTheme.typography.labelLarge,
|
)
|
||||||
"labelMedium" to MaterialTheme.typography.labelMedium,
|
|
||||||
"labelSmall" to MaterialTheme.typography.labelSmall,
|
|
||||||
)
|
|
||||||
|
|
||||||
LazyColumn(Modifier.background(MaterialTheme.colorScheme.background)) {
|
LazyColumn(Modifier.background(MaterialTheme.colorScheme.background)) {
|
||||||
|
textStyles.forEach { (label, style) ->
|
||||||
textStyles.forEach { (label, style) ->
|
item {
|
||||||
item {
|
Text(
|
||||||
Text(
|
text = "$label 123",
|
||||||
text = "$label 123",
|
style = style,
|
||||||
style = style,
|
color = MaterialTheme.colorScheme.onBackground
|
||||||
color = MaterialTheme.colorScheme.onBackground
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,25 +111,20 @@ private fun PreviewSystemTypography() {
|
|||||||
@Preview(widthDp = 480)
|
@Preview(widthDp = 480)
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewNumberTypography() {
|
private fun PreviewNumberTypography() {
|
||||||
CompositionLocalProvider(
|
val textStyles = mapOf(
|
||||||
LocalNumberTypography provides NumberTypographyUnitto
|
"displayLarge" to NumberTypographyUnitto.displayLarge,
|
||||||
) {
|
"displayMedium" to NumberTypographyUnitto.displayMedium,
|
||||||
val textStyles = mapOf(
|
"displaySmall" to NumberTypographyUnitto.displaySmall,
|
||||||
"displayLarge" to LocalNumberTypography.current.displayLarge,
|
)
|
||||||
"displayMedium" to LocalNumberTypography.current.displayMedium,
|
|
||||||
"displaySmall" to LocalNumberTypography.current.displaySmall,
|
|
||||||
)
|
|
||||||
|
|
||||||
LazyColumn(Modifier.background(MaterialTheme.colorScheme.background)) {
|
LazyColumn(Modifier.background(MaterialTheme.colorScheme.background)) {
|
||||||
|
textStyles.forEach { (label, style) ->
|
||||||
textStyles.forEach { (label, style) ->
|
item {
|
||||||
item {
|
Text(
|
||||||
Text(
|
text = "$label 123 Error 7 1⁄2",
|
||||||
text = "$label 123 Error 7 1⁄2",
|
style = style,
|
||||||
style = style,
|
color = MaterialTheme.colorScheme.onBackground
|
||||||
color = MaterialTheme.colorScheme.onBackground
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,6 @@ interface UserPreferencesRepository {
|
|||||||
|
|
||||||
suspend fun updateUnitConverterSorting(sorting: UnitsListSorting)
|
suspend fun updateUnitConverterSorting(sorting: UnitsListSorting)
|
||||||
|
|
||||||
suspend fun updateSystemFont(enabled: Boolean)
|
|
||||||
|
|
||||||
suspend fun updatePartialHistoryView(enabled: Boolean)
|
suspend fun updatePartialHistoryView(enabled: Boolean)
|
||||||
|
|
||||||
suspend fun updateAcButton(enabled: Boolean)
|
suspend fun updateAcButton(enabled: Boolean)
|
||||||
|
@ -26,6 +26,5 @@ interface AppPreferences {
|
|||||||
val monetMode: String
|
val monetMode: String
|
||||||
val startingScreen: String
|
val startingScreen: String
|
||||||
val enableToolsExperiment: Boolean
|
val enableToolsExperiment: Boolean
|
||||||
val systemFont: Boolean
|
|
||||||
val rpnMode: Boolean
|
val rpnMode: Boolean
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package com.sadellie.unitto.data.model.userprefs
|
package com.sadellie.unitto.data.model.userprefs
|
||||||
|
|
||||||
interface DisplayPreferences {
|
interface DisplayPreferences {
|
||||||
val systemFont: Boolean
|
|
||||||
val middleZero: Boolean
|
val middleZero: Boolean
|
||||||
val acButton: Boolean
|
val acButton: Boolean
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ data class AppPreferencesImpl(
|
|||||||
override val monetMode: String,
|
override val monetMode: String,
|
||||||
override val startingScreen: String,
|
override val startingScreen: String,
|
||||||
override val enableToolsExperiment: Boolean,
|
override val enableToolsExperiment: Boolean,
|
||||||
override val systemFont: Boolean,
|
|
||||||
override val rpnMode: Boolean,
|
override val rpnMode: Boolean,
|
||||||
) : AppPreferences
|
) : AppPreferences
|
||||||
|
|
||||||
@ -77,7 +76,6 @@ data class ConverterPreferencesImpl(
|
|||||||
) : ConverterPreferences
|
) : ConverterPreferences
|
||||||
|
|
||||||
data class DisplayPreferencesImpl(
|
data class DisplayPreferencesImpl(
|
||||||
override val systemFont: Boolean,
|
|
||||||
override val middleZero: Boolean,
|
override val middleZero: Boolean,
|
||||||
override val acButton: Boolean,
|
override val acButton: Boolean,
|
||||||
) : DisplayPreferences
|
) : DisplayPreferences
|
||||||
|
@ -32,7 +32,7 @@ internal object PrefsKeys {
|
|||||||
val MONET_MODE = stringPreferencesKey("MONET_MODE_PREF_KEY")
|
val MONET_MODE = stringPreferencesKey("MONET_MODE_PREF_KEY")
|
||||||
val STARTING_SCREEN = stringPreferencesKey("STARTING_SCREEN_PREF_KEY")
|
val STARTING_SCREEN = stringPreferencesKey("STARTING_SCREEN_PREF_KEY")
|
||||||
val ENABLE_TOOLS_EXPERIMENT = booleanPreferencesKey("ENABLE_TOOLS_EXPERIMENT_PREF_KEY")
|
val ENABLE_TOOLS_EXPERIMENT = booleanPreferencesKey("ENABLE_TOOLS_EXPERIMENT_PREF_KEY")
|
||||||
val SYSTEM_FONT = booleanPreferencesKey("SYSTEM_FONT_PREF_KEY")
|
// val SYSTEM_FONT = booleanPreferencesKey("SYSTEM_FONT_PREF_KEY")
|
||||||
val ENABLE_VIBRATIONS = booleanPreferencesKey("ENABLE_VIBRATIONS_PREF_KEY")
|
val ENABLE_VIBRATIONS = booleanPreferencesKey("ENABLE_VIBRATIONS_PREF_KEY")
|
||||||
val MIDDLE_ZERO = booleanPreferencesKey("MIDDLE_ZERO_PREF_KEY")
|
val MIDDLE_ZERO = booleanPreferencesKey("MIDDLE_ZERO_PREF_KEY")
|
||||||
val AC_BUTTON = booleanPreferencesKey("AC_BUTTON_PREF_KEY")
|
val AC_BUTTON = booleanPreferencesKey("AC_BUTTON_PREF_KEY")
|
||||||
|
@ -63,7 +63,6 @@ class UserPreferencesRepositoryImpl @Inject constructor(
|
|||||||
monetMode = preferences.getMonetMode(),
|
monetMode = preferences.getMonetMode(),
|
||||||
startingScreen = preferences.getStartingScreen(),
|
startingScreen = preferences.getStartingScreen(),
|
||||||
enableToolsExperiment = preferences.getEnableToolsExperiment(),
|
enableToolsExperiment = preferences.getEnableToolsExperiment(),
|
||||||
systemFont = preferences.getSystemFont(),
|
|
||||||
rpnMode = preferences.getRpnMode(),
|
rpnMode = preferences.getRpnMode(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -112,7 +111,6 @@ class UserPreferencesRepositoryImpl @Inject constructor(
|
|||||||
override val displayPrefs: Flow<DisplayPreferences> = data
|
override val displayPrefs: Flow<DisplayPreferences> = data
|
||||||
.map { preferences ->
|
.map { preferences ->
|
||||||
DisplayPreferencesImpl(
|
DisplayPreferencesImpl(
|
||||||
systemFont = preferences.getSystemFont(),
|
|
||||||
middleZero = preferences.getMiddleZero(),
|
middleZero = preferences.getMiddleZero(),
|
||||||
acButton = preferences.getAcButton(),
|
acButton = preferences.getAcButton(),
|
||||||
)
|
)
|
||||||
@ -265,12 +263,6 @@ class UserPreferencesRepositoryImpl @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun updateSystemFont(enabled: Boolean) {
|
|
||||||
dataStore.edit { preferences ->
|
|
||||||
preferences[PrefsKeys.SYSTEM_FONT] = enabled
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun updatePartialHistoryView(enabled: Boolean) {
|
override suspend fun updatePartialHistoryView(enabled: Boolean) {
|
||||||
dataStore.edit { preferences ->
|
dataStore.edit { preferences ->
|
||||||
preferences[PrefsKeys.PARTIAL_HISTORY_VIEW] = enabled
|
preferences[PrefsKeys.PARTIAL_HISTORY_VIEW] = enabled
|
||||||
@ -325,10 +317,6 @@ private fun Preferences.getEnableToolsExperiment(): Boolean {
|
|||||||
return this[PrefsKeys.ENABLE_TOOLS_EXPERIMENT] ?: false
|
return this[PrefsKeys.ENABLE_TOOLS_EXPERIMENT] ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Preferences.getSystemFont(): Boolean {
|
|
||||||
return this[PrefsKeys.SYSTEM_FONT] ?: false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun Preferences.getEnableVibrations(): Boolean {
|
private fun Preferences.getEnableVibrations(): Boolean {
|
||||||
return this[PrefsKeys.ENABLE_VIBRATIONS] ?: true
|
return this[PrefsKeys.ENABLE_VIBRATIONS] ?: true
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ import androidx.compose.material.icons.Icons
|
|||||||
import androidx.compose.material.icons.filled.Colorize
|
import androidx.compose.material.icons.filled.Colorize
|
||||||
import androidx.compose.material.icons.filled.DarkMode
|
import androidx.compose.material.icons.filled.DarkMode
|
||||||
import androidx.compose.material.icons.filled.ExposureZero
|
import androidx.compose.material.icons.filled.ExposureZero
|
||||||
import androidx.compose.material.icons.filled.FontDownload
|
|
||||||
import androidx.compose.material.icons.filled.Language
|
import androidx.compose.material.icons.filled.Language
|
||||||
import androidx.compose.material.icons.filled.Palette
|
import androidx.compose.material.icons.filled.Palette
|
||||||
import androidx.compose.material.icons.outlined.DarkMode
|
import androidx.compose.material.icons.outlined.DarkMode
|
||||||
@ -113,8 +112,6 @@ internal fun DisplayRoute(
|
|||||||
themmoController.setMonetMode(newValue)
|
themmoController.setMonetMode(newValue)
|
||||||
viewModel.updateMonetMode(newValue)
|
viewModel.updateMonetMode(newValue)
|
||||||
},
|
},
|
||||||
systemFont = prefs.systemFont,
|
|
||||||
updateSystemFont = viewModel::updateSystemFont,
|
|
||||||
acButton = prefs.acButton,
|
acButton = prefs.acButton,
|
||||||
updateAcButton = viewModel::updateAcButton,
|
updateAcButton = viewModel::updateAcButton,
|
||||||
middleZero = prefs.middleZero,
|
middleZero = prefs.middleZero,
|
||||||
@ -138,8 +135,6 @@ private fun DisplayScreen(
|
|||||||
onColorChange: (Color) -> Unit,
|
onColorChange: (Color) -> Unit,
|
||||||
monetMode: MonetMode,
|
monetMode: MonetMode,
|
||||||
onMonetModeChange: (MonetMode) -> Unit,
|
onMonetModeChange: (MonetMode) -> Unit,
|
||||||
systemFont: Boolean,
|
|
||||||
updateSystemFont: (Boolean) -> Unit,
|
|
||||||
acButton: Boolean,
|
acButton: Boolean,
|
||||||
updateAcButton: (Boolean) -> Unit,
|
updateAcButton: (Boolean) -> Unit,
|
||||||
middleZero: Boolean,
|
middleZero: Boolean,
|
||||||
@ -261,14 +256,6 @@ private fun DisplayScreen(
|
|||||||
|
|
||||||
Header(stringResource(R.string.settings_additional))
|
Header(stringResource(R.string.settings_additional))
|
||||||
|
|
||||||
UnittoListItem(
|
|
||||||
icon = Icons.Default.FontDownload,
|
|
||||||
headlineText = stringResource(R.string.settings_system_font),
|
|
||||||
supportingText = stringResource(R.string.settings_system_font_support),
|
|
||||||
switchState = systemFont,
|
|
||||||
onSwitchChange = updateSystemFont
|
|
||||||
)
|
|
||||||
|
|
||||||
UnittoListItem(
|
UnittoListItem(
|
||||||
icon = UnittoIcons.Clear,
|
icon = UnittoIcons.Clear,
|
||||||
headlineText = stringResource(R.string.settings_ac_button),
|
headlineText = stringResource(R.string.settings_ac_button),
|
||||||
@ -311,8 +298,6 @@ private fun Preview() {
|
|||||||
onColorChange = themmoController::setCustomColor,
|
onColorChange = themmoController::setCustomColor,
|
||||||
monetMode = themmoController.currentMonetMode,
|
monetMode = themmoController.currentMonetMode,
|
||||||
onMonetModeChange = themmoController::setMonetMode,
|
onMonetModeChange = themmoController::setMonetMode,
|
||||||
systemFont = false,
|
|
||||||
updateSystemFont = {},
|
|
||||||
acButton = false,
|
acButton = false,
|
||||||
updateAcButton = {},
|
updateAcButton = {},
|
||||||
middleZero = false,
|
middleZero = false,
|
||||||
|
@ -67,12 +67,6 @@ class DisplayViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateSystemFont(enabled: Boolean) {
|
|
||||||
viewModelScope.launch {
|
|
||||||
userPrefsRepository.updateSystemFont(enabled)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun updateAcButton(enabled: Boolean) {
|
fun updateAcButton(enabled: Boolean) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
userPrefsRepository.updateAcButton(enabled)
|
userPrefsRepository.updateAcButton(enabled)
|
||||||
|
@ -63,7 +63,7 @@ import com.sadellie.unitto.core.ui.common.UnittoScreenWithLargeTopBar
|
|||||||
import com.sadellie.unitto.core.ui.common.UnittoSlider
|
import com.sadellie.unitto.core.ui.common.UnittoSlider
|
||||||
import com.sadellie.unitto.core.ui.common.squashable
|
import com.sadellie.unitto.core.ui.common.squashable
|
||||||
import com.sadellie.unitto.core.ui.common.textfield.formatExpression
|
import com.sadellie.unitto.core.ui.common.textfield.formatExpression
|
||||||
import com.sadellie.unitto.core.ui.theme.LocalNumberTypography
|
import com.sadellie.unitto.core.ui.theme.NumberTypographyUnitto
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -139,7 +139,7 @@ fun FormattingScreen(
|
|||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = uiState.preview,
|
text = uiState.preview,
|
||||||
style = LocalNumberTypography.current.displayMedium,
|
style = NumberTypographyUnitto.displayMedium,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user