📱 Pokedex App built with MVVM pattern using Jetpack Compose, Coroutines, Retrofit and Retrofit
- Minumum SDK Level: 21
- 100% Kotlin
- Architecture
- MVVM Pattern: Industry-recognized software architecure pattern supported by Google
- Jetpack Compose: Modern toolkit for building Android user interfaces using a declarative programming model
- ViewModel: Exposes data streams as a state holder
- Hilt: Dependency injection library built on top of Dagger benefit from the compile-time correctness, runtime performance, scalability, and Android Studio support
- Coroutines: Concurrency design pattern provided by Kotlin
- Retrofit: Type-safe REST client for Android, Java and Kotlin developed by Square.
- OkHttp : 3rd party library sending and receive HTTP-based network requests built on top of the Okio library
- GSON: Java library that can be used to convert Java Objects into their JSON representation
Pokedex demonstrates MVVM architecture by separating multiple app components into two main layers - UI and Data. Following the core Android design principles, the app is scalable, maintainable and testable.
- Architectural Principles
- Separations of concerns
- Drive UI from data models
- Single source of truth
- Unidirectional Data Flow
Pokedex App follows the unidirectional data flow by adapting architectural layering. The app responds accordingly to user events and update ui states.
UI layer displays the application data and serves as the primary point for user interactions. Whenever the app data changes, the UI should update to reflect changes made by either user interaction or external input.
- The main activity hosts the navigation controller and navigates through two screens - PokemonListScreen and PokemonDetailScreen depending on user interactions.
- PokemonListViewModel requests data to the data layer and PokemonListScreen updates UI observing states held by ViewModel.
- PokemonDetailViewModel is responsible for fetching pokemon details and updates states for PokemonDetailScreen.
Data layer is reponsible for containing application data and business logics. The data layer is consisted of repositories and data sources. It is important to keep each repository as a single source of truth.
- PokemonRepository is a single source of truth and requests data from the remote data source.
- PokemonRepository requests network responses to PokeAPI server using Retrofit library.
Pokedex uses PokeApi for fetching JSON object from the server. PokeApi provides a full RESTful API linked to an extensive database detailing everything about the Pokémon main game series.
This project was built to understand how to build a clean architecture Jetpack Compose app using differnt types of Android libraries.