jetc.dev Newsletter Issue #239
Published: 2024-11-05
We got a Compose patch release and a new alpha, so let’s check them out!
We also see what JetBrains plans for 2025, spend some time with Glance, and port a library from Compose to Compose Multiplatform. Plus, we see how to consume broadcasts from composables, along with a scrollable table implementation.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
The Compose BOMs (main, alpha, and beta) are up to 2024.10.01
. The main BOM picks up 1.7.5
artifacts for the main Compose libraries, plus 1.3.1
for Compose Material3. This update fixes
a few bugs.
The main Compose artifacts also have a 1.8.0-alpha05
release. These include:
-
Preliminary autofill support
-
Support for autosizing text via an
AutoSize
parameter toBasicText()
, etc. -
A new
onRectChanged()
modifier, to track the movement of aLayoutNode
, as a lighter-weight alternative toonGloballyPositioned()
-
Support for configuring overscroll for scrollable containers, including lazy ones
Wear Compose is up to 1.5.0-alpha05
, with a bunch of improvements to TransformingLazyColumn()
.
And in Compose integration libraries, we have:
androidx.activity:activity-compose:1.10.0-alpha03
androidx.camera:camera-compose:1.5.0-alpha03
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha10
androidx.constraintlayout:constraintlayout-compose:1.1.0
androidx.constraintlayout:constraintlayout-compose-android:1.1.0
androidx.fragment:fragment-compose:1.8.5
androidx.lifecycle:lifecycle-runtime-compose:2.8.7
androidx.lifecycle:lifecycle-runtime-compose:2.9.0-alpha06
androidx.lifecycle:lifecycle-runtime-compose-android:2.8.7
androidx.lifecycle:lifecycle-runtime-compose-android:2.9.0-alpha06
androidx.lifecycle:lifecycle-runtime-compose-jvmstubs:2.8.7
androidx.lifecycle:lifecycle-runtime-compose-jvmstubs:2.9.0-alpha06
androidx.lifecycle:lifecycle-runtime-compose-linuxx64stubs:2.8.7
androidx.lifecycle:lifecycle-runtime-compose-linuxx64stubs:2.9.0-alpha06
androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7
androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha06
androidx.lifecycle:lifecycle-viewmodel-compose-android:2.8.7
androidx.lifecycle:lifecycle-viewmodel-compose-android:2.9.0-alpha06
androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.8.7
androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.9.0-alpha06
androidx.navigation:navigation-fragment-compose:2.9.0-alpha02
androidx.navigation:navigation-compose:2.9.0-alpha02
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
The Kotlin Slack archive remains stuck, with no updates in a couple of weeks. 😞
How Can I Follow a Finger?
You might want to have a composable follow a finger (or stylus or whatever) as it drags
across the screen. This can be implemented using awaitEachGesture()
in the pointerInput()
DSL,
as we see in this week’s highlighted Stack Overflow question.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Video: AnchoredDraggable | Compose Tips
Google’s Jossi Wolf looks at AnchoredDrawable()
, a lower-level drag detection composable used
to power drawers, swipe-to-dismiss/swipe-to-reveal, and similar features.
Video: #TheAndroidShow November 2024
Google published another episode of #TheAndroidShow. Clara Bayarri covers the latest changes to Compose, such as shared element transitions, in one of several segments in this episode.
Kotlin Multiplatform Development Roadmap for 2025
JetBrains’ Egor Tolstoy (@etolstoy@hachyderm.io) reviews what JetBrains has in store for Kotlin Multiplatform next year. This includes getting Compose for iOS to a stable release and boosting its rendering speed, along with feature parity to Jetpack Compose itself.
Medium: Widgets with Glance: Standing out
Katie Barnett has a bunch of new material out focused on Glance and app widgets. The above post focuses on ensuring that your Glance app widget has decent contrast with whatever the user has for wallpaper. This post looks at using dynamic system color theming to help your app widget blend in with the rest of the device. And this GDG Melbourne presentation video covers even more about Glance and app widgets!
Medium: We migrated an Image Cropping library to Kotlin Multiplatform in few easy steps!
Tamim Attafi writes about how a team ported the easycrop image cropping library
to support Compose Multiplatform. This included deciding what code could go in commonMain
versus
androidMain
, what needed new platform implementations, and other general updates.
Medium: Implementing a CustomSide Sheet in Jetpack Compose
Kerry Bisset is back, this time exploring what it takes to implement a side sheet — a
drawer opening from the side, rather than the bottom sheet pattern. Kerry’s CustomSideDrawerOverlay()
offers drag support, a scrim, a custom system BACK navigation handler, and more!
Medium: Compose for app architecture
Jean Tuffier looks at ways to have @Composable
functions generate streams of data, so they
can power more of the app architecture than just rendering a UI. This pattern can be seen
in molecule and Circuit;
Jean unpacks how these sorts of frameworks work.
Compose Performace - Finding Regressions
theapache64 (@theapache64@androiddev.social) writes about how we can identify what composable caused a performance regression, using Perfetto and theapache64’s own Diffetto. Diffetto generates a diff of two Perfetto traces (hence, the name).
Medium: 9 Tips to improve your Jetpack Compose Previews
Oliver Vicente walks us through ways to make our @Preview
composables more powerful (e.g.,
leverage LoremIpsum()
and @PreviewLightDark
) and more stable (e.g., avoid passing viewmodels
into previewed composables).
Other Interesting Links
- Creating Custom Shapes in Jetpack Compose: A Guide to Combining and Designing Shapes Using Path Operations
- Google Maps in Jetpack Compose: Circles
- Jetpack Compose Optimization - Making Your App Run Like a Well-Oiled Machine
- Medium: Building a Tinder-Inspired Profile Screen with ConstraintLayout in Jetpack Compose
- Medium: Composable lambda list during recomposition in Android
- Medium: Creating a Custom Search Bar in Jetpack Compose
- Medium: Exploring LaunchedEffect in Jetpack Compose: A Beginner’s Guide
- Medium: How to build Custom Adaptive Layouts in Jetpack Compose?
- Medium: How to Set Custom Marker in Google Map-Jetpack compose
- Medium: Jetpack Compose: Technique for Previewing Composable with Different Window Sizes
- Medium: Localization in Compose Multiplatform
- Medium: Mastering DisposableEffect in Jetpack Compose: Managing Side Effects Effectively
- Medium: Styling Your Compose Multiplatform App: A Guide to Fonts and Themes
- Medium: TypeSafe Navigation in Jetpack Compose
- Side-Effects in Jetpack Compose
- Slides: What’s New in Compose Multiplatform - A Live Tour
- Using Vertex AI in a Compose/Kotlin Multiplatform project
- Video: Screens are functions: Reimagining Navigation on Android
- Video: Unified Insights: Crafting an Analytics Solution in Jetpack Compose
Resource Roundup
100% pure code!
GitHub: efe-egbevwie / DataTable
Efe Egbevwie has created a Compose Multiplatform library, supporting at least Android and desktop, for rendering data in scrollable tables. You get to supply dedicated modifiers for header rows and regular rows, in addition to cell composables and other configuration.
GitHub: shubhamsinghshubham777 / ComposeBroadcasts
GitHub user shubhamsinghshubham777 offers a convenient set of remember...()
functions backed
by system broadcasts, such as rememberBatteryLevel()
and rememberIsHeadsetConnected()
.
You can create your own via rememberBroadcastReceiverAsState()
.
GitHub: malaa101 / compose-multiplatform-color-picker
Mohammed Alaa forked a color picker library and is adding Compose Multiplatform support.
GitHub: kdroidFilter / ComposeNativeNotification
GitHub user kdroidFilter is creating a Compose Multiplatform library to try to unify platform-specific notification APIs, including supporting custom actions, integrated permission requests, and more.
Notable Releases
Maps for Compose is up to 6.2.0
,
with an improvement for MarkerInfoWindow
.
Coil inches closer to its next stable major release,
shipping 3.0.0-rc02
.
This update fixes a few bugs and apparently can decode black holes. 😁
Compose Unstyled is up to 1.19.1
.
1.18.2
fixed some bugs, and 1.19.1
changes ModalBottomSheet()
to not dim the navigation
bar by default.
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?!?