Git Product home page Git Product logo

android-dagger-butterknife-mvp's Introduction

Android Dagger ButterKnife MVP

This project is part of a 3-part series about how to build Android applications using Dagger 2 with the Dagger Android extension, Dagger Android support extension, Butterknife, and Model-View-Presenter (MVP) pattern with support for @Singleton, @PerActivity, @PerFragment, and @PerChildFragment scopes.

A Larger Project

This project is a smaller, derivative of a larger project. One of the main purpose of this project is to showcase / walkthrough a specific portion of the larger project's architecture. Take a look at the following larger project for a more real-world example on how to apply Dagger Android (2.11), Butterknife (8.7), Clean Architecture, MVP, MVVM, Kotlin, Java Swing, RxJava, RxAndroid, Retrofit 2, Jackson, AutoValue, Yelp Fusion (v3) REST API, Google Maps API, monolithic repo project management with Gradle, JUNit 4, AssertJ, Mockito 2, Robolectric 3, Espresso 2, and Java best practices and design patterns.

https://github.com/vestrel00/business-search-app-java

Branches

There are 2 main branches:

  1. master
  • Uses regular Activity and Fragment classes with a minSdkVersion of 17.
  1. master-support
  • Uses AppCompatActivity and support Fragment classes with a minSdkVersion of 14. This branch is an extension of the master branch, containing all changes from master. Take a look at PR #49 for the main diff from master.

Why is the minSdkVersion of the non-support setup in master 17? Can it be lower?

There are 2 main reasons why the minSdkVersion of the non-support setup can only as low as 17.

  1. https://github.com/vestrel00/android-dagger-butterknife-mvp/pull/20/files#r133777223
  2. https://github.com/vestrel00/android-dagger-butterknife-mvp/pull/29/files#r133777242

Thus, the lowest minSdkVersion supported for the non-support setup in master is 17. It cannot be lower.

What about the minSdkVersion of the support setup in master-support? Can it be lower than 14?

No. The dagger.android.support API only supports minSdkVersion as low as 14.

Examples

This demonstrates dagger.android, Butterknife, and MVP setup using 3 examples:

  1. Activity with 1 fragment.
  2. Activity with 2 fragments.
  3. Activity with 1 fragment with 1 child fragment.

Walkthrough

Read the blogs for a complete walkthrough of this app:

  1. Creating a project, from scratch, using the new Dagger.Android (2.11) dependency injection framework with support for @Singleton, @PerActivity , @PerFragment, and @PerChildFragment scopes. ARTICLE
  2. Using Butterknife (8.7) to replace a lot of handwritten boilerplate view binding code. ARTICLE
  3. Restructuring the code to Model-View-Presenter (MVP) to increase testability, maintainability, and scalability. ARTICLE

License

Copyright 2017 Vandolf Estrellado

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.

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.