jetc.dev Newsletter Issue #150
Published: 2023-01-24
This week, we look at borders and locales. We examine previews and paging, and we play with foldables and Relay. And we see some libraries for horizontal date pickers and bi-directional scrollable composables.
Note that the newsletter emails are switching the styling of code
from
Buttondown’s default to simple monospace. Some subscribers were running into
problems with dark theme compatibility with the original approach that used
a background and border.
Also, the newsletter site also has some long-awaited improvements:
-
A customized search tool, searching by individual entry rather than by entire issues
-
Rendering improvements on mobile browsers
-
A per-issue badge, for those of you who get featured here and want to add some newsletter bling to your article or repo! (many thanks to Alex Styl for the suggestion!)
Ooooo… What Did We Get?
Reviewing the release notes for the latest Jetpack Compose update!
androidx.compose.compiler:compiler:1.4.0
was released, mostly bringing
us Kotlin 1.8.0 support.
One Off the Stack, One Off the Slack
You’ve got questions. That’s understandable!
How Do We Change a Single Side’s Border?
The border()
modifier support changing the width of a border, but only on all sides.
What happens if you need borders with varying widths? See a couple of solutions,
including the use of drawBehind()
, in this week’s highlighted Stack Overflow
question.
How Do We Find Our Locale(s)?
Sometimes, we will need to have our composables react to the current locale (or locales)
selected by the user. What’s the best way to do that, given Android 13’s per-app
locale support, as well as the changes to support multiple locales in API Level 24?
See some suggestions in this week’s highlighted Kotlinlang #compose
Slack thread.
Composable Commentary
Posts, videos, and other new information related to Jetpack Compose!
Podcast: Android Developers Backstage on Subtext
Chet, Romain, and Tor had Siyamed Sinir and Sean McQuillan over to chat about text rendering, both in terms of platform APIs and Compose APIs.
Relay Leg 2: Tips and tricks
Kristen Halper returns, continuing an exploration of Relay for converting Figma designs to composables. Here, Kristen explores the scope of what Relay can convert (smaller = better), how it does the conversion (technically correct but sometimes not what you want), and more!
Side Effects Summary in Jetpack Compose
Vincent Tsen is back to talk about effects, an ever-popular and ever-confusing
topic in Compose development. Vincent looks at a few types of effects, along
with related functions like produceState()
, and helps explain when you use
them and why.
Medium: Jetpack Compose and Composable Preview
Tomáš Repčík takes a look at the ever-popular @Preview
animation and points
out some lesser-known capabilities, such as creating custom annotations to
apply the same previews across multiple composables without redundancy.
Medium: 5 things to know when using Paging + Compose
Teja Narayan Chirala explores how we can use Compose’s support for Paging 3 in different ways, including using it in grids, how to leverage Paging 3’s placeholder support with composables, implementing refresh and retry logic, and more!
Understanding foldable devices: Code your UI
Thomas Künneth is back, once again to talk about his (seemingly) favorite
topic: foldables. Thomas demonstrates how to use windowLayoutInfo()
and computeCurrentWindowMetrics()
from the Jetpack Window library to help us deal with folding displays (both
ones with continuous folding screens and ones divided by hinges), as well
as tablets and landscape mode.
Medium: Adapting Material Theming from Jetpack Compose to SwiftUI
Sometimes, you just have to do some work for iOS. It happens. In this post, Kashif Mehmood looks at Compose Material themes, what they are made of (colors, typography, etc.), and how those can map to equivalent concepts in SwiftUI.
Medium: Translating Objects along a Path (Part 2)
Nikhil Mandlik continues looking at animations, specifically how to animate
composables along a path. Nikhil’s approach uses onGloballyPositioned()
,
Path
, and PathMeasure
to apply a cubic bezier curve to move one (or more!)
composables from a start to an end position.
A comprehensive guide to Android runtime permissions using Jetpack Compose
Alex Styl returns, to help us deal with runtime permissions. Alex covers some basics of runtime permissions in general before diving into Accompanist’s runtime permissions library and showing us how to use it for both required and optional permissions.
Other Interesting Links
- Medium: Jetpack Compose Create My Own TextField
- Medium: Bouncing and Pulsating Icon Animation In Jetpack compose
- Jetpack Compose Slider (with Examples)
- Medium: Navigation in Jetpack Compose
- Medium: Jetpack Compose — Heterogenous list
- Medium: Reusability of Jetpack Compose Components
- Medium: Create Custom Pie Chart with Animations in Jetpack Compose
- Medium: How to force an image to draw outside of its boundaries in Jetpack Compose
- How to Display Base64 Data as Image in Android Jetpack Compose
- Medium: How to implement the shimmer effect using jetpack compose?
Resource Roundup
100% pure code!
GitHub: JoelKanyi / HorizontalCalendarView
Joel Kanyi brings us a HorizontalCalendarView()
composable, for showing a series
of dates in a horizontally-scrolling container, for users to use to select a date.
GitHub: chihsuanwu / compose-free-scroll
Chi-Hsuan Wu is working on a freeScroll()
modifier to allow you to add bi-directional
scrolling to a composable, as opposed to only horizontal or vertical scrolling.
GitHub: shamimcse1 / StarTablayout
Md. Shamim Hossain has created a StarTabLayout()
tabbed container, where tabs
are represented as StarTabItem()
objects with associated composables for the
tab contents.
GitHub: razaghimahdi / Compose-Loading-Dots
GitHub user razaghimahdi brings us a trio of composables for different forms of dots animations for use as loading states.
Other Interesting Links
- GitHub: usuiat / Zoomable (pinch to zoom)
- GitHub: LDRAlighieri / Composites Fiberglass (screens built from rows and columns)
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?!?