jetc.dev Newsletter Issue #113
This week, we look at
1.2.0-alpha08, custom modifiers, and composable sizing.
We explore writing Compose tests, both for their own merits and for collecting
screenshots. We peek at a tree widget and an event queue implementation. And I point
out that “oh, just copy the composable and change it to meet your needs!” does
not always work out.
Reviewing the release notes for the latest Jetpack Compose update!
1.2.0-alpha08 came out, with support for Kotlin 1.6.20! 🎉
In addition, the new alpha:
Makes some adjustments to the tracing APIs, including restricting them to apps that opt into them
Adds supports for more font weights when using
FontFamily.SansSerif, even on older Android versions
LazyLayout()for your own lazy composables
Also, we got
1.0.0-alpha21 of Wear Compose, with a bunch of new options for
curved content, a new
SwipeDismissableNavHostState, changes to
and a lot more!
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
If you find yourself repeating the same
Modifier chain, you might want to create
Modifier that represents that chain. See a few techniques for doing this
in this week’s highlighted Stack Overflow question.
Posts, videos, and other new information related to Jetpack Compose!
A much more useful official post from Google comes by way of Jose Alcérreca. Jose
ComposeTestRule to block test execution until some
state is achieved. This can be used in lieu of Espresso-style idling or the
delay() approach to wait for some work to complete before proceeding
to test the UI.
Stephen Vinouze returns, examining the official composable wrapper for Google Maps. Stephen specifically looks at how to add markers and how to address those markers as the user pans and zooms the map.
Other Interesting Links
- Medium: Integrating ExoPlayer in Jetpack Compose Android
- Jetpack Compose Ticket ZigZag View
- How to Create a Collapsing Toolbar in Android using Jetpack Compose?
- Nested Scrolling in Android using Jetpack Compose
- Android Custom Dialog using jetpack compose
- Medium: Jetpack Compose Basics
- Jetpack Compose Basics - Preview and it’s parameters
- Slides: Jetpack Compose - The Future of Android Development (Extended)
100% pure code!
Adriel Café planted a
Bonsai() tree widget composable, supporting both Compose UI
for Android and Compose for Desktop. You can create your tree structure through a DSL
or via filesystem or JSON integration.
GitHub user patrykandpatryk created a chart library for Compose UI and the classic
View system, though not by the traditional interop approaches (e.g., using
to wrap the
View in a composable). The library supports bar and line charts,
including a combined “composed” chart.
Manideep Polireddi created an
EventQueue implementation, designed for composables
to be able to react to events coming from a viewmodel. See this Twitter thread
for usage notes.
Other Interesting Links
- GitHub: re-ovo / md3compat (backward compatible Material You implementation)
- GitHub: copper-leaf / ballast (KMP state management framework)
- GitHub: timbrueggenthies / compose-video-player (Compose-first video player)
…And One More Thing
When we ask why certain official composables do not offer Feature X, we are often
told “it’s all open source, just copy and modify the composable to do what you want”.
While true, this approach has a variety of problems. One of those problems: some
official composables cannot be copied, because they rely on
For example, as part of an upcoming blog post series, I wanted to create a
composable. In the Android SDK,
Presentation is a key way to get content onto
external displays. For reasons I have never really understood,
is a subclass of
Dialog. But, since Compose UI has a
I figured that I could copy it and tweak the implementation to use a
instead of a
That… did not work. A fair bit of the
Dialog() implementation relies on
APIs. Most notably, the content of the dialog is handled by a
class that extends
AbstractComposeView and overrides some
It is not out of the question that I could hack away at things and eventually
get rid of those
internal references. For the purposes of a demonstration in a blog
post, I elected to go a different route.
Most of the composables that we are suggested to clone and modify will be farther
away from low-level Compose UI plumbing. For example, wanting a Compose Material
widget that goes against Material Design in one area is likely to be relatively
easy to address. However, the closer you get to the Android SDK, the more likely it is
that you will run into places where the code that you are copying depends on being
part of Compose UI itself, as
- 2022-05-17: Google I|O 2022 videos! Compose beta01! Layout()! State! drawBehind()! Credit cards! App intros! And... what's a horologist?!?
- 2022-05-10: StateFlow vs. State! Design systems! MotionLayout! Text editing problems and solutions! And... modal sheets that are actually modal?!?
- 2022-05-03: @aditlal and @JorgeCastilloPr on design systems! KMP + Compose + SwiftUI! Dropdowns! FABs! And, what does Google I|O 2022 have in store for Compose UI developers?