jetc.dev Newsletter Issue #133
This week, Google warns us that we may be using
TextField() wrong. 😮
Google also suggests that we should be thinking in Compose but… what if that
leads us to use
TextField() wrong?!? 😱
Beyond that, we look at accessibility and paging, we draw some waveforms, and we look at an undo system for letting users correct errors!
(really, though, that seems superfluous — I, for one, nevre maek typose 😁)
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
There are lots of ways to map platform callbacks to
State that can trigger
recomposition. See two approaches — using
DisposableEffect() and using
a viewmodel — for recomposing on clipboard changes in this week’s highlighted
Stack Overflow question.
Some developers really dislike composables with lots of parameters, which is understandable.
Sometimes, they try bundling a bunch of would-be-parameters into more coarse-grained
objects, to reduce the parameter count. See an example, and arguments against
the approach, in this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Google’s Alejandra Stamato points out that
BasicTextField() and its design system
OutlinedTextField()) suffer from some fairly significant
synchronization problems, especially when using reactive data sources… and
reactive data sources are fairly important nowadays. Alejandra’s primary
recommendation is to mutate the text state synchronously or via a
Arkadii Ivanov separately suggests using
to safely collect a
Google’s Chris Arriola focuses on the declarative UI pattern: describing what the UI should be instead of how to get to that UI from whatever starting point you happen to be in at the moment. Google also published a video on the same subject.
Google is offering a series of “Compose Camp” events in concert with Google Developer Groups and Google Developer Student Clubs.
Tim Rijckaert discusses how to avoid too many overloads of the same function by using the builder pattern. In a nutshell, Tim advocates for writing a composable that takes a builder that in turn offers a DSL-style way to provide the input data for the composable.
Kristen Halper looks at how we can identify accessibility concerns in our Compose UI apps and how to help address them. Specifically, Kristen applies this to Microsoft’s Surface Duo Compose UI samples.
Daniel Dimovski demonstrates conumsing the Google Books API within a Compose UI
app. Specifically, Daniel looks at using
paging-compose to supply data page-at-a-time
collectAsLazyPagingItems() to map a
Flow to a
LazyPagingItems that can be used with the lazy containers.
Ruben Quadros wanted to use ExoPlayer in a Compose UI app. Specifically, Ruben
wanted to use composables for the controls overlay (play, pause, etc.). Ruben’s
post focuses on how to create composables that interact with ExoPlayer to control
playback and to respond to events (e.g., update a
SeekBar() position as the video
Other Interesting Links
- Medium: Explore Compose MotionLayout
- Video: Large Screens and Foldables
- Medium: Build a Camera Android App in Jetpack Compose Using CameraX
- Medium: Provider Pattern in Jetpack Compose
- Slides: Migrating to Compose
- Medium: Firebase Phone Authentication in Jetpack Compose using MVVM architecture
- Measuring Composable size using BoxWithConstraints
- Video: What does recomposition mean to your app?
- Drawing QR Codes in Jetpack Compose
- Medium: Fact Check And Common Misconceptions Around Comparing SwiftUI & Jetpack Compose
- Medium: Jetpack Compose: Implicit Intents
- Should new Android developers learn Compose or XML?
- Medium: Using Jetpack Compose in an existing Android application
100% pure code!
Andrew Linc brings us an
AudioWaveform() composable that renders a waveform
from a collection of amplitudes. The resulting UI is clickable,
to choose a particular offset in the waveform.
Google’s Zach Klippenstein created a proof-of-concept universal undo system
for Compose. As Zach notes, “this is a very unconventional and probably unsupported
use case of the
StateRecord APIs”, so be careful in using
this approach in production. Still, it represents an approach that might get first-class
support in the future.
- 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?!?