If you are working on a mobile app, chances are you need some form of navigation. Getting navigation right isn’t easy with many challenges at hand: back stack handling, lifecycles, state saving and restoration and deep linking are just some of them. In this post, we’ll explore the Navigation component’s support for Jetpack Compose and take a look under the hood!

Could I have chosen a more cliche photo? Probably not! Photo by Mick Haupt on Unsplash. Thanks, Mick!

Getting started!

Before getting started, we’ll add a dependency on , the Navigation component’s artifact for Compose support.

Let’s jump into the code!

First, we create and memoize a using the method. returns a which…


Recently, some clients asked us about our opinion on a newly released framework. To get a better idea of it, we ran an internal hack day — here’s how!
Stay tuned for the second part about our experiences with running Jetpack Compose hack day!

What’s a Hack Day?

Basically, a hack day is a one-day event where you can work on whatever. This is awesome for exploring a new technology or just doing something different once in a while! There are no rules except for that what you’re doing should probably be kinda related to your work, but it doesn’t have to be!

Why you should run a hack day

There…


If you haven’t, I recommend reading my other post about LiveData in Repositories.

We recently joined a new project with heavy LiveData usage, everywhere. The search for main thread blockages led us down a rabbit hole of removing a significant portion of our LiveData usages. Here’s how we migrated our Repositories from LiveData.

We were faced with a tough challenge: We had to migrate as quickly and smoothly as possible — there was no time for huge interruptions.
Having all our repositories and lots of helper classes use LiveData, this left us with two options:

  1. Make sure we get threading…


We recently joined a new project with heavy usage, everywhere. The search for main thread blockages led us down a rabbit hole of removing a significant portion of our usages.

Our Setup

We started off with Repositories, ViewModels and Fragments. The repositories would connect to data sources and expose . The ViewModels would then expose the to the UI Layer.

Our setup visualised.

Now — there are some issues with this, like the actually unneeded abstraction — but we won’t look at that here. Here’s what a typical Repository would look like:

I know what you think: This shouldn’t have been a…


This post was written for Compose 0.1.0.

Jetpack Compose is Google’s new Android UI Toolkit, currently in development. If you already want to have a look, you can play around with it and learn some exciting new things!

One area where Compose shines is previews. By annotating Composables with , you can preview the Composables inside Android Studio.

This is very useful when working with e.g. Design Systems, or you just want to explore different variants of your UI components. But often, your Composables will take parameters, like our Composable.

In these cases, you can’t use the…


How we used View Binding to replace Custom Views

In our codebase, we use a lot of custom views for reusability — but most of the time, a custom view was overkill. Here’s how we used View Binding to replace some of our custom views.

View Binding 101

If you are not familiar with View Binding yet, here is a great post by Sean McQuillan about it. In short: View Binding is a better alternative over Kotlin Synthetics, findViewById and good old Butterknife. It allows you to access the views in a layout in a type-safe and null-safe way.

For each XML layout, View Binding generates a binding object. For a layout…


A cute samoyed, Photo by Javier Esteban on Unsplash

MotionLayout Alpha 5 introduces touch regions for triggering transitions. This article explores the how and why.

Defining an OnSwipe or OnClick event which triggers the transition is fairly straightforward with just a few attributes being needed:

  • : The touch anchor to be used for tracking touches
  • : The side on the touch anchor for touches to be tracked from
  • : The direction to be swiped in
Touch Tracking without Touch Regions

Before Alpha 5, MotionLayout tracked touches on the whole MotionLayout and then used the provided to calculate the progress of the transition, based on…


I was told to add an image to the post, so here’s one Photo by Jf Brou from Unsplash. Bonus points since Samoyeds are some of the cutest dogs out there!

A piece of rather popular advice heard in software development is “favour composition over inheritance”. I won’t go into the details of why as there is an excellent chapter in “Effective Java” about it, as well as this nice article by Eric Lin.

This article explores how class delegation can be useful and how it works under the hood.

In our case, we had a custom view which should expose an interface looking like this:

Now it was time to create the implementation.

Of course, we don’t want to start putting logic into our view just for…


Just shy of the holidays, the ConstraintLayout team released a new alpha version of MotionLayout, introducing KeyTriggers (and more). If you haven’t used MotionLayout before, I recommend taking a look at Nicolas Roard series about it. But let’s get started!

Before MotionLayout, to achieve the effect from the above video you most likely used a with a .

Our old Layout
The CoordinatorLayout.Behavior

MotionLayout makes doing this possible in an easier way requiring less code using — so let’s shoot!

What is KeyTrigger?

allows you to have MotionLayout call a method on the specified target at a…


I recently gave a talk on Kotlin/JS, what it is and how you can use it at Kotlin User Group Munich.

You can find the recording online: https://twitter.com/KTUGMunich/status/1009489884430491648

As well as the slides: https://speakerdeck.com/jossiwolf/js-kug-munich

If you have any questions, please let me know!

Jossi Wolf

Android GDE & Android @snappmobile_io, working remotely from Hamburg, Germany. I like Kotlin, Animations and Rabbits! speakerdeck.com/jossiwolf

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