jetc.dev Newsletter Issue #157
Published: 2023-03-21
This week, we look at code organization, custom layouts, and text entry in Wear Compose. We also peek at a preference UI and a custom switch implementation.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
Unfortunately, the Linen archive of Kotlinlang Slack is somewhat broken
as I prepare this newsletter, so I will not have a highlighted #compose
Slack post 😞. Also, if you use Kotlinlang Slack, note that they created
a separate #compose-android
channel, so #compose
can be limited to general
Compose and Compose UI questions.
Why Do We Lose Weight?
Weight on a Row()
needs to be applied to the direct children of the row…
even if those children are not the actual UI elements that you might think
need the weight. See how AnimatedVisibility()
can break your weight
expectations in this week’s highlighted Stack Overflow question.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Video: Compose Layouts and Modifiers: Live Q&A - MAD Skills
Google’s Chris Arriola, Andrei Shikov, Simona Stojanovic, and Jolanda Verhoef spent about 45 minutes taking Compose UI questions, ranging from when it makes sense to create a custom layout to the state of experimental Compose features.
Organize your Views: Jetpack Compose edition
Marco Gomiero walks through one possible way of organizing your Navigation for Compose code,
including how to have a simpler NavHost()
and how to structure the screens that
you navigate to.
Custom Compose Layouts
Beatrice Kinya explores SubcomposeLayout()
, how it ties into the composition/layout/drawing
triad of phases, and when you might consider using it.
Medium: Infinite Scroll with Paginated API calls in Jetpack Compose
Medium user MathRoda examines how to detect when the user has scrolled to the bottom
of a LazyColumn()
, so you can load the next page of data from a paginated server
API.
Medium: Overlapping profile pictures with Jetpack Compose Modifier
A common UI pattern for social screens is having overlapping user avatars,
often with a circular crop. Baptiste Carlier explores how to implement that
sort of overlap effect, creating some custom modifiers (like circleCrop()
)
along the way.
Medium: Typing on a Tiny Screen
Entering text on a watch sucks. Entering text on a Compose UI app on a watch is
worse, because EditText()
does not appear to be available yet there. Katie
Barnett shows how to handle this the hard way, using RemoteInput
.
Jetpack Compose: Switch
Alex Zhukovich takes a deep dive into the Switch()
composable, including
what differs between Compose Material and Compose Material3 and how to test
composables that contain switches.
Medium: Jetpack Compose: Remember vs RememberSaveable
Morteza Taghdisi reviews the differences between ordinary remember()
and
rememberSaveable()
, including the benefits and limitations of the latter.
Other Interesting Links
- How to handle deeplinks using Jetpack Compose navigation
- Video: Developing Wear OS Apps with Jetpack Compose
- Medium: Compose Camp 2: Mastering Images in Jetpack Compose with Coil-Compose and Landscapist
- Medium: How to implement pagination in Realtime Database using Jetpack Compose?
- Medium: Custom Dynamic Form using Jetpack Compose: Making Form Creation Easy!
- Medium: Grammatical Inflection API-Android14
- Medium: Navigation in Jetpack Compose
- Medium: Multiple conditional modifier in jetpack compose
- Medium: Android Jetpack Compose Silly Mistakes
- How to Implement OutlinedButton in Jetpack Compose?
- Medium: Minimalism and State Management.
- Jetpack Compose — Auto Image Slider with Dots Indicator
- Medium: How write full stacks Apps with Kotlin (Springboot backend, Jetpack Compose Mobile)
Resource Roundup
100% pure code!
GitHub: markusressel / KutePreferences
Markus Ressel brings us a library for rendering a preference UI using Compose Material3m
including a KutePreferencesScreen()
composable and associated KutePreferencesViewModel
.
GitHub: razaghimahdi / ImageSwitch
GitHub user razaghimahdi shows us an ImageSwitch()
composable that uses an
image for the track portion of a switch.
Gist: bagus2x / ExoPlayerState.kt
Tubagus Saifulloh shows some Compose snippets for pausing ExoPlayer playback
when the activity is paused, then resuming playback when the activity is resumed,
via a rememberExoPlayerState()
composable.
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?!?