Image for post
Image for post
Photo by Kaleidico on Unsplash

A lot of modern Gradle projects are starting as a monolith during the prototyping phase, but soon enough when the project has matured you start realising that a modularized project has a lot of advantages.

  • Caching
  • Cleaner architecture (in terms of separation of concerns)
  • Re-usability of same module, in other applications

Module creation

This is a pretty straight forward process in any Gradle project, but for the sake of the example let’s assume that we are using Android Studio here (IntelliJ based IDE for Android).

Through File -> New -> New Module we can create any kind of module from the list…


Creating Coroutines/Flow empowered UseCases

Image for post
Image for post
Photo by Kelly Sikkema on Unsplash

If you haven’t read the previous articles of these series, you can find them here:

Part 1 — RecyclerView adapter with ViewBinding

Part 2 — Creating ViewModels in an MVI architecture

In this article we will see how to create different types of UseCases that will be used in our ViewModels.

What is a UseCase?

A UseCase is a list of actions or event steps typically defining the interactions between a role (known in the Unified Modeling Language (UML) as an actor) and a system to achieve a goal. The actor can be a human or other external system. In systems engineering, use cases…


Creating ViewModels in an MVI architecture

Image for post
Image for post
Photo by NordWood Themes on Unsplash

If you haven’t read the previous article of these series, you can find it here:

Part 1 — RecyclerView adapter with ViewBinding

Now that we have created a base RecyclerView adapter in order to bootstrap lists, we need to see how we will fetch , transform and present the data of our screen.

Entering ViewModel

ViewModel is the Jetpack component that we will need to extend in order to host the orchestration of several other components. The orchestration of the other components will result in fulfilling our business goals.

Usually in a ViewModel we will need to make some API calls or…


RecyclerView Adapter with ViewBinding

Image for post
Image for post
Photo by Mike Lewis HeadSmart Media on Unsplash

I have been developing on Android since late 2011 and always remember that we wanted, since the early days, Google to be opinionated about the suggested architecture on Android :)

This indeed happened a few years later, with Jetpack’s Android Architecture Components, which introduced ViewModels. ViewModels is the VM part of a MVVM architecture and can also survive configuration changes on screens. ViewModels communicate with the UI through an observable stream implemented by LiveData.

The thing though, is that the community also needed a new way to make async API calls and Database operations (or generally off-main thread work) easier…


Automatically cancel running builds on the same branch, when a new commit is pushed

Image for post
Image for post
Image taken from: https://cloud.google.com/images/products/cloud-build/cloud-build.png

CloudBuild is a CI/CD offered by Google. At Workable’s Mobile department we made a proof of concept to check if CloudBuild fits our needs in order to be used for artifact (APK) building.

A complex project requires a lot of custom configuration in order to properly set it up and we were able to find most of them in the great CloudBuilders community repo.

Cancelling a running build

CloudBuild builds though come at a cost and depending on your budget and the machine type you use. …


Image for post
Image for post
Image taken from: https://bit.ly/32EDPVH

Our codebase at Workable’s Android app has grown over the years due to the wide variety of features we offer. As most of you already know, a single monolithic Android app is often one factor that contributes to slow build times.

One of the proposed ways of reducing build times, is to split the monolithic app module into smaller modules, that could be cached and compiled once. …


Image for post
Image for post
Image taken from ProAndroidDev

Android Studio 3.5 has reached beta and it was time to try it out as a daily driver in work. Especially with Project Marble having introduced so many bug fixes and performance improvements, that meant the benefits would have an immediate effect.

Android Studio 3.5 also includes a new version of “instant run” written from scratch. Since we had it disabled in order to avoid possible build issues with the previous implementation, it was time to give the new “instant run” aka “Apply changes”, a try.

The problem

After enabling “Apply Changes” we tried changing something and just pressing the “Apply Code…


Image for post
Image for post
Taken from https://cloud.google.com/blog/products/maps-platform/introducing-new-improved-places-sdks Courtesy of Google.

Context

Up until January 29, 2019 all Places functionality was part of Play Services. Since that day Google announced new Places SDKs for both Android & iOS platforms. (https://cloud.google.com/blog/products/maps-platform/introducing-new-improved-places-sdks). The deadline for the migration to new Places SDK, is July 29, 2019.

The new Places SDK brings in new methods replacing the previous ones, so this should be considered as a breaking change if you want to follow that path. However, there is a compat library released as well, which delegates all the calls on Location library from Play Services, to Places client.

In this article we will explore the migration…


Image for post
Image for post
An example of our testing pipeline

In our days, almost every project, is backed by a Continuous Integration system (aka CI). Either that is an Open Source project or a private repository in the organization of your company.

Why do I need a CI?

Well, CI is what will have your back, at any given time. We are engineers and we might make mistakes from time to time, but 99% of those times our mistakes could have been easily detected by the proper tools, running in our CI, for each PR or commit.

To give you a real life example, we were using .forEach on Map


Image for post
Image for post

Nearly a year and a half ago, Facebook released Litho as an Open Source project. Litho is an Android framework, which lets you define your UI in a declarative way. It immediately got my interest and I started getting my hands dirty with some examples and pet projects.

It was a nice experience getting in touch with Litho and its React-like nature, that was a first for me. The amount of interest in that new area, made me realise that I could dive a bit more into it, by also contributing to the project. …

Android GDE — Sr. Full-Stack Engineer (Mobile) @ Blueground — ex: Mobile Team Lead @ Workable

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