-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
how can I add a listener in a editText to watch his size
this is my code
SimpleMaskFormatter simpleMaskFormatterCelular = new SimpleMaskFormatter("(NN)NNNNN-NNNN");
SimpleMaskFormatter simpleMaskFormatterTelefone = new SimpleMaskFormatter("(NN)NNNN-NNNN");
MaskTextWatcher maskTextWatcherTelefoneMaeCel = new MaskTextWatcher(binding.ipFoneMae, simpleMaskFormatterCelular);
MaskTextWatcher maskTextWatcherTelefoneMaeTel = new MaskTextWatcher(binding.ipFoneMae, simpleMaskFormatterTelefone);
MaskTextWatcher maskTextWatcherTelefonePaiCel = new MaskTextWatcher(binding.ipFonePai, simpleMaskFormatterCelular);
MaskTextWatcher maskTextWatcherTelefonePaiTel = new MaskTextWatcher(binding.ipFonePai, simpleMaskFormatterTelefone);
MaskTextWatcher maskTextWatcherTelefoneResponsavelCel = new MaskTextWatcher(binding.ipFoneRespo, simpleMaskFormatterCelular);
MaskTextWatcher maskTextWatcherTelefoneResponsavelTel = new MaskTextWatcher(binding.ipFoneRespo, simpleMaskFormatterTelefone);
MaskTextWatcher maskTextWatcherTelefoneContatoCel = new MaskTextWatcher(binding.ipFoneContato, simpleMaskFormatterCelular);
MaskTextWatcher maskTextWatcherTelefoneContatoTel = new MaskTextWatcher(binding.ipFoneContato, simpleMaskFormatterTelefone);
binding.ipFoneMae.addTextChangedListener(mViewModel.getItem().getTelefoneMae().length() == 11 ? maskTextWatcherTelefoneMaeCel : maskTextWatcherTelefoneMaeTel);
binding.ipFonePai.addTextChangedListener(mViewModel.getItem().getTelefonePai().length() == 11 ? maskTextWatcherTelefonePaiCel : maskTextWatcherTelefonePaiTel);
binding.ipFoneRespo.addTextChangedListener(mViewModel.getItem().getTelefonePai().length() == 11 ? maskTextWatcherTelefoneResponsavelCel : maskTextWatcherTelefoneResponsavelTel);
binding.ipFoneContato.addTextChangedListener(mViewModel.getItem().getTelefoneContato().length() == 11 ? maskTextWatcherTelefoneContatoCel : maskTextWatcherTelefoneContatoTel);
Metadata
Metadata
Assignees
Labels
No labels