File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
app/src/main/java/com/example/kalkulator/utils Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ public class CalculatorHandler
19
19
public static final String MINUS_NAN = "-NaN" ;
20
20
public static final String NAN = "NaN" ;
21
21
public static final int VALUE_TEXT_VIEW_MAX_SIZE = 10 ;
22
- public static final int OUTPUT_MAX_SIZE = 20 ;
22
+ public static final int OUTPUT_MAX_SIZE = 15 ;
23
23
public static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat ("#.##########" );
24
24
public static final int VIBRATION_DURATION_MS = 8 ;
25
25
public static final int VIBRATION_AMPLITUDE = 100 ;
@@ -71,7 +71,15 @@ public static boolean isOutputTooLong(String formattedOutput)
71
71
72
72
for (char c : formattedOutput .toCharArray ())
73
73
{
74
- digitsInOutput += Character .isDigit (c ) ? 1 : 0 ;
74
+ // only count the digits before a comma
75
+ if (c == ',' )
76
+ {
77
+ break ;
78
+ }
79
+ else
80
+ {
81
+ digitsInOutput += Character .isDigit (c ) ? 1 : 0 ;
82
+ }
75
83
}
76
84
77
85
System .out .println ("digits in output: " + digitsInOutput );
You can’t perform that action at this time.
0 commit comments