ProjectGuard: protect your project's dependency graph

As projects grow, so does their complexity. We slice our apps into modules, hoping to achieve clean architecture, faster build times, and better scalability. But with hundreds of modules, how do we prevent the dependency graph from turning into a mess? We’ve all seen it happen:

  • A new module is created and depends on a :legacy module for convenience, even though there’s a replacement already.
  • A :domain layer, which should be pure Kotlin, suddenly gets a dependency on :network or :database module
  • A library our team decided to replace months ago quietly slips back into a new module.

These occurrences accumulate over time, leading to technical debt and slower builds, depending on how big your dependency graph is. Even with code reviews, mistakes can always happen, and it’s always better to have some kind of automated check that verifies for consistency. To help solve this problem, I’m introducing ProjectGuard, a Gradle plugin that verifies that your project structure rules are being applied.

Read More

Buba Song

This weekend I managed to finally put together some of the improvised sections of a melody I’ve been playing for my son.

I hope I can some day play this together with him.

I’m releasing the sheet music here in case someone wants to play it as well and to help preserve it.

Read More

Exploring the game Peg Solitaire

This last Christmas, when I visited my grandfather, I saw this game I had gifted him a few years ago. I asked him if he had solved it, and to my surprise, he hadn’t found a solution yet. I remember seeing his notes, the strategies he came up with (back-tracking, segmenting the regions), a gentle reminder of how interesting the game is. I personally had also only solved it once, and since I enjoy solving problems with programming, why not coding a solution for it?

Read More

Carioca - Suite of Testing libraries for Android

This post celebrates the stable release of Carioca, a suite of testing libraries for Android that I’ve been working on since the last year.

This project is available here: https://github.com/rubensousa/Carioca

It contains 3 main component libraries:

  1. Instrumented test reports
  2. Hilt helper components
  3. Useful JUnit4 rules

In this post, I will briefly mention the set of libraries available. For more information about them, please check the website

Read More

DpadRecyclerView - A RecyclerView built for Android TV

When I first started working in Android TV in a project back in 2018, androidx was still a new thing and Leanback was the standard guide for building Android TV applications.

In fact, Leanback still is the recommended way by Google to build TV apps and the androidx libraries contain some helpers for TV UIs: https://developer.android.com/training/tv/start/start#tv-libraries

However, these libraries are too opinionated and not really flexible enough.

In this post I will go over the motivation for a new component for Android TV.

Read More

Using GitHub Packages for Android projects

GitHub has released GitHub Packages last year. You can now easily host your private libraries without subscribing to another service.

In this post, we’re going to setup GitHub Packages to publish an example Android library.

We’ll be following these steps:

  1. Creating credentials for accessing GitHub’s maven repository
  2. Publishing an Android library to GitHub’s maven repository using a Gradle plugin
  3. Installing an Android library in another project

The sample project is available on GitHub here: https://github.com/rubensousa/AndroidGithubPackage

Read More

A different raised button behavior

Since Material Design was introduced, Android has 3 main types of buttons:

  • Floating action buttons
  • Raised buttons
  • Flat buttons

According to the spec, the raised button definition is:

A typically rectangular material button that lifts and displays ink reactions on press.

But why should it lift? Does your finger work like a magnet? When you press any real button, the force you apply makes the button go down.

Read More