jetc.dev Newsletter Issue #231
Published: 2024-09-10
Compose 1.7.0
and Wear Compose 1.4.0
released! And, as usual, fresh alpha releases
also came out, so we see what we got!
We also watch a lot of droidcon Berlin 2024 videos, hear from Google about edge-to-edge, and think about circular layouts.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
The Compose 2024.09.00
edition of the BOM points to the final 1.7.0
main artifacts,
plus the 1.3.0
versions of Compose Material3. There are also 2024.09.00-alpha
and 2024.09.00-beta
BOMs, though they appear to be undocumented.
In addition to the 1.7.0
final edition of Compose, Google released 1.8.0-alpha01
,
with no release notes of note.
Compose Material3 Adaptive is up to a stable 1.0.0
release.
Wear Compose has a stable 1.4.0
release and a 1.5.0-alpha01
release. That alpha
includes:
- A
LazyColumn()
specific to Wear Compose - Support for letter spacing on curved text
- A bunch of bug fixes
In Compose-adjacent items, we have some new artifacts for using CameraX in Compose:
androidx.camera:camera-compose:1.5.0-alpha01
androidx.camera.viewfinder:viewfinder-compose:1.4.0-alpha08
…and we also got these updates:
androidx.activity:activity-compose:1.10.0-alpha02
androidx.activity:activity-compose:1.9.2
androidx.constraintlayout:constraintlayout-compose:1.1.0-beta01
androidx.constraintlayout:constraintlayout-compose-android:1.1.0-beta01
androidx.fragment:fragment-compose:1.8.3
androidx.lifecycle:lifecycle-runtime-compose:2.8.5
androidx.lifecycle:lifecycle-runtime-compose:2.9.0-alpha02
androidx.lifecycle:lifecycle-runtime-compose-android:2.8.5
androidx.lifecycle:lifecycle-runtime-compose-android:2.9.0-alpha02
androidx.lifecycle:lifecycle-runtime-compose-desktop:2.8.5
androidx.lifecycle:lifecycle-runtime-compose-jvmstubs:2.9.0-alpha02
androidx.lifecycle:lifecycle-runtime-compose-linuxx64stubs:2.9.0-alpha02
androidx.lifecycle:lifecycle-viewmodel-compose:2.8.5
androidx.lifecycle:lifecycle-viewmodel-compose:2.9.0-alpha02
androidx.lifecycle:lifecycle-viewmodel-compose-android:2.8.5
androidx.lifecycle:lifecycle-viewmodel-compose-android:2.9.0-alpha02
androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.8.5
androidx.lifecycle:lifecycle-viewmodel-compose-desktop:2.9.0-alpha02
androidx.navigation:navigation-compose:2.8.0
androidx.navigation:navigation-fragment-compose:2.8.0
And JetBrains released 1.7.0-beta01
of Compose Multiplatform.
This makes some changes to iOS interop, adds a new material-navigation
module,
adds desktop support for input methods to BasicTextField()
, adds test resources support,
and more!
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Alas, the Slack archive for Kotlinlang is still not working. If this situation persists, I may start summarizing threads again, as I used to in the early days of this newsletter.
Why Do I Keep Getting the Same Viewmodel?
By default, your Jetpack ViewModel
instances are scoped to the activity or fragment
hosting your composables. Unless you supply a key to the viewModel()
function, you
will get the same viewmodel instance for different screens, if those screens are just
composables in the same activity or fragment and you are not using something else
like Navigation for Compose. Learn more in this week’s highlighted Stack Overflow
question.
droidcon Berlin 2024
The videos for droidcon Berlin 2024 dropped, and there are quite a few with a Compose focus, including:
- A Sneak Peek at the Screenshot Testing Landscape in 2024
- Advanced Layout Animations in Compose
- Back to the Future: Bringing Predictive Back Gestures to your App
- Building an AR app with Compose & OpenGL ES
- Compose UI Testing beyond layouts: journey to automated regression
- Composing an API the right way
- Crash course to Compose for TV
- Design System 3.0 with Jetpack Compose at N26
- Going 100%* Compose Multiplatform (* and all the things they didn’t tell you)
- Hardware development with KMP and Compose Desktop
- How easy is it to draw on GoogleMaps using Compose?
- Jetpack Compose: Drawing without pain and recomposition
- Practical Tips and Tricks to Improve Your Compose Previews
- Remixing TIDAL App with Jetpack Compose
- Tap it! Shake it! Fling it! Sheep it! - The Gesture Animations Dance!
- What’s New in Compose Multiplatform - A Live Tour
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Medium: Insets handling tips for Android 15’s edge-to-edge enforcement
Google’s Ash Nohe reviews Android 15’s change for edge-to-edge presentation to
be opt-out rather than opt-in, once your targetSdk
rises to 35.
Ash then reviews various techniques for adapting to
edge-to-edge presentations while not putting important content in inappropriate
areas, including relying on Compose Material’s Scaffold()
and its supplied PaddingValues
.
Medium: Preview and test your app’s edge-to-edge UI
Google’s Meghan Mehta explores how to preview composable screens in an edge-to-edge presentation, leveraging some features only available in the Ladybug preview editions of Android Studio.
Medium: Type safe navigation for Compose
Google’s Don Turner walks us through type-safe navigation in Navigation for Compose. Don also reviews the tweaks that were made during the alpha period, such as support for enums.
Medium: SwiftUI vs Jetpack Compose: A Guide for Cross-Platform UI Development
Omar Mujtaba reviews a series of SwiftUI constructs, such as VStack
and @State
,
and ties them to Compose equivalents (e.g., Column()
and remember
), to help
iOS developers making the move to Compose.
Medium: Mastering TextDirection for Multi-Language Apps in Jetpack Compose
ilyas ipek looks at the textDirection
property of TextStyle
, how it relates
to the current LayoutDirection
, and what its default behavior is.
Medium: Crafting Circular Presentations in Jetpack Compose: A Look into Layouts and Measurement Policies
Sometimes, you want to lay out composables not in a row or a column, but instead
an arc or a circle. For example, you might want a radial menu when the user taps
on a floating action button. Kerry Bisset explores how to implement this, in the
form of a circularMeasurePolicy
for use in Layout()
, wrapped in a Circular()
container-style composable.
Google Maps in Jetpack Compose: Getting Started
Joe Birch takes a look at Maps for Compose, showing the GoogleMap()
composable,
rememberCameraPermissionState()
, MapUiSettings
, and MapStyleOptions
.
Other Interesting Links
- Beyond the Binary - More Inclusive Gender Options with Compose
- Effective Map Composables: Collections of Non-Draggable Markers
- How to Create Tabs in Jetpack Compose: A Comprehensive Guide
- Improve Compose UI with Spacing Constants
- Medium: Best way to keep state in a ViewModel
- Medium: Bring Your Android App to Life: Animate with Jetpack Compose Magic
- Medium: Creating a Custom Gauge Speedometer in Jetpack Compose
- Medium: Creating a Stylish Onboarding Page with Jetpack Compose in Android
- Medium: How to Create an Atomic Loader in Jetpack Compose
- Medium: How to Preview Jetpack Compose keyFrame Animation in Android Studio
- Medium: Jetpack Compose Refactoring: Transforming a RecyclerView Fragment in an Existing Codebase
- Medium: Jetpack Compose Side Effects in Details
- Medium: Jetpack Compose: Best Practices
- Medium: Mastering Gradients and Shaders in Jetpack Compose
- Medium: Mastering Navigation in Jetpack Compose: A Guide to Using the
inclusive
Attribute - Medium: Navigating with Type Safety in Jetpack Compose
- Medium: Nepali Date Picker for Android and iOS (Kotlin Multiplatform)
- Medium: Pagination Without Paging 3 In Jetpack Compose
- Shimmer animations in Jetpack Compose without extra dependencies
Resource Roundup
100% pure code!
GitHub: JaberAhamed / StackCarouselCompose
GitHub user JaberAhamed has published a StackCarousel()
composable, for Tinder-style
swipe cards, with customizable animations. See this Medium post
for more.
GitHub: amit-bhandari / Draggable-Layout-Compose
Amit Bhandari created a getDraggableModifier()
modifier that lets you enable
drag gestures on arbitrary composables, with control over the drag direction,
snap behavior, and more.
Notable Releases
Accompanist is up to 0.36.0
,
mostly to tie into the stable 1.7.0
release of Compose.
Maps for Compose is up to 6.1.2
,
with a couple of bug fixes.
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?!?