jetc.dev Newsletter Issue #168
This week, we avoid duplicate navigation and unit test
State. We look at performance,
animations, and sticky headers. And we see libraries for dialogs, countries, … and squircles.
NOTE: I am taking next weekend off. As a result, the next issue of this newsletter will be published on June 20.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
If you are not careful, you can wind up in situations where multiple user inputs, such as multiple button clicks, lead you to trigger navigation more than once. Google’s Ian Lake shows us how to detect duplicate-navigation events in this week’s highlighted Stack Overflow question. See also this related Medium post.
If you have a viewmodel that exposes a
State, probably you should have some tests
State. Jake Wharton points out the
snapshotFlow() solution in this week’s
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
The Code with the Italians crew hosted Google’s Sean McMillan, exploring Android Studio’s tools for helping you measure the performance of your composables, plus some approaches towards fixing the performance issues that you encounter.
Collapsing app bars let you have a rich set of top content on a screen that then
slides away as the user scrolls. Adolfo Chavez uses
MotionLayout() and JSON-defined transitions
to implement the effect.
Kristen Halper wraps up her blog series on Compose animations, extending the previous posts to show multiple parallel animations and using shaders to provide background (in this case, grass behind sunflowers).
Daniel Atitienei shows how to build a
Flow of network connection states using
callbackFlow(), then shows how to convert that
State via a custom
rememberConnectivityState() composable function.
Saqib looks at
derivedStateOf(), showing when you should use it and how it relates
to using a key value with
remember(). In a nutshell,
derivedStateOf() is great
for state that depends on other state, but where changes in that other state might not
result in changes to the derived state. In this fashion, you may be able to minimize
Igor Stevanovic examines the
stickyHeader() DSL function for
used for adding sticky rows or columns.
Other Interesting Links
- Custom TabRow Indicator in Jetpack Compose
- Medium: Material 3 bottom sheet — DragHandle Jetpack compose
- Medium: Jetpack Compose: HorizontalPager with PagerIndicator & Infinity scroll
- Medium: States in Jetpack Compose
- Simple Screen Navigation in Android Jetpack Compose
- Medium: Top App Navigation Bar with Jetpack Compose
- Medium: Grid and Lists in Compose
- Medium: How To Mask Your Password in Android (JetPack Compose)
- Medium: Jetpack Compose Rendering Steps: A Beginner’s Guide
100% pure code!
Stoyan Vuchev brings us a
SquircleShape, which offers a flexible
API for defining squircles with a variety of corner radii and smoothing approaches.
This can be used wherever you use other
Shape objects, such as in a
Naveen Kumar Kuppan created
composables, as part of a pair of libraries (for Compose and classic views) that
let you pick a country from a list of countries.
- 2023-09-12: Compose 1.5.1! Glance 1.0.0! Compose Multiplatform! Themes! Photos! Coachmarks! A bit of CommonsWare history! And @firstname.lastname@example.org tells us what not to do!
- 2023-09-05: Compose Compiler 1.5.3! Compose Multiplatform 1.5.0! @email@example.com on greyscaling composables! @firstname.lastname@example.org 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?!?