Paywalls: Small optimization purchase button#1375
Conversation
| colors: TemplateConfiguration.Colors, | ||
| ) { | ||
| val localization = selectedPackage.localization | ||
| AnimatedVisibility( |
There was a problem hiding this comment.
<3 this is so much better
|
This is a huge find, thank you @tonidero! 🙏🏻 |
NachoSoto
left a comment
There was a problem hiding this comment.
Actually I think we need to use the existing implementation
I was in the process of changing ConsistentPackageContentView to use AnimatedVisibility as well, but I realized that it removes elements from the layout. It's important that we don't do that because we need them to be hidden and contribute to the overall layout so that package transitions are consistent and don't move content around.
|
Oh hmm then maybe we can use it only for the progress indicator, which was causing the issue? Will confirm tomorrow, thanks for catching that? |
|
I noticed that the purchase button was changing height now because of that as well. |
Extracted part of #1375. This uses `AnimatedVisibility` on the `CircularProgressIndicator` so that when it's not visible it's actually removed and the animation doesn't take CPU time. It uses `Modifier.matchParentSize` to ensure that when it's presented it doesn't contribute to the layout and abruptly resize the `PurchaseButton`.
|
Closing in favor of #1376 |
Description
This changes the animations for the purchase button to use
AnimatedVisibilitywhich actually removes the composable when the animation ends, making sure the progress indicator is not rendered without need, causing CPU usage