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!
Getting Activity Results
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.
Delaying a Progress Indicator
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!
Video: Android for Everyone: Getting Started with 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.
How to Create Tabs with Jetpack Compose
John Codeos is back, this time looking at implementing tabs, based upon Accompanist’s pager composable and Compose Material’s tab implementation.
Implement TabLayout in Jetpack Compose
Mr Umbrella takes a deeper dive into the various tab composables offered by Compose Material, including creating tabs containing multiple composables, having tab rows that scroll, and more!
Explore Android Bottom Sheets in Jetpack Compose
Siva Ganesh Kantamani returns, with a peek at bottom sheets, both persistent ones (via
BottomSheetScaffold()) and modal ones (via
Jetpack Compose - Shape Your Views
Mahendran Vadivalagan explores applying shapes to
with concrete implementations of tags, teardrops, message bubbles, and more!
Navigating with Animations in Jetpack Compose
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 a Retro-Style Game with Jetpack Compose: Introduction
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.
Firebase Auth with Jetpack Compose
Eric Ampire demonstrates using
rememberLauncherForActivityResult() to integrate
Firebase Authentication (via
GoogleSignIn) into your login screen composable.
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!
GitHub: prafullmishra / JetComposer
Prafull Mishra has a sample project for various composable effects. In particular, Prafull has implemented a fascinating 3D parallax animation, controlled by user gestures.
GitHub: aaronoe / ComposeArcade
Aaron Oertel is working on a Sudoku implementation, written using Compose and Compose for Desktop in a Kotlin/Multiplatform project.
GitHub: Nthily / FlappyBird
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.
Gist: stevdza-san / SuperScriptText.kt
Stefan Jovanovic (a.k.a., stevdza-san) demonstrates how to use
SpanStyle in an
AnnotatedString to display text with a superscript.
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.
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
- 2023-05-30: Compose beta! Tracking continuous composable presses! Animated carousels! MVI! 2D scrolling layouts! Tables! And... a stable function?!?
- 2023-05-23: Focus and preview cards for Compose for TV! Interactions and visual states! ViewCompositionStrategy! Compose for iOS, for real! @email@example.com is zooming! Data tables! And... BasicTextField2, the sequel?!?
- 2023-05-16: Google I/O! New Compose BOM and alpha! Viewmodels! BottomScaffold()! SealedX! Lottie! Dynamic themes! Floating action menus!