diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4057b66
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,34 @@
+# Built application files
+*.apk
+*.ap_
+# Files for the ART/Dalvik VM
+*.dex
+# Java class files
+*.class
+# Generated files
+bin/
+gen/
+out/
+# Gradle files
+.gradle/
+build/
+# Local configuration file (sdk path, etc)
+local.properties
+# Proguard folder generated by Eclipse
+proguard/
+# Log Files
+*.log
+# Android Studio Navigation editor temp files
+.navigation/
+# Android Studio captures folder
+captures/
+# Intellij
+*.iml
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/libraries
+.idea/
+# Keystore files
+*.jks
+# External native build folder generated in Android Studio 2.2 and later
+.externalNativeBuild
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..2765586
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,46 @@
+apply plugin: 'com.android.application'
+android {
+ compileSdkVersion 27
+ buildToolsVersion "27.0.2"
+ defaultConfig {
+ applicationId "com.huitian.im"
+ minSdkVersion rootProject.ext.android["minSdkVersion"]
+ targetSdkVersion rootProject.ext.android["targetSdkVersion"]
+ versionCode rootProject.ext.android["versionCode"]
+ versionName rootProject.ext.android["versionName"]
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ multiDexEnabled true
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ lintOptions {
+ checkReleaseBuilds false
+ abortOnError false
+ }
+
+ packagingOptions {
+ exclude 'META-INF/DEPENDENCIES'
+ exclude 'META-INF/NOTICE'
+ exclude 'META-INF/NOTICE.txt'
+ exclude 'META-INF/LICENSE'
+ exclude 'META-INF/LICENSE.txt'
+ }
+
+
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile project(':dmvp')
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ testCompile 'junit:junit:4.12'
+}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..d60781b
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,33 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
+
+# 极光推送
+-dontoptimize
+-dontpreverify
+-dontwarn cn.jpush.**
+-keep class cn.jpush.** { *; }
+-dontwarn cn.jiguang.**
+-keep class cn.jiguang.** { *; }
diff --git a/app/src/androidTest/java/com/huitian/chen/oamanager/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/huitian/chen/oamanager/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..f98e3c0
--- /dev/null
+++ b/app/src/androidTest/java/com/huitian/chen/oamanager/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.huitian.chen.oamanager;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.example.chen.oamanager", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..43b143a
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/huitian/ui/activity/TestFragmentActivity.java b/app/src/main/java/com/huitian/ui/activity/TestFragmentActivity.java
new file mode 100644
index 0000000..66204e0
--- /dev/null
+++ b/app/src/main/java/com/huitian/ui/activity/TestFragmentActivity.java
@@ -0,0 +1,36 @@
+package com.huitian.ui.activity;
+
+import android.os.Bundle;
+import android.widget.FrameLayout;
+
+import com.chen.common.base.BaseActivity;
+import com.chen.common.di.component.AppComponent;
+import com.huitian.chen.R;
+
+import butterknife.Bind;
+
+/**
+ * @author :ChenYangYi
+ * @time :2018/4/3
+ * @desc :
+ */
+
+public class TestFragmentActivity extends BaseActivity {
+ @Bind(R.id.fl_container)
+ FrameLayout flContainer;
+
+ @Override
+ public int getLayoutId() {
+ return R.layout.activity_fragment;
+ }
+
+ @Override
+ public void initData(Bundle savedInstanceState) {
+
+ }
+
+ @Override
+ public void setupActivityComponent(AppComponent appComponent) {
+
+ }
+}
diff --git a/app/src/main/res/drawable-xhdpi/jpush_notification_icon.png b/app/src/main/res/drawable-xhdpi/jpush_notification_icon.png
new file mode 100644
index 0000000..74bae9b
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/jpush_notification_icon.png differ
diff --git a/app/src/main/res/drawable/deadpool.png b/app/src/main/res/drawable/deadpool.png
new file mode 100644
index 0000000..250af95
Binary files /dev/null and b/app/src/main/res/drawable/deadpool.png differ
diff --git a/app/src/main/res/drawable/ironman.png b/app/src/main/res/drawable/ironman.png
new file mode 100644
index 0000000..11d0a4e
Binary files /dev/null and b/app/src/main/res/drawable/ironman.png differ
diff --git a/app/src/main/res/drawable/shape_btn.xml b/app/src/main/res/drawable/shape_btn.xml
new file mode 100644
index 0000000..bcf87b1
--- /dev/null
+++ b/app/src/main/res/drawable/shape_btn.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_fragment.xml b/app/src/main/res/layout/activity_fragment.xml
new file mode 100644
index 0000000..3aee8a6
--- /dev/null
+++ b/app/src/main/res/layout/activity_fragment.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9a078e3
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..efc028a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..9bec2e6
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..34947cd
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..60782e5
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,30 @@
+
+
+ #208af2
+ #303F9F
+ #FF4081
+ #208af2
+ #F8F8F8
+ #D3D1D1
+ #403F3F
+ #72A3F4
+ #F66565
+ #E6A321
+ #2A2A2A
+ #393939
+ #91DFC5
+ #EE4949
+ #BEBCBC
+ #3383DD
+ #363636
+ #C7C4C4
+ #3383DD
+ #D3D1D1
+ #F7F4F4
+ #FD0001
+ #479AF7
+ #CACACA
+ #AFAFAF
+ #208af2
+
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..5fc82c2
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+ 11dp
+ 12dp
+ 14dp
+ 15dp
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..4094174
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,14 @@
+
+ 回天IM
+
+
+ - 你好!
+ - hi,你好!
+ - 今天去玩吗?
+ - 老司机又开车?
+ - 呵呵
+ - 去就去
+ - 可以
+ - gogogo
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..ccb0dbd
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/com/huitian/chen/oamanager/ExampleUnitTest.java b/app/src/test/java/com/huitian/chen/oamanager/ExampleUnitTest.java
new file mode 100644
index 0000000..6e597f8
--- /dev/null
+++ b/app/src/test/java/com/huitian/chen/oamanager/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.huitian.chen.oamanager;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..d4732be
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,25 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply from: "config.gradle"
+buildscript {
+ repositories {
+ jcenter()
+ google()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.3.3'
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ maven { url "https://jitpack.io" }
+ google()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/config.gradle b/config.gradle
new file mode 100644
index 0000000..53d4085
--- /dev/null
+++ b/config.gradle
@@ -0,0 +1,110 @@
+ext {
+
+ android = [
+ compileSdkVersion : 27,
+ buildToolsVersion : "27.0.3",
+ minSdkVersion : 15,
+ targetSdkVersion : 27,
+ versionCode : 1,
+ versionName : "1.0.0"
+ ]
+
+ version = [
+ androidSupportSdkVersion: "27.0.2",
+ retrofitSdkVersion : "2.3.0",
+ dagger2SdkVersion : "2.14.1",
+ glideSdkVersion : "4.5.0",
+ butterknifeSdkVersion : "8.8.1",
+ rxlifecycleSdkVersion : "1.0",
+ rxlifecycle2SdkVersion : "2.2.1",
+ espressoSdkVersion : "3.0.1",
+ canarySdkVersion : "1.5.4"
+ ]
+
+ dependencies = [
+ //support
+ "appcompat-v7" : "com.android.support:appcompat-v7:${version["androidSupportSdkVersion"]}",
+ "design" : "com.android.support:design:${version["androidSupportSdkVersion"]}",
+ "support-v4" : "com.android.support:support-v4:${version["androidSupportSdkVersion"]}",
+ "cardview-v7" : "com.android.support:cardview-v7:${version["androidSupportSdkVersion"]}",
+ "annotations" : "com.android.support:support-annotations:${version["androidSupportSdkVersion"]}",
+ "recyclerview-v7" : "com.android.support:recyclerview-v7:${version["androidSupportSdkVersion"]}",
+
+ //network
+ "retrofit" : "com.squareup.retrofit2:retrofit:${version["retrofitSdkVersion"]}",
+ "retrofit-converter-gson" : "com.squareup.retrofit2:converter-gson:${version["retrofitSdkVersion"]}",
+ "retrofit-adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava:${version["retrofitSdkVersion"]}",
+ "retrofit-adapter-rxjava2" : "com.squareup.retrofit2:adapter-rxjava2:${version["retrofitSdkVersion"]}",
+ "okhttp3" : "com.squareup.okhttp3:okhttp:3.9.1",
+ "okhttp-urlconnection" : "com.squareup.okhttp:okhttp-urlconnection:2.0.0",
+ "glide" : "com.github.bumptech.glide:glide:${version["glideSdkVersion"]}",
+ "glide-compiler" : "com.github.bumptech.glide:compiler:${version["glideSdkVersion"]}",
+ "glide-loader-okhttp3" : "com.github.bumptech.glide:okhttp3-integration:${version["glideSdkVersion"]}",
+ "picasso" : "com.squareup.picasso:picasso:2.5.2",
+
+ //view
+ "autolayout" : "com.zhy:autolayout:1.4.5",
+ "butterknife" : "com.jakewharton:butterknife:${version["butterknifeSdkVersion"]}",
+ "butterknife-compiler" : "com.jakewharton:butterknife-compiler:${version["butterknifeSdkVersion"]}",
+ "pickerview" : "com.contrarywind:Android-PickerView:3.2.5",
+ "photoview" : "com.github.chrisbanes.photoview:library:1.2.3",
+ "numberprogressbar" : "com.daimajia.numberprogressbar:library:1.2@aar",
+ "nineoldandroids" : "com.nineoldandroids:library:2.4.0",
+ "paginate" : "com.github.markomilos:paginate:0.5.1",
+ "vlayout" : "com.alibaba.android:vlayout:1.1.0@aar",
+
+ //rx1
+ "rxandroid" : "io.reactivex:rxandroid:1.2.1",
+ "rxjava" : "io.reactivex:rxjava:1.3.0",
+ "rxlifecycle" : "com.trello:rxlifecycle:${version["rxlifecycleSdkVersion"]}",
+ "rxlifecycle-components" : "com.trello:rxlifecycle-components:${version["rxlifecycleSdkVersion"]}",
+ "rxcache" : "com.github.VictorAlbertos.RxCache:runtime:1.7.0-1.x",
+ "rxcache-jolyglot-gson" : "com.github.VictorAlbertos.Jolyglot:gson:0.0.3",
+ "rxbinding-recyclerview-v7": "com.jakewharton.rxbinding:rxbinding-recyclerview-v7:1.0.1",
+ "rxpermissions" : "com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar",
+ "rxerrorhandler" : "me.jessyan:rxerrorhandler:1.0.1",
+
+ //rx2
+ "rxandroid2" : "io.reactivex.rxjava2:rxandroid:2.0.1",
+ "rxjava2" : "io.reactivex.rxjava2:rxjava:2.1.8",
+ "rxlifecycle2" : "com.trello.rxlifecycle2:rxlifecycle:${version["rxlifecycle2SdkVersion"]}",
+ "rxlifecycle2-android" : "com.trello.rxlifecycle2:rxlifecycle-android:${version["rxlifecycle2SdkVersion"]}",
+ "rxlifecycle2-components" : "com.trello.rxlifecycle2:rxlifecycle-components:${version["rxlifecycle2SdkVersion"]}",
+ "rxcache2" : "com.github.VictorAlbertos.RxCache:runtime:1.8.3-2.x",
+ "rxpermissions2" : "com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar",
+ "rxerrorhandler2" : "me.jessyan:rxerrorhandler:2.1.0",
+
+ //tools
+ "dagger2" : "com.google.dagger:dagger:${version["dagger2SdkVersion"]}",
+ "dagger2-android" : "com.google.dagger:dagger-android:${version["dagger2SdkVersion"]}",
+ "dagger2-android-support" : "com.google.dagger:dagger-android-support:${version["dagger2SdkVersion"]}",
+ "dagger2-compiler" : "com.google.dagger:dagger-compiler:${version["dagger2SdkVersion"]}",
+ "dagger2-android-processor": "com.google.dagger:dagger-android-processor:${version["dagger2SdkVersion"]}",
+ "androideventbus" : "org.simple:androideventbus:1.0.5.1",
+ "otto" : "com.squareup:otto:1.3.8",
+ "gson" : "com.google.code.gson:gson:2.8.2",
+ "multidex" : "com.android.support:multidex:1.0.1",
+ "javax.annotation" : "javax.annotation:jsr250-api:1.0",
+ "arouter" : "com.alibaba:arouter-api:1.3.0",
+ "arouter-compiler" : "com.alibaba:arouter-compiler:1.1.4",
+ "progressmanager" : "me.jessyan:progressmanager:1.5.0",
+ "retrofit-url-manager" : "me.jessyan:retrofit-url-manager:1.1.0",
+ "lifecyclemodel" : "me.jessyan:lifecyclemodel:1.0.1",
+
+ //test
+ "junit" : "junit:junit:4.12",
+ "androidJUnitRunner" : "android.support.test.runner.AndroidJUnitRunner",
+ "runner" : "com.android.support.test:runner:1.0.1",
+ "espresso-core" : "com.android.support.test.espresso:espresso-core:${version["espressoSdkVersion"]}",
+ "espresso-contrib" : "com.android.support.test.espresso:espresso-contrib:${version["espressoSdkVersion"]}",
+ "espresso-intents" : "com.android.support.test.espresso:espresso-intents:${version["espressoSdkVersion"]}",
+ "mockito-core" : "org.mockito:mockito-core:1.+",
+ "timber" : "com.jakewharton.timber:timber:4.6.0",
+ "logger" : "com.orhanobut:logger:2.1.1",
+ "canary-debug" : "com.squareup.leakcanary:leakcanary-android:${version["canarySdkVersion"]}",
+ "canary-release" : "com.squareup.leakcanary:leakcanary-android-no-op:${version["canarySdkVersion"]}",
+ "umeng-analytics" : "com.umeng.analytics:analytics:6.0.1"
+ ]
+
+
+}
diff --git a/dmvp/.gitignore b/dmvp/.gitignore
new file mode 100644
index 0000000..4877b12
--- /dev/null
+++ b/dmvp/.gitignore
@@ -0,0 +1,2 @@
+/build
+/*.iml
\ No newline at end of file
diff --git a/dmvp/build.gradle b/dmvp/build.gradle
new file mode 100644
index 0000000..74a4e7d
--- /dev/null
+++ b/dmvp/build.gradle
@@ -0,0 +1,65 @@
+apply plugin: 'com.android.library'
+
+
+android {
+ compileSdkVersion rootProject.ext.android["compileSdkVersion"]
+ buildToolsVersion rootProject.ext.android["buildToolsVersion"]
+
+ defaultConfig {
+ minSdkVersion rootProject.ext.android["minSdkVersion"]
+ targetSdkVersion rootProject.ext.android["targetSdkVersion"]
+ versionCode rootProject.ext.android["versionCode"]
+ versionName rootProject.ext.android["versionName"]
+ }
+ buildTypes {
+ release {
+ buildConfigField "boolean", "LOG_DEBUG", "false"
+ }
+ debug {
+ buildConfigField "boolean", "LOG_DEBUG", "true"
+ }
+ }
+}
+
+
+ext {
+ isLibrary = true
+ pomArtifactId = "Common"
+ pomDescription = "Common of android picker"
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+
+ //support
+ compile(rootProject.ext.dependencies["support-v4"]) {
+ exclude module: 'support-annotations'
+ }
+ compile(rootProject.ext.dependencies["appcompat-v7"]) {
+ exclude module: 'support-annotations'
+ exclude module: 'support-v4'
+ }
+ compile(rootProject.ext.dependencies["design"]) {
+ exclude module: 'support-annotations'
+ exclude module: 'appcompat-v7'
+ exclude module: 'support-v4'
+ }
+ compile rootProject.ext.dependencies["annotations"]
+
+ //retrofit和rxjava
+ compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3'
+ compile 'com.squareup.okhttp3:logging-interceptor:3.1.2'
+ compile 'io.reactivex:rxjava:1.0.1'
+ compile 'io.reactivex:rxandroid:1.0.1'
+ compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
+ compile 'com.squareup.retrofit2:adapter-rxjava:2.0.0-beta4'
+ compile 'com.jakewharton:butterknife:7.0.1'//view注解
+ compile 'com.jaeger.statusbaruitl:library:1.3.6' // 沉浸式状态栏
+ compile 'com.android.support:multidex:1.0.1'
+
+
+ compile rootProject.ext.dependencies["dagger2"]
+ annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
+}
+
+
diff --git a/dmvp/src/main/AndroidManifest.xml b/dmvp/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..8e4e839
--- /dev/null
+++ b/dmvp/src/main/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
diff --git a/dmvp/src/main/java/com/chen/common/app/App.java b/dmvp/src/main/java/com/chen/common/app/App.java
new file mode 100644
index 0000000..778f1f8
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/app/App.java
@@ -0,0 +1,35 @@
+package com.chen.common.app;
+
+import android.support.annotation.NonNull;
+
+import com.chen.common.di.component.AppComponent;
+import com.chen.common.di.component.DaggerAppComponent;
+import com.chen.common.di.module.AppModule;
+import com.chen.common.di.module.NetModule;
+
+
+/**
+ * Created by Chen on 2017/4/17.
+ */
+
+public class App extends BaseApplication implements IApp {
+
+ private AppComponent appComponent;
+ public static final String SERVICE_URL = "http://gank.io/api/";
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ appComponent = DaggerAppComponent
+ .builder()
+ .appModule(new AppModule(this))
+ .netModule(new NetModule(SERVICE_URL))
+ .build();
+ }
+
+ @NonNull
+ @Override
+ public AppComponent getAppComponent() {
+ return appComponent;
+ }
+}
diff --git a/dmvp/src/main/java/com/chen/common/app/AppManager.java b/dmvp/src/main/java/com/chen/common/app/AppManager.java
new file mode 100644
index 0000000..9ae8037
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/app/AppManager.java
@@ -0,0 +1,180 @@
+
+package com.chen.common.app;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.Context;
+
+import java.util.Stack;
+
+/**
+ * activity管理
+ */
+public class AppManager {
+ private static Stack activityStack;
+ private volatile static AppManager instance;
+
+ private AppManager() {
+
+ }
+ /**
+ * 单一实例
+ */
+ public static AppManager getAppManager() {
+ if (instance == null) {
+ synchronized (AppManager.class){
+ if(instance==null){
+ instance = new AppManager();
+ instance.activityStack = new Stack();
+ }
+ }
+
+ }
+ return instance;
+ }
+
+ /**
+ * 添加Activity到堆栈
+ */
+ public void addActivity(Activity activity) {
+ if (activityStack == null) {
+ activityStack = new Stack();
+ }
+ activityStack.add(activity);
+ }
+
+ /**
+ * 获取当前Activity(堆栈中最后一个压入的)
+ */
+ public Activity currentActivity() {
+ try {
+ Activity activity = activityStack.lastElement();
+ return activity;
+ } catch (Exception e) {
+// e.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * 获取当前Activity的前一个Activity
+ */
+ public Activity preActivity() {
+ int index = activityStack.size() - 2;
+ if (index < 0) {
+ return null;
+ }
+ Activity activity = activityStack.get(index);
+ return activity;
+ }
+
+ /**
+ * 结束当前Activity(堆栈中最后一个压入的)
+ */
+ public void finishActivity() {
+ Activity activity = activityStack.lastElement();
+ finishActivity(activity);
+ }
+
+ /**
+ * 结束指定的Activity
+ */
+ public void finishActivity(Activity activity) {
+ if (activity != null) {
+ activityStack.remove(activity);
+ activity.finish();
+ activity = null;
+ }
+ }
+
+ /**
+ * 移除指定的Activity
+ */
+ public void removeActivity(Activity activity) {
+ if (activity != null) {
+ activityStack.remove(activity);
+ activity = null;
+ }
+ }
+
+ /**
+ * 结束指定类名的Activity
+ */
+ public void finishActivity(Class> cls) {
+ try {
+ for (Activity activity : activityStack) {
+ if (activity.getClass().equals(cls)) {
+ finishActivity(activity);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * 结束所有Activity
+ */
+ public void finishAllActivity() {
+ for (int i = 0, size = activityStack.size(); i < size; i++) {
+ if (null != activityStack.get(i)) {
+ activityStack.get(i).finish();
+ }
+ }
+ activityStack.clear();
+ }
+
+ /**
+ * 返回到指定的activity
+ *
+ * @param cls
+ */
+ public void returnToActivity(Class> cls) {
+ while (activityStack.size() != 0)
+ if (activityStack.peek().getClass() == cls) {
+ break;
+ } else {
+ finishActivity(activityStack.peek());
+ }
+ }
+
+
+ /**
+ * 是否已经打开指定的activity
+ * @param cls
+ * @return
+ */
+ public boolean isOpenActivity(Class> cls) {
+ if (activityStack!=null){
+ for (int i = 0, size = activityStack.size(); i < size; i++) {
+ if (cls == activityStack.peek().getClass()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 退出应用程序
+ *
+ * @param context 上下文
+ * @param isBackground 是否开开启后台运行
+ */
+ public void AppExit(Context context, Boolean isBackground) {
+ try {
+ finishAllActivity();
+ ActivityManager activityMgr = (ActivityManager) context
+ .getSystemService(Context.ACTIVITY_SERVICE);
+ activityMgr.restartPackage(context.getPackageName());
+ } catch (Exception e) {
+
+ } finally {
+ // 注意,如果您有后台程序运行,请不要支持此句子
+ if (!isBackground) {
+ System.exit(0);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/dmvp/src/main/java/com/chen/common/app/BaseApplication.java b/dmvp/src/main/java/com/chen/common/app/BaseApplication.java
new file mode 100644
index 0000000..a8bb39e
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/app/BaseApplication.java
@@ -0,0 +1,42 @@
+package com.chen.common.app;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.support.multidex.MultiDex;
+import android.support.multidex.MultiDexApplication;
+
+/**
+ * APPLICATION
+ */
+public class BaseApplication extends MultiDexApplication {
+
+ private static BaseApplication baseApplication;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ baseApplication = this;
+ }
+
+ public static Context getAppContext() {
+ return baseApplication;
+ }
+ public static Resources getAppResources() {
+ return baseApplication.getResources();
+ }
+ @Override
+ public void onTerminate() {
+ super.onTerminate();
+ }
+
+ /**
+ * 分包
+ * @param base
+ */
+ @Override
+ protected void attachBaseContext(Context base) {
+ super.attachBaseContext(base);
+ MultiDex.install(this);
+ }
+
+}
diff --git a/dmvp/src/main/java/com/chen/common/app/IApp.java b/dmvp/src/main/java/com/chen/common/app/IApp.java
new file mode 100644
index 0000000..9611051
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/app/IApp.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2017 JessYan
+ *
+ * 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.
+ */
+package com.chen.common.app;
+
+import android.support.annotation.NonNull;
+
+import com.chen.common.di.component.AppComponent;
+
+
+/**
+ * ================================================
+ * 框架要求框架中的每个 {@link android.app.Application} 都需要实现此类,以满足规范
+ *
+ * Created by JessYan on 25/04/2017 14:54
+ * Contact me
+ * Follow me
+ * ================================================
+ */
+public interface IApp {
+ @NonNull
+ AppComponent getAppComponent();
+}
diff --git a/dmvp/src/main/java/com/chen/common/base/BaseActivity.java b/dmvp/src/main/java/com/chen/common/base/BaseActivity.java
new file mode 100644
index 0000000..883878f
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/base/BaseActivity.java
@@ -0,0 +1,187 @@
+package com.chen.common.base;
+
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.ActivityInfo;
+import android.os.Bundle;
+import android.support.annotation.ColorInt;
+import android.support.v7.app.AppCompatActivity;
+import android.view.Window;
+
+import com.jaeger.library.StatusBarUtil;
+import com.chen.common.R;
+import com.chen.common.app.AppManager;
+import com.chen.common.rx.RxManager;
+import com.chen.common.utils.CUtils;
+import com.chen.common.utils.ToastUitl;
+import com.chen.common.widget.LoadingDialog;
+import com.chen.common.di.component.AppComponent;
+
+import javax.inject.Inject;
+
+import butterknife.ButterKnife;
+
+/**
+ * Activity基类
+ */
+public abstract class BaseActivity extends AppCompatActivity {
+ @Inject
+ public T mPresenter; // 注入得到presenter的实例对象
+ @Inject
+ public RxManager mRxManager;
+ public Context mContext;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ doBeforeSetcontentView();
+ setContentView(getLayoutId());
+ ButterKnife.bind(this);
+ mContext = this;
+ setupActivityComponent(CUtils.obtainAppComponentFromContext(mContext)); // dagger2注入
+ this.initData(savedInstanceState);
+ }
+
+ /**
+ * 设置layout前配置
+ */
+ private void doBeforeSetcontentView() {
+ // 把actvity放到application栈中管理
+ AppManager.getAppManager().addActivity(this);
+ // 无标题
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ // 设置竖屏
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+ // 沉浸式状态栏
+ setStatusBar();
+ }
+
+ /**
+ * 默认沉浸式主题色,
+ */
+ private void setStatusBar() {
+ StatusBarUtil.setColor(this, getResources().getColor(R.color.colorPrimary), 0);
+ }
+
+ /**
+ * 默认沉浸式主题色,
+ */
+ private void setStatusBar(@ColorInt int color) {
+ StatusBarUtil.setColor(this, color, 0);
+ }
+
+ /*********************子类实现*****************************/
+ //获取布局文件
+ public abstract int getLayoutId();
+
+ //初始化view
+ public abstract void initData(Bundle savedInstanceState);
+
+ //这里提供 AppComponent 对象给 BaseActivity 的子类, 用于 Dagger2 的依赖注入
+ public abstract void setupActivityComponent(AppComponent appComponent);
+
+ /**
+ * 通过Class跳转界面
+ **/
+ public void startActivity(Class> cls) {
+ startActivity(cls, null);
+ }
+
+ /**
+ * 含有Bundle通过Class跳转界面
+ **/
+ public void startActivityForResult(Class> cls, Bundle bundle,
+ int requestCode) {
+ Intent intent = new Intent();
+ intent.setClass(this, cls);
+ if (bundle != null) {
+ intent.putExtras(bundle);
+ }
+ startActivityForResult(intent, requestCode);
+ }
+
+ /**
+ * 含有Bundle通过Class跳转界面
+ **/
+ public void startActivity(Class> cls, Bundle bundle) {
+ Intent intent = new Intent();
+ intent.setClass(this, cls);
+ if (bundle != null) {
+ intent.putExtras(bundle);
+ }
+ startActivity(intent);
+ }
+
+ /**
+ * 开启浮动加载进度条
+ */
+ public void startProgressDialog() {
+ LoadingDialog.showDialogForLoading(this);
+ }
+
+ /**
+ * 开启浮动加载进度条
+ *
+ * @param msg
+ */
+ public void startProgressDialog(String msg) {
+ LoadingDialog.showDialogForLoading(this, msg, true);
+ }
+
+ /**
+ * 停止浮动加载进度条
+ */
+ public void stopProgressDialog() {
+ LoadingDialog.cancelDialogForLoading();
+ }
+
+ /**
+ * 短暂显示Toast提示(来自String)
+ **/
+ public void showShortToast(String text) {
+ ToastUitl.showShort(text);
+ }
+
+ /**
+ * 短暂显示Toast提示(id)
+ **/
+ public void showShortToast(int resId) {
+ ToastUitl.showShort(resId);
+ }
+
+ /**
+ * 长时间显示Toast提示(来自res)
+ **/
+ public void showLongToast(int resId) {
+ ToastUitl.showLong(resId);
+ }
+
+ /**
+ * 长时间显示Toast提示(来自String)
+ **/
+ public void showLongToast(String text) {
+ ToastUitl.showLong(text);
+ }
+
+ /**
+ * 带图片的toast
+ *
+ * @param text
+ * @param res
+ */
+ public void showToastWithImg(String text, int res) {
+ ToastUitl.showToastWithImg(text, res);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (mPresenter != null)
+ mPresenter.onDestroy();
+ if (mRxManager != null)
+ mRxManager.clear();
+ ButterKnife.unbind(this);
+ AppManager.getAppManager().finishActivity(this);
+ }
+}
diff --git a/dmvp/src/main/java/com/chen/common/base/BaseFragment.java b/dmvp/src/main/java/com/chen/common/base/BaseFragment.java
new file mode 100644
index 0000000..6206b0f
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/base/BaseFragment.java
@@ -0,0 +1,174 @@
+package com.chen.common.base;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.chen.common.R;
+import com.chen.common.widget.LoadingDialog;
+import com.chen.common.di.component.AppComponent;
+import com.chen.common.rx.RxManager;
+import com.chen.common.utils.CUtils;
+import com.chen.common.utils.ToastUitl;
+
+import javax.inject.Inject;
+
+import butterknife.ButterKnife;
+
+/**
+ * des:基类fragment
+ * Created by xsf
+ * on 2016.07.12:38
+ */
+public abstract class BaseFragment extends Fragment {
+ protected View rootView;
+ @Inject
+ public T mPresenter;
+ @Inject
+ public RxManager mRxManager;
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ if (rootView == null)
+ rootView = inflater.inflate(getLayoutResource(), container, false);
+ ButterKnife.bind(this, rootView);
+ setupActivityComponent(CUtils.obtainAppComponentFromContext(getActivity())); // dagger2注入
+ this.initData(savedInstanceState);
+ return rootView;
+ }
+
+ //获取布局文件
+ protected abstract int getLayoutResource();
+
+ //初始化view
+ public abstract void initData(Bundle savedInstanceState);
+
+ //这里提供 AppComponent 对象给 BaseActivity 的子类, 用于 Dagger2 的依赖注入
+ public abstract void setupActivityComponent(AppComponent appComponent);
+
+
+ /**
+ * 通过Class跳转界面
+ **/
+ public void startActivity(Class> cls) {
+ startActivity(cls, null);
+ }
+
+ /**
+ * 通过Class跳转界面
+ **/
+ public void startActivityForResult(Class> cls, int requestCode) {
+ startActivityForResult(cls, null, requestCode);
+ }
+
+ /**
+ * 含有Bundle通过Class跳转界面
+ **/
+ public void startActivityForResult(Class> cls, Bundle bundle,
+ int requestCode) {
+ Intent intent = new Intent();
+ intent.setClass(getActivity(), cls);
+ if (bundle != null) {
+ intent.putExtras(bundle);
+ }
+ startActivityForResult(intent, requestCode);
+ }
+
+ /**
+ * 含有Bundle通过Class跳转界面
+ **/
+ public void startActivity(Class> cls, Bundle bundle) {
+ Intent intent = new Intent();
+ intent.setClass(getActivity(), cls);
+ if (bundle != null) {
+ intent.putExtras(bundle);
+ }
+ startActivity(intent);
+ }
+
+
+ /**
+ * 开启加载进度条
+ */
+ public void startProgressDialog() {
+ LoadingDialog.showDialogForLoading(getActivity());
+ }
+
+ /**
+ * 开启加载进度条
+ *
+ * @param msg
+ */
+ public void startProgressDialog(String msg) {
+ LoadingDialog.showDialogForLoading(getActivity(), msg, true);
+ }
+
+ /**
+ * 停止加载进度条
+ */
+ public void stopProgressDialog() {
+ LoadingDialog.cancelDialogForLoading();
+ }
+
+
+ /**
+ * 短暂显示Toast提示(来自String)
+ **/
+ public void showShortToast(String text) {
+ ToastUitl.showShort(text);
+ }
+
+ /**
+ * 短暂显示Toast提示(id)
+ **/
+ public void showShortToast(int resId) {
+ ToastUitl.showShort(resId);
+ }
+
+ /**
+ * 长时间显示Toast提示(来自res)
+ **/
+ public void showLongToast(int resId) {
+ ToastUitl.showLong(resId);
+ }
+
+ /**
+ * 长时间显示Toast提示(来自String)
+ **/
+ public void showLongToast(String text) {
+ ToastUitl.showLong(text);
+ }
+
+
+ public void showToastWithImg(String text, int res) {
+ ToastUitl.showToastWithImg(text, res);
+ }
+
+ /**
+ * 网络访问错误提醒
+ */
+ public void showNetErrorTip() {
+ ToastUitl.showToastWithImg(getText(R.string.net_error).toString(), R.drawable.ic_wifi_off);
+ }
+
+ public void showNetErrorTip(String error) {
+ ToastUitl.showToastWithImg(error, R.drawable.ic_wifi_off);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ ButterKnife.unbind(this);
+ if (mPresenter != null)
+ mPresenter.onDestroy();
+ if (mPresenter != null)
+ mRxManager.clear();
+ }
+
+
+}
diff --git a/dmvp/src/main/java/com/chen/common/base/BaseModel.java b/dmvp/src/main/java/com/chen/common/base/BaseModel.java
new file mode 100644
index 0000000..f10454d
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/base/BaseModel.java
@@ -0,0 +1,9 @@
+package com.chen.common.base;
+
+/**
+ * des:baseModel
+ * Created by xsf
+ * on 2016.08.14:50
+ */
+public interface BaseModel {
+}
diff --git a/dmvp/src/main/java/com/chen/common/base/BasePresenter.java b/dmvp/src/main/java/com/chen/common/base/BasePresenter.java
new file mode 100644
index 0000000..d09ee6d
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/base/BasePresenter.java
@@ -0,0 +1,39 @@
+package com.chen.common.base;
+
+import android.content.Context;
+
+import com.chen.common.rx.RxManager;
+import com.chen.common.utils.Preconditions;
+
+/**
+ * des:基类presenter
+ * Created by xsf
+ * on 2016.07.11:55
+ */
+public abstract class BasePresenter {
+ public Context mContext;
+ public E mModel;
+ public T mView;
+ public RxManager mRxManage = new RxManager();
+
+ /**
+ * 如果当前页面同时需要 Model 层和 View 层,则使用此构造函数(默认)
+ *
+ * @param model
+ * @param rootView
+ */
+ public BasePresenter(E model, T rootView) {
+ Preconditions.checkNotNull(model, "%s cannot be null", BaseModel.class.getName());
+ Preconditions.checkNotNull(rootView, "%s cannot be null", BaseView.class.getName());
+ this.mModel = model;
+ this.mView = rootView;
+ onStart();
+ }
+
+ public void onStart() {
+ }
+
+ public void onDestroy() {
+ mRxManage.clear();
+ }
+}
diff --git a/dmvp/src/main/java/com/chen/common/base/BaseView.java b/dmvp/src/main/java/com/chen/common/base/BaseView.java
new file mode 100644
index 0000000..f483b19
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/base/BaseView.java
@@ -0,0 +1,11 @@
+package com.chen.common.base;
+
+/**
+ * des:baseview
+ * Created by xsf
+ * on 2016.07.11:53
+ */
+public interface BaseView {
+ /*******内嵌加载*******/
+ void showErrorTip(String msg);
+}
diff --git a/dmvp/src/main/java/com/chen/common/di/ActivityScope.java b/dmvp/src/main/java/com/chen/common/di/ActivityScope.java
new file mode 100644
index 0000000..628ffdf
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/di/ActivityScope.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2015 Fernando Cejas Open Source Project
+ *
+ * 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.
+ */
+/**
+ * Copyright 2017 JessYan
+ *
+ * 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.
+ */
+package com.chen.common.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Scope;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * A scoping annotation to permit objects whose lifetime should
+ * conform to the life of the activity to be memorized in the
+ * correct component.
+ */
+@Scope
+@Documented
+@Retention(RUNTIME)
+public @interface ActivityScope {}
diff --git a/dmvp/src/main/java/com/chen/common/di/FragmentScope.java b/dmvp/src/main/java/com/chen/common/di/FragmentScope.java
new file mode 100644
index 0000000..a497ff4
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/di/FragmentScope.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2015 Fernando Cejas Open Source Project
+ *
+ * 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.
+ */
+/**
+ * Copyright 2017 JessYan
+ *
+ * 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.
+ */
+package com.chen.common.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+
+import javax.inject.Scope;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * A scoping annotation to permit objects whose lifetime should
+ * conform to the life of the activity to be memorized in the
+ * correct component.
+ */
+@Scope
+@Documented
+@Retention(RUNTIME)
+public @interface FragmentScope {}
diff --git a/dmvp/src/main/java/com/chen/common/di/component/AppComponent.java b/dmvp/src/main/java/com/chen/common/di/component/AppComponent.java
new file mode 100644
index 0000000..67fac54
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/di/component/AppComponent.java
@@ -0,0 +1,25 @@
+package com.chen.common.di.component;
+
+import android.app.Application;
+
+import com.chen.common.rx.IRetrofitManager;
+import com.chen.common.di.module.AppModule;
+import com.chen.common.di.module.NetModule;
+
+import javax.inject.Singleton;
+
+import dagger.Component;
+
+/**
+ * @author :ChenYangYi
+ * @time :2018/4/2
+ * @desc :拥有此接口的实现类即可调用对应的方法拿到 Dagger 提供的对应实例
+ */
+@Singleton
+@Component(modules = {AppModule.class, NetModule.class})
+public interface AppComponent {
+ Application application();
+
+ //用于管理网络请求层,以及数据缓存层
+ IRetrofitManager repositoryManager();
+}
diff --git a/dmvp/src/main/java/com/chen/common/di/module/AppModule.java b/dmvp/src/main/java/com/chen/common/di/module/AppModule.java
new file mode 100644
index 0000000..d663353
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/di/module/AppModule.java
@@ -0,0 +1,29 @@
+package com.chen.common.di.module;
+
+import android.app.Application;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+
+/**
+ * @author :ChenYangYi
+ * @time :2018/4/2
+ * @desc : 提供一些框架必须的实例
+ */
+
+@Module
+public class AppModule {
+ private Application application;
+
+ public AppModule(Application application) {
+ this.application = application;
+ }
+
+ @Singleton
+ @Provides
+ Application provideApplication() {
+ return application;
+ }
+}
diff --git a/dmvp/src/main/java/com/chen/common/di/module/NetModule.java b/dmvp/src/main/java/com/chen/common/di/module/NetModule.java
new file mode 100644
index 0000000..7b97319
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/di/module/NetModule.java
@@ -0,0 +1,89 @@
+package com.chen.common.di.module;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.chen.common.rx.IRetrofitManager;
+import com.chen.common.rx.RetrofitManager;
+
+import java.util.concurrent.TimeUnit;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+import okhttp3.Interceptor;
+import okhttp3.OkHttpClient;
+import okhttp3.logging.HttpLoggingInterceptor;
+import retrofit2.Retrofit;
+import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
+import retrofit2.converter.gson.GsonConverterFactory;
+
+/**
+ * @author :ChenYangYi
+ * @time :2018/4/2
+ * @desc :提供一些三方库客户端实例
+ */
+
+@Module
+public class NetModule {
+ /**
+ * 超时时间
+ */
+ private static final int TIME_OUT = 1000 * 20;
+ /**
+ * 域名
+ */
+ private String httpUrl;
+
+ public NetModule(String httpUrl) {
+ this.httpUrl = httpUrl;
+ }
+
+ @Provides
+ String provideHttpUrl() {
+ return this.httpUrl;
+ }
+
+ @Singleton
+ @Provides
+ Retrofit provideRetrofit(OkHttpClient okHttpClient, Gson gson) {
+ return new Retrofit.Builder()
+ .client(okHttpClient)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
+ .baseUrl(httpUrl)
+ .build();
+ }
+
+ @Singleton
+ @Provides
+ Gson provideGson() {
+ return new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").serializeNulls().create();
+ }
+
+ @Singleton
+ @Provides
+ OkHttpClient provideOkhttpClient(Interceptor logInterceptor) {
+ return new OkHttpClient.Builder()
+ .readTimeout(TIME_OUT, TimeUnit.MILLISECONDS)
+ .connectTimeout(TIME_OUT, TimeUnit.MILLISECONDS)
+ .addInterceptor(logInterceptor)
+ .build();
+ }
+
+ @Singleton
+ @Provides
+ Interceptor provideLogInterceptor() {
+ HttpLoggingInterceptor logInterceptor = new HttpLoggingInterceptor();
+ logInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
+ return logInterceptor;
+ }
+
+ @Singleton
+ @Provides
+ public IRetrofitManager provideRepositoryManager(RetrofitManager repositoryManager) {
+ return repositoryManager;
+ }
+
+
+}
diff --git a/dmvp/src/main/java/com/chen/common/rx/IRetrofitManager.java b/dmvp/src/main/java/com/chen/common/rx/IRetrofitManager.java
new file mode 100644
index 0000000..b5ba87d
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/rx/IRetrofitManager.java
@@ -0,0 +1,18 @@
+package com.chen.common.rx;
+
+/**
+ * @author :ChenYangYi
+ * @time :2018/4/3
+ * @desc : Retrofit管理,用于获取service接口实现类
+ */
+
+public interface IRetrofitManager {
+ /**
+ * 根据传入的 Class 获取对应的 Retrofit service
+ *
+ * @param service
+ * @param
+ * @return
+ */
+ T obtainRetrofitService(Class service);
+}
diff --git a/dmvp/src/main/java/com/chen/common/rx/RetrofitManager.java b/dmvp/src/main/java/com/chen/common/rx/RetrofitManager.java
new file mode 100644
index 0000000..1f435b7
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/rx/RetrofitManager.java
@@ -0,0 +1,48 @@
+package com.chen.common.rx;
+
+import android.app.Application;
+
+import java.util.HashMap;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+import dagger.Lazy;
+import retrofit2.Retrofit;
+
+/**
+ * @author :ChenYangYi
+ * @time :2018/4/3
+ * @desc : 根据传入的 Class 获取对应的 Retrofit service,单例
+ */
+@Singleton
+public class RetrofitManager implements IRetrofitManager {
+ private Lazy mRetrofit; // Lazy(懒加载)
+ private Application mApplication;
+ private HashMap mRetrofitServiceCache; // 保存service,防止重复创建
+
+
+ @Inject
+ public RetrofitManager(Lazy mRetrofit, Application mApplication) {
+ this.mRetrofit = mRetrofit;
+ this.mApplication = mApplication;
+ mRetrofitServiceCache = new HashMap<>();
+ }
+
+ /**
+ * 根据传入的 Class 获取对应的 Retrofit service
+ *
+ * @param service
+ * @param
+ * @return
+ */
+ @Override
+ public T obtainRetrofitService(Class service) {
+ if (mRetrofitServiceCache.containsKey(service.getName())) { // 如果map集合中存在改字节码对应的service对象,直接取出
+ return (T) mRetrofitServiceCache.get(service.getName());
+ } else { // map中不存在
+ mRetrofitServiceCache.put(service.getName(), mRetrofit.get().create(service));
+ return (T) mRetrofitServiceCache.get(service.getName());
+ }
+ }
+}
diff --git a/dmvp/src/main/java/com/chen/common/rx/RxBus.java b/dmvp/src/main/java/com/chen/common/rx/RxBus.java
new file mode 100644
index 0000000..b4cd7c4
--- /dev/null
+++ b/dmvp/src/main/java/com/chen/common/rx/RxBus.java
@@ -0,0 +1,127 @@
+package com.chen.common.rx;
+
+import android.support.annotation.NonNull;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import rx.Observable;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.subjects.PublishSubject;
+import rx.subjects.Subject;
+
+/**
+ * 用RxJava实现的EventBus
+ * Created by xsf
+ * on 2016.08.14:50
+ */
+public class RxBus {
+ private static RxBus instance;
+
+ public static synchronized RxBus getInstance() {
+ if (null == instance) {
+ instance = new RxBus();
+ }
+ return instance;
+ }
+
+ private RxBus() {
+ }
+
+ @SuppressWarnings("rawtypes")
+ private ConcurrentHashMap