jetc.dev Newsletter Issue #71
This week, we look at getting results from external activities into our composables, including integrating with Firebase Authentication. We take a couple of looks at implementing tabbed UIs, examine another navigation library, and look a bunch of additional games. And I ponder the impacts of Android-on-Windows-11 from the standpoint of Compose for Desktop.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Google recently wrapped
for classic Android app development. In Compose, though, you will tend to use
rememberLauncherForActivityResult() to get the results to your composable,
as we see in this week’s highlighted Stack Overflow question.
Sometimes, we do not want to render something right away, such as postponing
showing a progress indicator for a few hundred milliseconds. There are a few options
for implementing that sort of pattern, as we see in this week’s highlighted
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Alexx Mitchell and Sierra OBryan delivered an overview of Compose UI for the Women Who Code CONNECT REIMAGINE 2021 virtual conference. Topics covered included the basics of declarative frameworks and simple composables, up through image clipping and everyone’s favorite topic: state management.
Kaustubh Patange wrote a navigation library, rather than wait on Navigation for Compose to support animated transitions. Kaustubh’s library not only handles animations, but it uses sealed classes for routes and arguments (instead of strings).
Creating Compose and Compose for Desktop ports of classic computer games seems to be a popular pastime, and Thomas Künneth did not want to be left out. With that in mind, Thomas has started a new blog post series to examine how to implement a text mode maze game using Compose UI, after a brief peek at retrocomputing.
Other Interesting Links
- Part 1, UI Widgets From Scratch in Jetpack Compose
- Video: Text Selection - Jetpack Compose
- Video: How to Make a 3D Animated Drop Down in Jetpack Compose
- How to UseVisualTransformation to Create Phone Number TextField and Others in Jetpack Compose
- Video: Jetpack Compose - Align Children inside Rows and Columns
100% pure code!
Previously, we had a Compose for Desktop implementation of Flappy Bird, using radio buttons. This time, we have a classic mobile port of Flappy Bird to Compose, supplied by GitHub user Nthily.
Other Interesting Links
…And One More Thing
The big news last week in the world of Android was the announcement that Microsoft and Amazon are teaming up to bring Android apps to Windows 11.
This raises an interesting question for developers using Compose for Desktop: do you stick with Compose for Desktop for your Windows apps? Or do you just “double down” on the Android app and use it for Windows 11 as well?
If your objective is just to get to Windows 11 users, then perhaps you could skip Compose for Desktop. Despite all the gains with Compose for Desktop and Kotlin/Multiplatform, it is still likely to be less work to just maintain an Android app.
However, Compose for Desktop also gets you:
- Windows 10 and lower
While a lot of people will upgrade to Windows 11 in time, that will depend a lot on who qualifies for the upgrade. Many who qualify may postpone the upgrade, due to concerns about problems or just a lack of time/willingness to fuss with the process. So, Windows 10 and lower will be a large audience for a while, in addition to the macOS users and Linux fans (👋) out there.
There may also be limits as to what you can accomplish from an Android app on Windows 11. As Google’s Jim Sproch put it in Kotlinlang Slack:
…the Windows 11 thing still won’t let you access native OS functionality (eg. you can’t access files on the filesystem, don’t have access to system tray, file type associations, etc). You are pretty limited in what you can do if you can’t access any of the system APIs. Compose for Desktop solves this problem by giving you full access just like any other native application, instead of being constrained to the APIs of a virtualized environment.
Right now, details are “thin on the ground”, but Jim’s point almost certainly will be true to some extent. In the very near term, that needs to be counterbalanced with Compose for Desktop’s current limitations, of course.
Personally, I would prefer Compose for Desktop just to be able to avoid the Amazon AppStore for Android, at least with its current policies.
So, I do not view the Android-on-Windows-11 announcement as weakening the Compose for Desktop argument. What it will do is make it easier to start having the conversation around supporting desktops, and that gives you the opportunity to point to Compose for Desktop as an option.
- 2021-10-12: Overscroll! Responsive layouts! Accessibility! Reorderable lists! Foldables! Testing with an Espresso wrapper! And... testing with robots?!?
- 2021-10-05: 1.0.3! 1.1.0-alpha05! Scopes! Compose in production! rememberUpdatedState()! And... particles of Compose?!?
- 2021-09-28: @androidamanda on declarative UIs! Keyboard handling! Swapping themes! Pickers, pickers, and more pickers! And... LED matrix displays?