Skip to content

Commit

Permalink
fix: Fix string resource not found
Browse files Browse the repository at this point in the history
Fix for string resource not found for string id -1 returned by
the viewModel when in no error scenario.

Signed-off-by: Archit Raj <arch10@ymail.com>
  • Loading branch information
arch10 committed Feb 21, 2021
1 parent e432efa commit ca1417a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
applicationId "com.gigaworks.tech.calculator"
minSdkVersion 21
targetSdkVersion 30
versionCode 42
versionCode 44
versionName "2.0.0"
buildConfigField "java.util.Date", "buildTime", "new java.util.Date(" + System.currentTimeMillis() + "L)"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
val shake = AnimationUtils.loadAnimation(this, R.anim.shake)
getResultEditText().setTextColor(getResultTextColor(true))
val errorStringId = viewModel.error.value ?: R.string.invalid
setResult(getString(errorStringId))
if (errorStringId == -1) {
setResult("")
} else {
setResult(getString(errorStringId))
}
getResultEditText().startAnimation(shake)
} else {
val balancedExpression = viewModel.getCalculatedExpression()
Expand Down

0 comments on commit ca1417a

Please sign in to comment.