robinhood / ticker

An Android text view with scrolling text change animation
https://medium.com/robinhood-engineering/hello-ticker-20eaf6e51689
Apache License 2.0
4.38k stars 462 forks source link

Ticker animates initial setText() value when it should not #59

Closed danh32 closed 7 years ago

danh32 commented 7 years ago

When calling ticker.setText("value") for the very first time, Ticker tries to not animate this call by checking if getWidth == 0. I think this check is currently broken.

I'm proposing two things:

1) add a getText() method that returns the last value passed to setText() or empty CharSequence if never set (same behavior as TextView) 2) the 1 argument setText() method should pass !getText().isEmpty() for the animate argument to the 2 argument constructor.