Skip to content

Single drawable#87

Merged
mjtalbot merged 3 commits intomasterfrom
single_drawable
Apr 27, 2021
Merged

Single drawable#87
mjtalbot merged 3 commits intomasterfrom
single_drawable

Conversation

@mjohnsullivan
Copy link
Copy Markdown
Contributor

Experimenting with RiveDrawable creation; notes inline

@mjohnsullivan mjohnsullivan requested a review from mjtalbot April 26, 2021 23:37
fit: Fit = Fit.CONTAIN,
alignment: Alignment = Alignment.CENTER,
loop: Loop = Loop.NONE,
) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i think so

val bytes = resources.openRawResource(resId).readBytes()
setRiveBytes(
bytes,
fit = fit,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

@mjtalbot mjtalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mjtalbot mjtalbot merged commit 1cf784d into master Apr 27, 2021
@mjtalbot mjtalbot deleted the single_drawable branch April 27, 2021 15:10
mjtalbot added a commit that referenced this pull request Jun 26, 2022
mjtalbot added a commit that referenced this pull request Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants