jetc.dev Newsletter Issue #244
Published: 2024-12-10
This week, we see that the Compose Multiplatform train is off again, with our first 1.8.0 alpha!
We also peek at hot reloads and Presentation
. Plus, we animate some sprites and
render calendars on all the platforms.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
JetBrains has launched the 1.8.0 series of Compose Multiplatform with
1.8.0-alpha01
.
We get variable font support and improved Navigation for Compose support, but the “idle”
test functions like waitForIdle()
and runOnIdle()
have changed and may break your
tests.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Why Does My Bottom Sheet Have Wrong Values?
Modal widgets like ModalBottomSheet()
render content on a layer outside of the current
composable. That makes them a bit tricky to use with a LazyColumn()
or other composables
that work off of a collection of content. If you want to have one ModalBottomSheet()
for the entire column, great! If programming it seems simpler to have one ModalBottomSheet()
per item, that can work, but you need to be careful when displaying the sheet, as we see
in this week’s highlighted Stack Overflow question.
Why Are My Logs Not Updating?
In programming, power tends to come with complexity. Even things designed to simplify our
lives, like strong skipping and the Layout Inspector, may wind up causing confusion. See
an example, where debugging-via-logging seemed to break down, in this week’s highlighted
Kotlinlang #compose
Slack thread.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Video: Hot Reload Magic
Speaking of Code with the Italians… they are back with another episode! This time, they talk with JetBrains’ Márton Braun about Firework, the work-in-progress means of offering “hot reload” capabilities to Compose development.
Medium: Using Android Presentation API with Jetpack Compose
The Presentation
API has been around for quite some time in Android, allowing us to project
separate app content on an external display from the content that we show on a primary
display. İbrahim Ethem Şen (Mastodon)
demonstrates how to have a composable power that content, owing
to the fact that Presentation
extends Dialog
. 😭
Do DisposableEffects Always Dispose?
Vinay Gaba (Mastodon, Bluesky)
treats us to a Mastodon thread exploring the limits of onDispose()
in a DisposableEffect
.
In programming, when the question involves “always”, the answer often involves “no”, and
this case fits that pattern, as a DisposableEffect
could also be abandoned.
Medium: Bridging the Gap Between Jetpack Compose State and StateFlow for Reactive UI
Ioannis Anifantakis writes about the API disparity between State
and StateFlow
. Wanting
the power of StateFlow
but the simpler composable syntax of State
, Ioannis proposes
a toComposeState()
extension function on StateFlow
that lets the viewmodel keep the
StateFlow
while exposing State
to the composables.
Testing Different Navigation Options with Compose
Eevis Panula (Mastodon, Bluesky) returns, looking at writing instrumented tests, exercising a variety of user input patterns: simple clicks, swipe events, and keyboard input.
Animated Text Field Hint in Jetpack Compose
Sinasamaki (Mastodon, Bluesky) walks us through how to use shared element transitions to move text from the hint position in a text field to a label position above that field, an animation made famous in Android by some of the original work on Material Design.
Other Interesting Links
- How to add platform-specific icons to a Compose Multiplatform project
- How To Create Easy Pagination In Jetpack Compose
- How to enable the new Autofill API in Jetpack Compose
- How to Style and Theme an App With Jetpack Compose: A Complete Expert Guide
- Medium: Building a Simple Android MVVM App with Jetpack Compose
- Medium: Create a barcode scanner with Jetpack Compose
- Medium: Create a Stunning Rotational Loader Animation in Jetpack Compose
- Medium: Custom DatePicker in Jetpack compose
- Medium: Deploy Kotlin Mutliplatform WasmJS to Github Pages
- Medium: How easy is drag-and-drop in Compose?
- Medium: How to Open System Settings in Compose Multiplatform
- Medium: Improve Android app performance using SnapshotStateList in Jetpack Compose
- Medium: Listen To Lifecycle Events In Jetpack Compose
- Medium: Screenshot testing in Jetpack Compose
- Medium: Shared Element Transition in Jetpack Compose
- Medium: ThemeManager in Jetpack Compose: Inspired by Mantine
- Medium: Understanding Side Effects in Jetpack Compose
Resource Roundup
100% pure code!
GitHub: stevdza-san / SpriteView-KMP
Stefan Jovanovic published a SpriteView()
composable that renders animations based
on cells in a sprite sheet (or texture atlas).
You supply the sheet and details, and SpriteView()
handles decoding the sheet and
animating between individual images.
GitHub: WojciechOsak / Calendar
Wojciech Osak offers a Compose Multiplatform calendar, with single-date, multiple-date, or range selection, month or week views, and more!
Other Interesting Links
- GitHub: kapact / aonepermissions (permission request wrapper)
- GitHub: KAppMaker / KMPDevicePreview (multiplatform composable previews)
- GitHub: numq / Klarity (FFMPEG-based media playback)
- GitHub: rishadappat / ReachabilityCompose (network availability as state)
- GitHub: vooft / compose-treeview (multiplatform tree view)
- Telereso KMP Screenshot Testing (multiplatform screenshot testing)
Notable Releases
Horologist has 0.6.21
and 0.7.7-alpha
releases, improving ambient support.
Maps for Compose is up to 6.4.0
,
bumping the compileSdk
to 35.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 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?!?
- 2024-11-19: Compose alphas! Compose Multiplatform patch! PaddingValues! Graphics layers! Swiping! Heatmaps! Navigation! And... why did we get a new production Compose BOM?!?