A sample application to demonstrate how to use Jetpack Architecture Components in an Android Application following the Clean Architecture concepts.
This sample demonstrates how to use some of the Android Architecture Components available in Jetpack library.
In this sample I tried to follow the Clean Architecture principles and use some cool Android libraries.
The Application is divided in modules as displayed below:
The architecture flow is displayed below:
This screen displays all books saved on the repository (local or remote).
This screen display the details of a book selected in books list.
In this screen, the user can add a new book or edit an existing one.
The user must perform the login with their Google account to access the application.
This project is written in Kotlin and it's using the following libraries:
The project is compatible with Android Studio 3.5.2.
To run this application, you must have to create a Firebase Project and enable Google Authentication.
Afterwards, you must have to download the google_services.json
file from the firebase console and add it app
module root folder.
If you want to save data on Firebase Cloud Firestore, enable this database for your project in Firebase Console. Also enable the Firebase Cloud Storage.
To choose the data source you will save application data, just make the following change in the BooksRepositoryImpl.kt file.
internal class BooksRepositoryImpl(
// Change RoomLocalData to FBData interface
private val localData: RoomLocalData,
private val entityMapper: Mapper<BookData, Book>,
private val dataMapper: Mapper<Book, BookData>
) : BooksRepository {
...
}
And that's it! You're good to go.
This project is just a demo, but any feedback and/or PR's are appreciated! :)