View profile

"We should always allow some time to elapse, for time discloses the truth."

StoicallyTyped Newsletter
Hello and welcome to the last newsletter of June 2021!
  • Android 12 has a new beta (2.1)
  • StateFlow‘s get a life(cycle)
  • and there’s a new Scabbard for your Dagger!
I hope your weekend was great and this week is even better! Enjoy!

👾 Fun Stuff
Android 12 Beta 2 is out now! Below you’ll find some recaps of what is new in Android 12 and also a glimpse at how the new Material You colors can look!
This thread by Mishaal Rahman goes deep into some subtle changes that might make it into the release version of Android 12.
Mishaal Rahman
Android 12 Beta 2 is here! Read about the announced changes here: https://t.co/Bulw2ruPeW

As always, here's a thread detailing the changes I've found while using the Beta:
Ron Amadeo demonstrates the new dynamic color changes of Android 12! I am very excited for this feature and hoping that it works with live wallpapers!
Ron Amadeo
The "Monet" color-changy stuff works in Android 12 now, and I would like to report that it is HOT. https://t.co/tqJPRcPzIm
Dylan Roussel has found a way to make app icons also respond to this color change technology! You can read more about the official Google apps that support this on Android Police.
Dylan Roussel
Soo, I did something again :)

The icon can be based on these colors. https://t.co/mRYXWYMOek
📚 TL;DRs
StateFlow’s have already become a real competitor with LiveData, however LiveData still has a few tricks up its sleeve
… unless?
LiveData is great at managing values for UI’s and doing so in a LifeCycle aware fashion. As Dinorah Tovar shows below, there are new APIs to help StateFlow with this functionality as well! Check out repeatOnLifecycle available in the androidx.lifecycle dependency.
Dinorah Tovar
So this is the change, addOnRepeat does not exist anymore and repeatOnLifecycle is the new way to do collection of flows in a safe way

FlowWithLifecycle keeps the same! https://t.co/HPLRxDUfU0 https://t.co/xrr9ThsHeY
Enable state saving & restoration
🛠 For Your Toolkit
arunkumar9t2/scabbard · 0.5.0
🧑‍💻 Interview Practice Question
When using Kotlin Coroutines, what is the difference between launch and async?
Respond to the question in a reply or the Twitter thread of this issue to have your answer included in next weeks issue!
⭐️ Answer to Last Week's Question
What are some ways to ensure that text in TextViews is accessible?
There are multiple pieces of making TextView‘s accessible and some will depend on specific use cases. So here are some that can be used as a minimum checklist!
Make sure Text and the background it is on has a high enough contrast to be easily read.
  • If the text is smaller than 18pt, or if the text is bold and smaller than 14pt, the color contrast ratio should be at least 4.5:1.
  • For all other text, the color contrast ratio should be at least 3.0:1.
DO NOT provide contentDescriptions for TextView’s. The text will already be read out by the accessibility service on Android
Make sure to use sp instead of dp when defining TextView’s. SP allows for users to change the size of text in your app from their phone’s system settings.
If you are making a TextView clickable, make sure to add enough padding to it so that it is easily tapped. The height and width should be at least “48 dp”.
Finally, there is actually an official Codelab that goes through how to use and check pieces of your app for accessibility! Check it out and let me know what you think!
💭 Stoicism x Tech
“We should always allow some time to elapse, for time discloses the truth.” - Seneca
Have you ever gotten stuck on a really hard problem? What did you do? Did you keep grinding until you found the solution? Did you take a break and then realize that it wasn’t so hard after all?
Sometimes the best debugging is when you are away from your desk. Today’s quote can be applied to development by focusing on taking that mental break. Your brain will still have the problem in mind, but by doing other things you can reset and come back fresh. You might even have a moment of epiphany where the solution seems to come to you!
Next time you are really stuck, take a step back, take a walk, get a snack. I guarantee it will help!
👋 Want to Contribute!?
Did I miss something great this week? Have an career question you want answered by the community? Send them to me on Twitter or reply to this email. I’d love to hear from you and chat!
Stay hydrated, have a great week and happy Pride month 🏳️‍🌈!
Don’t miss out on the other issues by Matt McKenna
Did you enjoy this issue? Yes No
Matt McKenna
Matt McKenna @himattm

Develop a thoughtful approach to software engineering. Focused on Android, applicable to all. Delivered Monday mornings to kick off your week.

You can manage your subscription here.
In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Created with Revue by Twitter.