jetc.dev Newsletter Issue #7
A slim issue this week, with a heavy focus on animations!
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
LayoutAlign to Work
Modifiers are a list, not a set – their order matters!
Animations, and an Expand/Collapse Button
Setting up animated effects in Compose does not require a ton of code, particularly if you use the Jetpack Animation library to handle some of the interpolation. Here, we have an animated expand/collapse button in < 150 lines!
Note: to view this, you need to be a member of the Kotlin Slack workspace — sign up at https://slack.kotlinlang.org/!
100% pure code!
Gist: DrawLayer Demo
Another animation sample, this time focusing on
DrawLayer(). < 150 lines for a
demo of how scale and rotation affect the layer!
GitHub - programadorthi / compose-weather-forecast
A Compose sample demonstrating displaying a weather forecast, with yet more animations!
GitHub - AlexZhukovich / CoffeeDrinksWithJetpackCompose
A JetNews-style sample for placing a coffee order, with favorite drinks.
…And One More Thing
Documenting Jetpack Compose is going to be a challenge. KDocs are class-centric, and Compose is more function-centric.
Suppose, for example, you want to look up the definition of
head over to https://developer.android.com and search on it… and you seem to get
no matches. It’s not even clear if any of the search results are related to
What’s going on is that
LayoutWeight is a function, defined on
RowColumnScope is part of the Compose DSL, but we are not running around and
creating instances of it manually. But, since the
is centered around classes, if you do not know the right class, you may have
difficulty finding the function.
Google’s focus seems to be on Android Studio auto-complete and related integrations, which is a reasonable solution. But, we cannot link to auto-complete in Medium posts and Slack discussions. And Android Studio’s resource requirements amount to a tax on developers, one that not everyone can pay.
Eventually, this situation will improve. Probably the online docs will become more searchable for Compose items. Third parties might create their own catalog of Compose functions with an eye towards simplifying the documentation navigation. Until then… just be prepared to hunt through the docs a bit more than you might be used to.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
- 2023-05-30: Compose beta! Tracking continuous composable presses! Animated carousels! MVI! 2D scrolling layouts! Tables! And... a stable function?!?
- 2023-05-23: Focus and preview cards for Compose for TV! Interactions and visual states! ViewCompositionStrategy! Compose for iOS, for real! @firstname.lastname@example.org is zooming! Data tables! And... BasicTextField2, the sequel?!?
- 2023-05-16: Google I/O! New Compose BOM and alpha! Viewmodels! BottomScaffold()! SealedX! Lottie! Dynamic themes! Floating action menus!