jetc.dev Newsletter Issue #188
Published: 2023-10-31
This week, we look at how to tell that you’re on a TV (for composables) and whether
we can have Modifier
be returned by a composable. We explore slot APIs, ConstraintLayout()
,
and MapBox’s Compose UI support. Plus, we examine libraries for placeholders, calendars,
and button toggle groups.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
How Can I Have TV-Specific Composables?
In other words, how does the system decide to apply layout-television
for layout resources?
The answer appears to be that it detects FEATURE_LEANBACK
, and so we can use that
to decide whether to use a mobile or a TV-specific composable. However, I argue that
there may be better options than doing this on a granular basis, in this week’s highlighted
Stack Overflow question.
Is It OK to Make a Modifier Returned By a @Composable
?
We’re told to move away from using Modifier.composed()
. However, sometimes, we need
to read a composition local from within a modifier… and reading a composition local
can only be done inside of a composable. Learn why composed()
is still OK for the short
term, and other limits of using a composable to return a modifier, in this week’s
highlighted Kotlinlang #compose
Slack thread.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Meta built threads in only 5 months using Jetpack Compose
Yasmine Evjen and Florina Muntenescu walk through some high-level notes about how Meta assembled the Threads app.
Medium: Passing a Function from a Parent to a Child Composable
Michihiro Iwasaki examines slot APIs, a foundational concept in composable development, starting at the Kotlin concept of function types and building up from there.
Medium: Designing a Login Page By Using the Constraint Layout in Jetpack
Bharadwaj Rns takes a practical look at ConstraintLayout()
, the Compose UI equivalent
of the ConstraintLayout
that dominated newer View
-based Android UI construction.
The sample code explores creating and employing references to describe the relationships
between composables via the ConstraintLayoutScope()
DSL.
Medium: How to use Official Mapbox Maps Compose Extension with Permission Flow and FusedLocationProviderClient
Debanshu Datta explores MapBox’s official support for Compose UI, from simple maps to markers, location tracking, and more!
Other Interesting Links
- Left and Right align text simultaneously inside a button on the same line in Jetpack Compose
- Mastering Jetpack Compose: Best Practices for Superior Android App Development
- Medium: Creating Rich Interactions with Custom Gestures in Compose
- Medium: Elevate Your Android App’s Visual Appeal with Simple and Elegant Animations in Jetpack Compose
- Medium: Harmonizing Modifiers in Jetpack Compose: A Tale of Flexibility and Usability
- Medium: Integrating Jetpack Compose with Existing Android Projects: A Step-by-Step Tutorial
- Medium: Jetpack Compose Layouts: Crafting with Column and Row
- Medium: Make your Bottom Nav bar Beautiful with this UI in Jetpack compose!
- Medium: Mastering State Retention with Composable ViewModel: Navigating Orientation Changes
- Medium: Picking Images From Gallery Using Jetpack Compose
- Medium: Settings a custom content description on composables with no corresponding parameter
- Medium: Understanding @Stable, @Immutable, ImmutableCollection, and PersistentCollection in Jetpack Compose
- Medium: Useful Modifiers In Jetpack Compose Part — II
Resource Roundup
100% pure code!
GitHub: eygraber / compose-placeholder
Eliezer Graber took the deprecated Accompanist Placeholder and ported it to Compose Multiplatform, offering both Material and Material3 implementations.
GitHub: robertlevonyan / composable-button-toggle-group
GitHub user robertlevonyan created a Compose UI implementation of the MaterialButtonToggleGroup
from the Material3 spec. You provide the RowToggleButtonGroup()
with the icons, or
the ColumnToggleButtonGroup()
with the icons and labels, and the composables render
the toggle button group from there.
GitHub: GuilhE / JsonBroadcaster
Guilherme Delgado created a framework for triggering UI updates in Compose UI apps (and traditional iOS Xcode apps) from the command line, for rapid manual testing.
GitHub: Felix-Kariuki / MultiSelectCalendar
Felix Kariuki created a calendar composable that supports multiple date selections, not just a date range.
Other Interesting Links
- Gist: Mikkareem / GlassyImage.kt (blur-based glass effect)
- GitHub: GuilhE / KMP-ComposeUIViewController
- GitHub: mmoczkowski / Chart (Compose Multiplatform tiled map renderer)
Notable Releases
Compose WebView Multiplatform released 1.5.0 and 1.6.0 in rapid succession. Kevin Zou covers the 1.5.0 changes in this Medium post.
Maps for Compose released 4.0.0, 4.1.0, and 4.1.1 in a flurry of activity.
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?!?