Newsletter Issue #39

Published: 2020-11-10

This past week saw the debut of Compose for Desktop, which garnered a lot of attention! So, this week, we look at the Milestone 1 release, how to get started with it, and what it does (and does not) contain.

Beyond that, we look a bit a ActivityResult and how to use that from a composable, look a bit more at the previous week’s Navigation and Paging for Compose releases, plus play with some theme animations and drop-down lists.

One Off the Stack, One Off the Slack

You’ve got questions. That’s understandable!

ActivityResult and Compose

The new ActivityResult API is Google’s next-generation replacement for startActivityForResult() and onActivityResult(). However, most of the samples for this are for classic View-based UIs, driven by activities and fragments. However, you can use it from Compose as well, as Google’s Ian Lake shows us in this week’s highlighted Stack Overflow post.

What’s Missing in Compose for Desktop?

If we are going to start experimenting with Compose for Desktop, it is good to have a sense of how it compares with the Compose UI that we have been using in Android. In short: they are fairly comparable, but there are some gaps, as we see in this week’s highlighted Slack thread.

Composable Commentary

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

Compose for Desktop

This is the home for JetBrains’ Compose for Desktop resources, including links to tutorials and samples.

Jetpack Compose for Desktop: Milestone 1 Released

This blog post by JetBrains’ Nikolay Igotti announced the availability of Compose for Desktop and called on us to experiment with it.

Jetpack Compose for the Desktop!

John O’Reilly reviews how to get going with Compose for Desktop, both inside and outside of IntelliJ IDEA.

Create your first Hello World Desktop app using Jetpack Compose Desktop

Nwokocha Wisdom Maduabuchi provides a small walkthrough of the steps to create a sample Compose for Desktop app using the preview release of IntelliJ IDEA.

Implement Bottom Bar Navigation in Jetpack Compose

Ziv Kesten brings us a walkthrough of how to use the new Navigation for Compose component to handle navigation between screens via a bottom nav bar in a Scaffold().

Implementing Paging in Jetpack Compose

Lost in the shuffle of last week’s Navigation for Compose release was that we also got a Paging for Compose release. contributor kriticalflare wrote a post reviewing the basics of adding Paging to a Compose UI app, showing how it can feed into a LazyColumn().

Animating Visibility in Compose

Ben Trengrove continues his Compose tour, this time taking a look at how we have to re-think the concept of “visibility” that we are used to in the classic View framework.

Semantics and TalkBack with Jetpack Compose

Bryan Herbst continues his review of the Compose semantics API, this time looking more closely at how it can interact with Android’s TalkBack screen reader for adding accessibility to Compose apps.

Android Jetpack Compose — Exploring State Based UI

Medium user rajan ks has published a post reviewing how Compose integrates with the Jetpack ViewModel and demonstrating a custom LazyGridFor() implementation.

Jetpack Compose: Scrollable Components

Siva Ganesh Kantamani reviews scrolling in Compose UI, both using simple scrollable containers (e.g., ScrollableRow()) and the Lazy classes (e.g., LazyColumnFor()).

Where Compose Could Go

The balding guy who publishes this newsletter wrote a blog post reviewing where else Compose UI-based apps might run, now that we have support for Android and desktop OSes.

Resource Roundup

100% pure code!

GitHub: JetBrains / compose-jb

This is the monorepo for JetBrains’ Compose for Desktop!

GitHub: lcdsmao / Dark-Toggle-Button-Sample-Jetpack-Compose

Mao Yufeng offer us this sample app, showing animating both the icon of a button and the theme of an app from light to dark. Bonus: it works with Compose for Desktop as well!

GitHub: DevSrSouza / svg-to-compose

Gabriel Souza has assembled some code that takes SVG files as input and emits Compose UI source code that renders the SVG as output. The result should be reminiscent of the material icons available in Compose UI… in part because this project uses some of the same code that generated those icons. One of the gaps with Compose for Desktop is the lack of SVG/vector drawable support; this project is a step towards filling that gap.

GitHub: tylerbwong / ComposeDesktopDemo

Tyler Wong contributes a sample Compose for Desktop project. The entire sample fits in about 120 lines of Kotlin — part of the value is the build.gradle.kts file that shows how to set up a Compose for Desktop app as a plain Kotlin/JVM project, without necessarily needing a preview release of IntelliJ IDEA.

Gist: chethu / DropDownMenu

GitHub user Chethan shows off a DropDownList() wrapper around DropDownMenu() to simplify showing a drop-down list in a Compose UI app.

…And One More Thing

Apparently, the desktop is not yet dead. Who knew?

The previous week’s release of Navigation for Compose excited the community. That was not too surprising, considering that lots of developers had been asking about it in the past couple of months. Compose is great, but getting past trivial samples requires some sort of navigation system, and now we can start to get the sense for what Google wants to do in this area.

But, while I had gotten some positive feedback from my coverage of Compose for Desktop back in April, I confess that I am surprised by the level of enthusiasm that we saw from the Milestone 1 announcement.

After all, mobile development has been the focus of the past decade, and the Web was the focus for the decade before that. It has been quite some time since the desktop was “front and center” in the eyes of developers… despite the fact that most developers use a desktop OS on a daily basis.

As a certified “old person”, I spent my first decade-and-change writing desktop software. So, I’m pleased that the desktop may make a bit of a renaissance here, at least in terms of developer attention. Being able to share code with Android apps and other platforms (yay, Kotlin/Multiplatform!) means that writing for the desktop should be a lot less of a “heavy lift” than it had been.

So, let’s see what Compose for Desktop can do!