This repository contains a source code for a sample client Android application. The main focus is to showcase the architecture approach that the author commonly uses during Android Software Development. App is based on Poke API and communicates via REST with PokeAPI service;
Please refer to Architecture Overview section for more architecture details.
Please note that this is not an official sample app.
Features
- Paginated list of Pokemons;
- Details screen with image and species;
- Portrait/landscape support;
- Data is persistent during configuration changes;
- Total Pokemons count;
- Loading states as the user scrolls up/down to load more items;
- Network connectivity validation;
- Network connectivity text on both (list and details);
- Dynamic background for image and species at Details screen;
- Long press on image action: shake animation and haptics feedback (vibration);
- Dark Mode Support.
Please check screenshots
folder for better understanding how these features look like.
In order to import, sync and build Android application you must meet the following requirements:
Your PC's local settings:
- At least Java 11 OpenJDK installed and configured;
- Latest Android Studio installed;
- At least Android SDK of API level 32 is downloaded;
- Android Emulator is created or physical device is connected.
To import the project follow instructions below:
- Clone this repository;
- Close active project in Android Studio if it is open;
- Select
File
->Open
-> Navigate topoke-android-client/app
and selectbuild.gradle
; - Wait until Android Studio synchronizes the project, Gradle Plugin, and all dependencies successfully. It will take some time.
- Build the project.
If all the steps pass successfully, you can proceed to How to run the application section. Otherwise, check troubleshooting section.
Project is implemented on top of Clean Architecture and MVVM pattern. Project structure is organized by layers (android libraries):
- app
- core:
- data
- system
- ui
- domain (business layer)
- features:
- pokemons
- pokemondetails
The multi-module structure provides a clear separation of concerns as well as decouples UI from business and data layers. Each feature includes only the components it needs by adding required dependencies.
Unit tests
The data layer contains Unit Tests that cover Retrofit's API Service with requests.
Navigate to core/data/src/test
to view and run tests on your machine.
- Kotlin
- Kotlin Coroutines/Flow
- Hilt for dependency injection
- Paging 3 library
- Retrofit/OkHttp, Gson
- AndroidX tools
- Ktx extensions
- Glide for image processing
- MockWebServer for testing API calls
- If you import the project in other way than using
app/build.gradle
file, it will fail to finish successfully. You'll need to clone this repository again; - In case your Java SDK does not meet the requirements above, Gradle Plugin will fail to import all the dependencies, especially those that use newer versions of Gradle plugins.
The project is already configured to run the app in release mode.
- Navigate to
Build Variants
and selectrelease
configuration forapp
module. It will be applied automatically to all other modules. - Select
Run
and wait until the build finishes and .apk file is installed. - Play with the app.
This repository contains release.keystore
file and signingConfigs
with release keys for testing purposes.
Please note that uploading app's keys and keystore file into the repository is absolutely not recommended for typical Android apps and must be avoided.