jetc.dev Newsletter Issue #88
This week, we try to make sense of
SubcomposeLayout() and janky lists. We
look at text entry validation, tooltips, and nested navigation.
Plus, Chris Banes tries to have an “Oprah moment” with your composables:
“You get a
Modifier! And you get a
Modifier! Everybody gets a
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
One of the more mystifying composables in the base Compose UI roster is
SubcomposeLayout()… in part because the verb “subcompose” is never defined.
Learn a bit more about
SubcomposeLayout() in this week’s highlighted
Stack Overflow question.
Why Is My List So Sluggish?
If you see X is behaving slowly, see whether you are recomposing it too often.
And, if so, see if you can rework your state access to reduce the frequency or breadth
of the recompositions. You can see more about how this works in this week’s highlighted
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Always Provide a Modifier
Chris Banes would like every composable function to accept a
Modifier as a parameter.
That may seem like overkill — in this post, Chris tries to convince you otherwise.
Medium: How to Validate Fields Using Jetpack Compose in Android
Ideally, your users always provide valid input data. That… does not always work out. Siva Ganesh Kantamani demonstrates basic input validation and how to render errors for flawed entries in text fields.
Medium: Simple MVI implementation with Jetpack Compose
Volodymyr Shcherbyuk explores the model-view-intent (MVI) unidirectional data flow
architecture and how one can implement it in Compose UI. Along the way, Volodymyr
@Immutable sealed classes for events and states, a Jetpack
implementing the “reducer” logic, event record/playback, and more!
Video: Nested Navigation
Stevda-San brings us another screencast, this time examining nested navigation graphs with Navigation for Compose, particularly looking at how to use a nested graph for authentication screens, separate from the main app navigation graph.
Medium: Building your first Custom Chart in Android with Jetpack Compose
Christopher Elias needed a line chart to show cryptocurrency prices. In this
post, Christopher shows us how to render that sort of chart directly using a
avoiding any of the various composable charting libraries.
Other Interesting Links
- Medium: Jetpack Compose with Single Activity Navigation
- Medium: The Interesting case of ViewTree*Owner
- Adopting Jetpack Compose: ComposeView
- Video: MVVM Architecture To do App in Jetpack Compose
- Medium: Jetpack Compose: filling max width or height
- Jetpack Compose Basics - Showing images
100% pure code!
I linked to Chris Banes’ Snapper library a couple of weeks ago, before it had
any documentation. Now that the documentation is available, it is worth another look!
Basically, if you have a
LazyColumn() and want fling gestures to
“snap” to a specific spot (e.g., an item is always centered in the available space),
Snapper may be your solution!
Gist: amal / Tooltip.kt
Amal Samally provides us with a small
Tooltip() composable, to display a short-term popup
near something else (e.g., near some other UI element that the user long-clicked upon).
Tooltips are particularly useful for icon-only buttons, so users have a way to find out
what the icon represents, if it is not obvious to them.
Other Interesting Links
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! @firstname.lastname@example.org 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!