Clean architecture in Android (Jetpack Compose, Paging 3.0, Kotlin, MVVM) ーPart- 2

Farhan Tanvir
4 min readFeb 16, 2022

Nowadays Clean architecture is an essential part of Android development. So I believe every developer should know about it. I won't talk much about the importance and details of Clean architecture. Because this is the second part of this series. We will use this GitHub repository. If you did not read the previous part I suggest taking a look.

Show Me what we are Reading

It is a great app. Isn’t it?

You always talk Too much

Ok ok. Let’s start. First, we will see what is new in this part.

  1. Improved design (Or maybe deterioration 😃)
  2. Movie Details Screen
  3. Paging 3.0
  4. ROOM DB

TL;DR

  1. Add local data source (ROOM DB)in the data layer
  2. Add paging and RemoteMediatorin data layer
  3. Add use case in domain layer to interact
  4. Modify MovieRemoteDataSourceImpl to add paging and caching.

Adding ROOM DB

I think there is no introduction needed for ROOM DB 😃. I think it is a widely used Local database in android. We have added DB in data the module. Here all the DB-related operations will happen.

In MovieDao All the MovieTable related functionality will happen. In the getAllMovies() the function returns PagingSource which is used for paging.

--

--

Farhan Tanvir

Believes in learn by doing . Currently working as a software engineer. Love to share Knowledge. https://twitter.com/FarhanTanvirBD