jetc.dev Newsletter Issue #187
Published: 2023-10-24
We have a new BOM and new alphas for Compose and Wear Compose, so we check them out.
We also try to infer the importance of @Stable
and look at supporting both
views and composables from a library. We explore dialog animations and Paparazzi.
And we see a pair of Kevin Zou libraries for Compose Multiplatform, including a WebView
wrapper.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
The Compose BOM is up to 2023.10.01
, corresponding with the 1.5.4
patch release,
which presumably contained bug fixes.
We also got a 1.6.0-alpha08
release, with various optimizations, along with:
-
A new
draggable2D()
modifier -
New
isDisplayed()
andisNotDisplayed()
functions onSemanticsNodeInteraction
-
The
LoremIpsum
PreviewParameterProvider
is nowopen
Wear Compose now has a 1.2.1
patch release with bug fixes. It also has a
1.3.0-alpha08
release with better control over PositionIndicator
animations.
And, in Compose-adjacent libraries, we have 1.1.0-rc01
for the Hilt Compose Navigation
integration (androidx.hilt:hilt-navigation-compose
) and 2.7.0-alpha03
of
the Lifecycle integration with Compose, notably androidx.lifecycle:lifecycle-viewmodel-compose
.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
What’s the Point of rememberUpdatedState()?
While rememberUpdatedState()
might not be needed much, if you use effects, it
may prove useful, as we see in this week’s highlighted Stack Overflow question.
How Important is @Stable
?
The original vision of Compose was that stability — correctly determining what has not changed —
would be inferred by the compiler without much help. Some developers more aggressively
use @Stable
and @Immutable
to help out the compiler. However, before long,
strong skipping mode
may reduce the need for such manual interventions, as we see in this week’s
highlighted Kotlinlang #compose
Slack thread.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Medium: Adopt Compose for View-based libraries
Google’s Chris Arriola reviews different approaches for supporting both Views
and
composables, with an eye towards library publishers. Chris specifically looks at
how your composable API might influence the implementation (even if that implementation
is a View
), the stateful-vs.-stateless decision, and how to cleanly support @Preview
.
Video: #TheAndroidShow 2023
This year’s edition of Google’s #TheAndroidShow included a few bits on Compose, including screenshot testing, supporting Wear OS and foldables, integration of DataStore, and more.
Medium: Building Reddit Recap with Jetpack Compose on Android
Google’s Medium account ran a guest post from Reddit’s Aaron Oertel, describing how Reddit Recap leveraged Compose UI in its 2022 revamp, from rich animations to performance tuning.
Medium: Unlock Interactive Possibilities with SwipeBox: A Compose Multiplatform Library for Swipe-to-Action Widget
Kevin Zou writes about compose-swipebox-multiplatform, Kevin’s Compose Multiplatform library for supporting horizontal swipes exposing actions that users can take.
Custom Dialog Animation in Jetpack Compose
sinasamaki reviews how to wrap Dialog()
in a CustomDialog()
composable, then progressively
replace default behaviors with custom ones. In particular, this post explores custom
animations, such as for when the dialog is dismissed().
Medium: Capturing Pixel-Perfect Android UIs: A Snapshot Testing Journey with Paparazzi
Ivan Dimitrov examines using Paparazzi for screenshot testing, both of composables and
of classic Views
. Ivan also looks at overcoming certain challenges when using Paparazzi,
such as dealing with locale differences between developer machines.
Medium: Editing currency TextFields in Jetpack Compose
Damian Petla looks at currency fields in Compose UI, where there are limits on what
is input (digits only) and where the visual result needs to be formatted as a currency. Damian
demonstrates how a custom VisualTransformation
, along with filtering logic in onValueChanged
of a TextField()
, can deliver the desired results.
Medium: Requesting Permission Jetpack Compose — The Complete Guide
Chirag T walks us through using accompanist-permissions
to request one or several permissions from our composables.
Other Interesting Links
- Building a Speedometer with Compose Canvas API
- Medium: CatGPT - or How to Position Elements on Overlays
- Medium: Creating a Smooth Fade Transition for Compose Pager Indicators
- Medium: Creating an Animated Border Composable in Jetpack Compose
- Medium: Creating Expandable Sections with Compose
- Medium: Creating Image Zoom In and Out in Jetpack Compose
- Medium: Dynamic Font Sizes With Jetpack Compose
- Medium: Jetpack Compose for Beginners
- Medium: Jetpack Compose | Dependency injection with Koin!
- Medium: Jetpack Compose — Let’s Make An Application
- Medium: Jetpack Compose: State Management
- Medium: Paging 3 Library with Jetpack Compose List and Coil Library in Android
- Medium: Picture-Perfect Code: Exploring Camera & Gallery Features in Jetpack Compose
- Medium: Putting ComposeViewModel into Action: An Example with TextEntry
- Medium: Taking pictures using Jetpack Compose
- Medium: The most important and common use of Live Templates for Jetpack Compose in Android
- Video: Jetpack Compose for Maps
- Video: Setting Sail with Compose Multiplatform
Resource Roundup
100% pure code!
GitHub: KevinnZou / compose-webview-multiplatform
Kevin Zou worked on a Compose Multiplatform wrapper around platform-specific Web rendering
options: WebView
on Android, WKWebView
on iOS, and Java CEF Browser for desktop.
GitHub: oas004 / VerifyComposeMetricsPlugin
Odin Asbjørnsen created a library that leverages the Compose compiler report to alert you if your code has exceeded a developer-determined threshold for unstable classes.
GitHub: OrlanDroyd / ComposeCalendar
Orlando Peña Fernández brings us a set of composables for selecting a date, a date-time, a date range, or just a month and year.
GitHub: journiapp / pinch-to-zoom
GitHub user journiapp offers up another pinch-to-zoom implementation that can be applied to arbitrary composables, not just images.
Other Interesting Links
- GitHub: Debdutta-Panda / J3 (miscellaneous composables)
- GitHub: jump-sdk / jetpack_compose_country_code_picker_emoji
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-11-12: @cbruegg@mastodon.green on Compose 1.7 and compatibility! @eevis@mas.to on rendering text in a Canvas! @sinasamaki@androiddev.social and a centered slider! @touchlab@mastodon.social with a Compose-Swift bridge! And... is NavigationSuiteScaffold() FAB?!?
- 2024-11-05: Compose patch release! Compose alpha! 2025 Compose Multiplatform plans! Glance! Side panels! @theapache64@androiddev.social on performance! Tables! And... reacting to a broadcast from a composable?!?
- 2024-10-29: Relay! Paparazzi! droidcon Lisbon 2024! Server-defined UI! And... desktop OS trays?!?