A Deep Dive Into the Motion Transition With the new Update of the Material Design Component Library

Image for post
Image for post
Photo by Pau Casals on Unsplash

Google recently released an alpha update(1.2.0-alpha05) of its material components library that includes the implementation of The motion system which is a set of guidance for transition patterns between views.

The motion system categories transitions pattern of views and fragments/activities in 4 different types

  1. Container transform
  2. Shared axis
  3. Fade through
  4. Fade

Container transform

The container transform pattern is used when the transition includes a persistent container (buttons, lists or cards) that transitions into a detailed view.

Note: It’s a shared element transition but unlike the traditional shared element transition that works on a single shared element between both views container transformation changes bounds of start view to the bounds of end view which can be two different views on the same screen or a view on different fragment/activity.


Using ViewBinding with <include>, <merge>, adapters, fragments, and activities

Comparison between different view access type
Comparison between different view access type
Source: Google I/O 2019

Google introduced view binding in the What’s new in Android session at Google I/O 2019.

There is a brief talk about view binding in What’s New in Architecture Components, which compares view binding with existing solutions and further talks about why view binding is better than existing solutions like data binding or Kotlin synthetics.

For me, Kotlin synthetics was working fine but all the IDs reside in a global namespace so if you are using an ID with the same name and if you import the ID from the wrong layout, you’re going to get a crash because the ID is not part of the current layout and there is no way to know this in advance unless you run your app and go to that layout. …


Image for post
Image for post
Photo by Émile Perron on Unsplash

Android developers were happy when Google announced in-app update at Google I/0 2019 because we all wanted a way to tell our user if there is a critical update available that fixes some security flow. In-app update is also useful in some other cases like where you may have API v1 up and running on your server because 1.5% of users haven’t updated the application in months😂. So at work after knowing about in-app update we were quick to implement it so let’s dive right into it

There are two types of in-app updates available Immediate & Flexible.

  • Immediate approach is best for apps that require users to update and restart the app in order to continue using the app. Note: Immediate type doesn’t stop the user from using the ap user can still use the app after taping the cross at the top right of the fullscreen app update dialog. …


Image for post
Image for post

Remember, Java provides interesting ways to generate random numbers and Kotlin is no different. Until recently Kotlin didn’t have its own Random class but with the release of Kotlin 1.3 developers now have a whole new kotlin.random package so let’s see how it’s done !! There are 4 (or more) ways to do it-

  • Using kotlin.random package (Only for Kotlin 1.3 or above)
  • Using Kotlin shuffled() function on Ranges (For Kotlin 1.2)
  • Using java.util.Random()
  • Using ThreadLocalRandom class (Only for Java 1.7 or above)

Let’s look at them one by one -

Using Random class (Kotlin 1.3)

Kotlin is a multiplatform language and there was no common API to generate random number in Kotlin for all targets, there was no way to do that consistently in multiplatform code. As of 1.3, Kotlin comes with its own multiplatform Random generator. …


Previously in part one, we talked about different annotations available in ButterKnife. Please read part one to know the reason behind this article. We previously talked about Resource Binding and View Binding and left with @BindViews in which we can bind multiple views in a List or Array. There are three convenience methods for working with view list or array.

Let’s cut the Rope… (oops Crap) and start coding

I’ll bind some country names inside CheckBox[]. …


Ever since I started mobile development I used many libraries some of them are evergreen, A must for every Android project of mine and one of them is ButterKnife. I hope most of you’re familiar with it… and just in case you’re not, check it out on Github.

I am using ButterKnife for the last two years and have seen many projects on GitHub that use ButterKnife but one thing I noticed is that very few of those projects actually make use of this library. Even I wasn’t using its awesome features until recently. Most of us use it only for binding view (the findViewById Phobia) and for setting clicks (The SetOnClickListener Phobia ) on views. I’ve seen many people on StackOverflow using @OnClick from Butterknife at the same time using setOnLongClickListener() their buttons on the same activity. So what about other listeners? Bindings other than BindView? Like @OnTextChanged or @BindBitmap ? At the time of writing ButterKnife 8.8.1 has 24 different annotations that we can use. …

About

Somesh Kumar

Senior Software Engineer. Gamer & Programmer by heart.

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