/gallery-demo

Demo gallery MVVM app

Primary LanguageKotlin

Gallery (Demo)

Summary

Android app that retrieves a list of images from an end point and displays then on a grid allowing the user to click to enlarge the image and zoom.

Architecture

The application uses MVVM, dependency injection, repository pattern and other principles of clean architecture like use cases to control the flow of information between components and keep dependencies between modules to a minimum.

Its composed of only one activity containing the main navigation host and 2 fragments for the views

Libraries/Dependencies

  • Koin for dependency injection to achieve a decoupled more testable logic
  • Timber for improved logging capabilities
  • Navigation Component for navigation between fragments and static type safe arguments
  • Retrofit2 for retrieving remote data
  • Moshi for parsing server response json objects into java classes
  • okHttp Logging Interceptor for intercepting and logging all request and response made using retrofit
  • Glide for loading images efficiently into the views
  • ScrollGalleryView for showing image details and enabling zooming capabilities and thumbnail previews
  • Mockito for mocking classes in unit testing

Limitations/Known issues

  • As scroll view gallery library is unmaintained I had to downgrade glide library version for compatibility. To solve this is possible to write a custom image loader which also could include a custom url for thumbnails improving loading speeds. For the future local images represented now as strings should contain both the regular big url (_27.jpg) and the thumbnail url (_2.jpg) to optimize use in different parts of the app.
  • In case of network error the user would have to close and open again the app to reload the image. This can be solved adding pull to refresh component

Next steps

  • Build my own image loader to be able to use latest glide library
  • Support thumbnails in the image list and image details to improve loading speeds
  • Add pull to refresh component to the image list