Code Monkey home page Code Monkey logo

watchgithub's Introduction

WatchGithub

An android MVP structure APP with RxJava, Dagger2 and GitHub v3 API.

References

https://github.com/googlesamples/android-architecture

- References to branch to todo-mvp, dev-todo-mvp-rxjava and todo-mvp-dagger
- Concept of data flow through cache, local and remote.

https://github.com/frogermcs/GithubClient
- Use GitHub API with retrofit.
- Concept of dagger @Subcomponent.

Features

  • The sample of Android MVP architecture using Dagger2 and RxJava.
  • The GitHub API requests are restricted to 60 per a hour.
  • Use 2 POJO model(User, Repository) classes with each 2 storages(local-remote & cache-remote).

Demo Video

ScreenShot
with Mobizen

Dependencies

Android Support Packages
Dagger2
RxJava
RxAndroid
RxBinding
butterknife

picasso
retrofit
sqlbrite

mockito
espresso

adapter-rxjava, converter-gson, timber and guava

Architecture

  • WatchGithub MVP Architecture
    ScreenShot

  • Dagger Object Graph ScreenShot

Activity

ScreenShot

[Local & Remote Storage]

Create  : - User can add new Github User clicking floating button.
          if user is not valid, snackbar is shown with warning.
          
Read    : - When app launched, all of users saved in local storage(SQLite) are updated with remote storage(GitHub API).
          - Aleary launched, users data is brought from local storage
          - Users are filterd into All User, Popular(have followers over 150), and User or Organization.
          - Also, you can search as typing the user login id.

Update/Delete  : - You can write user description(To find out who). It will place at the hint 'Go to setting..'.
                  The way writing is to click the set icon (looks like gear)
                  then, detail activity is launched, you can
                  update user's description
                  also delete user in local storage.

ScreenShot

[Cache & Remote Storage]

Create :  - User's repositories is cached by replacement policy of LRU.
          - When The capacity of cache is sufficient, 
          cache will save repositories data with user login id and requested last page number

Read :   - When view user's repositories, first of all try to read from cache.
          - If not placed in cache, request to GitHub server and save to cache.
          - When You scroll down over viewed repositories, request next repositories to GitHub server and save to cache.
          - Filtering is similar to User filter (ALL, Popular(starred over 500), 
          ORIGIN or FORK and Recently pushed(before 3days).

Update :  - Update is performed when requests repositories when the repositories are not placed in cache.

Delete :  - Cache is implemented with LinkedHashMap of Java, and follows the replacement policy of LRU.
          So, Least Rencently Used data is removed when save new data to cache in full capacity.

Test

[Android Test]

VIEW : Used espresso and Fake object for state verification.

[Test]

Presenter and Model : Used JUnit and Stub object implemented with Mockito for state verfication.
Presenter and Model : Used Mockito and Mock object implemented with Mockito for behaviro verification.

Articles

  1. Introduction to WatchGithub
  2. Construct MVP pattern with Dagger2
  3. Use sqlbrite using RxJava
  4. Use retrofit with RxJava
  5. Implement LRU Cache with LinkedHashMap and RxJava
  6. Implement filter with RxJava and sqlbrite
  7. Implement filter with RxJava and Cache
  8. Implement search with RxBinding and sqlbrite
  9. Implement scroll down when viewed data are end using retrofit and recyclerView onScroll
  10. Connect to local data(sqlbrite) with remote data(retrofit) using RxJava
  11. Connect to cache with remote data(retrofit) using RxJava
  12. TODO : androidTest and Test with espresso, junit and mockito

watchgithub's People

Contributors

nicholas-fwang avatar

Watchers

James Cloos avatar Alexander Urriola 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.