Merge pull request #231 from Aga-C/fix-sign-change
Fixed changing operator after dividing by zero (#202)
This commit is contained in:
commit
5293466274
1 changed files with 8 additions and 2 deletions
|
@ -118,8 +118,14 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
|||
}
|
||||
}
|
||||
|
||||
lastKey = operation
|
||||
lastOperation = operation
|
||||
if (getSecondValue() == 0.0 && inputDisplayedFormula.contains("÷")) {
|
||||
lastKey = DIVIDE
|
||||
lastOperation = DIVIDE
|
||||
} else {
|
||||
lastKey = operation
|
||||
lastOperation = operation
|
||||
}
|
||||
|
||||
showNewResult(inputDisplayedFormula)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue