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!
How Can I Avoid Navigating Twice?
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.
How Do I Unit Test State Emissions?
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!
Video: Jetpack Compose Performance Performance and a bit more Performance
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.
Medium: How to create an amazing CollapsingTopAppBar in Jetpack Compose with Motion Layout
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.
Blossoming love for Compose animation
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).
Medium: Observing Network Connection State using Jetpack Compose — Android
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.
Medium: Jetpack Compose — Deep-dive into derivedStateOf and comparison with remember(key)
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
Medium: Kotlin with Jetpack Compose -Tabs
Maneesha Erandi examines the
Tab() composables for implementing a top
tab bar, with a
HorizontalPager() implementing the tab content itself.
Medium: Jetpack Compose List Sticky Header
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!
GitHub: stoyan-vuchev / squircle-shape
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
GitHub: akshaaatt / Dialogs-Android
Akshat Tiwari published a library with a variety of canned composable dialog implementations, for input boxes, simple messages, and more.
GitHub: nkuppan / country
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.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
- 2023-05-30: Compose beta! Tracking continuous composable presses! Animated carousels! MVI! 2D scrolling layouts! Tables! And... a stable function?!?
- 2023-05-23: Focus and preview cards for Compose for TV! Interactions and visual states! ViewCompositionStrategy! Compose for iOS, for real! @email@example.com is zooming! Data tables! And... BasicTextField2, the sequel?!?
- 2023-05-16: Google I/O! New Compose BOM and alpha! Viewmodels! BottomScaffold()! SealedX! Lottie! Dynamic themes! Floating action menus!