@@ -371,47 +371,59 @@ public void afterTextChanged(Editable editable) {
371
371
!mInputValidator .isValidInput (editable .toString ())) {
372
372
return ;
373
373
}
374
- int intValue ;
375
- try {
376
- intValue = Integer .valueOf (editable .toString ());
377
- } catch (NumberFormatException | NullPointerException ignore ) {
378
- return ;
374
+ final Number value ;
375
+ switch (mTextInputLayout .getId ()) {
376
+ case R .id .input_layout_flex_grow :
377
+ case R .id .input_layout_flex_shrink :
378
+ try {
379
+ value = Float .valueOf (editable .toString ());
380
+ } catch (NumberFormatException | NullPointerException ignore ) {
381
+ return ;
382
+ }
383
+ break ;
384
+ default :
385
+ try {
386
+ value = Integer .valueOf (editable .toString ());
387
+ } catch (NumberFormatException | NullPointerException ignore ) {
388
+ return ;
389
+ }
379
390
}
391
+
380
392
switch (mTextInputLayout .getId ()) {
381
393
case R .id .input_layout_order :
382
- mFlexItem .order = intValue ;
394
+ mFlexItem .order = value . intValue () ;
383
395
break ;
384
396
case R .id .input_layout_flex_grow :
385
- mFlexItem .flexGrow = intValue ;
397
+ mFlexItem .flexGrow = value . floatValue () ;
386
398
break ;
387
399
case R .id .input_layout_flex_shrink :
388
- mFlexItem .flexShrink = intValue ;
400
+ mFlexItem .flexShrink = value . floatValue () ;
389
401
break ;
390
402
case R .id .input_layout_width :
391
- mFlexItem .width = intValue ;
403
+ mFlexItem .width = value . intValue () ;
392
404
break ;
393
405
case R .id .input_layout_height :
394
- mFlexItem .height = intValue ;
406
+ mFlexItem .height = value . intValue () ;
395
407
break ;
396
408
case R .id .input_layout_flex_basis_percent :
397
- if (intValue != FlexboxLayout .LayoutParams .FLEX_BASIS_PERCENT_DEFAULT ) {
398
- mFlexItem .flexBasisPercent = (float ) (intValue / 100.0 );
409
+ if (value . intValue () != FlexboxLayout .LayoutParams .FLEX_BASIS_PERCENT_DEFAULT ) {
410
+ mFlexItem .flexBasisPercent = (float ) (value . intValue () / 100.0 );
399
411
} else {
400
412
mFlexItem .flexBasisPercent
401
413
= FlexboxLayout .LayoutParams .FLEX_BASIS_PERCENT_DEFAULT ;
402
414
}
403
415
break ;
404
416
case R .id .input_layout_min_width :
405
- mFlexItem .minWidth = intValue ;
417
+ mFlexItem .minWidth = value . intValue () ;
406
418
break ;
407
419
case R .id .input_layout_min_height :
408
- mFlexItem .minHeight = intValue ;
420
+ mFlexItem .minHeight = value . intValue () ;
409
421
break ;
410
422
case R .id .input_layout_max_width :
411
- mFlexItem .maxWidth = intValue ;
423
+ mFlexItem .maxWidth = value . intValue () ;
412
424
break ;
413
425
case R .id .input_layout_max_height :
414
- mFlexItem .maxHeight = intValue ;
426
+ mFlexItem .maxHeight = value . intValue () ;
415
427
break ;
416
428
}
417
429
}
0 commit comments