jetc.dev Newsletter Issue #158
This week, we got a stable
1.4.0 release of Compose! 🎉 But, don’t worry,
we also got a new alpha for Compose, along with new alphas for Compose for TV
and Wear Compose.
Beyond that, we look at lazy layouts and text hyphenation. We explore how to
improve performance and how to outline text. We see some code for synchronizing
lists and tabs, plus reading sensors as
State. And we drown in a flood of
date and time pickers.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
The big thing is that Compose itself is now out in a
1.4.0 stable release.
The BOM is up to
androidx.compose:compose-bom:2023.03.00 to include
Compose Compiler is up to
1.4.4, with a few bug fixes.
Compose also has a
1.5.0-alpha01 release, so the version march continues.
AnimatedContent APIs are now stable.
Compose for TV is up to
1.0.0-alpha05, with new side navigation drawer, icon, and
surface composables. Note that
CarouselItem is now called
Finally, Wear Compose is up to
1.2.0-alpha07. The expandable item components
moved out of
foundation, since they do not depend on
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
A common UI pattern is to have a button that automatically displays a
CircularProgressIndicator() or something similar. However, if you are not
careful, that indicator might change the size of the button itself, which
you may not want. See how to keep the indicator size constrained in this week’s
highlighted Stack Overflow question.
Setting the value of a
BasicTextField() using a
String instead of a
TextFieldValue means you are losing control over how the cursor gets positioned
when you change that value. This can lead to unexpected effects, such as the
cursor jumping back to the beginning of the text when you wanted it to stay at the
end. Learn more in this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
The Code with the Italians team hosted a livestream with Google’s Alejandra Stamato and Halil Ozercan, exploring hyphenation APIs (including how Android 13 improved them), font padding, the new marquee text effect, Halil’s compose-richtext library, and more!
Here, Mahmoud Afarideh walks through a few implementations of a progress text
composable (showing percent-completion as a bar behind some text). Along the way,
Mahmoud examines where earlier implementations had performance issues, due to
excessive recompositions, and settles on a
State-based solution in the end.
Marcin Hanas adds to the pile of complaints regarding Navigation for Compose’s
approach to stringified nav arguments. However, Marcin then explores the implementation
of Navigation for Compose and points out a way of bypassing that approach and
Bundle directly, based on the underlying Jetpack Navigation
Other Interesting Links
- All about theming in Jetpack Compose
- Medium: Jetpack Compose BOM
- Medium: Android Jetpack Compose: What are Modifiers and How to Use Them in Kotlin?
- Medium: Understanding State Management in Jetpack Compose: remember() vs mutableStateOf()
- Medium: Tabs in Jetpack Compose using Official API
- Medium: How to create the Snackbar in Jetpack Compose
- Creating a Circular Progress Bar with a Gradient using Jetpack Compose
- Medium: Navigation drawer in JetPack Compose with Material Design 3 components
- Medium: Creating a Live Stream Screen Using Jetpack Compose
- Medium: Creating a particle explosion animation in Jetpack Compose
- Medium: Jetpack Compose gets official support for Marquee 🎉! Here’s how to use it!
- Jetpack Compose Tutorial: Improving Performance in Dribbble Audio App
- Medium: A Brief Analysis of Declarative UI
- Medium: The Battle between Jetpack Compose and XML: Why Compose is Winning the War #1
- Medium: Adapting Material Theming from Jetpack Compose to SwiftUI
100% pure code!
Ahmad Hamwi created a library that syncs tabs with a sectioned list, supporting
TabLayout for classic
Views and Compose equivalents
this Medium post
The Mutual Mobile team brings us a work-in-progress library for wrapping the
Sensor API in a
State-based API, so we have functions like
rememberGyroscopeState() to easily consume sensors directly from composables.
Other Interesting Links
- Compose UI at Awesome KMM
- GitHub: aliernfrog / top-toast-compose (toasts)
- Gist: bagus2x / TwitterDatePicker.kt (date picker)
- Gist: tpoisson / DatePicker.kt (another date picker)
- GitHub: alireza-milani / persian-date-range-picker (Persian date picker)
- Gist: Islomov49 / DecimalAmountTransformation.kt (demo of
- 2023-11-21: Compose/Material3/Wear Compose updates! remember()! Adaptive layouts! Compose Multiplatform in 2024! @email@example.com on BasicTextField2()! Compose Multiplatform charts! And... is TV Compose in trouble?!?
- 2023-11-14: Compose Compiler! BasicTextField2()! @firstname.lastname@example.org and animations! Optimization! @email@example.com, JetBrains, and Fleet! JetBrains and plotting! And... we collapse?!?
- 2023-11-07: Compose Multiplatform! Chips in fields! Diffing! Custom fonts in Glance app widgets! Heatmaps! PIN input! And @firstname.lastname@example.org is in a bit of a haze?!?