Cache the images using Memory and Disk Cache -
Setup App Development Environment
- Download and install Android Studio
- Download/clone this repository to a folder on your computer
- Start Android Studio, open your source code folder, and check if the Gradle build will be successful using the Build/Make Module "App". You might have to install the right Android SDK via Tools/SDK Manager first.
- Run ./gradlew from the root directory of the project you checkout to build all debug versions, this might take a while.
- If the build is successful, you can run the app by doing the following: click Run -> Run 'app'.
- Connect your phone or create a new virtual device following on-screen instruction
Overview: The main intention of this project is to use the traditional way of data handling/caching without using any third-party libraries. Displaying the images from Unsplash in a Staggered Grid. For demo purposes, we can request a maximum of 50 requests in an hour.
Features:
- Image Loading - Loads images asynchronously using traditional Handlers and Threads.
- Asynchronously load more images based on the scrolling behavior
- Save in Memory/Disk Cache - Saves the images in memory and/or disk based on the build config parameter CACHE_TYPE.
The values for cache type are like
- MEMORY - 1,
- DISK - 2,
- MEMORY_AND_DISK - 3
- If the image is read from disk, updating the same to the memory cache.
- Caching the images with maximum size and expiry time.
- Validating the expiry time (24 Hours) before returning the requested image from both memory and disk cache.
- Saving the images in the Disk cache by checking the available space in the cache.
- Added error handling for basic operations.
Advantages of caching
- Improved performance
- Improved responsiveness
- Reduce data usage
- Enhance user experience