jetc.dev Newsletter Issue #35
This week, we look at staggered grids, screenshot testing, tooltips, and split-pane UIs. Plus, we see how Compose UI is getting a bit more secure in an upcoming release.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Staggered grids are a popular UI pattern. With the classic
View system, we used
RecyclerView. In Compose UI, we
can create a custom
Layout() for our staggered grid, as we see in this week’s
highlighted Stack Overflow question.
Posts, videos, and other new information related to Jetpack Compose!
Shot is a Gradle plugin for assisting with screenshot testing. In this article, Pedro Gómez describes how Shot now supports Compose, allowing you to create screenshot diffs to see where your test results differ visually from those in prior runs.
Long-term, the Jetpack Navigation component will be a popular solution for navigating between screens in Compose-based apps. António Valente shows us how we can use it in the short term, with simple fragment wrappers around composables representing screens, as an interim solution until native Compose support is available for Navigation.
100% pure code!
…And One More Thing
Sometimes, prayers are answered.
One important element of Android app security is
FLAG_SECURE. You can add it to
a window to block screenshots being taken of the window, to protect sensitive user
content (passwords, account numbers, etc.). But
FLAG_SECURE is per window,
and some things in our
View-based UIs are child windows: dialogs, menus, toasts, and
so on. Unfortunately, the code creating those child windows failed to pass along
Early versions of Compose UI suffered from the same problem.
FLAG_SECURE is one of those flags that should get propagated to child windows.
After all, if we want to protect a window, UI elements that happen to require child
windows should be protected by default. But, Compose UI was not doing that, just
View counterparts did not do that.
So, I filed tickets to get
FLAG_SECURE to be passed along to child windows for
two Compose UI scenarios:
Dialog(). At the time,
those were the only two places that I saw child windows being created.
I filed them nearly a year ago and had assumed they were lost in the shuffle.
Much to my surprise and great relief, they were addressed in early October.
After the change ships (
alpha05?), I will run some tests to confirm that it works,
plus I will check to see if there are other child windows added since last November
that need similar treatment.
I am elated that these were fixed, and I am very grateful to the Compose team for taking the time to fix them!
If you encounter problems in subscribing, let us know!
- 2020-10-20: alpha05! ConstraintLayout! Semantics API! Epoxy vs. Compose! And Tetris!
- 2020-10-13: Staggered grids! Screenshot testing! Columns, and more columns! Tooltips! And security improvements!
- 2020-10-06: alpha04! Themes! Pagers! Tables! Presentations! But Not Stability!