mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 08:45:27 +02:00
Dude gave 2 stars cause of this
Hopefully he gives the app at least 3 stars now
This commit is contained in:
parent
20d0310fd0
commit
ee5435dc7a
@ -1368,4 +1368,6 @@ Used in this dialog window. Should be short -->
|
|||||||
<string name="yesterday">Yesterday</string>
|
<string name="yesterday">Yesterday</string>
|
||||||
<string name="search_text_field_placeholder">Search…</string>
|
<string name="search_text_field_placeholder">Search…</string>
|
||||||
<string name="add_time_zone_title">Add time zone</string>
|
<string name="add_time_zone_title">Add time zone</string>
|
||||||
|
<string name="middle_zero_option">Zero in the middle</string>
|
||||||
|
<string name="middle_zero_option_support">Swap zero and decimal buttons</string>
|
||||||
</resources>
|
</resources>
|
@ -83,6 +83,7 @@ data class UserPreferences(
|
|||||||
val unitConverterFavoritesOnly: Boolean = false,
|
val unitConverterFavoritesOnly: Boolean = false,
|
||||||
val unitConverterFormatTime: Boolean = false,
|
val unitConverterFormatTime: Boolean = false,
|
||||||
val unitConverterSorting: UnitsListSorting = UnitsListSorting.USAGE,
|
val unitConverterSorting: UnitsListSorting = UnitsListSorting.USAGE,
|
||||||
|
val middleZero: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class UIPreferences(
|
data class UIPreferences(
|
||||||
@ -107,6 +108,7 @@ data class MainPreferences(
|
|||||||
val unitConverterFavoritesOnly: Boolean = false,
|
val unitConverterFavoritesOnly: Boolean = false,
|
||||||
val unitConverterFormatTime: Boolean = false,
|
val unitConverterFormatTime: Boolean = false,
|
||||||
val unitConverterSorting: UnitsListSorting = UnitsListSorting.USAGE,
|
val unitConverterSorting: UnitsListSorting = UnitsListSorting.USAGE,
|
||||||
|
val middleZero: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -135,6 +137,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
|
|||||||
val UNIT_CONVERTER_FAVORITES_ONLY = booleanPreferencesKey("UNIT_CONVERTER_FAVORITES_ONLY_PREF_KEY")
|
val UNIT_CONVERTER_FAVORITES_ONLY = booleanPreferencesKey("UNIT_CONVERTER_FAVORITES_ONLY_PREF_KEY")
|
||||||
val UNIT_CONVERTER_FORMAT_TIME = booleanPreferencesKey("UNIT_CONVERTER_FORMAT_TIME_PREF_KEY")
|
val UNIT_CONVERTER_FORMAT_TIME = booleanPreferencesKey("UNIT_CONVERTER_FORMAT_TIME_PREF_KEY")
|
||||||
val UNIT_CONVERTER_SORTING = stringPreferencesKey("UNIT_CONVERTER_SORTING_PREF_KEY")
|
val UNIT_CONVERTER_SORTING = stringPreferencesKey("UNIT_CONVERTER_SORTING_PREF_KEY")
|
||||||
|
val MIDDLE_ZERO = booleanPreferencesKey("MIDDLE_ZERO_PREF_KEY")
|
||||||
}
|
}
|
||||||
|
|
||||||
val uiPreferencesFlow: Flow<UIPreferences> = dataStore.data
|
val uiPreferencesFlow: Flow<UIPreferences> = dataStore.data
|
||||||
@ -199,6 +202,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
|
|||||||
val unitConverterFavoritesOnly: Boolean = preferences[PrefsKeys.UNIT_CONVERTER_FAVORITES_ONLY] ?: false
|
val unitConverterFavoritesOnly: Boolean = preferences[PrefsKeys.UNIT_CONVERTER_FAVORITES_ONLY] ?: false
|
||||||
val unitConverterFormatTime: Boolean = preferences[PrefsKeys.UNIT_CONVERTER_FORMAT_TIME] ?: false
|
val unitConverterFormatTime: Boolean = preferences[PrefsKeys.UNIT_CONVERTER_FORMAT_TIME] ?: false
|
||||||
val unitConverterSorting: UnitsListSorting = preferences[PrefsKeys.UNIT_CONVERTER_SORTING]?.let { UnitsListSorting.valueOf(it) } ?: UnitsListSorting.USAGE
|
val unitConverterSorting: UnitsListSorting = preferences[PrefsKeys.UNIT_CONVERTER_SORTING]?.let { UnitsListSorting.valueOf(it) } ?: UnitsListSorting.USAGE
|
||||||
|
val middleZero: Boolean = preferences[PrefsKeys.MIDDLE_ZERO] ?: false
|
||||||
|
|
||||||
MainPreferences(
|
MainPreferences(
|
||||||
digitsPrecision = digitsPrecision,
|
digitsPrecision = digitsPrecision,
|
||||||
@ -212,6 +216,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
|
|||||||
unitConverterFavoritesOnly = unitConverterFavoritesOnly,
|
unitConverterFavoritesOnly = unitConverterFavoritesOnly,
|
||||||
unitConverterFormatTime = unitConverterFormatTime,
|
unitConverterFormatTime = unitConverterFormatTime,
|
||||||
unitConverterSorting = unitConverterSorting,
|
unitConverterSorting = unitConverterSorting,
|
||||||
|
middleZero = middleZero,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +242,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
|
|||||||
unitConverterFavoritesOnly = main.unitConverterFavoritesOnly,
|
unitConverterFavoritesOnly = main.unitConverterFavoritesOnly,
|
||||||
unitConverterFormatTime = main.unitConverterFormatTime,
|
unitConverterFormatTime = main.unitConverterFormatTime,
|
||||||
unitConverterSorting = main.unitConverterSorting,
|
unitConverterSorting = main.unitConverterSorting,
|
||||||
|
middleZero = main.middleZero,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +376,17 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update preference on where zero should be.
|
||||||
|
*
|
||||||
|
* @param enabled True if user wants zero button to be in the middle.
|
||||||
|
*/
|
||||||
|
suspend fun updateMiddleZero(enabled: Boolean) {
|
||||||
|
dataStore.edit { preferences ->
|
||||||
|
preferences[PrefsKeys.MIDDLE_ZERO] = enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update preference on whether or not show tools screen.
|
* Update preference on whether or not show tools screen.
|
||||||
*
|
*
|
||||||
|
@ -278,7 +278,8 @@ private fun CalculatorScreen(
|
|||||||
clearSymbols = clearSymbols,
|
clearSymbols = clearSymbols,
|
||||||
deleteSymbol = deleteSymbol,
|
deleteSymbol = deleteSymbol,
|
||||||
toggleAngleMode = toggleAngleMode,
|
toggleAngleMode = toggleAngleMode,
|
||||||
evaluate = evaluate
|
evaluate = evaluate,
|
||||||
|
middleZero = uiState.middleZero,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,8 @@ data class CalculatorUIState(
|
|||||||
val radianMode: Boolean = true,
|
val radianMode: Boolean = true,
|
||||||
val history: List<HistoryItem> = emptyList(),
|
val history: List<HistoryItem> = emptyList(),
|
||||||
val allowVibration: Boolean = false,
|
val allowVibration: Boolean = false,
|
||||||
val formatterSymbols: FormatterSymbols = FormatterSymbols.Spaces
|
val formatterSymbols: FormatterSymbols = FormatterSymbols.Spaces,
|
||||||
|
val middleZero: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
||||||
sealed class CalculationResult(@StringRes val label: Int? = null) {
|
sealed class CalculationResult(@StringRes val label: Int? = null) {
|
||||||
|
@ -75,7 +75,8 @@ internal class CalculatorViewModel @Inject constructor(
|
|||||||
radianMode = userPrefs.radianMode,
|
radianMode = userPrefs.radianMode,
|
||||||
history = history,
|
history = history,
|
||||||
allowVibration = userPrefs.enableVibrations,
|
allowVibration = userPrefs.enableVibrations,
|
||||||
formatterSymbols = AllFormatterSymbols.getById(userPrefs.separator)
|
formatterSymbols = AllFormatterSymbols.getById(userPrefs.separator),
|
||||||
|
middleZero = userPrefs.middleZero,
|
||||||
)
|
)
|
||||||
}.stateIn(
|
}.stateIn(
|
||||||
viewModelScope, SharingStarted.WhileSubscribed(5000L), CalculatorUIState()
|
viewModelScope, SharingStarted.WhileSubscribed(5000L), CalculatorUIState()
|
||||||
|
@ -104,6 +104,7 @@ internal fun CalculatorKeyboard(
|
|||||||
radianMode: Boolean,
|
radianMode: Boolean,
|
||||||
fractional: String,
|
fractional: String,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
|
middleZero: Boolean,
|
||||||
addSymbol: (String) -> Unit,
|
addSymbol: (String) -> Unit,
|
||||||
clearSymbols: () -> Unit,
|
clearSymbols: () -> Unit,
|
||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
@ -116,6 +117,7 @@ internal fun CalculatorKeyboard(
|
|||||||
radianMode = radianMode,
|
radianMode = radianMode,
|
||||||
fractional = fractional,
|
fractional = fractional,
|
||||||
allowVibration = allowVibration,
|
allowVibration = allowVibration,
|
||||||
|
middleZero = middleZero,
|
||||||
addSymbol = addSymbol,
|
addSymbol = addSymbol,
|
||||||
toggleAngleMode = toggleAngleMode,
|
toggleAngleMode = toggleAngleMode,
|
||||||
deleteSymbol = deleteSymbol,
|
deleteSymbol = deleteSymbol,
|
||||||
@ -128,6 +130,7 @@ internal fun CalculatorKeyboard(
|
|||||||
radianMode = radianMode,
|
radianMode = radianMode,
|
||||||
fractional = fractional,
|
fractional = fractional,
|
||||||
allowVibration = allowVibration,
|
allowVibration = allowVibration,
|
||||||
|
middleZero = middleZero,
|
||||||
addSymbol = addSymbol,
|
addSymbol = addSymbol,
|
||||||
toggleAngleMode = toggleAngleMode,
|
toggleAngleMode = toggleAngleMode,
|
||||||
deleteSymbol = deleteSymbol,
|
deleteSymbol = deleteSymbol,
|
||||||
@ -143,6 +146,7 @@ private fun PortraitKeyboard(
|
|||||||
radianMode: Boolean,
|
radianMode: Boolean,
|
||||||
fractional: String,
|
fractional: String,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
|
middleZero: Boolean,
|
||||||
addSymbol: (String) -> Unit,
|
addSymbol: (String) -> Unit,
|
||||||
toggleAngleMode: () -> Unit,
|
toggleAngleMode: () -> Unit,
|
||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
@ -257,8 +261,13 @@ private fun PortraitKeyboard(
|
|||||||
KeyboardButtonFilled(mainButtonModifier, UnittoIcons.Plus, allowVibration) { addSymbol(Token.Operator.plus) }
|
KeyboardButtonFilled(mainButtonModifier, UnittoIcons.Plus, allowVibration) { addSymbol(Token.Operator.plus) }
|
||||||
}
|
}
|
||||||
Row(weightModifier) {
|
Row(weightModifier) {
|
||||||
|
if (middleZero) {
|
||||||
|
KeyboardButtonLight(mainButtonModifier, fractionalIcon, allowVibration) { addSymbol(Token.Digit.dot) }
|
||||||
|
KeyboardButtonLight(mainButtonModifier, UnittoIcons.Key0, allowVibration) { addSymbol(Token.Digit._0) }
|
||||||
|
} else {
|
||||||
KeyboardButtonLight(mainButtonModifier, UnittoIcons.Key0, allowVibration) { addSymbol(Token.Digit._0) }
|
KeyboardButtonLight(mainButtonModifier, UnittoIcons.Key0, allowVibration) { addSymbol(Token.Digit._0) }
|
||||||
KeyboardButtonLight(mainButtonModifier, fractionalIcon, allowVibration) { addSymbol(Token.Digit.dot) }
|
KeyboardButtonLight(mainButtonModifier, fractionalIcon, allowVibration) { addSymbol(Token.Digit.dot) }
|
||||||
|
}
|
||||||
KeyboardButtonLight(mainButtonModifier, UnittoIcons.Backspace, allowVibration, clearSymbols) { deleteSymbol() }
|
KeyboardButtonLight(mainButtonModifier, UnittoIcons.Backspace, allowVibration, clearSymbols) { deleteSymbol() }
|
||||||
KeyboardButtonFilled(mainButtonModifier, UnittoIcons.Equal, allowVibration) { evaluate() }
|
KeyboardButtonFilled(mainButtonModifier, UnittoIcons.Equal, allowVibration) { evaluate() }
|
||||||
}
|
}
|
||||||
@ -345,6 +354,7 @@ private fun LandscapeKeyboard(
|
|||||||
radianMode: Boolean,
|
radianMode: Boolean,
|
||||||
fractional: String,
|
fractional: String,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
|
middleZero: Boolean,
|
||||||
addSymbol: (String) -> Unit,
|
addSymbol: (String) -> Unit,
|
||||||
toggleAngleMode: () -> Unit,
|
toggleAngleMode: () -> Unit,
|
||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
@ -390,14 +400,22 @@ private fun LandscapeKeyboard(
|
|||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key7, allowVibration) { addSymbol(Token.Digit._7) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key7, allowVibration) { addSymbol(Token.Digit._7) }
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key4, allowVibration) { addSymbol(Token.Digit._4) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key4, allowVibration) { addSymbol(Token.Digit._4) }
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key1, allowVibration) { addSymbol(Token.Digit._1) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key1, allowVibration) { addSymbol(Token.Digit._1) }
|
||||||
|
if (middleZero) {
|
||||||
|
KeyboardButtonLight(buttonModifier, fractionalIcon, allowVibration) { addSymbol(Token.Digit.dot) }
|
||||||
|
} else {
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key0, allowVibration) { addSymbol(Token.Digit._0) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key0, allowVibration) { addSymbol(Token.Digit._0) }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key8, allowVibration) { addSymbol(Token.Digit._8) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key8, allowVibration) { addSymbol(Token.Digit._8) }
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key5, allowVibration) { addSymbol(Token.Digit._5) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key5, allowVibration) { addSymbol(Token.Digit._5) }
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key2, allowVibration) { addSymbol(Token.Digit._2) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key2, allowVibration) { addSymbol(Token.Digit._2) }
|
||||||
|
if (middleZero) {
|
||||||
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key0, allowVibration) { addSymbol(Token.Digit._0) }
|
||||||
|
} else {
|
||||||
KeyboardButtonLight(buttonModifier, fractionalIcon, allowVibration) { addSymbol(Token.Digit.dot) }
|
KeyboardButtonLight(buttonModifier, fractionalIcon, allowVibration) { addSymbol(Token.Digit.dot) }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Column(Modifier.weight(1f)) {
|
Column(Modifier.weight(1f)) {
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key9, allowVibration) { addSymbol(Token.Digit._9) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key9, allowVibration) { addSymbol(Token.Digit._9) }
|
||||||
KeyboardButtonLight(buttonModifier, UnittoIcons.Key6, allowVibration) { addSymbol(Token.Digit._6) }
|
KeyboardButtonLight(buttonModifier, UnittoIcons.Key6, allowVibration) { addSymbol(Token.Digit._6) }
|
||||||
@ -496,6 +514,7 @@ private fun PreviewCalculatorKeyboard() {
|
|||||||
deleteSymbol = {},
|
deleteSymbol = {},
|
||||||
toggleAngleMode = {},
|
toggleAngleMode = {},
|
||||||
evaluate = {},
|
evaluate = {},
|
||||||
allowVibration = false
|
allowVibration = false,
|
||||||
|
middleZero = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,7 @@ private fun ConverterScreen(
|
|||||||
converterMode = uiState.mode,
|
converterMode = uiState.mode,
|
||||||
allowVibration = uiState.allowVibration,
|
allowVibration = uiState.allowVibration,
|
||||||
fractional = uiState.formatterSymbols.fractional,
|
fractional = uiState.formatterSymbols.fractional,
|
||||||
|
middleZero = uiState.middleZero
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -47,6 +47,7 @@ data class ConverterUIState(
|
|||||||
val unitTo: AbstractUnit? = null,
|
val unitTo: AbstractUnit? = null,
|
||||||
val mode: ConverterMode = ConverterMode.DEFAULT,
|
val mode: ConverterMode = ConverterMode.DEFAULT,
|
||||||
val allowVibration: Boolean = false,
|
val allowVibration: Boolean = false,
|
||||||
|
val middleZero: Boolean = false,
|
||||||
val formatterSymbols: FormatterSymbols = FormatterSymbols.Spaces,
|
val formatterSymbols: FormatterSymbols = FormatterSymbols.Spaces,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -126,7 +126,8 @@ class ConverterViewModel @Inject constructor(
|
|||||||
unitTo = unitToValue,
|
unitTo = unitToValue,
|
||||||
mode = if (_unitFrom.value is NumberBaseUnit) ConverterMode.BASE else ConverterMode.DEFAULT,
|
mode = if (_unitFrom.value is NumberBaseUnit) ConverterMode.BASE else ConverterMode.DEFAULT,
|
||||||
allowVibration = prefs.enableVibrations,
|
allowVibration = prefs.enableVibrations,
|
||||||
formatterSymbols = AllFormatterSymbols.getById(prefs.separator)
|
formatterSymbols = AllFormatterSymbols.getById(prefs.separator),
|
||||||
|
middleZero = prefs.middleZero,
|
||||||
)
|
)
|
||||||
}.stateIn(
|
}.stateIn(
|
||||||
viewModelScope, SharingStarted.WhileSubscribed(5000), ConverterUIState()
|
viewModelScope, SharingStarted.WhileSubscribed(5000), ConverterUIState()
|
||||||
|
@ -78,10 +78,11 @@ internal fun ConverterKeyboard(
|
|||||||
converterMode: ConverterMode,
|
converterMode: ConverterMode,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
fractional: String,
|
fractional: String,
|
||||||
|
middleZero: Boolean,
|
||||||
) {
|
) {
|
||||||
Crossfade(converterMode, modifier = modifier) {
|
Crossfade(converterMode, modifier = modifier) {
|
||||||
when (it) {
|
when (it) {
|
||||||
ConverterMode.DEFAULT -> DefaultKeyboard(addDigit, clearInput, deleteDigit, allowVibration, fractional)
|
ConverterMode.DEFAULT -> DefaultKeyboard(addDigit, clearInput, deleteDigit, allowVibration, fractional, middleZero)
|
||||||
ConverterMode.BASE -> BaseKeyboard(addDigit, clearInput, deleteDigit, allowVibration)
|
ConverterMode.BASE -> BaseKeyboard(addDigit, clearInput, deleteDigit, allowVibration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,6 +95,7 @@ private fun DefaultKeyboard(
|
|||||||
deleteDigit: () -> Unit,
|
deleteDigit: () -> Unit,
|
||||||
allowVibration: Boolean,
|
allowVibration: Boolean,
|
||||||
fractional: String,
|
fractional: String,
|
||||||
|
middleZero: Boolean,
|
||||||
) {
|
) {
|
||||||
val fractionalIcon = remember { if (fractional == Token.Digit.dot) UnittoIcons.Dot else UnittoIcons.Comma }
|
val fractionalIcon = remember { if (fractional == Token.Digit.dot) UnittoIcons.Dot else UnittoIcons.Comma }
|
||||||
ColumnWithConstraints {
|
ColumnWithConstraints {
|
||||||
@ -129,8 +131,13 @@ private fun DefaultKeyboard(
|
|||||||
KeyboardButtonFilled(bModifier, UnittoIcons.Minus, allowVibration) { addDigit(Token.Operator.minus) }
|
KeyboardButtonFilled(bModifier, UnittoIcons.Minus, allowVibration) { addDigit(Token.Operator.minus) }
|
||||||
}
|
}
|
||||||
Row(cModifier, horizontalArrangement) {
|
Row(cModifier, horizontalArrangement) {
|
||||||
|
if (middleZero) {
|
||||||
|
KeyboardButtonLight(bModifier, fractionalIcon, allowVibration) { addDigit(Token.Digit.dot) }
|
||||||
|
KeyboardButtonLight(bModifier, UnittoIcons.Key0, allowVibration) { addDigit(Token.Digit._0) }
|
||||||
|
} else {
|
||||||
KeyboardButtonLight(bModifier, UnittoIcons.Key0, allowVibration) { addDigit(Token.Digit._0) }
|
KeyboardButtonLight(bModifier, UnittoIcons.Key0, allowVibration) { addDigit(Token.Digit._0) }
|
||||||
KeyboardButtonLight(bModifier, fractionalIcon, allowVibration) { addDigit(Token.Digit.dot) }
|
KeyboardButtonLight(bModifier, fractionalIcon, allowVibration) { addDigit(Token.Digit.dot) }
|
||||||
|
}
|
||||||
KeyboardButtonLight(bModifier, UnittoIcons.Backspace, allowVibration, clearInput) { deleteDigit() }
|
KeyboardButtonLight(bModifier, UnittoIcons.Backspace, allowVibration, clearInput) { deleteDigit() }
|
||||||
KeyboardButtonFilled(bModifier, UnittoIcons.Plus, allowVibration) { addDigit(Token.Operator.plus) }
|
KeyboardButtonFilled(bModifier, UnittoIcons.Plus, allowVibration) { addDigit(Token.Operator.plus) }
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ package com.sadellie.unitto.feature.settings
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.ExposureZero
|
||||||
import androidx.compose.material.icons.filled.Home
|
import androidx.compose.material.icons.filled.Home
|
||||||
import androidx.compose.material.icons.filled.Info
|
import androidx.compose.material.icons.filled.Info
|
||||||
import androidx.compose.material.icons.filled.Palette
|
import androidx.compose.material.icons.filled.Palette
|
||||||
@ -173,6 +174,22 @@ internal fun SettingsScreen(
|
|||||||
// ADDITIONAL GROUP
|
// ADDITIONAL GROUP
|
||||||
item { Header(stringResource(R.string.additional_settings_group)) }
|
item { Header(stringResource(R.string.additional_settings_group)) }
|
||||||
|
|
||||||
|
// MIDDLE ZERO
|
||||||
|
item {
|
||||||
|
UnittoListItem(
|
||||||
|
label = stringResource(R.string.middle_zero_option),
|
||||||
|
leadingContent = {
|
||||||
|
Icon(
|
||||||
|
Icons.Default.ExposureZero,
|
||||||
|
stringResource(R.string.middle_zero_option)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
supportContent = stringResource(R.string.middle_zero_option_support),
|
||||||
|
switchState = userPrefs.value.middleZero,
|
||||||
|
onSwitchChange = viewModel::updateMiddleZero
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// VIBRATIONS
|
// VIBRATIONS
|
||||||
item {
|
item {
|
||||||
UnittoListItem(
|
UnittoListItem(
|
||||||
|
@ -49,6 +49,15 @@ class SettingsViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see UserPreferencesRepository.updateMiddleZero
|
||||||
|
*/
|
||||||
|
fun updateMiddleZero(enabled: Boolean) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
userPrefsRepository.updateMiddleZero(enabled)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see UserPreferencesRepository.updateStartingScreen
|
* @see UserPreferencesRepository.updateStartingScreen
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user