Sample Jetpack compose project with MVVM architecture. Project includes Hilt for dependecy injection and Flow for emit the data and collect on UI.
- Jetpack Compose provides a native way to navigate through multiple composable components.
- With NavHost and NavController, you can push or pop you composables.
- All those fragment transactions, navigations and intents for activities are handle by Navigation.
- Graphs are wrapped in a single NavHost.
- It has declaration of the Routes.
- It is initialized at the root and passed to every graph.
- It is shared among them.
- Every screen have access to the navController.
- It provides API to move around the declared routes.
- Stack can be viewed as a history of the composables
- rememberNavController()
- navController.navigate("SecondScreen")
- navController.popBackStack()
- navController.popBackStack(inclusive: false)
- Inclusive parameter tells us if the targeted composable should be removed too
Nrup_Country.List_video.mp4
- Jetpack Compose
- MVVM architecture [ model-View-View Model]
- Hilt for DI
- Scaffold
- TopAppBar
- BottomBar [ NavigationBar ]
- BottomNavItem
- Navigation compose
- Retrofit
- OkHttp logging
- Gson converter factory
- Kotlin Coroutine
- Flow for emit and collect data
- Coil for Image loading
- Swipe Refresh in Home and Detail screen
- Adaptive Icon : Theme based Icon support
- Shimmer Effect (Theme based)
- Network Check
- Retry functionality
- App Bar
- Bottom Navigation Bar
- Show circular loader until API response come.
- Coil lib used to load the image
- Center crop the image
#1 | #2 | #3 | #4 |
---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![](https://private-user-images.githubusercontent.com/108717119/239871730-f661f4a1-414f-4b0e-b383-5aace70e757e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg5OTI1ODUsIm5iZiI6MTcxODk5MjI4NSwicGF0aCI6Ii8xMDg3MTcxMTkvMjM5ODcxNzMwLWY2NjFmNGExLTQxNGYtNGIwZS1iMzgzLTVhYWNlNzBlNzU3ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjIxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyMVQxNzUxMjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hZGY5MTk4NzU0MWYzOTE2NzY5MTdkYzdlYmNlYWEzZTUyOGJjMjFjNzBmNjAxZjljODgwZWRmZGZmYWU1Njc4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.JxaoFuO2JgGLFUFvJCbnqNL63rMW0HqZHXvU5pGwFzg)
#1 | #2 | #3 |
---|---|---|
![]() |
![]() |
![]() |
- compileSdk 33
- targetSdk 33
- Remove android:roundIcon="@mipmap/ic_launcher_round" from AndroidManifest.xml
- in res->drawable folder add one XML file name like adaptive_icon.xml
Add this line
<monochrome android:drawable="@drawable/adaptive_icon"/>
So, your anydpi-v26/launcher.xml looks like
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/adaptive_icon"/>
</adaptive-icon>
And make Vector drawable of your app icon with below constraints :
-
Make the canvas 108x108 px
-
Make the App Icon 48x48 px
-
Make sure, icon don't have shadow
-
To generate App icon to SVG (png to svg) use https://svg2vector.com/
-
To create adaptive icon, [48px x 48px] make your app icon black and white and make blank space as a transparent.
-
Use Paint.net software for that. Reference: https://www.getpaint.net/download.html
Reference https://developer.android.com/develop/ui/views/launch/icon_design_adaptive
https://developer.android.com/courses/android-basics-compose/course
-
Bottom Navigation in Jetpack Compose Android https://medium.com/geekculture/bottom-navigation-in-jetpack-compose-android-9cd232a8b16
-
A simple example of using NavHost and NavController https://tomas-repcik.medium.com/android-jetpack-compose-and-navigation-59f5ffa1219e
-
Putting composables into an appropriate structure https://betterprogramming.pub/android-jetpack-compose-and-nesting-navigation-f72df5a84691