Navigation between modules

In the first part of this post, we talked about the testing plans, modularization structure and release plans.

In this post, we will share how we solved the navigation problems and reducing the inter-module dependency for navigation.

Navigating between modules

If all our activities are part of a single app module, starting a new activity is as simple as

startActivity(this, A::class)

Although we do end up increasing the coupling by referring to the class A and this happens across our projects.

For starting a new screen from a different module we had 2 approaches,

  1. Each feature module specifies it’s own navigator interface using which other features modules can start the activities of a different module. …

Reducing build times by 60%

A very late post about modularization indeed, and hopefully it will help someone on their way on modularization of monoliths and help them reduce their build times.

The context

2 years back, We started unifying our multiple partner apps into one single app using the best available software engineering principles we had learnt.
Practo Pro would be our one single app for all our partner use cases. The features focused on presence management on Practo, practice management, online consultations, leads dashboard for our partners.

We organised our codebase features in packages in one single monolith app module. And with time as we added more features, we also added more classes, more utils, more libraries, more resources and eventually a lot more minutes to our build times. …


Image for post
Image for post

TLDR; We created an easy to use wrapper on top of exoplayer api and made it lifecycle aware. Find the source code here

For a recent feature, we needed to add audio streaming support to our application.

Media playback isn’t the most complex topic out there and one can easily start with Mediaplayer APIs.

And well for local media files it works really well, except for a few device-specific issues, or when we have to work on managing states (A little complex), also most of the MediaPlayer updates are tied to the OS update.

The alternative to MediaPlayer is Exoplayer a `powerful` media playback library by Google which can be easily customised, ships with our application and can be updated through the play store. Exoplayer also happens to be the defacto suggested library for media playback on Android. …


In the first part of the series, we talked about the dagger annotations and how they are useful in our projects.

In the second part we will look at how we can use Dagger 2 to provide dependencies in our mobile apps.

Add following lines to app build.gradle file

  1. The plugin kotlin-kapt (Kotlin Annotation Processor) is required for processing the kotlin annotations.
  2. The first dependency is from dagger required for annotations and other internal functionalities.
  3. The second dependency is our dagger compiler, which is required to process our dagger based annotations and generate the code.
  4. The third dependency is for Dagger android annotations. …


  • Architecture
    [ ]
    Object oriented Programming
    [ ] SOLID Principles
    [ ] Common Design Patterns
    [ ] Functional programming
    [ ] Working with pure functions and immutable data
    [ ] Dependency Injection, and Inversion of control
    [ ] Architectural components
    [ ] Common architectures as MVP, MVVM
    [ ] Reactive Programming
  • Languages
    [ ] Java
    [ ] Kotlin
    [ ] Read Effective Java, and Kotlin in Action
  • Generating Code
    [ ] Annotation processing and generating code on fly.
  • Animations
    [ ]
    Physics based animations
    [ ] Activity and fragments animations
    [ ] Vector animations
  • Performance
    [ ]
    Constraint Layout
    [ ] Memory profiling
    [ ] Vector…


Image for post
Image for post

Dependency injection means giving an object its instance variables — James Shore

To sum up what it is

  • Providing dependencies to classes instead of class itself creating dependencies
  • A central/structured way of providing dependent objects/services.
  • Helps in Unit testing
  • Helps in writing reusable-modular-interchangeable code.

If you want to read more about DI, Follow the link

Dagger 2: Is the library which helps us in managing and providing dependencies for our app in a very efficient way. It builds an object graph of dependencies and creates/provides dependencies wherever they are required in the Object graph.

Setup

We will use IntelliJ CE with a gradle based project. …


So if your vector drawable has a lot of decimal point instructions without the leading 0. You will get a lint error as

This check ensures that vector paths are valid. For example, it makes sure that the numbers are not using scientific notation (such as 1.0e3) which can lead to runtime crashes on older devices.

I wrote a small python script to fix this in our project

Also checkout


Some of the IntelliJ shortcuts I use actively

cmd + ctrl + a — Open command panel

cmd + [ — Move back

cmd + ] — Move forward

cmd + shift + e — Show recently edit files

cmd + ctrl + g — Select all occurrences

cmd + 1 — Open project panel

cmd + shift + v — Show clipboard history

cmd + p — Show method parameters

cmd + shift + u — Change letter case

cmd + b — Go to implementation

cmd + option+ b — See all implementations

cmd + u — Super…


After Kotlin was made official by Google in the IO, we went ahead and gave it a shot for our Android app.

Pre: Our app is written in Java and uses Multidex.

So we decided to migrate one of our modules to Kotlin. Since existing modules are in Java, we had to call some part of the existing code.

Now, There happens to be this one class with a nested interface. The interface was never declared private.

We were calling this interface from our Kotlin code using SAM conversions.

Result: Our app crashed again and again with NoClassDefFound for MyClass$1

So, MyClass$1 was the anonymous inner class from SAM conversion, but for some reason it was not being loaded to primary dex file. …


Everyone has a set of resource to which we refer while making an application.

Here are few I use frequently

Material design guidelines help in finding the right specs and color combination. Best for developers who are just starting up and need design helps.

The asset studio by @romannurik is the best way to generate icons/drawables for my projects.

Need more material design icons here is an awesome website with many free material design icons.

Looking for any library, well Android Arsenal has a lot of them.

Still looking for more newest, os libraries, well @github is the way to go.

Useful for material inspired color palettes.

The detail guide to almost everything in Android.

Have any doubt, or want to learn more https://stackoverflow.com/questions/popular/android?show=today&sort=hot

Crashes or bugs, Fabric @twitter is the way.

These are the some most helpful tools, for my everyday development.

About

Rachit

#android @practo

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