jetc.dev Newsletter Issue #171
There is a new Compose Compiler version, a new Compose beta, and a new Compose Multiplatform patch release — we peek at all three!
In addition, we examine the impacts of ordinary
@Stable on recompositions. We see floating bubbles and improved animations
in action menus. Our rounded rectangles get smoother. And our string resources
get typesafe composable builders.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
Compose Compiler is up to
1.4.8 and is able to target Kotlin
1.8.22. It also improves
some errors and warnings around
@Composable annotation usage.
The main Compose dependencies are up to
1.5.0-beta03. Other than adding support
FocusTarget implementations, and a new
progress property on states like
ModalBottomSheetState, this release is mostly bug fixes.
It feels like we will move into RCs and a stable release fairly soon.
In Compose-adjacent dependencies, Navigation for Compose is up to
Finally, Compose Multiplatform is up to
mostly with bug fixes.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
This keeps coming up, so I keep pointing it out through these questions… Compose
is powerful but it is not magic. In particular, changing the value of a plain
often does not trigger recomposition, as a plain
var is not some form of
that is being observed. Learn more in this week’s highlighted Stack Overflow question.
Sometimes, we want recomposition to be skipped, such as when data really does not
change but Compose might think it is. Two key tools for that are the
@Stable annotations. However, the documentation is a bit confusing
(“positional memoization”?). Learn more about the practical impacts of these two
annotations in this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Vaios Tsitsonis needed a floating draggable bubble, akin to Android’s notification bubbles, but
within an app. The resulting implementation leveraged
Udit Verma created a two-post series, demonstrating how to dramatically reduce
recompositions. The fixes ranged from simple
remember() calls through immutable/stable
parameters, deferring state reads by converting parameters to lambdas, and more!
Chris Mack refines the animations used in this earlier Medium post, to avoid some jank, have the menu expand from where the member tapped on it, and more.
HorizontalPager() is great, and it has low-level support for pager indicators, but there
is a lack of actual indicator implementations. Radhika S shows how to implement a wide
range of indicators, from simple sliding bars to bouncing dots and more.
Rhytham Negi walks us through a typical bottom tab bar implementation, using Navigation for
Compose to control the content rendered based on the selected tab, using a
to represent the bar items and their associated navigation routes.
Other Interesting Links
- Medium: Text Scrolling in Jetpack Compose
- How to Create AnnotatedString in Android Jetpack Compose
- Medium: Music Player in Jetpack Compose with Media3 Exoplayer
- Introduction to Jetpack Compose Layouts
- Material 3 TextField in Jetpack Compose (with Examples)
- Medium: Crafting a Clock in Jetpack Compose with Canvas
- Medium: Dark Theme Switch in Jetpack Compose with CompositionLocal
- Medium: How to play beautiful lottie animations in Android Jetpack compose
- Medium: Lottie Animation and Jetpack Compose
- Medium: Mastering the Power of State Hoisting in Jetpack Compose: Unleashing Seamless State Management Across Your UI Galaxy
- Medium: Mocking APIs in a Better way in Android Jetpack Compose
- Medium: Navigation bar with Jetpack Compose
- Medium: Paging in Android Jetpack Compose: From Caching Data with Room to Displaying in LazyColumn
- Medium: Room DB pagination without Paging Android Jetpack Compose
- Medium: Simplifying Authentication with Google Sign-In in Jetpack Compose UI
100% pure code!
The Cash App folks created a Gradle plugin that takes ICU message string resources and creates typesafe formatters for them, so you do not accidentally try to put a number into a string or vice versa. The formatters support both Compose UI and classic views.
Other Interesting Links
- GitHub: atsushieno / compose-audio-controls (knobs and keyboards)
- GitHub: JGomez-Dev / drag-and-drop-compose-library (modifier for list drag-and-drop for reordering)
- GitHub: rafaeltonholo / svg-to-compose (SVG paths to
- GitHub: razaghimahdi / Compose-Persian-Date-Picker (Persian date picker)
- 2023-09-12: Compose 1.5.1! Glance 1.0.0! Compose Multiplatform! Themes! Photos! Coachmarks! A bit of CommonsWare history! And @email@example.com tells us what not to do!
- 2023-09-05: Compose Compiler 1.5.3! Compose Multiplatform 1.5.0! @firstname.lastname@example.org on greyscaling composables! @email@example.com on Espresso testing with Compose interop! Scrollbars! AnnotatedString!
- 2023-08-29: Compose Compiler 1.5.2! Compose and Wear Compose alphas! Capture composables to bitmaps! Testing! Recomposition! Compose Multiplatform! And... Accompanist is downsizing?!?