jetc.dev Newsletter Issue #54
beta01 release is out! So, this week, we look at the beta launch materials
from Google and the release notes for the
beta01 artifacts. We also look at more
charting and navigation libraries, plus continue spending time in (app) bars.
Peeking at what Google announced with the beta release!
This was the official blog post for the release of
beta01 of Jetpack Compose.
It includes links to many new training resources, the latest edition of the
#AndroidDevChallenge, a testing cheatsheet, and more.
Reviewing the release notes for the latest Jetpack Compose update!
The big one here, that will break lots of code, is that
preferredSize() were renamed to
size() modifiers are now
If you were using
Scaffold() or other uses of
DrawerState, note that
close() are now
suspend functions, presumably because animations use
rememberCoroutineScope() to get a suitable scope for launching those
MeasureBlocks was renamed to
InteractionSource and had a bunch of API changes. Plus,
zoomable() is now
tapGestureFilter() was removed, replaced by
vectorResource() are now extension functions on the
companion objects for
AnimatedFloat are gone.
RadioButton() now support
null values for their
Slider() can now be enabled or disabled. There is a new
interface to define different colors for different states of
OutlinedTextField. And a ton of other things were renamed (e.g.,
BottomDrawer). You are going to want to read these release notes!
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Legacy container classes, notably
RelativeLayout, supported negative margins.
Compose UI does not support negative padding, but the
offset() modifier offers
an alternative, as we see
in this week’s highlighted Stack Overflow question.
While Compose UI has a transitive dependency upon AppCompat, that is not strictly
needed, and you can work on removing it from your project, as we see in
this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Anton Shilov looks at design systems, how you might have implemented them with classic views, and how you can adapt those to the world of Compose UI. The slides are also available.
100% pure code!
With something like a
TopAppBar(), you can add
IconButton() widgets, perhaps
DropDownMenu(). However, that is all managed manually, so if you want
to take available screen space into account, you have to do that manually too. GitHub
user MachFour offers an
ActionMenu() that works a bit like menu resources and an
action bar, where which items get toolbar buttons and which get moved to an overflow
menu is based partly on spec and partly on available space.
View-based counterpart, the
Checkbox() composable is just the box, without
a label. Denis Ismailaj shows a
LabelledCheckBox() that uses a
Text() to implement a checkbox with an associated label.
…And One More Thing
As I hoped, Google is being reasonable about setting expectations regarding the Compose beta releases. In the release blog post, they wrote:
With this beta release, Compose is API complete and has all the features you need to build production-ready apps. Beta also means API stable, so we won’t change or remove APIs. Now is a great time to start learning Compose and begin planning for how you will use it in an upcoming project or feature once it reaches 1.0 later this year.
That third sentence is key: Google is not necessarily expecting you to ship products based on Compose at the present time. Nothing is stopping you from doing so if you wish, and if the available functionality matches your needs, great!
At the same time, Compose UI is very young. While it is remarkably broad for such a new initiative, there are many gaps. While Google says that Compose UI “has all the features you need to build production-ready apps”, that does not imply that it has everything that your designer wants.
If your project is developer-driven, such that app functionality and look-and-feel can be adjusted based on Compose UI capabilities, starting to use Compose seriously now is not unreasonable. Conversely, if you need to match particular designs, that may be easy or hard depending on how well Compose UI — and Compose Material — line up with those designs.
So, starting to use Compose “for realz” is possible, but it may or may not be the best plan for you and your project. Evaluate whether you can deal with any Compose UI limitations before you dive into trying to implement new designs or convert existing screens into composables.
- 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?