This project is an Android application developed for an interview task. It fetches media coverages from a remote service and displays them in a paginated list. The app utilizes modern Android development practices and libraries such as Retrofit for network operations, Dagger Hilt for dependency injection, and Paging 3 for pagination.
- IDE: Android Studio Iguana | 2023.2.1 Patch 2
- Gradle Version: 8.4
- Android Gradle Plugin Version: 8.3.2
- Compile SDK: 34
- Min SDK: 24
- Target SDK: 34
To build and run the project locally, follow these steps:
- Clone the repository to your local machine.
- Open the project in Android Studio.
- Build the project using the provided Gradle configuration.
The project uses several third-party libraries for various functionalities. Here are the main dependencies:
- Retrofit: For making network requests.
- Dagger Hilt: For dependency injection.
- Paging 3: For pagination of media coverages.
- Coroutines: For asynchronous programming.
- AndroidX Libraries: Including LiveData, ViewModel, RecyclerView, etc.
- Other: sdp & ssp Libraries used for maintaining resolution across different screen sizes.
For a detailed list of dependencies and versions, refer to the build.gradle
file in the project.
- Media Coverage Display: Fetches media coverages from a remote service and displays them in a paginated list.
- Image Loading and Caching: Implements image loading and caching mechanism using a combination of LruCache and memory cache. It provides informative error messages or placeholders for failed image loads.
- Error Handling: Provides error handling for failed image loads, ensuring a smooth user experience.
- Dependency Injection: Utilizes Dagger Hilt for dependency injection to manage dependencies efficiently.
- No Third-Party Libraries: Implements image loading and caching mechanism without relying on any third-party libraries.
The application follows the following approach for image loading and caching:
- Check Cache Memory: It first checks if the image is available in the cache memory. If found, it directly loads the image from the cache.
- Local Path: If the image is not available in the cache memory, it checks if a local path for the image is available. If found, it loads the image from the local path.
- URL: If the image is not available in the cache memory or through a local path, it fetches the image from the provided URL.
The app primarily consists of the following components:
- MediaCoverageRepository: Responsible for fetching media coverages from the remote service.
- MediaCoverageViewModel: Manages the UI-related data and interactions, including permission status and media coverages data.
- MediaCoverageAdapter: Adapts the media coverages data for display in a RecyclerView.
- SquareGridRecyclerView: A custom RecyclerView implementation for displaying items in a grid layout with square aspect ratio.