PhoneNumberKit
PhoneNumberKit copied to clipboard
MaskedTextChangedListener implementation bug
Came across an issue with mask format. When a textChangedListener is installed on a text edit it uses number example to make a mask. Problem is that number example is just on of the possible variants of the input so using it for the mask restricts from another valid input of different format.
Example:
Indonesian mobile number + 62 812 111-222-33
which is perfectly valid, it's number pattern in the google lib is 8[1-35-9]\d{7,10}
.
It's impossible to input the whole number because textChangedListener uses short variant of mask +[00] [000]-[000]-[000]
so it allows only + 62 812 111-222
.
The workaround is using a widest possible mask format i guess.
Hi @derkicker do you have any suggestion to cover that case? As far as I know lilphonenumber provides just 1 sample number for the given country code.
Hi @ibrahimsn98! I'd suggest using possibleLengths
block from resources:


So we could get max value from mobile.possibleLength_
and compose a mask of that length