mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-04-03 13:01:42 +02:00
properly handle pressing Plus after a decimal
This commit is contained in:
parent
a6c1847701
commit
04a191c66b
@ -49,6 +49,7 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastKey = DECIMAL
|
||||||
showNewResult(inputDisplayedFormula)
|
showNewResult(inputDisplayedFormula)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +62,8 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
|||||||
inputDisplayedFormula = "√"
|
inputDisplayedFormula = "√"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operations.contains(inputDisplayedFormula.last().toString())) {
|
val lastChar = inputDisplayedFormula.last().toString()
|
||||||
|
if (operations.contains(lastChar) || lastChar == ".") {
|
||||||
inputDisplayedFormula = inputDisplayedFormula.dropLast(1)
|
inputDisplayedFormula = inputDisplayedFormula.dropLast(1)
|
||||||
inputDisplayedFormula += getSign(operation)
|
inputDisplayedFormula += getSign(operation)
|
||||||
} else if (!inputDisplayedFormula.trimStart('-').contains(operationsRegex.toRegex())) {
|
} else if (!inputDisplayedFormula.trimStart('-').contains(operationsRegex.toRegex())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user