Giter Club home page Giter Club logo

android-test-assignment's Introduction

android-test-assignment

Template project for Shackle Android interview assignment

Instructions

Just run the project as would any other Android project, on any device or emulator. You may need to change the api key for your own, in Service.kt.

Architecture

  • MVVM architecture, with a repository layer to abstract the two data sources we're using.
  • Data source 1 is the remote API, which is accessed via Ktor. This is used for fetching results and details with the given parameters.
  • Data source 2 is the local database, which is accessed via Room. This is used for persisting previous searches.
  • The views follow the unidirectional data flow pattern, where the view model is the single source of for the search parameters and the user edits them in the grid. This is done using liveData and the coroutines. Events from the compose views are passed up and the view model updates the liveData, which is then observed by the views.
  • When the user hits search the navigation is quite simple. We just start a new activity with the search parameters as extras, and pop in on the nav stack.
  • We SearchActivity has it's own ViewModel which fetches the results from the repository and observes them. When the results are received they are passed to the view. We also save the search to the local database in this ViewModel
  • The models aren't exactly decoupled from each layer of the architecture (The entitiy is used in the database and the view model), but I traded off speed of delivery for perfect architecture here.

More comments

  • The API is quite slow so I added a loading spinner. With more time I could've explored making it faster by use more parrallel requests when fetching the details.
  • The API sometimes times out that's why I added the error message. Do re-run the search if you get an error.
  • Please see fig_1.0.png for architecture diagram and dependencies.

3rd party libraries used

  • Ktor for networking
  • Room for database
  • Coil for image loading
  • Hilt for dependency injection
  • Serialization for json parsing
  • Mockito for testing

android-test-assignment's People

Contributors

nfrolov-shackle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.