/dagger2-clean-mvp-example

Sample project with a basic approach to CLEAN architecture on Android

Primary LanguageJavaApache License 2.0Apache-2.0

Dagger2-CLEAN-MVP Example

Build Status

Sample project with the first steps of my approach to Android CLEAN architecture, based on elegant solutions from respected developers. Features a List of users, obtained from randomuser API. Some of the aspects covered on this project are:

  • Dependency Injection using Dagger2.
  • Elegant ListView RecyclerView implementation using Renderers.
  • View binding using Jake Wharton's ButterKnife 6.x (current is 8.x).
  • Image loading using picasso, round transformations using PorterDuff.
  • Creating an image cache with picasso.
  • Model-View-Presenter + Interactor + DataSource layers, with different DataSources:
    • a REST Api using retrofit
    • a local JSON file
    • a class generating mock instances
  • Code-style rules using checkstyle. This blogpost indicates how checkstyle has been imported
  • Android Unit testing using JUnit 4 and Mockito.
  • UI Testing using Espresso
  • Low-boilerplate MVP implementation using generics (splitted into Presenter / APresenter / APresenterImpl).
  • Travis CI integration including instrumentation tests ran on an AVD. see .travis.yml script

Screenshot

This project has taken the following talks, articles, and repos as inspiration (it wouldn't have been possible without them)

TODOs

  • A better Thread management to do heavier operations outside the UI Thread
  • RecyclerViews, Renderers2.0
  • More DataSources like parse, Google Cloud, Azure, protobuf...
  • Unit tests
  • UI tests
  • Refactor to add Repository layer
  • Refactor Presenter layer to make it testable with JUnit
  • Add retrofit2-based API layer, keeping the retrofit1 one
  • Redesign UI to a more attractive one

Developed By

Follow me on Twitter Find me on Linkedin

License

Copyright 2016 Olmo Gallegos Hernández

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Imagery

All icons & art were obtained from flaticon.com, an excellent resource for downloading icons under attribution. If you don't know it, I recommend you to have a look, and don't forget to credit the authors!