jetc.dev Newsletter Issue #103
This week, we look at minimum sizes and minimum states. We work with the new Maps Compose library, write some snapshot tests, and carve some new shapes. We implement showcase views, video players, and radial color pickers. Plus, I hope for more official composable wrappers, like Maps Compose, coming out of the Googleplex.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
In the classic
View system, we have
attributes to state a minimum size, even if the size can be flexible above the
minimum. See how to accomplish the same thing in Compose UI in this week’s
highlighted Stack Overflow question.
When it comes to recomposition, is it better to have fewer coarse-grained state
objects, or more fine-grained ones? Google’s Adam Powell helps explore this area
of optimization in this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
The Code with the Italians team not only write interesting code, but they are amazing at getting guests to appear! This time, Google’s Chris Sinco helps out a bit on the design side, at the intersection of Figma and Compose UI.
John O’Reilly wrote about implementing Google Maps in Compose way back in the developer preview days. Google just shipped Maps Compose as an official composable wrapper for Maps — in this post, John writes about how he was able to quickly migrate one of his apps to use it!
Anders Ullnæss writes about snapshot testing (a.k.a., screenshot testing), focusing on how you capture known-good screenshots and how you verify future test runs against those screenshots. If you find this subject interesting, this week brought us another post on it!
Eric Donovan reviews the distinction between state and events, pointing out how MVP architectures lean toward events and Compose leans towards states. Eric reviews how to switch from an event mindset to a state mindset when migrating an MVP-style app to Compose UI.
Another week, another replacement for Navigation for Compose! This time, Vitali
Olsehvski provides a brief overview of
a navigation library that Vitali created.
Other Interesting Links
- Awesome Compose for Desktop
- Medium: Lottie Reverse Loop Animation with Jetpack Compose
- Medium: How to test Jetpack Compose’s ProgressIndicators
- My approach to solve the problem of first and last item padding with Jetpack Compose
- Medium: Build Single Activity Apps With Jetpack Compose
- Animating Composables Made Easy
- Into the Compose-Verse: A Beginners Guide To Jetpack Compose: Composables and Modifiers
- Medium: Top 5 lessons learned in fully Compose production app
100% pure code!
This repository contains Maps Compose, Google’s official composable wrapper around its Maps SDK.
We get a
GoogleMap() composable that we can place in our UI wherever we need to
display a map. More on this in “And One More Thing”, later in the newsletter!
Canopas Software has released a library with an
This implements the “showcase” pattern, highlighting a UI element and providing
notes about its role, designed for introducing users to how your UI works.
See this blog post
from Canopas for more!
Shivam Dhuria has created a library with a
Palette() composable that implements
a color picker. Rather than typical “grid of colors” or color wheels,
implements something closer to a radial menu of color swatches to choose from.
Other Interesting Links
- GitHub: ireward / compose-html
- GitHub: pushpalroy / jetlime
- GitHub: yeocak / ComposableTimelineView
- GitHub: develNerd / JC-CustomSwitch
- GitHub: MotionCompose Examples
…And One More Thing
The advent of Maps Compose is just one of several such wrappers that I hope that Google will roll out over the coming months and years.
“Wrapper” is the key word in that previous sentence. In the end, Maps Compose
AndroidView to wrap a
MapView, no different than you or I might create
on our own. The overall map engine has not been rewritten from the ground up using
Compose, and it is unclear when (or even if) that will be done.
Still, wrappers are useful. The developers of Maps Compose know Maps better than you or I, and they can focus on creating a wrapper that implements a clean API that (hopefully) they will support for quite some time. All else being equal, officially-supported wrappers tend to be better choices than ones that you create yourself. Over time, more developers will already have knowledge of the official wrapper, whereas nobody but your team knows your custom one.
(“all else” sometimes is not equal, and if you feel that you can do a better job at a wrapper, by all means build it!)
I expect that 2022 will be a big year for official composable wrappers. Compose has had a stable release for six months, and many Google teams might have wanted to wait until a stable release before committing resources to building a relevant wrapper.
My eye is on ExoPlayer; in the meantime, we have independent wrappers, such as the one listed in the “Resource Roundup” section.
- 2022-09-13: Compose updates! Tracking down and fixing recompositions! Maestro! Redwood! Molecule! And Twitter's rules for composables!
- 2022-09-06: Snapshots! A Glance support library! Measuring and drawing! Swipe-to-dismiss! Speed dials! And... a redwood sighting?!?
- 2022-08-30: Android 13 per-app language support! Performance optimizations! Expandable lists! MVI! Zooming! Steppers! And... another Compose beta? Already?!?