Skip to content

Commit

Permalink
Fix a bug that the floating label animation works improperly.
Browse files Browse the repository at this point in the history
It's caused by incorrect use of ObjectAnimator.reverse().
  • Loading branch information
rengwuxian committed Apr 28, 2015
1 parent da02d43 commit 58e3c02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,7 @@ public void afterTextChanged(Editable s) {
}
} else if (!floatingLabelShown) {
floatingLabelShown = true;
if (getLabelAnimator().isStarted()) {
getLabelAnimator().reverse();
} else {
getLabelAnimator().start();
}
getLabelAnimator().start();
}
}
}
Expand All @@ -864,11 +860,7 @@ public void afterTextChanged(Editable s) {
public void onFocusChange(View v, boolean hasFocus) {
if (floatingLabelEnabled && highlightFloatingLabel) {
if (hasFocus) {
if (getLabelFocusAnimator().isStarted()) {
getLabelFocusAnimator().reverse();
} else {
getLabelFocusAnimator().start();
}
getLabelFocusAnimator().start();
} else {
getLabelFocusAnimator().reverse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,7 @@ public void afterTextChanged(Editable s) {
}
} else if (!floatingLabelShown) {
floatingLabelShown = true;
if (getLabelAnimator().isStarted()) {
getLabelAnimator().reverse();
} else {
getLabelAnimator().start();
}
getLabelAnimator().start();
}
}
}
Expand All @@ -864,11 +860,7 @@ public void afterTextChanged(Editable s) {
public void onFocusChange(View v, boolean hasFocus) {
if (floatingLabelEnabled && highlightFloatingLabel) {
if (hasFocus) {
if (getLabelFocusAnimator().isStarted()) {
getLabelFocusAnimator().reverse();
} else {
getLabelFocusAnimator().start();
}
getLabelFocusAnimator().start();
} else {
getLabelFocusAnimator().reverse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,11 +846,7 @@ public void afterTextChanged(Editable s) {
}
} else if (!floatingLabelShown) {
floatingLabelShown = true;
if (getLabelAnimator().isStarted()) {
getLabelAnimator().reverse();
} else {
getLabelAnimator().start();
}
getLabelAnimator().start();
}
}
}
Expand All @@ -861,11 +857,7 @@ public void afterTextChanged(Editable s) {
public void onFocusChange(View v, boolean hasFocus) {
if (floatingLabelEnabled && highlightFloatingLabel) {
if (hasFocus) {
if (getLabelFocusAnimator().isStarted()) {
getLabelFocusAnimator().reverse();
} else {
getLabelFocusAnimator().start();
}
getLabelFocusAnimator().start();
} else {
getLabelFocusAnimator().reverse();
}
Expand Down

0 comments on commit 58e3c02

Please sign in to comment.