Option to disable partial history view

kinda closes #75
This commit is contained in:
Sad Ellie 2023-09-12 17:44:51 +03:00
parent 0930eead24
commit 1f21cfbae0
15 changed files with 301 additions and 72 deletions

View File

@ -1414,4 +1414,8 @@ Used in this dialog window. Should be short -->
<string name="gallon_us_per_100_mile_short">gal/100 mi (US)</string>
<string name="gallon_uk_per_100_mile">Gallon per 100 mile (UK)</string>
<string name="gallon_uk_per_100_mile_short">gal/100 mi (UK)</string>
<string name="partial_history_view_setting">Small history view</string>
<string name="partial_history_view_setting_support">Peek latest entrance in history</string>
<string name="calculator_settings_support">History view</string>
<string name="converter_settings_support">Unit groups, sorting, formatting</string>
</resources>

View File

@ -85,6 +85,7 @@ data class UserPreferences(
val unitConverterSorting: UnitsListSorting = UnitsListSorting.USAGE,
val middleZero: Boolean = false,
val systemFont: Boolean = false,
val partialHistoryView: Boolean = true,
)
data class UIPreferences(
@ -112,6 +113,7 @@ data class MainPreferences(
val unitConverterSorting: UnitsListSorting = UnitsListSorting.USAGE,
val middleZero: Boolean = false,
val enableToolsExperiment: Boolean = false,
val partialHistoryView: Boolean = true,
)
/**
@ -142,6 +144,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
val UNIT_CONVERTER_SORTING = stringPreferencesKey("UNIT_CONVERTER_SORTING_PREF_KEY")
val MIDDLE_ZERO = booleanPreferencesKey("MIDDLE_ZERO_PREF_KEY")
val SYSTEM_FONT = booleanPreferencesKey("SYSTEM_FONT_PREF_KEY")
val PARTIAL_HISTORY_VIEW = booleanPreferencesKey("PARTIAL_HISTORY_VIEW_PREF_KEY")
}
val uiPreferencesFlow: Flow<UIPreferences> = dataStore.data
@ -210,6 +213,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
val unitConverterSorting: UnitsListSorting = preferences[PrefsKeys.UNIT_CONVERTER_SORTING]?.let { UnitsListSorting.valueOf(it) } ?: UnitsListSorting.USAGE
val middleZero: Boolean = preferences[PrefsKeys.MIDDLE_ZERO] ?: false
val enableToolsExperiment: Boolean = preferences[PrefsKeys.ENABLE_TOOLS_EXPERIMENT] ?: false
val partialHistoryView: Boolean = preferences[PrefsKeys.PARTIAL_HISTORY_VIEW] ?: false
MainPreferences(
digitsPrecision = digitsPrecision,
@ -224,7 +228,8 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
unitConverterFormatTime = unitConverterFormatTime,
unitConverterSorting = unitConverterSorting,
middleZero = middleZero,
enableToolsExperiment = enableToolsExperiment
enableToolsExperiment = enableToolsExperiment,
partialHistoryView = partialHistoryView
)
}
@ -252,6 +257,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
unitConverterSorting = main.unitConverterSorting,
middleZero = main.middleZero,
systemFont = ui.systemFont,
partialHistoryView = main.partialHistoryView
)
}
@ -454,4 +460,15 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
preferences[PrefsKeys.SYSTEM_FONT] = enabled
}
}
/**
* Update partial history view preference.
*
* @param enabled When true will enable partial history view.
*/
suspend fun updatePartialHistoryView(enabled: Boolean) {
dataStore.edit { preferences ->
preferences[PrefsKeys.PARTIAL_HISTORY_VIEW] = enabled
}
}
}

View File

@ -23,6 +23,7 @@ import androidx.compose.animation.Crossfade
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.anchoredDraggable
import androidx.compose.foundation.gestures.snapTo
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@ -48,6 +49,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@ -72,6 +74,7 @@ import com.sadellie.unitto.data.model.HistoryItem
import com.sadellie.unitto.feature.calculator.components.CalculatorKeyboard
import com.sadellie.unitto.feature.calculator.components.CalculatorKeyboardLoading
import com.sadellie.unitto.feature.calculator.components.HistoryList
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Locale
@ -149,19 +152,28 @@ private fun CalculatorScreen(
var historyItemHeight by remember { mutableStateOf(0.dp) }
val textBoxHeight = maxHeight * 0.25f
var dragStateCurrentValue by rememberSaveable { mutableStateOf(DragState.CLOSED) }
val corScope = rememberCoroutineScope()
val dragState = rememberDragState(
historyItem = historyItemHeight,
max = maxHeight - textBoxHeight,
initialValue = dragStateCurrentValue
initialValue = dragStateCurrentValue,
enablePartialView = uiState.partialHistoryView
)
val dragDp by remember(dragState.requireOffset()) {
val dragDp by remember(dragState) {
derivedStateOf {
focusManager.clearFocus(true)
with(density) { dragState.requireOffset().toDp() }
with(density) {
try {
dragState.requireOffset().toDp()
} catch (e: IllegalStateException) {
corScope.launch { dragState.snapTo(DragState.CLOSED) }
0.dp
}
}
}
}
val keyboardHeight by remember(dragState.requireOffset()) {
val keyboardHeight by remember(dragState) {
derivedStateOf {
if (dragDp > historyItemHeight) {
maxHeight - textBoxHeight - historyItemHeight

View File

@ -35,6 +35,7 @@ internal sealed class CalculatorUIState {
val allowVibration: Boolean = false,
val formatterSymbols: FormatterSymbols = FormatterSymbols.Spaces,
val middleZero: Boolean = false,
val partialHistoryView: Boolean = true,
) : CalculatorUIState()
}

View File

@ -77,6 +77,7 @@ internal class CalculatorViewModel @Inject constructor(
allowVibration = userPrefs.enableVibrations,
formatterSymbols = AllFormatterSymbols.getById(userPrefs.separator),
middleZero = userPrefs.middleZero,
partialHistoryView = userPrefs.partialHistoryView,
)
}.stateIn(
viewModelScope, SharingStarted.WhileSubscribed(5000L), CalculatorUIState.Loading

View File

@ -26,25 +26,34 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Dp
internal enum class DragState { CLOSED, HALF, OPEN }
internal enum class DragState { CLOSED, SMALL, OPEN }
@Composable
internal fun rememberDragState(
initialValue: DragState = DragState.CLOSED,
historyItem: Dp,
max: Dp,
enablePartialView: Boolean,
): AnchoredDraggableState<DragState> {
val historyItemHeight = with(LocalDensity.current) { historyItem.toPx() }
val maxHeight = with(LocalDensity.current) { max.toPx() }
val anchors: DraggableAnchors<DragState> = if (enablePartialView) {
DraggableAnchors {
DragState.CLOSED at 0f
DragState.SMALL at historyItemHeight
DragState.OPEN at maxHeight
}
} else {
DraggableAnchors {
DragState.CLOSED at 0f
DragState.OPEN at maxHeight
}
}
return remember(key1 = historyItem) {
return remember(historyItem, enablePartialView) {
AnchoredDraggableState(
initialValue = initialValue,
anchors = DraggableAnchors {
DragState.CLOSED at 0f
DragState.HALF at historyItemHeight
DragState.OPEN at maxHeight
},
anchors = anchors,
positionalThreshold = { 0f },
velocityThreshold = { 0f },
animationSpec = tween()

View File

@ -54,9 +54,9 @@ import com.sadellie.unitto.core.ui.openLink
@Composable
internal fun AboutScreen(
viewModel: SettingsViewModel = hiltViewModel(),
navigateUpAction: () -> Unit,
navigateToThirdParty: () -> Unit,
viewModel: SettingsViewModel = hiltViewModel()
) {
val mContext = LocalContext.current
val userPrefs = viewModel.userPrefs.collectAsStateWithLifecycle()

View File

@ -0,0 +1,61 @@
/*
* Unitto is a unit converter for Android
* Copyright (c) 2023 Elshan Agaev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.feature.settings
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Timer
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.sadellie.unitto.core.base.R
import com.sadellie.unitto.core.ui.common.NavigateUpButton
import com.sadellie.unitto.core.ui.common.UnittoListItem
import com.sadellie.unitto.core.ui.common.UnittoScreenWithLargeTopBar
@Composable
internal fun CalculatorSettingsScreen(
viewModel: SettingsViewModel,
navigateUpAction: () -> Unit,
) {
val userPrefs = viewModel.userPrefs.collectAsStateWithLifecycle()
UnittoScreenWithLargeTopBar(
title = stringResource(R.string.calculator),
navigationIcon = { NavigateUpButton(navigateUpAction) }
) { padding ->
LazyColumn(contentPadding = padding) {
item {
UnittoListItem(
label = stringResource(R.string.partial_history_view_setting),
leadingContent = {
Icon(
Icons.Default.Timer,
stringResource(R.string.partial_history_view_setting)
)
},
supportContent = stringResource(R.string.partial_history_view_setting_support),
switchState = userPrefs.value.partialHistoryView,
onSwitchChange = viewModel::updatePartialHistoryView
)
}
}
}
}

View File

@ -0,0 +1,121 @@
/*
* Unitto is a unit converter for Android
* Copyright (c) 2023 Elshan Agaev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sadellie.unitto.feature.settings
import androidx.compose.foundation.clickable
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Rule
import androidx.compose.material.icons.filled.Sort
import androidx.compose.material.icons.filled.Timer
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.sadellie.unitto.core.base.R
import com.sadellie.unitto.core.ui.common.NavigateUpButton
import com.sadellie.unitto.core.ui.common.UnittoListItem
import com.sadellie.unitto.core.ui.common.UnittoScreenWithLargeTopBar
import com.sadellie.unitto.data.model.UnitsListSorting
import com.sadellie.unitto.feature.settings.components.AlertDialogWithList
@Composable
internal fun ConverterSettingsScreen(
viewModel: SettingsViewModel,
navigateUpAction: () -> Unit,
navigateToUnitsGroup: () -> Unit
) {
val userPrefs = viewModel.userPrefs.collectAsStateWithLifecycle()
var showDialog: Boolean by rememberSaveable { mutableStateOf(false) }
UnittoScreenWithLargeTopBar(
title = stringResource(R.string.unit_converter),
navigationIcon = { NavigateUpButton(navigateUpAction) }
) { padding ->
LazyColumn(contentPadding = padding) {
// UNIT GROUPS
item {
ListItem(
leadingContent = {
Icon(
Icons.Default.Rule,
stringResource(R.string.disable_unit_group_description),
)
},
headlineContent = { Text(stringResource(R.string.unit_groups_setting)) },
supportingContent = { Text(stringResource(R.string.unit_groups_support)) },
modifier = Modifier.clickable { navigateToUnitsGroup() }
)
}
// UNITS LIST SORTING
item {
ListItem(
leadingContent = {
Icon(
Icons.Default.Sort,
stringResource(R.string.units_sorting)
)
},
headlineContent = { Text(stringResource(R.string.units_sorting)) },
supportingContent = { Text(stringResource(R.string.units_sorting_support)) },
modifier = Modifier.clickable { showDialog = true }
)
}
// FORMAT TIME
item {
UnittoListItem(
label = stringResource(R.string.format_time),
leadingContent = {
Icon(
Icons.Default.Timer,
stringResource(R.string.format_time)
)
},
supportContent = stringResource(R.string.format_time_support),
switchState = userPrefs.value.unitConverterFormatTime,
onSwitchChange = viewModel::updateUnitConverterFormatTime
)
}
}
}
if (showDialog) {
AlertDialogWithList(
title = stringResource(R.string.units_sorting),
listItems = mapOf(
UnitsListSorting.USAGE to R.string.sort_by_usage,
UnitsListSorting.ALPHABETICAL to R.string.sort_by_alphabetical,
UnitsListSorting.SCALE_DESC to R.string.sort_by_scale_desc,
UnitsListSorting.SCALE_ASC to R.string.sort_by_scale_asc,
),
selectedItemIndex = userPrefs.value.unitConverterSorting,
selectAction = viewModel::updateUnitConverterSorting,
dismissAction = { showDialog = false }
)
}
}

View File

@ -22,15 +22,14 @@ import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.foundation.clickable
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Calculate
import androidx.compose.material.icons.filled.ExposureZero
import androidx.compose.material.icons.filled.Home
import androidx.compose.material.icons.filled.Info
import androidx.compose.material.icons.filled.Language
import androidx.compose.material.icons.filled.Palette
import androidx.compose.material.icons.filled.RateReview
import androidx.compose.material.icons.filled.Rule
import androidx.compose.material.icons.filled.Sort
import androidx.compose.material.icons.filled.Timer
import androidx.compose.material.icons.filled.SwapHoriz
import androidx.compose.material.icons.filled.Vibration
import androidx.compose.material.icons.filled._123
import androidx.compose.material3.Icon
@ -55,12 +54,12 @@ import com.sadellie.unitto.core.ui.common.NavigateUpButton
import com.sadellie.unitto.core.ui.common.UnittoListItem
import com.sadellie.unitto.core.ui.common.UnittoScreenWithLargeTopBar
import com.sadellie.unitto.core.ui.openLink
import com.sadellie.unitto.data.model.UnitsListSorting
import com.sadellie.unitto.feature.settings.components.AlertDialogWithList
import com.sadellie.unitto.feature.settings.navigation.aboutRoute
import com.sadellie.unitto.feature.settings.navigation.calculatorSettingsRoute
import com.sadellie.unitto.feature.settings.navigation.converterSettingsRoute
import com.sadellie.unitto.feature.settings.navigation.formattingRoute
import com.sadellie.unitto.feature.settings.navigation.themesRoute
import com.sadellie.unitto.feature.settings.navigation.unitsGroupRoute
@Composable
internal fun SettingsScreen(
@ -125,52 +124,31 @@ internal fun SettingsScreen(
)
}
// UNIT CONVERTER GROUP
item { Header(stringResource(R.string.unit_converter)) }
// UNIT GROUPS
item {
ListItem(
leadingContent = {
Icon(
Icons.Default.Rule,
stringResource(R.string.disable_unit_group_description),
Icons.Default.Calculate,
stringResource(R.string.calculator),
)
},
headlineContent = { Text(stringResource(R.string.unit_groups_setting)) },
supportingContent = { Text(stringResource(R.string.unit_groups_support)) },
modifier = Modifier.clickable { navControllerAction(unitsGroupRoute) }
headlineContent = { Text(stringResource(R.string.calculator)) },
supportingContent = { Text(stringResource(R.string.calculator_settings_support)) },
modifier = Modifier.clickable { navControllerAction(calculatorSettingsRoute) }
)
}
// UNITS LIST SORTING
item {
ListItem(
leadingContent = {
Icon(
Icons.Default.Sort,
stringResource(R.string.units_sorting)
Icons.Default.SwapHoriz,
stringResource(R.string.unit_converter),
)
},
headlineContent = { Text(stringResource(R.string.units_sorting)) },
supportingContent = { Text(stringResource(R.string.units_sorting_support)) },
modifier = Modifier.clickable { dialogState = DialogState.UNIT_LIST_SORTING }
)
}
// FORMAT TIME
item {
UnittoListItem(
label = stringResource(R.string.format_time),
leadingContent = {
Icon(
Icons.Default.Timer,
stringResource(R.string.format_time)
)
},
supportContent = stringResource(R.string.format_time_support),
switchState = userPrefs.value.unitConverterFormatTime,
onSwitchChange = viewModel::updateUnitConverterFormatTime
headlineContent = { Text(stringResource(R.string.unit_converter)) },
supportingContent = { Text(stringResource(R.string.converter_settings_support)) },
modifier = Modifier.clickable { navControllerAction(converterSettingsRoute) }
)
}
@ -276,21 +254,6 @@ internal fun SettingsScreen(
)
}
DialogState.UNIT_LIST_SORTING -> {
AlertDialogWithList(
title = stringResource(R.string.units_sorting),
listItems = mapOf(
UnitsListSorting.USAGE to R.string.sort_by_usage,
UnitsListSorting.ALPHABETICAL to R.string.sort_by_alphabetical,
UnitsListSorting.SCALE_DESC to R.string.sort_by_scale_desc,
UnitsListSorting.SCALE_ASC to R.string.sort_by_scale_asc,
),
selectedItemIndex = userPrefs.value.unitConverterSorting,
selectAction = viewModel::updateUnitConverterSorting,
dismissAction = { resetDialog() }
)
}
DialogState.LANGUAGE -> {
AlertDialogWithList(
title = stringResource(R.string.language_setting),
@ -322,5 +285,5 @@ internal fun SettingsScreen(
* All possible states for alert dialog that opens when user clicks on settings.
*/
private enum class DialogState {
NONE, START_SCREEN, UNIT_LIST_SORTING, LANGUAGE
NONE, START_SCREEN, LANGUAGE
}

View File

@ -93,4 +93,13 @@ class SettingsViewModel @Inject constructor(
userPrefsRepository.updateUnitConverterSorting(sorting)
}
}
/**
* @see UserPreferencesRepository.updatePartialHistoryView
*/
fun updatePartialHistoryView(enabled: Boolean) {
viewModelScope.launch {
userPrefsRepository.updatePartialHistoryView(enabled)
}
}
}

View File

@ -49,7 +49,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.sadellie.unitto.core.base.MAX_PRECISION
import com.sadellie.unitto.core.base.OutputFormat
@ -67,7 +66,7 @@ import kotlin.math.roundToInt
@Composable
fun FormattingRoute(
viewModel: FormattingViewModel = hiltViewModel(),
viewModel: FormattingViewModel,
navigateUpAction: () -> Unit,
) {
val uiState = viewModel.uiState.collectAsStateWithLifecycle()

View File

@ -18,6 +18,8 @@
package com.sadellie.unitto.feature.settings.navigation
import androidx.compose.runtime.remember
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
@ -26,6 +28,8 @@ import androidx.navigation.compose.navigation
import androidx.navigation.navDeepLink
import com.sadellie.unitto.core.base.TopLevelDestinations
import com.sadellie.unitto.feature.settings.AboutScreen
import com.sadellie.unitto.feature.settings.CalculatorSettingsScreen
import com.sadellie.unitto.feature.settings.ConverterSettingsScreen
import com.sadellie.unitto.feature.settings.SettingsScreen
import com.sadellie.unitto.feature.settings.ThirdPartyLicensesScreen
import com.sadellie.unitto.feature.settings.formatting.FormattingRoute
@ -40,6 +44,8 @@ internal const val unitsGroupRoute = "units_group_route"
internal const val thirdPartyRoute = "third_party_route"
internal const val aboutRoute = "about_route"
internal const val formattingRoute = "formatting_route"
internal const val calculatorSettingsRoute = "calculator_settings_route"
internal const val converterSettingsRoute = "converter_settings_route"
fun NavController.navigateToSettings() {
navigate(TopLevelDestinations.Settings.start)
@ -61,7 +67,10 @@ fun NavGraphBuilder.settingGraph(
)
) {
composable(start) {
val parent = remember(it) { navController.getBackStackEntry(graph) }
SettingsScreen(
viewModel = hiltViewModel(parent),
menuButtonClick = navController::navigateUp,
navControllerAction = navController::navigate
)
@ -69,6 +78,7 @@ fun NavGraphBuilder.settingGraph(
composable(themesRoute) {
ThemesRoute(
viewModel = hiltViewModel(),
navigateUpAction = navController::navigateUp,
themmoController = themmoController,
)
@ -81,22 +91,46 @@ fun NavGraphBuilder.settingGraph(
}
composable(aboutRoute) {
val parent = remember(it) { navController.getBackStackEntry(graph) }
AboutScreen(
viewModel = hiltViewModel(parent),
navigateUpAction = navController::navigateUp,
navigateToThirdParty = { navController.navigate(thirdPartyRoute) },
navigateToThirdParty = { navController.navigate(thirdPartyRoute) }
)
}
composable(unitsGroupRoute) {
UnitGroupsScreen(
viewModel = hiltViewModel(),
navigateUpAction = navController::navigateUp,
)
}
composable(formattingRoute) {
FormattingRoute(
viewModel = hiltViewModel(),
navigateUpAction = navController::navigateUp
)
}
composable(calculatorSettingsRoute) {
val parent = remember(it) { navController.getBackStackEntry(graph) }
CalculatorSettingsScreen(
viewModel = hiltViewModel(parent),
navigateUpAction = navController::navigateUp,
)
}
composable(converterSettingsRoute) {
val parent = remember(it) { navController.getBackStackEntry(graph) }
ConverterSettingsScreen(
viewModel = hiltViewModel(parent),
navigateUpAction = navController::navigateUp,
navigateToUnitsGroup = { navController.navigate(unitsGroupRoute) }
)
}
}
}

View File

@ -48,7 +48,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.sadellie.unitto.core.base.R
import com.sadellie.unitto.core.ui.common.Header
@ -81,9 +80,9 @@ private val colorSchemes: List<Color> by lazy {
@Composable
internal fun ThemesRoute(
viewModel: ThemesViewModel,
navigateUpAction: () -> Unit = {},
themmoController: ThemmoController,
viewModel: ThemesViewModel = hiltViewModel()
) {
val systemFont = viewModel.systemFont.collectAsStateWithLifecycle()

View File

@ -47,7 +47,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.sadellie.unitto.core.base.R
import com.sadellie.unitto.core.ui.common.Header
import com.sadellie.unitto.core.ui.common.NavigateUpButton
@ -60,7 +59,7 @@ import org.burnoutcrew.reorderable.reorderable
@Composable
internal fun UnitGroupsScreen(
viewModel: UnitGroupsViewModel = hiltViewModel(),
viewModel: UnitGroupsViewModel,
navigateUpAction: () -> Unit
) {
UnittoScreenWithLargeTopBar(