Image for post
Image for post
Koin & Xposed logos combined.

Hello everyone! 👋 In this story I will explain a simplified approach to dynamic features with Dependency-less Navigation & Koin. I will start by covering what dynamic features are & what changes are involved with the common project setup.

Dynamic Features

Dynamic Delivery is Google Play’s new way to distribute apps. It uses Android App Bundles (.aab) which is a way to defer APK generation and signing to Google Play on install. This allows the optimization of the APK built for your specific phone (removing unnecessary resources & hardware architectures).

Dynamic Feature Modules also take advantage of Dynamic Delivery, allowing dynamic app features to be installed & removed at a later stage using PlayCore API. …


Image for post
Image for post

Hello everyone! 👋 In this story I will show how to improve your Kotlin codebase with Detekt, a Kotlin Static Analysis Tool.

Detekt will analyze Kotlin code with multiple rule sets and flag the code that breaks any of its rules. Detekt improves the codebase by enforcing rule sets including complexity, naming, performance & potential-bugs among others.

When added to CI (in my case, CircleCI) it will also act as a safety net in case you try to merge code which contains Kotlin code smells.

Before starting: Make sure you have the latest Gradle (4.10.2 right now) in the gradle-wrapper.properties …


Image for post
Image for post

Hello everyone! 👋 In this story I want to explain how I used Koin, a Dependency Injection framework, in my Multi-Module Feature Project.

What is Koin?

A pragmatic lightweight DSL dependency injection framework for Kotlin.

Why Koin?

Koin is easy, simple & well documented. It is perfect for encapsulated feature/library modules.

Brief Intro

If you are not familiar with Koin at all I highly recommend Koin’s README. Koin’s Documentation is also very well explained and simple to follow.

If you are not familiar with feature modularization you can check my Intro to App Modularization (modules based on features, not the standard monolithic modularization with presentation, domain & data modules). …


Image for post
Image for post

Hello everyone! 👋 In this story I will show how to enforce the Kotlin Style Guide with Ktlint, a Kotlin Code Style Static Analysis Tool.

Ktlint will remove the work that involves following the Kotlin Style Guide.

When added to CI (in my case, CircleCI) it will also act as a safety net in case you try to merge code that isn’t following the Kotlin Style Guide.

Ktlint provides a built-in formatter task called ktlintFormat and it can also update your Android Studio formatting.

Using Ktlint will also save discussion time. From Ktlint’s GitHub.

No configuration. Which means no decisions to make, nothing to argue about and no special files to manage. …


Image for post
Image for post
The Lego Batman Movie

Hello everyone! 👋 In this story I want to give a brief introduction to App Modularization, some thoughts around it & first steps you can take to achieve it.

First of all, what is App Modularization?

App Modularization is the process of applying Modular Programming to our Android App.

Modular programming is a software design technique to separate functionality into independent, interchangeable modules, so that each contains everything necessary to execute a specific functionality.

We can achieve this through the creation of Feature Modules.

Why should I Modularize my app?

  • Faster build times.
  • Fine-grained dependency control.
  • Improve reusability across other apps.
  • Improves the ownership & the quality of the codebase.
  • Stricter boundaries when compared to packages. …


Image for post
Image for post
Difference between Data Flow & Dependency Rule

Hello everyone! 👋 In this story I want to explain Clean Architecture (with tested examples) & talk about the most common mistake when adopting it (the difference between Data Flow and Dependency Rule).

This story is the follow up after my latest medium Intro to App Architecture. Make sure to check it out if you are interested in what makes a good Architecture & why + how to achieve a more maintainable codebase.

Data Flow

Let’s start explaining Data Flow in Clean Architecture with an example.

Imagine opening an app that loads a list of posts which contains additional user information. …


Image for post
Image for post

Hello everyone! 👋 Today I want to talk about the importance of architecting our apps and the main concerns around it. 🤔

What makes a good Architecture?

Maintainability

This is the main benefit of architecting our apps and libraries. A maintainable project means that its codebase is easy to (RUDT) Read, Update, Debug & Test. ☮️

Fighting Technical Debt

Technical Debt is the price that our projects pay for the wrong decisions. This can affect 1 or multiple RUDT points. Resulting in a more complex and/or error-prone codebase. 👊

  • Good decisions can turn into bad ones with time. Don’t be afraid of change.

RUDT (read, update, debug & test) points → Extra notes:

Read: Read from an objective point of view. Don’t let your familiarness blur how readable something really is. …


Image for post
Image for post
❤️

Hello everyone! 👋 This story is aimed at anyone interested in Continuous Integration (CI). I will focus on how to implement CircleCI in any Android project.

Let’s begin with one important question. Why would we want to have CI in our projects?

Increase the speed of development while ensuring the quality of the code.

It also helps to avoid this kind of situation:

Image for post
Image for post
😠

To take full advantage of CI tools TESTING needs to be a first-class citizen. …


Image for post
Image for post

Hello everyone! 👋 In this story I want to share some light on how you can use ViewModel (Android Architecture Components) with Dagger 2 Injection.

If you aren’t familiar with ViewModel and LiveData I highly recommend my previous story: https://proandroiddev.com/the-death-of-presenters-and-the-rise-of-viewmodels-aac-f14d54b419a

Let’s start with a ViewModel with @Inject of a Use Case.

Adding @Inject to our ViewModels won’t work out of the box 😢. So how can we make our ViewModel figure out the dependencies?

By creating our own ViewModelFactory!

The above & adding this ViewModelModule to our Injector class is everything we need to do.

Remember to add any new ViewModels to your ViewModelModule.

To end with, our activity will have ViewModelProvider.Factory injected and it will be passed to the ViewModelProviders.of() method as the factory (second parameter).

Done! Our ViewModels with @Inject will now work. 💃

For @Inject with dynamic parameters read an interesting issue over here.

You can always check my sample project down here 👇

Remember to follow, share & hit the 👏 button if you’ve liked it! (:

GitHub | LinkedIn | Twitter


Image for post
Image for post

Hello everyone! 👋 In this story I will quickly go over ViewModel and LiveData from Android Architecture Components (AAC) and will present you with some perks you should consider.

First of all, why would we want to use AAC ViewModels with LiveData to ditch our beloved Presenters? ❤️

ViewModel preparing for the fight.

ViewModel survives rotation & other configuration changes.

ViewModel keeps running while the activity is on the back stack.

ViewModel is Lifecycle agnostic. You can override onCleared (to clear disposables for example) just before the ViewModel is about to get killed.

ViewModel promotes simple and concise code.

ViewModel promotes reactiveness based on state down to the view by letting the view observe the live data inside the view model. …

About

Mario Sanoguera de Lorenzo

Staff Engineer @Turo

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