rtoshiro / MaskFormatter

An Android Library to format Strings usings masks. Can be used with TextWatcher.
89 stars 33 forks source link

Define InputType #1

Open WBertan opened 8 years ago

WBertan commented 8 years ago

Could I set an InputType by position?

I've this mask:

    SimpleMaskFormatter smf = new SimpleMaskFormatter("UUU-NNNN");

In Brazil this is our Mask for car plates, but the keyboard needs to change between only unsigned numbers to upper cased letters, and vice-versa when the user point the cursor directly in the number side (if possible disable this option for the user set the cursor position).

rtoshiro commented 8 years ago

Hi @WBertan Yes, you can change the inputType programmatically trying to infer the position of the EditText cursor. I agree it would be a nice functionality to this library. I'm going to try to change it to support this kind of feature. In a mean time, I suggest you to use TextWatcher and parse from start and end position.