Code Monkey home page Code Monkey logo

elmenus-assignment's Introduction

ElMenus-Assignment

Background

This is an android app which talk to two dummy Apis a food tags comes in pages the page has eight tags each of which has a list of of food items which comes from the scond api in a static list of items this app mainly consists of two activities one for tags and it's items and the other one for the item details.

Screenshots

Splash Normal View Item Details Offline and cache has no data Offline and cache has data Error loading selected tag items

Technical overview

  1. I used MVVM with the modern architecture components in the architecture of the app image and the new paging technology in the infinite tag list: alt because I'm using room the data layer handled in Room itself the data source and it's factory, I just implemented the Boundary Callback.
  2. The API retured name including the page number i.e. 1 - Pizza I beautified the name and make it configurable throw the constant in Constants file so the default names are beautified if you need to see the api names just change the constant to true in the file com.elmenus.assignment.constants.AppConstants make the variable value to false: SHOW_BEAUTIFIED_NAMES = false
  3. The connection state changes are observed be noted that there are different states in offline mode:
  • There is no cached data: you will see a dionsaur in this state after you getting online automatically we try loading data to get in this state make mobile offline in a fresh install and open the app
  • There is cached data: you will see a snack bar tells you you're offline and whenever you get connected it will disappear
  1. Error handling, I didn't handled the error well, but I made two basic error handling:
  • If there are a error in connecting or parsing data it will try up to 10 times to reconnect and get data
  • If any error occures including the offline state while loading the list of items (not tags) you will see error message with retry button
  • also if any loading of images errors occurred the error place holder image will be shown.
  1. There is always a room for improvments I like to begin with more test cases to cover more scenarios, also the item details needs some enhancements

Notes:

  • The Api needs a header of Content-Type to be Application/json which is only supposed to be needed in POST requests only, but it's seems it's removed as a condition in a request
  • There is a fast splash screen with default wait time of a half second The main activity is big a little bit due to ui handling including show/hide errors and progress bars and views
  • I named the app El-Menus with dash to be different from the elmenus app
  • Naming: I'm not familiar with this kind of apps, you might be confused of names,btw I considerd the tags as FoodTags and list of items as TagItems or SelectedTagItems ^_^

Libs:

  • Retrofit Used as RESTful client,also I made the ok http client loges the apis response in only debug builds!
  • Glide For loading and caching images
  • Anko Used in:
  1. Multithreading & Background Work e.g.
doAsync{
  .... coroutine to run in background thread
  uiThread{
  ....coroutine to run in main thread
  }
}
  1. Start activties e.g. startActivity<MainActivity>()
  • Room used to cache both of food tags and food items in a local sqlite database.

References

Paging Library

Anko

Room

Architecture components

Thank you! ๐Ÿ˜‰

elmenus-assignment's People

Contributors

mohammaddesouky avatar

Watchers

James Cloos 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.