jetc.dev Newsletter Issue #39
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 API is Google’s next-generation replacement for
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.
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.
Posts, videos, and other new information related to Jetpack Compose!
Lost in the shuffle of last week’s Navigation for Compose release was that
we also got a Paging for Compose release.
dev.to contributor kriticalflare wrote a post reviewing the basics of adding Paging
to a Compose UI app, showing how it can feed into a
100% pure code!
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.
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
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.
…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!
If you encounter problems in subscribing, let us know!
- 2020-11-10: Compose for Desktop! Using ActivityResult from composables! Navigation and Paging! Talkback and Scrolling! Theme animations! And more!
- 2020-11-03: Navigation for Compose! Drawing! Previews! Modifiers! And yet more Navigation for Compose!
- 2020-10-27: Exceptions! Libraries! React-to-Compose translations! KMP and Compose! And some sliders! (note: not the baseball kind)