A simple Android application built with modern Android development practices to load and display an image from a given URL.
- Load an image from a URL input by the user.
- Display a loading indicator while the image is being fetched.
- Display the loaded image on the screen.
- Clear the displayed image.
- Clean, single-activity architecture using Jetpack Compose.
This project follows the principles of Clean Architecture and utilizes a modern Android technology stack.
- UI: Jetpack Compose for building the UI declaratively.
- Architecture:
- MVVM (Model-View-ViewModel)
- Clean Architecture (UI -> Domain -> Data layers)
- Dependency Injection: Koin for managing dependencies.
- Asynchronous Programming: Kotlin Coroutines and Flow for managing background tasks and state.
- Modularity: The project is split into
:appand:imageLoadermodules to separate concerns. - Code Quality: ktlint is configured with a Git pre-commit hook to automatically format code and maintain a consistent style.
- Clone the repository.
- Open the project in Android Studio.
- Let Gradle sync the dependencies.
- Activate the Git Hook (Optional but Recommended): To enable automatic code formatting before each commit, run the following commands from the project root directory in your terminal:
cp pre-commit-hook.sh .git/hooks/pre-commit chmod +x .git/hooks/pre-commit
- Build and run the application on an emulator or a physical device.
The project is divided into two main modules:
:app: The main application module, containing the UI (Compose screens), ViewModel, and dependency injection setup for the application.:imageLoader: A library module responsible for the core logic of fetching and decoding an image from a URL. This module contains the data and domain layers.