DynamicAmountEditText

Additional

Language
Kotlin
Version
N/A
Created
Aug 23, 2020
Updated
Aug 23, 2020
Owner
Aksenov Vladimir (vovaksenov99)
Contributor
Aksenov Vladimir (vovaksenov99)
1
Activity
Badge
Generate
Download
Source code

Announcement

DynamicAmountEditText

Customizable EditText with runtime amount formatting. There's nothing extra. Supports different separator's types.

Features:

  • Extended from EditText, so you can use it like regular EditText f.e. with TextInputLayout
  • Formatting occurs in runtime
  • You can change decimal separator, decimal part length, grouping separator
  • Cases with insert from clipboard was processed, as a result, you can't paste incorrect values. From pasted data will be select correct parts only

Project sample is above.

Work example

View params.

Parameter def. value description
decimalSeparator ',' Separator of integer and fractional part
decimalPartLength 2 Max decimal part length
isSeparatorCutInvalidDecimalLength false If false, input separator in position (string length - decimalPartLength) will be forbid. If true, you can put separator to any string's position, but excess decimal part will be cut off
GROUPING_SEPARATOR ' ' Discharge separator of integer part