Closed mattsilber closed 5 years ago
Thanks for the awesome lib!
I went ahead and made some of the changes you requested. If you decide you want me to go ahead and migrate it to using an enum I'd be happy to do that as well
I migrated the TickerView.DIRECTION_X
constants to TickerView.ScrollingDirection
. Would you prefer it in there, or would you rather that enum pulled out of that level?
This PR fixes #97 by introducing the ability to enforce a preferred scrolling direction when animating
TickerColumn
changes.The direction can be set by calling
TickerView.setPreferredScrollingDirection(int)
with values ofTickerView.DIRECTION_ANY
,TickerView.DIRECTION_UP
, orTickerView.DIRECTION_DOWN
. It can also be set via XML via::ticker_defaultPreferredScrollingDirection
with values ofany
,up
, ordown
. The default behavior of the scrolling animation is what it currently is before the introduction of this PR (TickerView.DIRECTION_ANY).The direction is stored within the
TickerDrawMetrics
and is retrievable viaTickerDrawMetrics.getPreferredScrollingDirection()
.This PR also updates the
TickerCharacterListTest
tests to explicitly define their target direction, and adds several tests for the enforced up/down scrolling behavior.I also left some sample calls within ticker-sample, but was unsure if you'd prefer to leave them out.