Android Developers
Published in

Android Developers

Illustration by Virginia Poltrack

Suspending over views — example

The problem

Episode expanding (20% speed)
Wrong item expanding (20% speed)

Ideal solution

The ideal result (20% speed)

Coroutines to the rescue 🦸

MotionLayout.awaitTransitionComplete()

Adapter.awaitItemIdExists()

RecyclerView.awaitScrollEnd()

Final result

Solution, broken down into steps (20% speed)

Break the callback-chains ⛓️

--

--

--

Articles on modern tools and resources to help you build experiences that people love, faster and easier, across every Android device.

Recommended from Medium

How to Create a Custom image as a rotating Progress Bar Kotlin?

Noobs approach to Android Pentesting- Nullcon Xtreme Android Hacking Training Experience

How To Use RecyclerView in Android

Navigation Architecture: Android Jetpack

How to unit test your Flutter loading widgets

How to setup your own public API using a free cloud service

Convert JSON to Data Classes Using a Nice Android Studio Plugin

Broadcast Receiver in Kotlin — Beginner In-Depth Guide

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Banes

Chris Banes

Work @Google on #Android

More from Medium

Android Touch System — Part 1: Touch Functions and the View Hierarchy

Setting UserAgent in Android Webview

Converting Localized iOS Files For Android Codebase

Android Jetpack DataStore 101