Skip to content

Commit

Permalink
fix #59
Browse files Browse the repository at this point in the history
  • Loading branch information
HITGIF committed Mar 17, 2018
1 parent 7933e77 commit d2ca9af
Showing 1 changed file with 5 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ public class TextFieldBoxes extends FrameLayout {
protected int ANIMATION_DURATION = 100;
protected boolean onError = false;
protected boolean activated = false;
protected boolean doNotRemoveError = false;

protected View panel;
protected View bottomLine;
Expand Down Expand Up @@ -445,10 +444,8 @@ public void afterTextChanged(Editable editable) {

if (!activated && !editable.toString().isEmpty()) activate(true);
if (activated && editable.toString().isEmpty() && !hasFocus) deactivate();
if (!doNotRemoveError) {
removeError();
updateCounterText();
}
removeError();
updateCounterText();
}
});

Expand Down Expand Up @@ -590,26 +587,9 @@ protected void activate(boolean animated) {

protected void makeCursorBlink() {

int cursorPos = this.editText.getSelectionStart();
if (cursorPos == 0)
if (this.editText.getText().toString().isEmpty()) {
if (this.onError) {
this.doNotRemoveError = true;
this.editText.setText(" ");
this.editText.setText("");
this.doNotRemoveError = false;
} else {
this.editText.setText(" ");
this.editText.setText("");
}
} else {
this.editText.setSelection(1);
this.editText.setSelection(0);
}
else {
this.editText.setSelection(0);
this.editText.setSelection(cursorPos);
}
CharSequence hintCache = this.editText.getHint();
this.editText.setHint(" ");
this.editText.setHint(hintCache);
}

/**
Expand Down

0 comments on commit d2ca9af

Please sign in to comment.