Android Jetpack Compose with Retrofit Room Hilt in Kotlin
- Description
- Curriculum
- FAQ
- Reviews
During this course, we will create an Android application that will display photos taken by the rovers on Mars.
This app will use all the latest Jetpack technologies :
-
Compose (no more XML)
-
Hilt (Dependency injection library)
-
Room (Jetpack component to create a lite database)
-
Retrofit (Simple libraries to make network request)
-
Coroutines and Flow (To create asynchronous tasks and request our database)
You also use ViewModels with Jetpack.
With this example, you should be able to create an Android App to the industry standard.
Navigation with Jetpack Compose could be challenging, so we will create a simple example with 4 screens and a BottomNav to understand it. A Scaffold will be use to create the BottomNav.
Your productivity will be improve as Jetpack Compose is easier to write and reuse.
You will improve your knowledge of Kotlin. If you still use Java, this course is an opportunity to learn.
Compose is a new way to create a UI on Android. It is more concise and reusable. Therefore, it helps to develop faster Android applications.
In this app we will use Jetpack Compose Components from Materal3:
-
Card
-
LazyColumn
-
Column
-
Row
-
AsyncIamge (from the Coil lib to display an image from a server)
-
Text
-
Image
-
NavHost (to use navigation)
-
NavigationBar
-
NavigationBarItem
-
Box
We will also see how we can use a modifier to define padding.
-
1Project introductionVideo lesson
In this first part, we will explore the Android App that we will building during this course. We will also look at the NASA API used to get the data and image to be displayed.
-
2Get NASA Api key (optional)Video lesson
We will see how we can create a NASA API key on the api.nasa.gov website. This step is optional, using the DEMO_KEY is possible for this course.
-
3Basic understanding of Flow Kotlin coroutineVideo lesson
Thought a simple basketball example we will describe the observable pattern with Flow.
-
4Code organizationVideo lesson
Discover how the code will be organized into 4 layers:
Activity/Compose elements
ViewModels
Repositories
Data layers (Retrofit for API network requests and Room for local database)
We will describe the observation pattern to illustrate how the data are updated on the screen.
This lecture will feature some code examples to explain the relationship between layers.
-
5Quiz Code organization and Flow coroutineQuiz
Let's verify if you have understand concept of the project layer.
-
6Android Studio setupVideo lesson
-
22How to create a bottom navigationVideo lesson
-
23Create a bottom nav componentVideo lesson
During this lecture, we will add a bottom bar to choose between all the rovers photos and the saved photos.
In the resource, find the Android Studio project with the result expected at the end of the video. Also find the rover icon in the resources.
-
24How to use RoomVideo lesson
Reading of the Room documentation to understand how we will use it inside the Android application.
-
25Create a database and add dataVideo lesson
We will create the sqlite marsRover.db using Room. We will define one table for this database by creating the MarsRoverSavedLocalModel. In addition, we will create the DAO to access the data.
Then we will use Flow Combine to mix network data with local data. In order to display the rover photo with the status save/not save. We will also make the photo card clickable to change this status.
-
26Display data from the databaseVideo lesson
Create the saved screen accessible from the bottom bar with the saved photo that came from the database. In the downloadable material, you will find the Android project at the end of this stage.
-
27How to update colorsText lesson
This article describes how to create light and dark theme for our app. The next video is a live coding of it.
-
28Update colorsVideo lesson
Define a light and dark theme with personalized colors to create the unique Mars Rover Explorer Android application.
-
29Update fontsVideo lesson
Learn how to change to font of the app using Material3 theme.
-
30Create animation for the save iconVideo lesson
In this lecture, we will animate the save/unsave icon when the user saves or unsaves the photo. The animation will be a scale-in/scale-out type. We will also play with duration.
-
31Manifest Convertor Unit TestVideo lesson
-
32Manifest ViewModel Test with mockk and MainCoroutineRuleVideo lesson
In this lecture, we will create a MarsRoverManifestViewModelTest to test the MarsRoverManifestViewModel.
Mockk dependency will be added to mock a MarsRoverManifestRepo and control answers for this repo.
We will also add a MainCoroutineRule to use coroutines in our test.
In addition, we will refactor MarsRoverManifestViewModel to use the IoDispatcher in our coroutine.
-
33Manifest Repo TestVideo lesson
We will write tests for the MarsRoverManifestRepo and use mockk to predefine answers for the MarsRoverManifestService (success and error).
-
34Photo List ViewModel TestVideo lesson
We will use test with coverage to verify that we test all the lines in the MarsRoverPhotoViewModel.
-
35Photo Repo TestVideo lesson
In this video, we will write unit tests on the function that combines data from the Retrofit interface (network request) and the Dao interface (room database) into a single model.

External Links May Contain Affiliate Links read more