jetc.dev Newsletter Issue #141
Published: 2022-11-15
We got a patch release of Compose, plus a new alpha, and an RC for Wear Compose!
Beyond that, we watch what was presented at the second phase of the Android Developer Summit plus the October 2022 edition of Android Worldwide. We look at lazy lists, permissions, and drawing text. Plus, we showcase a showcase.
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
The 2022.11.00
edition of compose-bom
was released, mostly to pull
in the 1.3.1
patch releases of the Compose artifacts. This patch contains
just a handful of bug fixes.
Compose Compiler has a 1.4.0-alpha02
release, with Kotlin 1.7.21 support.
The rest of the Compose artifacts are also up to 1.4.0-alpha02
. Changes
include:
-
A new
minLines
parameter onBasicText()
andBasicTextField()
, for those who are building their own non-Material design system -
The same
minLines
parameter onText()
,TextField()
, andOutlinedTextField()
, for those using Compose Material -
A
Paint
constructor that takes an Android platformPaint
parameter, andFontFamily.Resolver.resolveAsTypeface()
function to convert aFontFamily
into aTypeface
, for more interop options with the classicView
system
Wear Compose is up to 1.1.0-rc01
, with a long list of bug fixes.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
How Do I Select All the Text?
Normally, the user handles text selection manually with a TextField()
or
BasicTextField()
. But, from time to time, you might need to adjust the
selection yourself. See how you can use TextFieldValue
and TextRange
for
this, in this week’s highlighted Stack Overflow question.
Can a ViewModel
be @Stable
?
For that matter, should a ViewModel
be @Stable
? The answer may be “yes”,
at least in some circumstances, such as a composable-scoped viewmodel. Learn more
in this week’s highlighted Kotlinlang #compose
Slack thread.
Android Developer Summit 2022, Part Deux
The Android Developer Summit for 2022 is a three-event affair. The second part was focused on “form factors”, looking at how to get your app to other devices beyond phones. Presentations related to Compose included:
- Around a watch: Handling rotary input in Wear OS
- Compose: Implementing responsive UI for larger screens
- Deep dive into Wear OS app architecture
- Form Factors #AskAndroid
- Insets: Compose edition
- Navigation Compose on every screen size
Android Worldwide
The Android Worldwide October 2022 event included a handful of Compose-related presentations, including:
- Android widgets and Jetpack Compose: Making your app fancy
- Interacting with Composable Canvas
- Jetpack Compose: Art of the State
- Scalable multi-module architecture for Jetpack Compose apps
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Android Developers Backstage: Compose Lazy Layouts
Google’s Rebecca Franks and Chet Haas hosted a podcast with Andrey Kulikov,
Matvei Malkov, and Andrei Shikov, covering the use of LazyColumn()
, LazyRow()
,
and the rest of the lazy containers in Compose UI.
Medium: A Foray into Relay
Jamie Samson plays around with Relay, the pair of plugins that lets you convert Figma components into composables. Jamie specifically looks at how to deal with Compose themes, as there may not be a direct mapping from Figma to your design system. And Jamie also looks at some potential issues with Relay, such as adding Figma as the system of record for your actual code.
How to Request Permissions in Jetpack Compose (2 Ways)
The SemicolonSpace team explores two approaches for requesting runtime permissions
from users: rememberLauncherForActivityResult()
and
Accompanist’s permissions API.
Medium: Exploring text on Canvas using drawText API in Jetpack Compose
Radhika S looks at drawText()
, a recent addition to the Canvas()
DSL that
lets you render text directly on the canvas. Radhika examines all four forms
of the experimental drawText()
function to see what options they offer.
Show BottomBar conditionally in Compose
You might have a BottomBar()
as part of your navigation setup, but you might
not want that bar all the time as the user navigates deeper in your app.
James Shvarts explores what it takes to hide that bar, using some state
to indicate whether the BottomBar()
should be included in the composition.
Other Interesting Links
- Medium: Android Guide To Navigation with Jetpack Compose- Displaying Files from Local Storage in Jetpack Compose
- Medium: Clean way to close drawer when back button is pressed in Jetpack Compose
- Handling Text in Jetpack compose with Android
- Medium: 7 Useful Android Jetpack Compose Libraries You Should Use in Your Next Project
- Searching Paged Data In Jetpack Compose
- Medium: How to create bitmap of a composable in Jetpack compose Android?
- Video: Getting Started with Android Jetpack Compose
- Medium: Easy Listview / Recyclerview with Jetpack Compose
- Medium: Say Goodbye XML, Hello Compose!
- Medium: Constraint Layout in Jetpack Compose
- Video: Jetpack Compose - Maps + Markers
Resource Roundup
100% pure code!
GitHub: SimformSolutionsPvtLtd / SSComposeShowCaseView
The Simform Solutions team implemented a showcase, to highlight a particular UI
element and explain its use. Their library gives us ShowcaseProperty
to capture
the particular area to highlight and a ShowCaseTarget()
composable to render
the showcase.
Gist: alexstyl / AutoCompleteTextComposable.kt
Alex Styl demonstrates how to use an ExposedDropdownMenuBox()
combined with
a TextField()
to implement the basics of a Compose UI equivalent of the
classic AutoCompleteTextView
widget.
GitHub: yml-org / YCharts
The yml-org GitHub user brings us a large library of chart composables, for pie, donut, line, bar, and grouped bar charts.
GitHub: mxalbert1996 / compose-shared-elements
Albert Chang forked and updated a library mentioned here way back in issue #8, to help implement shared element transitions as users navigate from screen to screen within your app.
Other Interesting Links
- GitHub: mennovogel / zoom-compose (
Zoomable()
composable for pinch-to-zoom, etc.) - GitHub: jojoyel / enhanced-progress (progress indicator)
Or, you can subscribe to the Atom feed or follow Mark Murphy in the Fediverse.
Recent Issues:
- 2024-12-10: A Compose Multiplatform alpha! Hot reload! Presentation! Sprites! Calendars!
- 2024-12-03: Rebecca Franks on clipping and masking! Stefano Natali on graphicsLayer()! FunkyMuse on type-safe nav results! And... if we have enough maps, do we need to store our maps in a Map?!?
- 2024-11-26: Math! Shared element transitions! Custom modifiers! Macrobenchmark! Adapting to platform-specific design systems! And... why does wrapContentSize() not wrap my content size?!?