SUBSCRIBE NOW
avatar
I always learn something just by skimming it that makes me want to bookmark the issue now and dig deeper later
SUBSCRIBE NOW
avatar
Keep up the good work with the newsletter šŸ’Ŗ I really enjoy it
SUBSCRIBE NOW
avatar
Dispatch is a must read for Android devs today and my go-to for keeping up with all things Jetpack Compose
SUBSCRIBE NOW
avatar
Dispatch has been my go-to resource as it's packed with useful information while being fun at the same time
SUBSCRIBE NOW
avatar
The content is light, fun, and still useful. I especially appreciate the small tips that are in each issue
SUBSCRIBE NOW
avatar
I truly love this newsletter ā¤ļøā€šŸ”„ Spot on content and I know there's a lot of effort that goes behind it
SUBSCRIBE NOW
avatar
Thanks for taking the time and energy to do it so well
JetpackCompose.app's Newsletter
avatar
I always learn something just by skimming it that makes me want to bookmark the issue now and dig deeper later
JetpackCompose.app's Newsletter
avatar
Keep up the good work with the newsletter šŸ’Ŗ I really enjoy it
JetpackCompose.app's Newsletter
avatar
Dispatch is a must read for Android devs today and my go-to for keeping up with all things Jetpack Compose
JetpackCompose.app's Newsletter
avatar
Dispatch has been my go-to resource as it's packed with useful information while being fun at the same time
JetpackCompose.app's Newsletter
avatar
The content is light, fun, and still useful. I especially appreciate the small tips that are in each issue
JetpackCompose.app's Newsletter
avatar
I truly love this newsletter ā¤ļøā€šŸ”„ Spot on content and I know there's a lot of effort that goes behind it
JetpackCompose.app's Newsletter
avatar
Thanks for taking the time and energy to do it so well

Dispatch Issue # 5

šŸ”¤ Learn about Zach Klippenstein, the Android connection to Wordle, creating presentations using Compose, running Android Studio on Android and @ComposableTarget
Vinay Gaba Profile Image
Vinay Gaba on July 20, 2024
Hero Image

Good Morning Friends! This is JetpackCompose.appā€™s Dispatch. The #1 Doctor recommended source for your weekly Android knowledge.

This is Issue # 5 and boy do we have a lot in store for you.

šŸ„‚ Tipsy Tip

Ever found yourself needing to ensure a Composable slot in your function is strictly for side-effects, with no sneaky UI logic creeping in? Youā€™re not alone. Most developers rely on trust and a bit of divine intervention to ensure these components are used correctly. But we can do better than that, right?

Luckily, thereā€™s a secret weapon in our toolkit: the @ComposableTarget("Empty") annotation. This little gem ensures that your Composable function doesnā€™t emit any UI, making it perfect for side-effects. Hereā€™s how you use it:

@Composable
fun MyCustomComponent(
	effect: @Composable @ComposableTarget("Empty") () -> Unit
) {...}

This annotation acts as a safeguard, ensuring that only non-UI Composables are passed to your slot. Remember, for this to trigger a build error, youā€™ll need to configure your Kotlin compile options to treat warnings as errors.

So, next time you need to keep your side-effects in check, ditch the divine intervention and leverage @ComposableTarget("Empty"). Your code (and your sanity) will thank you!

šŸ˜† Dev Delight

Never spend 6 minutes doing something by hand when you can spend 6 hours trying to automate it



I dont know, I really dont know

šŸ¤” Interesting tid-bits

  1. I recently stumbled on a new project called CuP, which is a tool to build presentations using Jetpack Compose! It's a new tool that lets you build presentations directly in Jetpack Compose, and let me tell you, the results are impressive. Try it yourself with this demo link.

    CuP offers smooth transitions, fun animations, multi-step slides, annotations and more. Imagine creating slides using Compose code! Iā€™m genuinely considering using CuP for my next talk. It's a fantastic tool for anyone looking to add a unique, custom touch to their presentations. Hereā€™s an example where the subtitle animates when you click once:

val title by Slide(
    stepCount = 2
) { step ->
    Text("Thank you for subscribing", fontSize = 24.sp)
    AnimatedVisibility(visible = step >= 1) {
        Text("I appreciate your trust!")
    }
}

Slides and Steps in CuP Overview mode to view all your slides + steps in a single view

  1. A new blog post on the Android Developers blog details the steps needed to add support for Predictive Back animation for screens using the classic View system. When I first read it, I thought it was a parody because it contains this monstrosity šŸ¤Æ

    This is absolutely bonkers! If you're an engineering manager, please ensure you're paying your Android developers more than their iOS counterpartsā€”they work too hard dealing with stuff like this. Thankfully, itā€™s a lot easier to manage in Compose.

Predictive Back Milestones Flow Diagram Not sure what to even add as a caption for this image

  1. Ever wondered why we call them "bugs" and "debugging"? It turns out, we owe the term to Grace Hopper. While working on a Mark II computer at Harvard University, her team found a moth stuck in a relay, causing an issue. They logged it as the "First actual case of a bug being found." What started as a joke became a staple in our coding vocabulary. ~80 years later, weā€™re still blaming those pesky insects for our coding mistakes šŸ˜…

Fried Bug Source

  1. It seems you can now run Android Studio directly on your Android device šŸ¤Æ! I havenā€™t tried it myself yet, but the video in this link looks promising. This setup allows you to build an Android app and run it on the same device.

    The reason this is interesting to me is because for the last decade, Iā€™ve wondered what the ideal UX might look like for programing on a mobile device. This development has rekindled my curiosity about that problem space. Have any of you tried coding on mobile? Any tools or setups you love? Iā€™d love to hear your thoughts!

  2. Zach Klippenstein (who also happens to be our featured developer this issue) has been writing some seminal pieces about Compose state. He recently wrote a blog post diving deep into how derivedStateof works. Normally, I like to give the golden nuggets here in the newsletter, but this post is so comprehensive that it deserves to be read in its entirety. Check it out, and learn more about Zach in one of the sections below ā¬‡ļø

Zach Klippenstein wrote another blog post on Compose State

šŸŽ„Ā Media Player

I found a hidden gem of a video recently, and a couple of minutes in, I was giddy with excitement because I knew it had to be in the next issue of Dispatch. Sharing these hidden gems is the whole point of writing this newsletter!

The video is from Figmaā€™s annual conference, Config, and features a talk by Josh Wardle, the creator of Wordleā€”the game that went super viral during the pandemic. Most people know that it was eventually acquired by The New York Times for a few million dollars, a great outcome for Josh. But hereā€™s the kicker: Josh created the original prototypes of Wordle on Android in 2013 and then forgot about it for the next six years šŸ¤Æ

Wordle prototype on Android The original prototype of Wordle on Android

During the pandemic, he picked it back up and built it for the web. One fascinating part of his talk was how, when he first built the prototype on Android, he kept stumbling on words he had never heard before, making the game less fun. To fix this, he created a mini game app for his partner where she would be presented with a word and she had to confirm if she knew the word. This reduced the word pool from 13,000 down to 2,500 5 letter words. This curated word list was eventually used in the final game that we all know and love and played a big role in itā€™s success.

There are plenty more fun stories in the talk, so I highly, highly recommend watching it. Believe me, itā€™s worth it!

This issueā€™s featured developer is engineer extraordinaire Zach Klippenstein who works at Google on Jetpack Compose itself and Iā€™ve had the honor of knowing him for the last few years.

Zack Klippenstein Business in the day, party in the night šŸŽ‰
The various moods of Zach

Whatā€™s your favorite Android Studio shortcut?

Ctrl+J: Shows a popup with the rendered kdoc for the thing under the cursor. Itā€™s the easiest way to view docs while coding, and also a quick way to verify your markdown formatting when writing kdoc.

What's your daily driver?

iPhone 15 Pro (šŸ¤Ø)

Who's your programmer hero?

Writing code and building software is just a skill that can be learned. ā€œHeroismā€ usually implies self-sacrifice for the greater good, which is not a scalable engineering practice nor a sustainable approach to work/life. That said, I think one of the most important programmers, historically, is Ada Lovelaceā€”the first programmer.

If you were allowed only 3 apps on your phone, which apps would it be and why?

iMessage: To stay in touch with friends and colleagues and organize my social life.
Apple Music: Because life would be unbearably boring without music.
Safari: Almost everything can be done through a web browser.

One project that you feel most proud about shipping

I spent all of last year and the first part of this year working with Halil Ozercan to redesign and rewrite the BasicTextField component for Compose, and Iā€™m pretty happy with how that turned out.

One project that you feel most proud about shipping

The snapshot system! Sometimes I write or talk about it.

Divider

If you found this useful, please share it on your companyā€™s Android specific Slack channel and/or your Twitter account. Your feedback is invaluable, and it helps me know that my efforts are making a difference. Otherwise, it feels like Iā€™m shouting into the void!

On that note, hereā€™s hoping that your bugs are minor and your compilations are error free.

Welcome to the VIP club
To read the rest of the post, subscribe and never miss an issue!
Already a subscriber? Use the same email id to login again.