mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-02-26 16:27:55 +01:00
Properly format calculation formula
This commit is contained in:
parent
8668a5b680
commit
2af2a6175f
@ -272,11 +272,14 @@ class CalculatorImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
showNewResult(result.format())
|
showNewResult(result.format())
|
||||||
baseValue = result
|
val newFormula = "${baseValue.format()}$sign${secondValue.format()}"
|
||||||
val newFormula = expression.replace("sqrt", "√").replace("*", "×").replace("/", "÷")
|
HistoryHelper(context).insertOrUpdateHistoryEntry(
|
||||||
HistoryHelper(context).insertOrUpdateHistoryEntry(History(null, newFormula, result.format(), System.currentTimeMillis()))
|
History(id = null, formula = newFormula, result = result.format(), timestamp = System.currentTimeMillis())
|
||||||
inputDisplayedFormula = result.format()
|
)
|
||||||
showNewFormula(newFormula)
|
showNewFormula(newFormula)
|
||||||
|
|
||||||
|
inputDisplayedFormula = result.format()
|
||||||
|
baseValue = result
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
context.toast(R.string.unknown_error_occurred)
|
context.toast(R.string.unknown_error_occurred)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user