jetc.dev Newsletter Issue #160

Published: 2023-04-11

This time around, we got a fresh April 2023 BOM for a patch release, plus 1.5.0-alpha02 with some more improvements to Compose.

We also spend a lot of time looking at HorizontalPager() and VerticalPager(). We explore TVs and State management. And we edit some Markdown, meaning that in theory I could start composing these newsletters in Compose, writing Stack Overflow answers in Compose, writing books in Compose…

(yes, I pretty much dream in Markdown at this point)

Ooooo… What Did We Get?

Reviewing the release notes for the latest Jetpack Compose update!

The Compose BOM is up to 2023.04.00, which maps to 1.4.1 versions of most of the Compose libraries. Those 1.4.1 libraries are mostly just bug fixes, as one would expect from a patch release.

We also got 1.5.0-alpha02. One big change is that now getValue() operators — used by property delegates — can themselves be marked as @Composable. Other changes include:

  • Support for Talkback and other accessibility services with UrlAnnotation in AnnotatedString

  • Support for fixed-size cells in LazyGrid() and fixed-size lanes in LazyStaggeredGrid()

  • Improvements to SubcomposeLayout(), supporting a lookahead API

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Why Is Paging 3 Not Caching?

Employing Paging for Compose is a bit tricky. Google’s Ian Lake helps one developer out, showing how creating new flows cause break the paging caches, in this week’s highlighted Stack Overflow question.

How Do We Override Fling Velocity?

More generally: how do we change composable behaviors when those behaviors are implemented as private functions or objects? See a specific example, in the form of overriding the velocity of DefaultFlingBehavior, in this week’s highlighted Kotlinlang #compose Slack thread!

Composable Commentary

Posts, videos, and other new information related to Jetpack Compose!

Medium: Customizing Compose Pager with fun indicators and transitions

Google’s Rebecca Franks looks at HorizontalPager() and VerticalPager(). Rebecca focuses on adding elaborate effects, such as fades rather than translations as users switch pages, changing the content of the currently-selected page as part of a transition, and creating custom page indicators.

Medium: Building Reddit Recap with Jetpack Compose on Android

Google’s Medium account is starting to publish guest posts! This one is from Aaron Oertel of Reddit, and it examines the implementation of Reddit Recap: a set of cards that depict how readers used Reddit over the previous year. Aaron especially explores how they set up all the animations, from simple swipes to 3D card rotations.

Video: Android Navigation Jetpack Compose

The Code with the Italians team hosted Google’s Ian Lake, taking a look at Navigation for Compose, including its strengths, where it might be headed, and what sorts of previous techniques it deprecates.

Setting up ViewPager in Jetpack Compose

As Rebecca Franks did, sinasamaki also looks at the new HorizontalPager() and VerticalPager() composables added to Compose 1.4.0, including having different structures for composables for different pages and controlling the initial state of the pager.

All about Google Accompanist

Alex Styl dives into Accompanist, Google’s playground for composables that maybe — just maybe — will one day be promoted into the official Compose libraries. Alex also mentions Horologist, Google’s equivalent experiments, but for Wear Compose.

Medium: Leanback to Jetpack Compose TV— A paradigm change in Android TV development

Umair Khalid compares and contrasts Google’s legacy TV UI (Leanback) with the nascent Compose for TV libraries.

Medium: Managing Compose State Variable With And Without ViewModel

Kamlesh Lakhani explores several different ways of tracking State within a Compose app, from remembering them in composables to holding them in viewmodels.

Medium: Simplify Your Styling: A Beginner’s Guide to Jetpack Compose Theming

Medium user Madhan examines MaterialTheme(): how to define one, where the code could reside, and how to have specific themes for specific types of composables.

Resource Roundup

100% pure code!

GitHub: meetup / MarkdownTwain

The Meetup developers published a library that provides a Markdown editor, with a preview and syntax highlighting.

GitHub: ellsworthrw / DiamondCharts

Reed Ellsworth brings us a FunctionGraph() composable for rendering graphs and charts, complete with axis labels and gridlines.

GitHub: T8RIN / DynamicTheme

Malik Mukhametzyanov created a library that creates a dynamic theme based on wallpaper colors that works back to Android 5.0.