Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
Updating Method AddTextChangedListener, PhoneEditTextWatcher object s…
Browse files Browse the repository at this point in the history
…hall be the default TextWatcher
  • Loading branch information
Leonardo Esparis committed Feb 13, 2017
1 parent eeb9324 commit 9010821
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public PhoneEditText(Context context, AttributeSet attrs) {
// no matter what kind of input type developer will use
// always, phone input type shall be used.
setInputType(-1);
addTextChangedListener(new PhoneEditTextWatcher());
addTextChangedListener(null);
setText((PLUS + Codes.asString(p_mCode)));
}

Expand Down Expand Up @@ -64,11 +64,7 @@ public void setInputType(int type) {

@Override
public void addTextChangedListener(TextWatcher watcher) {
if(watcher instanceof PhoneEditTextWatcher) {
super.addTextChangedListener(watcher);
} else {
throw new RuntimeException("textwatcher object should be a PhoneEditTextWatcher object or a child of it.");
}
super.addTextChangedListener(new PhoneEditTextWatcher());
}

private class PhoneEditTextWatcher implements TextWatcher {
Expand Down

0 comments on commit 9010821

Please sign in to comment.