mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 08:45:27 +02:00
Rename parameter from evaluate to equal
This commit is contained in:
parent
8d46084b51
commit
9f8c5b8c36
@ -48,7 +48,7 @@ class CalculatorScreenTest {
|
|||||||
deleteTokens = {},
|
deleteTokens = {},
|
||||||
onCursorChange = {},
|
onCursorChange = {},
|
||||||
toggleCalculatorMode = {},
|
toggleCalculatorMode = {},
|
||||||
evaluate = {},
|
equal = {},
|
||||||
clearHistory = {},
|
clearHistory = {},
|
||||||
addBracket = {}
|
addBracket = {}
|
||||||
)
|
)
|
||||||
@ -81,7 +81,7 @@ class CalculatorScreenTest {
|
|||||||
deleteTokens = {},
|
deleteTokens = {},
|
||||||
onCursorChange = {},
|
onCursorChange = {},
|
||||||
toggleCalculatorMode = {},
|
toggleCalculatorMode = {},
|
||||||
evaluate = {},
|
equal = {},
|
||||||
clearHistory = {},
|
clearHistory = {},
|
||||||
addBracket = {}
|
addBracket = {}
|
||||||
)
|
)
|
||||||
@ -115,7 +115,7 @@ class CalculatorScreenTest {
|
|||||||
deleteTokens = {},
|
deleteTokens = {},
|
||||||
onCursorChange = {},
|
onCursorChange = {},
|
||||||
toggleCalculatorMode = {},
|
toggleCalculatorMode = {},
|
||||||
evaluate = {},
|
equal = {},
|
||||||
clearHistory = {},
|
clearHistory = {},
|
||||||
addBracket = {}
|
addBracket = {}
|
||||||
)
|
)
|
||||||
|
@ -99,7 +99,7 @@ internal fun CalculatorRoute(
|
|||||||
deleteTokens = viewModel::deleteTokens,
|
deleteTokens = viewModel::deleteTokens,
|
||||||
onCursorChange = viewModel::onCursorChange,
|
onCursorChange = viewModel::onCursorChange,
|
||||||
toggleCalculatorMode = viewModel::updateRadianMode,
|
toggleCalculatorMode = viewModel::updateRadianMode,
|
||||||
evaluate = viewModel::evaluate,
|
equal = viewModel::equal,
|
||||||
clearHistory = viewModel::clearHistory,
|
clearHistory = viewModel::clearHistory,
|
||||||
addBracket = viewModel::addBracket
|
addBracket = viewModel::addBracket
|
||||||
)
|
)
|
||||||
@ -116,7 +116,7 @@ internal fun CalculatorScreen(
|
|||||||
deleteTokens: () -> Unit,
|
deleteTokens: () -> Unit,
|
||||||
onCursorChange: (TextRange) -> Unit,
|
onCursorChange: (TextRange) -> Unit,
|
||||||
toggleCalculatorMode: (Boolean) -> Unit,
|
toggleCalculatorMode: (Boolean) -> Unit,
|
||||||
evaluate: () -> Unit,
|
equal: () -> Unit,
|
||||||
clearHistory: () -> Unit
|
clearHistory: () -> Unit
|
||||||
) {
|
) {
|
||||||
when (uiState) {
|
when (uiState) {
|
||||||
@ -130,7 +130,7 @@ internal fun CalculatorScreen(
|
|||||||
deleteSymbol = deleteTokens,
|
deleteSymbol = deleteTokens,
|
||||||
onCursorChange = onCursorChange,
|
onCursorChange = onCursorChange,
|
||||||
toggleAngleMode = { toggleCalculatorMode(!uiState.radianMode) },
|
toggleAngleMode = { toggleCalculatorMode(!uiState.radianMode) },
|
||||||
evaluate = evaluate,
|
equal = equal,
|
||||||
clearHistory = clearHistory,
|
clearHistory = clearHistory,
|
||||||
addBracket = addBracket
|
addBracket = addBracket
|
||||||
)
|
)
|
||||||
@ -148,7 +148,7 @@ private fun Ready(
|
|||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
onCursorChange: (TextRange) -> Unit,
|
onCursorChange: (TextRange) -> Unit,
|
||||||
toggleAngleMode: () -> Unit,
|
toggleAngleMode: () -> Unit,
|
||||||
evaluate: () -> Unit,
|
equal: () -> Unit,
|
||||||
clearHistory: () -> Unit
|
clearHistory: () -> Unit
|
||||||
) {
|
) {
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
@ -285,7 +285,7 @@ private fun Ready(
|
|||||||
clearSymbols = clearSymbols,
|
clearSymbols = clearSymbols,
|
||||||
deleteSymbol = deleteSymbol,
|
deleteSymbol = deleteSymbol,
|
||||||
toggleAngleMode = toggleAngleMode,
|
toggleAngleMode = toggleAngleMode,
|
||||||
evaluate = evaluate,
|
equal = equal,
|
||||||
middleZero = uiState.middleZero,
|
middleZero = uiState.middleZero,
|
||||||
acButton = uiState.acButton,
|
acButton = uiState.acButton,
|
||||||
addBracket = addBracket
|
addBracket = addBracket
|
||||||
@ -375,7 +375,7 @@ private fun PreviewCalculatorScreen() {
|
|||||||
deleteTokens = {},
|
deleteTokens = {},
|
||||||
onCursorChange = {},
|
onCursorChange = {},
|
||||||
toggleCalculatorMode = {},
|
toggleCalculatorMode = {},
|
||||||
evaluate = {},
|
equal = {},
|
||||||
clearHistory = {},
|
clearHistory = {},
|
||||||
addBracket = {}
|
addBracket = {}
|
||||||
)
|
)
|
||||||
|
@ -178,7 +178,7 @@ internal class CalculatorViewModel @Inject constructor(
|
|||||||
calculatorHistoryRepository.clear()
|
calculatorHistoryRepository.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun evaluate() = viewModelScope.launch {
|
fun equal() = viewModelScope.launch {
|
||||||
val prefs = _prefs.value ?: return@launch
|
val prefs = _prefs.value ?: return@launch
|
||||||
if (_equalClicked.value) return@launch
|
if (_equalClicked.value) return@launch
|
||||||
if (!_input.value.text.isExpression()) return@launch
|
if (!_input.value.text.isExpression()) return@launch
|
||||||
|
@ -123,7 +123,7 @@ internal fun CalculatorKeyboard(
|
|||||||
clearSymbols: () -> Unit,
|
clearSymbols: () -> Unit,
|
||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
toggleAngleMode: () -> Unit,
|
toggleAngleMode: () -> Unit,
|
||||||
evaluate: () -> Unit
|
equal: () -> Unit
|
||||||
) {
|
) {
|
||||||
val fractionalIcon = remember(fractional) { if (fractional == Token.Digit.dot) IconPack.Dot else IconPack.Comma }
|
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 }
|
val angleIcon = remember(radianMode) { if (radianMode) IconPack.Rad else IconPack.Deg }
|
||||||
@ -140,7 +140,7 @@ internal fun CalculatorKeyboard(
|
|||||||
toggleAngleMode = toggleAngleMode,
|
toggleAngleMode = toggleAngleMode,
|
||||||
deleteSymbol = deleteSymbol,
|
deleteSymbol = deleteSymbol,
|
||||||
clearSymbols = clearSymbols,
|
clearSymbols = clearSymbols,
|
||||||
evaluate = evaluate,
|
equal = equal,
|
||||||
acButton = acButton,
|
acButton = acButton,
|
||||||
addBracket = addBracket,
|
addBracket = addBracket,
|
||||||
invMode = invMode,
|
invMode = invMode,
|
||||||
@ -157,7 +157,7 @@ internal fun CalculatorKeyboard(
|
|||||||
toggleAngleMode = toggleAngleMode,
|
toggleAngleMode = toggleAngleMode,
|
||||||
deleteSymbol = deleteSymbol,
|
deleteSymbol = deleteSymbol,
|
||||||
clearSymbols = clearSymbols,
|
clearSymbols = clearSymbols,
|
||||||
evaluate = evaluate,
|
equal = equal,
|
||||||
acButton = acButton,
|
acButton = acButton,
|
||||||
addBracket = addBracket,
|
addBracket = addBracket,
|
||||||
invMode = invMode,
|
invMode = invMode,
|
||||||
@ -177,7 +177,7 @@ private fun PortraitKeyboard(
|
|||||||
toggleAngleMode: () -> Unit,
|
toggleAngleMode: () -> Unit,
|
||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
clearSymbols: () -> Unit,
|
clearSymbols: () -> Unit,
|
||||||
evaluate: () -> Unit,
|
equal: () -> Unit,
|
||||||
acButton: Boolean,
|
acButton: Boolean,
|
||||||
addBracket: () -> Unit,
|
addBracket: () -> Unit,
|
||||||
invMode: Boolean,
|
invMode: Boolean,
|
||||||
@ -318,7 +318,7 @@ private fun PortraitKeyboard(
|
|||||||
KeyboardButtonLight(mainButtonModifier, fractionalIcon, allowVibration, KeyboardButtonContentHeightTall) { addSymbol(Token.Digit.dot) }
|
KeyboardButtonLight(mainButtonModifier, fractionalIcon, allowVibration, KeyboardButtonContentHeightTall) { addSymbol(Token.Digit.dot) }
|
||||||
}
|
}
|
||||||
KeyboardButtonLight(mainButtonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightTall, clearSymbols) { deleteSymbol() }
|
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))
|
Spacer(modifier = Modifier.height(spacerHeight))
|
||||||
@ -404,7 +404,7 @@ private fun LandscapeKeyboard(
|
|||||||
toggleAngleMode: () -> Unit,
|
toggleAngleMode: () -> Unit,
|
||||||
deleteSymbol: () -> Unit,
|
deleteSymbol: () -> Unit,
|
||||||
clearSymbols: () -> Unit,
|
clearSymbols: () -> Unit,
|
||||||
evaluate: () -> Unit,
|
equal: () -> Unit,
|
||||||
acButton: Boolean,
|
acButton: Boolean,
|
||||||
addBracket: () -> Unit,
|
addBracket: () -> Unit,
|
||||||
invMode: Boolean,
|
invMode: Boolean,
|
||||||
@ -469,7 +469,7 @@ private fun LandscapeKeyboard(
|
|||||||
}
|
}
|
||||||
KeyboardButtonLight(buttonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightShort, clearSymbols) { deleteSymbol() }
|
KeyboardButtonLight(buttonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightShort, clearSymbols) { deleteSymbol() }
|
||||||
KeyboardButtonFilled(buttonModifier, IconPack.Plus, allowVibration, KeyboardButtonContentHeightShort) { addSymbol(Token.Operator.plus) }
|
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 {
|
} else {
|
||||||
KeypadFlow(
|
KeypadFlow(
|
||||||
@ -525,7 +525,7 @@ private fun LandscapeKeyboard(
|
|||||||
}
|
}
|
||||||
KeyboardButtonLight(buttonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightShort, clearSymbols) { deleteSymbol() }
|
KeyboardButtonLight(buttonModifier, IconPack.Backspace, allowVibration, KeyboardButtonContentHeightShort, clearSymbols) { deleteSymbol() }
|
||||||
KeyboardButtonFilled(buttonModifier, IconPack.Plus, allowVibration, KeyboardButtonContentHeightShort) { addSymbol(Token.Operator.plus) }
|
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 = {},
|
clearSymbols = {},
|
||||||
deleteSymbol = {},
|
deleteSymbol = {},
|
||||||
toggleAngleMode = {},
|
toggleAngleMode = {},
|
||||||
evaluate = {},
|
equal = {},
|
||||||
allowVibration = false,
|
allowVibration = false,
|
||||||
middleZero = false,
|
middleZero = false,
|
||||||
acButton = true,
|
acButton = true,
|
||||||
@ -563,7 +563,7 @@ private fun PreviewLandscapeKeyboard() {
|
|||||||
clearSymbols = {},
|
clearSymbols = {},
|
||||||
deleteSymbol = {},
|
deleteSymbol = {},
|
||||||
toggleAngleMode = {},
|
toggleAngleMode = {},
|
||||||
evaluate = {},
|
equal = {},
|
||||||
allowVibration = false,
|
allowVibration = false,
|
||||||
middleZero = false,
|
middleZero = false,
|
||||||
acButton = true,
|
acButton = true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user