diff --git a/app/src/main/java/me/zobrist/tichucounter/ui/counter/CounterViewModel.kt b/app/src/main/java/me/zobrist/tichucounter/ui/counter/CounterViewModel.kt index a1810cd..5362fbf 100644 --- a/app/src/main/java/me/zobrist/tichucounter/ui/counter/CounterViewModel.kt +++ b/app/src/main/java/me/zobrist/tichucounter/ui/counter/CounterViewModel.kt @@ -203,12 +203,23 @@ class CounterViewModel @Inject constructor( override fun digitClicked(digit: String) { focusLastInput() - if(activeValue.digitCount() < 5) + + if(activeValue.digitCount() >= 5) { - activeValue += digit - updateOtherScore() - updateSubmitButton() + // 5 digits is enough + return } + + val newValue = activeValue + digit + + try { + activeValue = newValue.toInt().toString() + } catch (_: NumberFormatException) + { + } + + updateOtherScore() + updateSubmitButton() } override fun negateClicked() {