jetc.dev Newsletter Issue #184
Published: 2023-10-03
The BOM was bumped, but not by much.
Elsewhere, we dive into how measuring and touch input dispatching work with composables. We examine Roborazzi and a Material3 implementation of pull-to-refresh. Plus, we look at a PDF viewer and a Compose Multiplatform charting library.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
The Compose BOM got a bump to 2023.09.02
, which maps to the 1.5.2
patch release,
which contains some crash fixes.
Also, JetBrains released 1.5.0-beta02
for Compose Multiplatform.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Why Does My LaunchedEffect
ANR?
LaunchedEffect()
is not magic. It still runs your code on the main application thread.
You remain subject to the rules of that thread, such as “do not block it indefinitely”.
Learn more in this week’s highlighted Stack Overflow question.
Why Are My Window Insets Late?
Usually mutable data, especially mutable remembered State
data, is the wrong
answer, because changes to the content of the mutable data do not trigger recompositions.
But, occasionally, you need to break the rules, such as when changing the PaddingValues
used by consumeWindowInsets()
, as we see in this week’s highlighted Kotlinlang #compose
Slack thread.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
How Jetpack Compose Measuring Works
Helios Alonso takes a deep dive into Compose UI’s composition/measurement/placement flow, with an eye towards the measurement phase and how to optimize it.
ANR internals: touch dispatching through the view hierarchy
Pierre-Yves Ricau (of LeakCanary fame) explores the legendary Application Not Responding
(ANR) dialog, particularly for when it is triggered due to the app failing to respond to
touch events in a timely fashion. PY uses that to look at how touch events get dispatched in both the
classic View
system and composables.
Medium: Composing AnnotatedString — Poetry, Music, Code, Blogs, Expandables and Beyond
Nirbhay Pherwani looks at AnnotatedString
and the buildAnnotatedString
DSL for
creating richly-formatted text in Compose UI, including addUrlAnnotation()
for links,
expandable text, and more.
Medium: Debugging Jetpack Compose
Kaaveh Mohamedi worked to eliminate overcomposition in a sample app, using Compose compiler metric reports to identify non-skippable functions and fix up unstable model classes.
How to do a Material 3 pull refresh
Andrei Mukomolov wanted pull-to-refresh in a Material3 project. That combination is not officially supported at this time. Andrei’s team cloned the Material implementation and adjusted it to use the Material3 design system, resulting in this library.
Medium: Constraint Layout in Jetpack Compose
Kaushal Vasava walks us through the use of ConstraintLayout()
in Compose UI as an
alternative for Row()
/Column()
-centric layouts, to end up with more readable layout code.
Medium: Screenshot testing in Compose
Stefano Natali examines Roborazzi, a Roboletric-integrated screenshot testing library for Android. Roborazzi lets you write your screenshot tests to run on the JVM, rather than in the emulator. Stefano shows us how to use Roborazzi to write screenshot tests of our composables.
Medium: Best Practices for Compose Navigation in Multi-Module Project
Medium user Saqib explores ways of having your Navigation for Compose routes support screens defined in separate modules.
Other Interesting Links
- A Guide to Layouts, Modifiers, and UI Components in Jetpack Compose
- Android Jetpack Compose – Dynamic Progress Bar with Text
- How to create a weather app in jetpack compose
- Medium: Android lifecycle in jetpack compose
- Medium: Composition Local In Jetpack Compose
- Medium: drawBehind , drawWithContent , drawWithCache Modifier In Jetpack Compose
- Medium: From Blank to Beautiful: Implementing Shimmer Effect in Compose
- Medium: Implementing the ScrollableTabRow in Jetpack Compose
- Medium: Jetpack Compose Tutorial Part 3
- Medium: Jetpack Compose ViewModel Update UI Using Flow
- Medium: Jetpack Compose — Cognitive overload II
- Medium: Make a simple “Slide to unlock” in Jetpack Compose
- Medium: Mastering Permissions in Jetpack Compose: A Step-by-Step Guide
- Medium: Reduce Recomposition for Images/Icons In Jetpack Compose
- Medium: SearchBar with Jetpack Compose and Material Design 3
- Medium: Simplifying State Management in Jetpack Compose: Effortless Flow Observation
- Medium: Solving the mystery of PropagateMinConstraints
- Medium: Understanding Effect Handlers in Jetpack Compose
- Medium: Using MPChartLib with Jetpack Compose
- Simplifying UI Development with Jetpack Compose
- Tab Layout in Material 3 Jetpack Compose (with Examples)
Resource Roundup
100% pure code!
GitHub: pratikksahu / JetPDFVue
GitHub user pratikksahu offers a library for viewing PDFs in composables, powered by
the OS-supplied PdfRenderer
. It supports horizontal and vertical paging, pinch-to-zoom,
rotating pages, and integrated sharing options.
GitHub: TheChance101 / AAY-chart
GitHub user TheChance101 published a Kotlin Multiplatform charting library, supporting Android, desktop, iOS, and Web targets. It supports line, pie, donut, bar, and radar chart types.
GitHub: boswelja / compose-menuprovider
Jack Boswell created a composition local-based system to allow a common Scaffold()
to host varying top bar actions. As you navigate, the composables for each screen can
post their own menu items, which trigger recomposition of the top app bar.
GitHub: lukasroberts / AndroidLinkView
Lukas Roberts brings us a library that parses Open Graph metadata for a Web page and offers to builds a preview card for that page.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-11-05: Compose patch release! Compose alpha! 2025 Compose Multiplatform plans! Glance! Side panels! @theapache64@androiddev.social on performance! Tables! And... reacting to a broadcast from a composable?!?
- 2024-10-29: Relay! Paparazzi! droidcon Lisbon 2024! Server-defined UI! And... desktop OS trays?!?
- 2024-10-22: Compose patch! Compose alpha! Compose Multiplatform stable! droidcon NYC! Adaptive UIs! MVI! HTML conversions! Math rendering! And... are we now Fluent in Compose?!?