jetc.dev Newsletter Issue #12

Published: 2020-05-05

dev10 is out, bringing with it a compiler plugin update! We also have a bunch of articles from Joe Birch, a conference presentation, and a bit of shimmer.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

How do I split the screen into two areas, while having a form in the center?

Z-axis ordering, through composables like Stack(), allows you to float composables on top of one another, so you can have complex backgrounds.

Implementing a Shimmer Effect

There was a Slack discussion on how to implement an animated gradient “shimmer” effect in Compose. The thread wound up previewing a new top-level Compose function (composed()) and reviewing whether @Composable functions can return values or not.

Composable Commentary

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

Compose dev10 Release Notes

The big change, by far, is the new Kotlin compiler plugin, based on a newer version of Kotlin. The updated plugin offers better support for annotation processors (kapt) and coroutines. It is still a pre-release implementation, but it should be several steps in the right direction.

Compose UI dev10 Release Notes

By contrast, dev10 of Compose UI has no huge changes, but a lot of little ones. FontLoader is gone, focus and blur events are consolidated on TextField, and Color parameters are now mostly non-nullable (use Color.unset for a “null” Color).

Custom Layouts, measuring and WithConstraints in Jetpack Compose

Jorge Castillo dives into ways of organizing children in Compose, and when and where we might use WithConstraints for laying out those children.

Exploring Jetpack Compose: Border

Joe Birch is back with a trio of posts, the first one looking at Border for adding an outline to a composable.

Exploring Jetpack Compose: Stack

Joe’s second post is on Stack, a way of organizing your composables on the Z-axis, as seen in this week’s Stack Overflow question.

Exploring Jetpack Compose: Android View

Finally, Joe has a short piece on integrating traditional view-based layouts and custom views in a UI otherwise constructed from composables!

Composable App Bar

Brian Gardner also was busy, first with a piece exploring TopAppBar() for — you guessed it — implementing a top app bar.

Become A Composer

Brian also delivered a presentation as part of the droidcon online series, with introductory material on Compose.

196: Composing with Leland 👨‍🎨 – Fragmented

Donn Felker’s and Kaushik Gopal’s long-running podcast has a Compose-centric episode, featuring Google’s Leland Richardson, one of the more prominent developers on Compose.

State Management in Jetpack Compose

Himanshu Singh gives us an overview of how we hold onto data and have it affect our composables when that data changes.

Resource Roundup

100% pure code!

GitHub - andob/microMVCompose

This repo contains a “micro MVC framework” for writing Compose apps.

GitHub - digitalbuddha/ForBritishEyesOnly

This is Mike Nakhimovich’s experiment in blending Compose with Square’s Workflow and the Store data storage and caching library.

…And One More Thing

dev10 is a major release, courtesy of the new compiler plugin. Make sure that when you upgrade to dev10 that you also set kotlinCompilerVersion to 1.3.70-dev-withExperimentalGoogleExtensions-20200424 in your composeOptions in your module’s Gradle script.

As the name suggests, this plugin is based on Kotlin 1.3.70. There have been reports of some hiccups in using newer Kotlin builds with this plugin, so if you get strange results, try setting your org.jetbrains.kotlin:kotlin-gradle-plugin version in your top-level Gradle script to 1.3.70 to match the plugin version.

However, on the positive side, there are reports that you can now use kapt-based libraries like Room in a Compose module. Previously, you need to keep those separate, due to conflicts between the annotation processors and the Compose compiler plugin. And, there are reports that coroutines are working a lot better, though there may still be some lingering issues with using Flow.

All in all, it is well worth trying to move to dev10 soon, and major thanks go out to the entire Compose development team for the updates!