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

[refactor] Refactor ticker to allow for variable number of character lists #73

Closed jinatonic closed 6 years ago

jinatonic commented 6 years ago

This is a backward incompatible change in preparation for major release 2.

Breaking changes:

Supporting variable number of character lists have several advantages.

  1. We don't have to specify the animation behavior from all possible characters.
  2. Characters that do not exist in any character list can be treated differently by the animator. e.g. always prioritize preserving them via ACTION_SAME so they do not get animated.
  3. Can support more custom animation behavior since each character list gets priority over the previous. e.g. [0, 1, 2] dictates animation behavior from 0 to 2, but what if I want a different behavior from 1 to 2? I can provide another character list that's something like [1, 3, 2].
  4. Can support wrapping around behavior where 9 -> 0 properly wraps around the list rather than going all the way down. This is currently not possible because wrap-around in the current scenario would mean it would animate through all of the non-number characters (e.g. $).

closes #67

jinatonic commented 6 years ago

wtf i fucked up the branch, one sec