mirror of
https://github.com/SimpleMobileTools/Simple-Calculator.git
synced 2025-04-13 01:32:07 +02:00
fix #203, show an error if the result is infinite
This commit is contained in:
parent
41a2f2273e
commit
7f3358856a
@ -55,7 +55,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.32.15'
|
||||
implementation 'com.simplemobiletools:commons:5.33.17'
|
||||
implementation 'me.grantland:autofittextview:0.2.1'
|
||||
implementation 'net.objecthunter:exp4j:0.4.8'
|
||||
}
|
||||
|
@ -175,6 +175,11 @@ class CalculatorImpl(calculator: Calculator, private val context: Context) {
|
||||
}
|
||||
|
||||
val result = ExpressionBuilder(expression.replace(",", "")).build().evaluate()
|
||||
if (result.isInfinite()) {
|
||||
context.toast(R.string.unknown_error_occurred)
|
||||
return
|
||||
}
|
||||
|
||||
showNewResult(result.format())
|
||||
baseValue = result
|
||||
inputDisplayedFormula = result.format()
|
||||
|
@ -8,7 +8,7 @@ buildscript {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
Loading…
x
Reference in New Issue
Block a user