jetc.dev Newsletter Issue #148
This week, we look at
ContactsContract, and how each can
be used from within Compose UI. We focus some on focus, and we look at a snippet
for rendering a QR code. Plus, we feast our eyes on some balloons, though for
most phone apps, 99 red balloons might be a bit much.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Many Compose developers have gotten the error “
@Composable invocations can only happen from the context of a
Learn more about that error and how to revise your approach to avoid it, in this
week’s highlighted Stack Overflow question.
Focus can be a bit tricky in Compose UI. See the differences between
onFocusEvent, and the importance of
in this week’s highlighted Kotlinlang
#compose Slack thread.
Posts, videos, and other new information related to Jetpack Compose!
Alex Styl returns, looking at the various classes and functions involved in managing
the focus for
TextField() composables. This includes requesting focus, clearing focus,
setting the focus order, and more! (Did I mention that focus can be a bit tricky in Compose UI?)
FunkyMuse looks at
Activity lifecycle method that gets called
if an existing
Activity instance is brought back to the foreground via a
call. How do you integrate these callbacks into your Compose UI setup, such that your
app can react both to the initial activity creation (
calls as well?
Elye is back, this time looking at situations where the contents of a list are meant to be modified by the user via a composable. When it comes to adding and removing list items, it is clear that we need to mutate the entire list. But, what if it is only the contents of an individual item that are affected (e.g., the checked state of a checklist item)? Elye explores a few possible ways to model and observe these changes.
Enrico Mazzucchelli brings us an extended example, looking at how to get contact
ContactsContract, expose it in a repository, then render it using
Compose UI. The UI includes handling the runtime permission request as well as
sticky headers in a lazy list, to group contacts by first letter.
Ban Markovic looks at Navigation for Compose and how to manage the back stack, particularly for the case of completely clearing the back stack to get to the initial route. As Ban points out, “the back stack doesn’t contain only screens as destinations; it also contains navigational graphs”, which makes this process a bit more confusing than you might expect.
Other Interesting Links
- Jetpack Compose Card (with Examples)
- Medium: Date and Time Pickers in Jetpack Compose
- Medium: Jetpack Compose for iOS. Getting started, step by step
- Medium: Jetpack Compose Text Modifiers
- Medium: Custom Toggle Button in Jetpack Compose
- Medium: Jetpack Compose — Navigation Component Android — Beginner Steps — Part 2 (Practice)
- Medium: Thinking in Compose, the SwiftUI and Flutter developer Glossary
100% pure code!
Jaewoong Eum recently added Compose UI support to his tooltips library, in
the form of a
Balloon() composable supported by a
BalloonBuilder class for
configuration details. Learn more about how to create tooltips and other types
of popups with this library in this Medium post
- 2023-01-24: Locales! Relay! Effects! Paging! Foldables! Permissions! Date pickers! Bi-directional scrolling! And what your MaterialTheme means... for your SwiftUI code?!?
- 2023-01-17: New Compose patches and alphas! Dealing with Navigation for Compose! Scaffolds! QR codes! Server-defined UI! And @firstname.lastname@example.org has joined the BOM squad! 😁 💥
- 2023-01-10: onNewIntent() and composables! ContactsContract and composables! Balloons! QR codes! Pencils! And a focus on focus!