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!
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!
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:
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.
We started off with Repositories, ViewModels and Fragments. The repositories would connect to data sources and expose LiveData
. The ViewModels would then expose the LiveData
to the UI Layer.
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:
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 @Preview
, 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 Project
Composable.
In these cases, you can’t use the…
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.
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…
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:
touchAnchorId
: The touch anchor to be used for tracking touchestouchAnchorSide
: The side on the touch anchor for touches to be tracked fromdragDirection
: The direction to be swiped inBefore Alpha 5, MotionLayout tracked touches on the whole MotionLayout and then used the provided touchAnchorId
to calculate the progress of the transition, based on…
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 CanvasCapabilities
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 FloatingActionButton
effect from the above video you most likely used a CoordinatorLayout
with a CoordinatorLayout.Behavior
.
MotionLayout makes doing this possible in an easier way requiring less code using KeyTrigger
— so let’s shoot!
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!
This post was featured in Android Weekly’s #290 issue
Material Design brings us Material Motion and the Android Framework gives us the possibilities to implement it in our apps. In this post I will write about implementing a Google-Play-like circular reveal effect with shared elements.
This post was heavily inspired by Antonis Tsagaris article “My FAB brings all the boys to the yard, damn right” and is specifically about implementing a circular reveal effect with shared elements and a CollapsingToolbarLayout
.
Apart from the obvious (it really is pretty and smooth)…
Android GDE & Android @snappmobile_io, working remotely from Hamburg, Germany. I like Kotlin, Animations and Rabbits! speakerdeck.com/jossiwolf