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

getText method reuest #32

Closed HarshBhatia closed 8 years ago

HarshBhatia commented 8 years ago

getText() fucntion is not available in TickerView

jinatonic commented 8 years ago

I thought about exposing this API, but it's not super straightforward. For example, if the view is in the process of an animation, what does getText() return? Does it return the text it's animating to?

What's your use-case for this API?

HarshBhatia commented 8 years ago

I am making a video view counter, the videos are embedded in cards in the recyclerview. Each video has an onCompletionListener which increments the respective video's views by one, each time it is played. Those views are also embedded in the card as TickerView and onCompletion I need to setText(viewTicker.getText()+1)

jinatonic commented 8 years ago

You can call TickerView.addAnimatorListener to add a listener to know whenever the animation completes, and in your case you can easily keep track of the current value of the ticker yourself and increment it that way.

Otherwise, you would have to do something like Integer.valueOf(tickerView.getText()) which isn't too great anyway.