Rename parameter from evaluate to equal

This commit is contained in:
Sad Ellie 2024-01-19 00:28:54 +03:00
parent 8d46084b51
commit 9f8c5b8c36
4 changed files with 20 additions and 20 deletions

View File

@ -48,7 +48,7 @@ class CalculatorScreenTest {
deleteTokens = {},
onCursorChange = {},
toggleCalculatorMode = {},
evaluate = {},
equal = {},
clearHistory = {},
addBracket = {}
)
@ -81,7 +81,7 @@ class CalculatorScreenTest {
deleteTokens = {},
onCursorChange = {},
toggleCalculatorMode = {},
evaluate = {},
equal = {},
clearHistory = {},
addBracket = {}
)
@ -115,7 +115,7 @@ class CalculatorScreenTest {
deleteTokens = {},
onCursorChange = {},
toggleCalculatorMode = {},
evaluate = {},
equal = {},
clearHistory = {},
addBracket = {}
)

View File

@ -99,7 +99,7 @@ internal fun CalculatorRoute(
deleteTokens = viewModel::deleteTokens,
onCursorChange = viewModel::onCursorChange,
toggleCalculatorMode = viewModel::updateRadianMode,
evaluate = viewModel::evaluate,
equal = viewModel::equal,
clearHistory = viewModel::clearHistory,
addBracket = viewModel::addBracket
)
@ -116,7 +116,7 @@ internal fun CalculatorScreen(
deleteTokens: () -> Unit,
onCursorChange: (TextRange) -> Unit,
toggleCalculatorMode: (Boolean) -> Unit,
evaluate: () -> Unit,
equal: () -> Unit,
clearHistory: () -> Unit
) {
when (uiState) {
@ -130,7 +130,7 @@ internal fun CalculatorScreen(
deleteSymbol = deleteTokens,
onCursorChange = onCursorChange,
toggleAngleMode = { toggleCalculatorMode(!uiState.radianMode) },
evaluate = evaluate,
equal = equal,
clearHistory = clearHistory,
addBracket = addBracket
)
@ -148,7 +148,7 @@ private fun Ready(
deleteSymbol: () -> Unit,
onCursorChange: (TextRange) -> Unit,
toggleAngleMode: () -> Unit,
evaluate: () -> Unit,
equal: () -> Unit,
clearHistory: () -> Unit
) {
val focusManager = LocalFocusManager.current
@ -285,7 +285,7 @@ private fun Ready(
clearSymbols = clearSymbols,
deleteSymbol = deleteSymbol,
toggleAngleMode = toggleAngleMode,
evaluate = evaluate,
equal = equal,
middleZero = uiState.middleZero,
acButton = uiState.acButton,
addBracket = addBracket
@ -375,7 +375,7 @@ private fun PreviewCalculatorScreen() {
deleteTokens = {},
onCursorChange = {},
toggleCalculatorMode = {},
evaluate = {},
equal = {},
clearHistory = {},
addBracket = {}
)

View File

@ -178,7 +178,7 @@ internal class CalculatorViewModel @Inject constructor(
calculatorHistoryRepository.clear()
}
fun evaluate() = viewModelScope.launch {
fun equal() = viewModelScope.launch {
val prefs = _prefs.value ?: return@launch
if (_equalClicked.value) return@launch
if (!_input.value.text.isExpression()) return@launch

View File

@ -123,7 +123,7 @@ internal fun CalculatorKeyboard(
clearSymbols: () -> Unit,
deleteSymbol: () -> Unit,
toggleAngleMode: () -> Unit,
evaluate: () -> Unit
equal: () -> Unit
) {
val fractionalIcon = remember(fractional) { if (fractional == Token.Digit.dot) IconPack.Dot else IconPack.Comma }
val angleIcon = remember(radianMode) { if (radianMode) IconPack.Rad else IconPack.Deg }
@ -140,7 +140,7 @@ internal fun CalculatorKeyboard(
toggleAngleMode = toggleAngleMode,
deleteSymbol = deleteSymbol,
clearSymbols = clearSymbols,
evaluate = evaluate,
equal = equal,
acButton = acButton,
addBracket = addBracket,
invMode = invMode,
@ -157,7 +157,7 @@ internal fun CalculatorKeyboard(
toggleAngleMode = toggleAngleMode,
deleteSymbol = deleteSymbol,
clearSymbols = clearSymbols,
evaluate = evaluate,
equal = equal,
acButton = acButton,
addBracket = addBracket,
invMode = invMode,
@ -177,7 +177,7 @@ private fun PortraitKeyboard(
toggleAngleMode: () -> Unit,
deleteSymbol: () -> Unit,
clearSymbols: () -> Unit,
evaluate: () -> Unit,
equal: () -> Unit,
acButton: Boolean,
addBracket: () -> Unit,
invMode: Boolean,
@ -318,7 +318,7 @@ private fun PortraitKeyboard(
KeyboardButtonLight(mainButtonModifier, fractionalIcon, allowVibration, KeyboardButtonContentHeightTall) { addSymbol(Token.Digit.dot) }
}
KeyboardButtonLight(mainButtonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightTall, clearSymbols) { deleteSymbol() }
KeyboardButtonFilled(mainButtonModifier, IconPack.Equal, allowVibration, KeyboardButtonContentHeightTall) { evaluate() }
KeyboardButtonFilled(mainButtonModifier, IconPack.Equal, allowVibration, KeyboardButtonContentHeightTall) { equal() }
}
Spacer(modifier = Modifier.height(spacerHeight))
@ -404,7 +404,7 @@ private fun LandscapeKeyboard(
toggleAngleMode: () -> Unit,
deleteSymbol: () -> Unit,
clearSymbols: () -> Unit,
evaluate: () -> Unit,
equal: () -> Unit,
acButton: Boolean,
addBracket: () -> Unit,
invMode: Boolean,
@ -469,7 +469,7 @@ private fun LandscapeKeyboard(
}
KeyboardButtonLight(buttonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightShort, clearSymbols) { deleteSymbol() }
KeyboardButtonFilled(buttonModifier, IconPack.Plus, allowVibration, KeyboardButtonContentHeightShort) { addSymbol(Token.Operator.plus) }
KeyboardButtonFilled(buttonModifier, IconPack.Equal, allowVibration, KeyboardButtonContentHeightShort) { evaluate() }
KeyboardButtonFilled(buttonModifier, IconPack.Equal, allowVibration, KeyboardButtonContentHeightShort) { equal() }
}
} else {
KeypadFlow(
@ -525,7 +525,7 @@ private fun LandscapeKeyboard(
}
KeyboardButtonLight(buttonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightShort, clearSymbols) { deleteSymbol() }
KeyboardButtonFilled(buttonModifier, IconPack.Plus, allowVibration, KeyboardButtonContentHeightShort) { addSymbol(Token.Operator.plus) }
KeyboardButtonFilled(buttonModifier, IconPack.Equal, allowVibration, KeyboardButtonContentHeightShort) { evaluate() }
KeyboardButtonFilled(buttonModifier, IconPack.Equal, allowVibration, KeyboardButtonContentHeightShort) { equal() }
}
}
}
@ -542,7 +542,7 @@ private fun PreviewPortraitKeyboard() {
clearSymbols = {},
deleteSymbol = {},
toggleAngleMode = {},
evaluate = {},
equal = {},
allowVibration = false,
middleZero = false,
acButton = true,
@ -563,7 +563,7 @@ private fun PreviewLandscapeKeyboard() {
clearSymbols = {},
deleteSymbol = {},
toggleAngleMode = {},
evaluate = {},
equal = {},
allowVibration = false,
middleZero = false,
acButton = true,