Skip to content

Commit

Permalink
Corrigido bug na mascara de telefone
Browse files Browse the repository at this point in the history
  • Loading branch information
Josue10599 committed Jul 31, 2019
1 parent 669b290 commit 5c7501e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ private void formataTelefone(TextInputEditText v) {
if (telefoneDigitado.matches(regex)) {
telefoneDigitadoFormatado = telefoneDigitado
.replaceAll(regex, "($1) $2$3-$4");
} else {
telefoneDigitadoFormatado = "";
}
}
v.setText(telefoneDigitadoFormatado);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void afterTextChanged(Editable editable) {
isRunning = true;

int editableLength = editable.length();
if (editableLength < mask.length()) {
if (editableLength < mask.length() && editableLength >= 1) {
if (mask.charAt(editableLength) != '#') {
editable.append(mask.charAt(editableLength));
} else if (mask.charAt(editableLength - 1) != '#') {
Expand Down

0 comments on commit 5c7501e

Please sign in to comment.