jetc.dev Newsletter Issue #103
Published: 2022-02-08
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!
How Do We Enforce a Minimum Size?
In the classic View
system, we have android:minWidth
and android:minHeight
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.
One State, or Two?
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.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Video: Code with the Italians… And Chris Sinco
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.
Using Google Maps in a Jetpack Compose app - Part 2!
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!
Oh Snap! Snapshot Testing with Jetpack Compose
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!
Tic-tac-toe: from MVP to Jetpack Compose
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.
Jetpack Compose in Many Shapes and Forms
Aida Issayeva looks at Compose UI’s Shape
interface, where it gets used, what
implementations ship with Compose UI, and how to implement your own custom Shape
!
Compose Navigation Reimagined
Another week, another replacement for Navigation for Compose! This time, Vitali
Olsehvski provides a brief overview of compose-navigation-reimagined
,
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
Resource Roundup
100% pure code!
GitHub: googlemaps / android-maps-compose
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!
GitHub: canopas / Intro-showcase-view
Canopas Software has released a library with an IntroShowCase()
composable.
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!
GitHub: imherrera / compose-video-player
Juan Pablo Herrera has shipped a very early release of a VideoPlayer()
composable wrapper around ExoPlayer!
GitHub: Shivamdhuria / palette
Shivam Dhuria has created a library with a Palette()
composable that implements
a color picker. Rather than typical “grid of colors” or color wheels, Palette()
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
is using 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.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-12-10: A Compose Multiplatform alpha! Hot reload! Presentation! Sprites! Calendars!
- 2024-12-03: Rebecca Franks on clipping and masking! Stefano Natali on graphicsLayer()! FunkyMuse on type-safe nav results! And... if we have enough maps, do we need to store our maps in a Map?!?
- 2024-11-26: Math! Shared element transitions! Custom modifiers! Macrobenchmark! Adapting to platform-specific design systems! And... why does wrapContentSize() not wrap my content size?!?