jetc.dev Newsletter Issue #70
This week, we look briefly at
beta09, as the countdown to a stable release continues ticking!
We also look at string resources,
Text(). We peek at some
dialogs and “swipe to expose” composables. And we try to have a bit of “focus time”.
Reviewing the release notes for the latest Jetpack Compose update!
beta09 was not huge, but does contain more changes than I would expect for a nearly-final release.
The Compose artfacts now contain “profile rules”. As is explained
in the Compose runtime
beta09 release notes,
these rules teach ART what functions should be compiled ahead of time, rather than
just in time, to improve first-run app performance.
Also, the Compose team is improving support for running Compose-based tests as unit
tests using Robolectric. The Compose UI
beta09 release notes
list some known limitations.
Compose UI converted another bunch of enums to inline classes, including
FontStyle, and several more.
Compose Foundation removed
Compose Material added a
shapeparameter to let you control the border of the
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
OutlinedTextField() is outlined. However, historically, that outline was purely managed
by the composable, following Material Design aesthetics. However,
beta09 gave us
shape parameter to control this, as we see in this week’s highlighted Stack Overflow question.
String resource files have been the backbone of internationalization and localization
in classic Android development. In the short term, that is not going to change, as we see in
this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
This episode of the Android Developers Backstage podcast series on Compose (“AD/BC”)
looks at the process of laying out composables, including comparing and constrasting
it with the equivalent operations in the classic
Zach Klippenstein continues a deep dive into the snapshot state system. In particular,
in this post, Zach mostly skips composables and focuses purely on
derivedStateOf(), and how the snapshot engine can let you create reactive systems that
have nothing much to do with UI.
With classic views, we had methods to call to get the focus to move from widget to widget,
for cases where automatic focus management did not work as desired. In this post, Jamie Sanson
looks at the equivalent operations in Compose UI, using
onFocusChanged() modifier, and more!
Over a pair of posts, Aleksander Jaworski implements a stopwatch in Compose UI. In the first post, Aleksander sets up the state representation, the elapsed time counter, and how to toggle between running and paused states. In the follow-up post, Aleksander extends the system to support an arbitrary number of stopwatches, all running in parallel.
Other Interesting Links
- Jetpack Compose: Custom View
- Video: How to Make a Draggable Music Knob in Jetpack Compose
- Video: Migrating to Compose: ComposeView
- A Better Way of Creating Android Views with JetPackCompose
- Avoid Pain in Jetpack Compose
100% pure code!
Other Interesting Links:
- Gist: maurobanze / stepper.kt
- GitHub: Spikeysanju / JetQuotes-Desktop
- GitHub: theapache64 / compose-bird
…And One More Thing
It is easy to ignore focus. Focus is a concept tied to keyboard navigation of a UI. Few developers (or designers) use a phone with a keyboard. “Out of sight, out of mind” means that forgetting about keyboards is very common.
Yet, while phones with keyboards are uncommon, there may be more than you might think of:
Most Chrome OS devices come with keyboards
Bluetooth keyboards are a popular accessory for tablets
Users needing assistive technology will often wind up with a peripheral that either is a keyboard or presents itself to Android as a keyboard
You may be required by regulation to support keyboard navigation
Televisions are not touchscreens; navigation through a TV app is via a remote that emits key events
Game controllers emit key events
Your future Compose for Desktop app will be tied tightly to keyboards
And, believe it or not, there are modern phones with keyboards
Jamie Sanson’s post on focus demonstrates that Compose has an in-depth API for focus management. It is our job to test our app’s focus management and make fixes in places where the “out of the box” implementation is shaky. Plus, Compose UI is new, and focus management may not have gotten enough community attention, so there may be bugs, or gaps in functionality where Google postponed some things to address after 1.0.
As you develop your battle plan for migrating to Compose UI in the coming years, try to find time to work on focus management… even if it is not your primary focus.
- 2021-10-12: Overscroll! Responsive layouts! Accessibility! Reorderable lists! Foldables! Testing with an Espresso wrapper! And... testing with robots?!?
- 2021-10-05: 1.0.3! 1.1.0-alpha05! Scopes! Compose in production! rememberUpdatedState()! And... particles of Compose?!?
- 2021-09-28: @androidamanda on declarative UIs! Keyboard handling! Swapping themes! Pickers, pickers, and more pickers! And... LED matrix displays?