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

Remove unnecessary synchronized modifier. #80

Closed naturalwarren closed 6 years ago

naturalwarren commented 6 years ago

TickerView.setText() is only safe to call from the thread that created the TickerView since it calls invalidate(). Calling from a different thread results in:

android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.

There doesn't appear to be a benefit from synchronizing this method and doing so has a non-zero cost. Thoughts on removing it?