Conversation
kotlin/src/main/java/app/rive/runtime/kotlin/RiveAnimationView.kt
Outdated
Show resolved
Hide resolved
| fit: Fit = Fit.CONTAIN, | ||
| alignment: Alignment = Alignment.CENTER, | ||
| loop: Loop = Loop.NONE, | ||
| ) { |
There was a problem hiding this comment.
Not sure the way these initialize make sense; if we're setting the Rive file multiple times, it'll reuse the first one's artboard and animation names if they're not specified, which will probably cause new files to explode. Better to have those reset to null so defaults can be chosen?
Same wit the other parameters; best to have everything reset to defaults?
| val bytes = resources.openRawResource(resId).readBytes() | ||
| setRiveBytes( | ||
| bytes, | ||
| fit = fit, |
There was a problem hiding this comment.
So I've moved resetting the drawable's defaults to this level; see comments on the setRiveFile function. As we eat the defaults the first time we call setRiveXXX, I just copied the defaults out to here and setRiveBytes. We could have the defaults as class immutables on RiveDrawable if we wanted to keep things nicely encapsulated.
b0cf628 to
241f64b
Compare
Experimenting with RiveDrawable creation; notes inline