[#23] Prevent trailing zeros stacking up.
Some checks failed
continuous-integration/drone/push Build was killed
Some checks failed
continuous-integration/drone/push Build was killed
closes #23
This commit is contained in:
@@ -203,12 +203,23 @@ class CounterViewModel @Inject constructor(
|
|||||||
override fun digitClicked(digit: String) {
|
override fun digitClicked(digit: String) {
|
||||||
focusLastInput()
|
focusLastInput()
|
||||||
|
|
||||||
if(activeValue.digitCount() < 5)
|
|
||||||
|
if(activeValue.digitCount() >= 5)
|
||||||
{
|
{
|
||||||
activeValue += digit
|
// 5 digits is enough
|
||||||
updateOtherScore()
|
return
|
||||||
updateSubmitButton()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val newValue = activeValue + digit
|
||||||
|
|
||||||
|
try {
|
||||||
|
activeValue = newValue.toInt().toString()
|
||||||
|
} catch (_: NumberFormatException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOtherScore()
|
||||||
|
updateSubmitButton()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun negateClicked() {
|
override fun negateClicked() {
|
||||||
|
|||||||
Reference in New Issue
Block a user