jetc.dev Newsletter Issue #14

Published: 2020-05-19

In this issue, we look at the dev11 Compose/Compose UI release, ConstraintLayout, multiple options for integrating Coil for image loading, and the death of (a) @Model.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

Asynchronous AdapterList

AdapterList is a bit tricky to use when you are loading content asynchronously. Stack Overflow user adneal points out some possible workarounds.

Exceptions and Compose

Exceptions happen. How we handle them in Compose code, though, may look a bit different from how we handle them in more classic Android app development.

Composable Commentary

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

Compose dev11 Release Notes

If you have been working with Canvas, you may find that your API is now changed to give you a CanvasScope. Use drawCanvas() to get to the actual Canvas.

And we now have a collectAsState() extension function for Flow to be able to consume one and have it update our composition when new values are emitted.

Compose UI dev11 Release Notes

There are about 30 changes in this release, including the removal of some previously-deprecated items.

Why do we need Jetpack Compose?

Pamela Hill wrote a piece outlining the pain points of the existing Android view system and how Compose addresses them.

Using ConstraintLayout in Jetpack Compose

Himanshu Singh has the first of two articles that appeared this week examining the Compose implementation of ConstraintLayout and how to apply it.

Jetpack Compose ConstraintLayout

Our other post on the subject comes from Jorge Castillo, who also demonstrates the use of ConstraintLayout, in this case also blending in Coil support for images, using the Accompanist library that you’ll see later in this issue.

Early learnings in testing with Jetpack Compose

Joe Birch continues his tour of Compose, this time looking at writing automated UI tests for Compose screens.

Bottom Navigation Bar With Compose

Not to be outdone, Brian Gardner continues his series of posts on Compose, this time looking at bottom navigation.

Resource Roundup

100% pure code!

GitHub: Chris Banes - Accompanist

Google’s Chris Banes has contributed his Accompanist library to Compose developers. Right now, it offers Coil integration for image loading, and a way to apply existing Material Design Components-based theme to your Compose UIs.

GitHub: Luca992 - coil-composable

Another way to use Coil for Compose image-loading comes from this library from Luca Spinazzola.

GitHub: SkikaSD - compose-server-side

Andrei Shikov is experimenting with using Compose’s node-change-management system to power a Web app, where the server sends messages over a websocket to a client that renders them.

GitHub: square - workflow-kotlin-compose

This repo contains some experimental integration of Compose into Square’s Workflow state management system.

…And One More Thing

When Jetpack Compose first came out — back before we even had artifacts — I filed a bug report about @Model not supporting val properties.

Little did I know that several months later, that issue would be updated… with information about @Model being removed. 😶

According to a tweet from Leland Richardson, this change will land in dev12 — given the publishing timetable of this newsletter, that means next week.

So, if you have invested in @Model in your Compose work, you may want to start migrating to state() or mutableStateOf(), as Leland outlines in that issue update and the associated Gerrit entry.