jetc.dev Newsletter Issue #107
This week, we peek at
1.2.0-alpha05 and see how much optimization we need to worry
about in our
Canvas composables. We look at permissions, Glance, and animations.
We see a seemingly infinite number of color pickers and a way to help detect
overcomposing. And I hope for some “how do we
do this in Compose UI?” love for the long tail of Android UI elements.
Reviewing the release notes for the latest Jetpack Compose update!
1.2.0-alpha05 came out, with:
Support for coroutines 1.6.0
Documentation for some Gradle options for getting metrics and reports from the Compose compiler
A change to have
includeFontPaddingbe disabled by default
Support for the “animator duration scale” value in Developer Options
A refactoring of
LazyHorizontalGrid()into a new
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Slider() is an easy way to implement a
SeekBar-style UI, but by default it returns
a value between
1f. If you wish for a more convenient range of values,
valueRange parameter, as we see in this week’s highlighted Stack Overflow
We were told to worry about allocating objects in custom views, particularly in
and similar methods. Learn about whether that is a concern in Compose UI in this
week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Marcel Pintó wrote a FAQ for applying Glance to your app widgets, covering things like how Glance ties into the app widget XML metadata, what level of control you have over the look of the app widget, and how you publish updates to the app widget content.
Stephen Vinouze returns, this time looking at having multiple animations tie together
in time, including sequential and parallel animations. Stephen demonstrates using
delay() for controlling the timing and sequence of events.
The current Compose for Web is style-agnostic, insofar as it helps you generate HTML without necessarily imposing any particular style on that HTML. Amr Yousef walks through the setup for using Tailwind CSS in conjunction with Compose for Web and applying Tailwind styles to your composables.
100% pure code!
Colton Idle and theapache64 highlighted a particular Compose UI snippet from Google.
This defines a
recomposeHighlighter() modifier “that draws a border around elements that are recomposing”.
This can help you identify overcomposing, where elements are being recomposed more
often than you might expect.
…And One More Thing
A lot of stuff has been written about converting ordinary UI elements from the
View-based system to composables, such as
Button. A fair amount
of material exists for converting various flavors of
to composables. All that is essential and wonderful.
There is a lot more to classic UI construction than that, though, and we are going to need information about converting those to Compose UI as well.
On a percentage basis, neither of those are common compared with
However, that still means that tens of thousands of apps use them, and some of those
are going to need to get converted to Compose UI. And for that, having existing
instructions or recipes will help.
If you have converted this sort of legacy UI to Compose UI, please consider writing something about it!
- 2023-09-12: Compose 1.5.1! Glance 1.0.0! Compose Multiplatform! Themes! Photos! Coachmarks! A bit of CommonsWare history! And @email@example.com tells us what not to do!
- 2023-09-05: Compose Compiler 1.5.3! Compose Multiplatform 1.5.0! @firstname.lastname@example.org on greyscaling composables! @email@example.com on Espresso testing with Compose interop! Scrollbars! AnnotatedString!
- 2023-08-29: Compose Compiler 1.5.2! Compose and Wear Compose alphas! Capture composables to bitmaps! Testing! Recomposition! Compose Multiplatform! And... Accompanist is downsizing?!?