├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── inspectionProfiles
│ ├── Project_Default.xml
│ └── profiles_settings.xml
├── markdown-navigator
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── lizejun
│ │ └── demo
│ │ └── arouterdemo
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── lizejun
│ │ │ └── demo
│ │ │ └── arouterdemo
│ │ │ └── MainActivity.java
│ └── res
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── lizejun
│ └── demo
│ └── arouterdemo
│ └── ExampleUnitTest.java
├── build.gradle
├── config.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── lib-base
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── lizejun
│ │ └── demo
│ │ └── lib
│ │ └── base
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── lizejun
│ │ │ └── demo
│ │ │ └── lib
│ │ │ └── base
│ │ │ ├── BaseApplication.java
│ │ │ ├── BaseInterceptor.java
│ │ │ ├── ConstantMap.java
│ │ │ ├── JsonServiceImpl.java
│ │ │ ├── RouterMap.java
│ │ │ ├── bean
│ │ │ └── SerialBean.java
│ │ │ ├── service
│ │ │ ├── IStoreModuleService.java
│ │ │ └── StoreModuleRouterService.java
│ │ │ └── util
│ │ │ ├── FragmentUtils.java
│ │ │ └── Utils.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── lizejun
│ └── demo
│ └── lib
│ └── base
│ └── ExampleUnitTest.java
├── module-home
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── lizejun
│ │ └── demo
│ │ └── module
│ │ └── home
│ │ └── ExampleInstrumentedTest.java
│ ├── debug
│ └── AndroidManifest.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── lizejun
│ │ │ └── demo
│ │ │ └── module
│ │ │ └── home
│ │ │ ├── HomeActivity.java
│ │ │ ├── HomeFragment.java
│ │ │ └── ResultClientActivity.java
│ └── res
│ │ ├── layout
│ │ ├── activity_home.xml
│ │ ├── activity_result_client.xml
│ │ └── fragment_home.xml
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── lizejun
│ └── demo
│ └── module
│ └── home
│ └── ExampleUnitTest.java
├── module-other
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── lizejun
│ │ └── demo
│ │ └── module
│ │ └── other
│ │ └── ExampleInstrumentedTest.java
│ ├── debug
│ └── AndroidManifest.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── lizejun
│ │ │ └── demo
│ │ │ └── module
│ │ │ └── other
│ │ │ ├── EventBusActivity.java
│ │ │ ├── InjectActivity.java
│ │ │ ├── InterMiddleActivity.java
│ │ │ ├── InterTargetActivity.java
│ │ │ ├── NoResultActivity.java
│ │ │ ├── ResultServerActivity.java
│ │ │ └── SettingActivity.java
│ └── res
│ │ ├── layout
│ │ ├── activity_event_bus.xml
│ │ ├── activity_inter_middle.xml
│ │ └── activity_result_server.xml
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── lizejun
│ └── demo
│ └── module
│ └── other
│ └── ExampleUnitTest.java
├── module-store
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── lizejun
│ │ └── demo
│ │ └── module
│ │ └── store
│ │ └── ExampleInstrumentedTest.java
│ ├── debug
│ └── AndroidManifest.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── lizejun
│ │ │ └── demo
│ │ │ └── module
│ │ │ └── store
│ │ │ └── StoreModuleServiceImpl.java
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── lizejun
│ └── demo
│ └── module
│ └── store
│ └── ExampleUnitTest.java
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.idea/markdown-navigator/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | def config = rootProject.ext
4 |
5 | android {
6 | compileSdkVersion config.android.compileSdkVersion
7 | buildToolsVersion config.android.buildToolsVersion
8 | defaultConfig {
9 | applicationId "com.lizejun.demo.arouterdemo"
10 | minSdkVersion config.android.minSdkVersion
11 | targetSdkVersion config.android.targetSdkVersion
12 | versionCode 1
13 | versionName "1.0"
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile fileTree(dir: 'libs', include: ['*.jar'])
26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27 | exclude group: 'com.android.support', module: 'support-annotations'
28 | })
29 | compile config.dependencies["support-v7"]
30 | testCompile config.dependencies["junit"]
31 | //在壳中,导入各业务组件即可。
32 | if (isNeedHomeModule.toBoolean()) {
33 | compile project(":module-home")
34 | }
35 | if (isNeedOtherModule.toBoolean()) {
36 | compile project(":module-other")
37 | }
38 | if (isNeedStoreModule.toBoolean()) {
39 | compile project(":module-store")
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/lizejun/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/lizejun/demo/arouterdemo/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.arouterdemo;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.lizejun.demo.arouterdemo", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/lizejun/demo/arouterdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.arouterdemo;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.widget.FrameLayout;
7 |
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.lizejun.demo.lib.base.RouterMap;
10 | import com.lizejun.demo.lib.base.util.FragmentUtils;
11 |
12 | public class MainActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_main);
18 | addFragment();
19 | }
20 |
21 | private void addFragment() {
22 | Fragment homeFragment = getHomeFragment();
23 | FragmentUtils.addFragment(this, homeFragment, R.id.fl_container);
24 | }
25 |
26 | private Fragment getHomeFragment() {
27 | return (Fragment) ARouter.getInstance().build(RouterMap.HOME_FRAGMENT).navigation();
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ArouterDemo
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/com/lizejun/demo/arouterdemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.arouterdemo;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | //统一依赖库版本。
4 | apply from : "config.gradle"
5 |
6 | buildscript {
7 | repositories {
8 | maven { url 'https://maven.google.com' }
9 | jcenter()
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:2.3.1'
13 | }
14 | }
15 |
16 | allprojects {
17 |
18 | repositories {
19 | jcenter()
20 | maven { url 'https://maven.google.com' }
21 | }
22 | }
23 |
24 | task clean(type: Delete) {
25 | delete rootProject.buildDir
26 | }
27 |
--------------------------------------------------------------------------------
/config.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | android = [
3 | compileSdkVersion : 25,
4 | buildToolsVersion : "25.0.2",
5 | minSdkVersion : 14,
6 | targetSdkVersion : 25
7 | ]
8 | dependencies = [
9 | "support-v4" : 'com.android.support:support-v4:25.3.1',
10 | "support-v7" : 'com.android.support:appcompat-v7:25.3.1',
11 | "junit" : 'junit:junit:4.12',
12 | "arouter-api" : 'com.alibaba:arouter-api:1.2.4',
13 | "arouter-compiler" : 'com.alibaba:arouter-compiler:1.1.4',
14 | "event-bus" : 'org.simple:androideventbus:1.0.5.1',
15 | "fastjson" : 'com.alibaba:fastjson:1.2.9'
16 | ]
17 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | isNeedHomeModule = true
20 | isNeedOtherModule = true
21 | isNeedStoreModule = true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/imZeJun/ArouterDemo/078b69fb55b2234f4e1a0853bf37e96b3ae2858d/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Apr 07 12:41:15 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/lib-base/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/lib-base/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | def config = rootProject.ext
4 |
5 | android {
6 | compileSdkVersion config.android.compileSdkVersion
7 | buildToolsVersion config.android.buildToolsVersion
8 | defaultConfig {
9 | javaCompileOptions {
10 | annotationProcessorOptions {
11 | arguments = [moduleName: project.getName()]
12 | }
13 | }
14 | minSdkVersion config.android.minSdkVersion
15 | targetSdkVersion config.android.targetSdkVersion
16 | versionCode 1
17 | versionName "1.0"
18 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | }
27 |
28 | dependencies {
29 | compile fileTree(dir: 'libs', include: ['*.jar'])
30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
31 | exclude group: 'com.android.support', module: 'support-annotations'
32 | })
33 | compile config.dependencies["support-v7"]
34 | testCompile config.dependencies["junit"]
35 | //在基础组件中,需要导入路由的运行期、编译期依赖库。
36 | compile config.dependencies["arouter-api"]
37 | annotationProcessor config.dependencies["arouter-compiler"]
38 | compile config.dependencies["event-bus"]
39 | compile config.dependencies["fastjson"]
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/lib-base/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/lizejun/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/lib-base/src/androidTest/java/com/lizejun/demo/lib/base/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.lizejun.demo.lib.base.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib-base/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/BaseApplication.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import com.alibaba.android.arouter.launcher.ARouter;
7 | import com.lizejun.demo.lib.base.util.Utils;
8 |
9 | public class BaseApplication extends Application {
10 |
11 | private static BaseApplication instance;
12 |
13 | @Override
14 | public void onCreate() {
15 | super.onCreate();
16 | instance = this;
17 | initRouter(this);
18 | }
19 |
20 | public static Context getInstance() {
21 | return instance;
22 | }
23 |
24 | private void initRouter(BaseApplication mApplication) {
25 | // 这两行必须写在init之前,否则这些配置在init过程中将无效
26 | if (Utils.isApkInDebug(instance)) {
27 | //打印日志
28 | ARouter.openLog();
29 | //开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!
30 | //线上版本需要关闭,否则有安全风险)
31 | ARouter.openDebug();
32 | }
33 | // 尽可能早,推荐在Application中初始化
34 | ARouter.init(mApplication);
35 |
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/BaseInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 | import android.content.Context;
4 |
5 | import com.alibaba.android.arouter.facade.Postcard;
6 | import com.alibaba.android.arouter.facade.annotation.Interceptor;
7 | import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
8 | import com.alibaba.android.arouter.facade.template.IInterceptor;
9 | import com.alibaba.android.arouter.launcher.ARouter;
10 |
11 | @Interceptor(priority = 1, name = "重新分组进行拦截")
12 | public class BaseInterceptor implements IInterceptor {
13 |
14 | @Override
15 | public void process(Postcard postcard, InterceptorCallback callback) {
16 | if (postcard.getExtra() == ConstantMap.LOGIN_EXTRA) {
17 | boolean isLogin = postcard.getExtras().getBoolean(ConstantMap.IS_LOGIN);
18 | if (!isLogin) {
19 | ARouter.getInstance().build(RouterMap.INTER_MIDDLE_ACTIVITY).navigation();
20 | } else {
21 | postcard.withString(ConstantMap.IS_LOGIN_EXTRA, "登录了!");
22 | callback.onContinue(postcard);
23 | }
24 | } else {
25 | callback.onContinue(postcard);
26 | }
27 | }
28 |
29 | @Override
30 | public void init(Context context) {
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/ConstantMap.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 |
4 | public class ConstantMap {
5 |
6 | public static final int FOR_RESULT_CODE = 100;
7 |
8 | public static final String FOR_RESULT_KEY = "for_result_key";
9 |
10 | public static final String EVENT_BUS_DATA = "event_bus_data_str";
11 |
12 | public static final String EVENT_BUS_KEY = "event_bus_key";
13 |
14 | public static final String IS_LOGIN = "is_login";
15 |
16 | public static final String IS_LOGIN_EXTRA = "is_login_extra";
17 |
18 | public static final String INJECT_AGE = "inject_age";
19 |
20 | public static final String INJECT_OBJECT = "inject_object";
21 |
22 | public static final int LOGIN_EXTRA = 1 << 1;
23 | }
24 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/JsonServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 |
4 | import android.content.Context;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Route;
7 | import com.alibaba.android.arouter.facade.service.SerializationService;
8 | import com.alibaba.fastjson.JSON;
9 |
10 | import java.lang.reflect.Type;
11 |
12 | @Route(path = RouterMap.JSON_SERVICE, name = "序列化")
13 | public class JsonServiceImpl implements SerializationService {
14 |
15 | @Override
16 | public void init(Context context) {
17 |
18 | }
19 |
20 | @Override
21 | public T json2Object(String text, Class clazz) {
22 | return JSON.parseObject(text, clazz);
23 | }
24 |
25 | @Override
26 | public String object2Json(Object instance) {
27 | return JSON.toJSONString(instance);
28 | }
29 |
30 | @Override
31 | public T parseObject(String input, Type clazz) {
32 | return JSON.parseObject(input, clazz);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/RouterMap.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 | public class RouterMap {
4 |
5 | public static final String HOME_FRAGMENT = "/home/main";
6 |
7 | public static final String NO_RESULT_ACTIVITY = "/other/no_result";
8 |
9 | public static final String RESULT_SERVER_ACTIVITY = "/other/result_server";
10 |
11 | public static final String EVENT_BUS_ACTIVITY = "/other/event_bus";
12 |
13 | public static final String INTERCEPT_GROUP = "intercept_group";
14 |
15 | public static final String INTER_MIDDLE_ACTIVITY = "/other/inter_middle";
16 |
17 | public static final String INTER_TARGET_ACTIVITY = "/other/inter_target";
18 |
19 | public static final String STORE_MODULE_SERVICE = "/store/service";
20 |
21 | public static final String INJECT_ACTIVITY = "/other/inject";
22 |
23 | public static final String JSON_SERVICE = "/base/json_service";
24 | }
25 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/bean/SerialBean.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base.bean;
2 |
3 |
4 | public class SerialBean {
5 |
6 | private int age;
7 | private String name;
8 |
9 | public int getAge() {
10 | return age;
11 | }
12 |
13 | public void setAge(int age) {
14 | this.age = age;
15 | }
16 |
17 | public String getName() {
18 | return name;
19 | }
20 |
21 | public void setName(String name) {
22 | this.name = name;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/service/IStoreModuleService.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base.service;
2 |
3 |
4 | import com.alibaba.android.arouter.facade.template.IProvider;
5 |
6 | public interface IStoreModuleService extends IProvider {
7 |
8 | /**
9 | * 获取是否登录的状态。
10 | * @return 是否登录。
11 | */
12 | boolean isLogin();
13 |
14 | /**
15 | * 设置是否登录。
16 | * @param login 是否登录。
17 | */
18 | void setLogin(boolean login);
19 | }
20 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/service/StoreModuleRouterService.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base.service;
2 |
3 |
4 | import com.alibaba.android.arouter.launcher.ARouter;
5 | import com.lizejun.demo.lib.base.RouterMap;
6 |
7 | public class StoreModuleRouterService {
8 |
9 | public static boolean isLogin() {
10 | IStoreModuleService chatModuleService = (IStoreModuleService) ARouter.getInstance().build(RouterMap.STORE_MODULE_SERVICE).navigation();
11 | return chatModuleService != null && chatModuleService.isLogin();
12 | }
13 |
14 | public static void setLogin(boolean login) {
15 | IStoreModuleService chatModuleService = (IStoreModuleService) ARouter.getInstance().build(RouterMap.STORE_MODULE_SERVICE).navigation();
16 | if (chatModuleService != null) {
17 | chatModuleService.setLogin(login);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/util/FragmentUtils.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base.util;
2 |
3 |
4 | import android.support.annotation.IdRes;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v4.app.FragmentManager;
7 | import android.support.v4.app.FragmentTransaction;
8 | import android.support.v7.app.AppCompatActivity;
9 |
10 | public class FragmentUtils {
11 |
12 | public static void addFragment(AppCompatActivity activity, Fragment fragment, @IdRes int containerId) {
13 | FragmentManager manager = activity.getSupportFragmentManager();
14 | FragmentTransaction transaction = manager.beginTransaction();
15 | transaction.add(containerId, fragment);
16 | transaction.commit();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/lib-base/src/main/java/com/lizejun/demo/lib/base/util/Utils.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base.util;
2 |
3 | import android.content.Context;
4 | import android.content.pm.ApplicationInfo;
5 | import android.widget.Toast;
6 |
7 | public class Utils {
8 |
9 | public static final String COMMON_TAG = "ROUTER_DEMO_TAG";
10 |
11 | public static boolean isApkInDebug(Context context) {
12 | try {
13 | ApplicationInfo info = context.getApplicationInfo();
14 | return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
15 | } catch (Exception e) {
16 | return false;
17 | }
18 | }
19 |
20 | public static void toast(Context context, String message) {
21 | Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib-base/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | lib-base
3 |
4 |
--------------------------------------------------------------------------------
/lib-base/src/test/java/com/lizejun/demo/lib/base/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.lib.base;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/module-home/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/module-home/build.gradle:
--------------------------------------------------------------------------------
1 | def config = rootProject.ext
2 |
3 | if (isNeedHomeModule.toBoolean()) {
4 | apply plugin: 'com.android.library'
5 | } else {
6 | apply plugin: 'com.android.application'
7 | }
8 |
9 | android {
10 | compileSdkVersion config.android.compileSdkVersion
11 | buildToolsVersion config.android.buildToolsVersion
12 | defaultConfig {
13 | if (!isNeedHomeModule.toBoolean()) {
14 | applicationId "com.demo.lizejun.module.home"
15 | }
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [moduleName: project.getName()]
19 | }
20 | }
21 | minSdkVersion config.android.minSdkVersion
22 | targetSdkVersion config.android.targetSdkVersion
23 | versionCode 1
24 | versionName "1.0"
25 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
26 |
27 | }
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 | sourceSets {
35 | main {
36 | if (!isNeedHomeModule.toBoolean()) {
37 | manifest.srcFile 'src/debug/AndroidManifest.xml'
38 | } else {
39 | manifest.srcFile 'src/main/AndroidManifest.xml'
40 | java {
41 | exclude '**/debug/**'
42 | }
43 | }
44 | }
45 | }
46 | }
47 |
48 | dependencies {
49 | compile fileTree(dir: 'libs', include: ['*.jar'])
50 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
51 | exclude group: 'com.android.support', module: 'support-annotations'
52 | })
53 | compile config.dependencies["support-v7"]
54 | testCompile config.dependencies["junit"]
55 | //在业务组件中,需要导入路由的编译期依赖库、以及所有的基础组件。
56 | annotationProcessor config.dependencies["arouter-compiler"]
57 | compile project(":lib-base")
58 | }
59 |
--------------------------------------------------------------------------------
/module-home/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/lizejun/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/module-home/src/androidTest/java/com/lizejun/demo/module/home/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.home;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.lizejun.demo.module.main.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/module-home/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/module-home/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/module-home/src/main/java/com/lizejun/demo/module/home/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.home;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import com.demo.lizejun.module.home.R;
8 | import com.lizejun.demo.lib.base.util.FragmentUtils;
9 |
10 | public class HomeActivity extends AppCompatActivity {
11 |
12 | @Override
13 | protected void onCreate(@Nullable Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_home);
16 | addFragment();
17 | }
18 |
19 | private void addFragment() {
20 | FragmentUtils.addFragment(this, new HomeFragment(), R.id.fl_container);
21 | }
22 |
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/module-home/src/main/java/com/lizejun/demo/module/home/HomeFragment.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.home;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.Button;
12 |
13 | import com.alibaba.android.arouter.facade.annotation.Route;
14 | import com.alibaba.android.arouter.launcher.ARouter;
15 | import com.demo.lizejun.module.home.R;
16 | import com.lizejun.demo.lib.base.ConstantMap;
17 | import com.lizejun.demo.lib.base.RouterMap;
18 | import com.lizejun.demo.lib.base.bean.SerialBean;
19 | import com.lizejun.demo.lib.base.service.StoreModuleRouterService;
20 | import com.lizejun.demo.lib.base.util.Utils;
21 |
22 | import org.simple.eventbus.EventBus;
23 | import org.simple.eventbus.Subscriber;
24 |
25 | @Route(path = RouterMap.HOME_FRAGMENT)
26 | public class HomeFragment extends Fragment {
27 |
28 | @Override
29 | public void onAttach(Context context) {
30 | super.onAttach(context);
31 | EventBus.getDefault().register(this);
32 | }
33 |
34 | @Nullable
35 | @Override
36 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
37 | ViewGroup view = (ViewGroup) LayoutInflater.from(container.getContext()).inflate(R.layout.fragment_home, container, false);
38 | Button noResultButton = (Button) view.findViewById(R.id.bt_no_result);
39 | noResultButton.setOnClickListener(new HomeClickListener());
40 | Button resultClientButton = (Button) view.findViewById(R.id.bt_result_client);
41 | resultClientButton.setOnClickListener(new HomeClickListener());
42 | Button eventBusButton = (Button) view.findViewById(R.id.bt_event_bus);
43 | eventBusButton.setOnClickListener(new HomeClickListener());
44 | Button interButton = (Button) view.findViewById(R.id.bt_intercept);
45 | interButton.setOnClickListener(new HomeClickListener());
46 | Button injectButton = (Button) view.findViewById(R.id.bt_inject);
47 | injectButton.setOnClickListener(new HomeClickListener());
48 | return view;
49 | }
50 |
51 | @Override
52 | public void onDestroy() {
53 | super.onDestroy();
54 | EventBus.getDefault().unregister(this);
55 | }
56 |
57 | private class HomeClickListener implements View.OnClickListener {
58 |
59 | @Override
60 | public void onClick(View v) {
61 | int id = v.getId();
62 | if (id == R.id.bt_no_result) {
63 | ARouter.getInstance().build(RouterMap.NO_RESULT_ACTIVITY).navigation();
64 | } else if (id == R.id.bt_result_client) {
65 | getActivity().startActivity(new Intent(getActivity(), ResultClientActivity.class));
66 | } else if (id == R.id.bt_event_bus) {
67 | ARouter.getInstance().build(RouterMap.EVENT_BUS_ACTIVITY)
68 | .withInt(ConstantMap.EVENT_BUS_DATA, 1000)
69 | .navigation();
70 | } else if (id == R.id.bt_intercept) {
71 | ARouter.getInstance().build(RouterMap.INTER_TARGET_ACTIVITY)
72 | .withBoolean(ConstantMap.IS_LOGIN, StoreModuleRouterService.isLogin())
73 | .navigation();
74 | } else if (id == R.id.bt_inject) {
75 | SerialBean bean = new SerialBean();
76 | bean.setName("SerialBean");
77 | bean.setAge(18);
78 | ARouter.getInstance().build(RouterMap.INJECT_ACTIVITY)
79 | .withInt(ConstantMap.INJECT_AGE, 18)
80 | .withObject(ConstantMap.INJECT_OBJECT, bean)
81 | .navigation();
82 | }
83 | }
84 | }
85 |
86 | @Subscriber(tag = ConstantMap.EVENT_BUS_KEY)
87 | public void onEvent(String s) {
88 | Utils.toast(getContext(), s);
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/module-home/src/main/java/com/lizejun/demo/module/home/ResultClientActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.home;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.Button;
9 |
10 | import com.alibaba.android.arouter.launcher.ARouter;
11 | import com.demo.lizejun.module.home.R;
12 | import com.lizejun.demo.lib.base.ConstantMap;
13 | import com.lizejun.demo.lib.base.RouterMap;
14 | import com.lizejun.demo.lib.base.util.Utils;
15 |
16 | public class ResultClientActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(@Nullable Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_result_client);
22 | Button button = (Button) findViewById(R.id.bt_result_client);
23 | button.setOnClickListener(new View.OnClickListener() {
24 |
25 | @Override
26 | public void onClick(View v) {
27 | ARouter.getInstance().build(RouterMap.RESULT_SERVER_ACTIVITY).navigation(ResultClientActivity.this, ConstantMap.FOR_RESULT_CODE);
28 | }
29 | });
30 | }
31 |
32 | @Override
33 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
34 | super.onActivityResult(requestCode, resultCode, data);
35 | switch (requestCode) {
36 | case ConstantMap.FOR_RESULT_CODE:
37 | Utils.toast(ResultClientActivity.this, "receive=" + data.getStringExtra(ConstantMap.FOR_RESULT_KEY));
38 | break;
39 | default:
40 | break;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/module-home/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
--------------------------------------------------------------------------------
/module-home/src/main/res/layout/activity_result_client.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
12 |
--------------------------------------------------------------------------------
/module-home/src/main/res/layout/fragment_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
37 |
38 |
--------------------------------------------------------------------------------
/module-home/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | module-home
3 |
4 |
--------------------------------------------------------------------------------
/module-home/src/test/java/com/lizejun/demo/module/home/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.home;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/module-other/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/module-other/build.gradle:
--------------------------------------------------------------------------------
1 | def config = rootProject.ext
2 |
3 | if (isNeedOtherModule.toBoolean()) {
4 | apply plugin: 'com.android.library'
5 | } else {
6 | apply plugin: 'com.android.application'
7 | }
8 |
9 | android {
10 | compileSdkVersion config.android.compileSdkVersion
11 | buildToolsVersion config.android.buildToolsVersion
12 | defaultConfig {
13 | if (!isNeedOtherModule.toBoolean()) {
14 | applicationId "com.demo.lizejun.module.other"
15 | }
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [moduleName: project.getName()]
19 | }
20 | }
21 | minSdkVersion config.android.minSdkVersion
22 | targetSdkVersion config.android.targetSdkVersion
23 | versionCode 1
24 | versionName "1.0"
25 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
26 |
27 | }
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 | sourceSets {
35 | main {
36 | if (!isNeedHomeModule.toBoolean()) {
37 | manifest.srcFile 'src/debug/AndroidManifest.xml'
38 | } else {
39 | manifest.srcFile 'src/main/AndroidManifest.xml'
40 | java {
41 | exclude '**/debug/**'
42 | }
43 | }
44 | }
45 | }
46 |
47 | }
48 |
49 | dependencies {
50 | compile fileTree(dir: 'libs', include: ['*.jar'])
51 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
52 | exclude group: 'com.android.support', module: 'support-annotations'
53 | })
54 | compile config.dependencies["support-v7"]
55 | testCompile config.dependencies["junit"]
56 | //在业务组件中,需要导入路由的编译期依赖库、以及所有的基础组件。
57 | annotationProcessor config.dependencies["arouter-compiler"]
58 | compile project(":lib-base")
59 | }
60 |
--------------------------------------------------------------------------------
/module-other/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/lizejun/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/module-other/src/androidTest/java/com/lizejun/demo/module/other/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.lizejun.demo.module.other.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/module-other/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/module-other/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/EventBusActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.Button;
8 |
9 | import com.alibaba.android.arouter.facade.annotation.Route;
10 | import com.demo.lizejun.module.other.R;
11 | import com.lizejun.demo.lib.base.ConstantMap;
12 | import com.lizejun.demo.lib.base.RouterMap;
13 |
14 | import org.simple.eventbus.EventBus;
15 |
16 | @Route(path = RouterMap.EVENT_BUS_ACTIVITY)
17 | public class EventBusActivity extends AppCompatActivity {
18 |
19 | @Override
20 | protected void onCreate(@Nullable Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_event_bus);
23 | final int revValue = getIntent().getIntExtra(ConstantMap.EVENT_BUS_DATA, 0);
24 | Button button = (Button) findViewById(R.id.bt_event_bus);
25 | button.setOnClickListener(new View.OnClickListener() {
26 |
27 | @Override
28 | public void onClick(View v) {
29 | EventBus.getDefault().post("通过 EventBus 返回数据=" + revValue, ConstantMap.EVENT_BUS_KEY);
30 | finish();
31 | }
32 | });
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/InjectActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import com.alibaba.android.arouter.facade.annotation.Autowired;
8 | import com.alibaba.android.arouter.facade.annotation.Route;
9 | import com.alibaba.android.arouter.launcher.ARouter;
10 | import com.lizejun.demo.lib.base.ConstantMap;
11 | import com.lizejun.demo.lib.base.RouterMap;
12 | import com.lizejun.demo.lib.base.bean.SerialBean;
13 | import com.lizejun.demo.lib.base.util.Utils;
14 |
15 | @Route(path = RouterMap.INJECT_ACTIVITY)
16 | public class InjectActivity extends AppCompatActivity {
17 |
18 | @Autowired(name = ConstantMap.INJECT_AGE)
19 | int age;
20 |
21 | @Autowired(name = ConstantMap.INJECT_OBJECT)
22 | SerialBean bean;
23 |
24 | @Override
25 | protected void onCreate(@Nullable Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | ARouter.getInstance().inject(this);
28 | Utils.toast(this, "age=" + age + ",bean.age=" + bean.getAge() + ",bean.name=" + bean.getName());
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/InterMiddleActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.widget.CompoundButton;
8 | import android.widget.Switch;
9 | import android.widget.TextView;
10 |
11 | import com.alibaba.android.arouter.facade.annotation.Route;
12 | import com.demo.lizejun.module.other.R;
13 | import com.lizejun.demo.lib.base.RouterMap;
14 | import com.lizejun.demo.lib.base.service.StoreModuleRouterService;
15 |
16 | @Route(path = RouterMap.INTER_MIDDLE_ACTIVITY)
17 | public class InterMiddleActivity extends AppCompatActivity {
18 |
19 | @Override
20 | protected void onCreate(@Nullable Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_inter_middle);
23 | updateStatus();
24 | switchStatus();
25 | }
26 |
27 | private void updateStatus() {
28 | TextView tvStatus = (TextView) findViewById(R.id.tv_login_status);
29 | tvStatus.setText("登录状态=" + StoreModuleRouterService.isLogin());
30 | }
31 |
32 | private void switchStatus() {
33 | final Switch switchStatus = (Switch) findViewById(R.id.sw_login);
34 | switchStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
35 |
36 | @Override
37 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
38 | StoreModuleRouterService.setLogin(isChecked);
39 | updateStatus();
40 | }
41 | });
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/InterTargetActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 |
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Route;
7 | import com.lizejun.demo.lib.base.ConstantMap;
8 | import com.lizejun.demo.lib.base.RouterMap;
9 |
10 | @Route(path = RouterMap.INTER_TARGET_ACTIVITY, extras = ConstantMap.LOGIN_EXTRA)
11 | public class InterTargetActivity extends AppCompatActivity {
12 |
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/NoResultActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 |
8 | import com.alibaba.android.arouter.facade.annotation.Route;
9 | import com.lizejun.demo.lib.base.RouterMap;
10 | import com.lizejun.demo.lib.base.util.Utils;
11 |
12 | @Route(path = RouterMap.NO_RESULT_ACTIVITY)
13 | public class NoResultActivity extends AppCompatActivity {
14 |
15 | @Override
16 | protected void onCreate(@Nullable Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | Utils.toast(this, "NoResultActivity onCreate");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/ResultServerActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.Button;
9 |
10 | import com.alibaba.android.arouter.facade.annotation.Route;
11 | import com.demo.lizejun.module.other.R;
12 | import com.lizejun.demo.lib.base.ConstantMap;
13 | import com.lizejun.demo.lib.base.RouterMap;
14 |
15 | @Route(path = RouterMap.RESULT_SERVER_ACTIVITY)
16 | public class ResultServerActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(@Nullable Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_result_server);
22 | Button button = (Button) findViewById(R.id.bt_for_result);
23 | button.setOnClickListener(new View.OnClickListener() {
24 |
25 | @Override
26 | public void onClick(View v) {
27 | Intent intent = new Intent();
28 | intent.putExtra(ConstantMap.FOR_RESULT_KEY, "返回数据给 Client");
29 | setResult(ConstantMap.FOR_RESULT_CODE, intent);
30 | finish();
31 | }
32 | });
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/module-other/src/main/java/com/lizejun/demo/module/other/SettingActivity.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 |
5 | public class SettingActivity extends AppCompatActivity {
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/module-other/src/main/res/layout/activity_event_bus.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
--------------------------------------------------------------------------------
/module-other/src/main/res/layout/activity_inter_middle.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
14 |
--------------------------------------------------------------------------------
/module-other/src/main/res/layout/activity_result_server.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
--------------------------------------------------------------------------------
/module-other/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | module-other
3 |
4 |
--------------------------------------------------------------------------------
/module-other/src/test/java/com/lizejun/demo/module/other/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.other;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/module-store/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/module-store/build.gradle:
--------------------------------------------------------------------------------
1 | def config = rootProject.ext
2 |
3 | if (isNeedStoreModule.toBoolean()) {
4 | apply plugin: 'com.android.library'
5 | } else {
6 | apply plugin: 'com.android.application'
7 | }
8 |
9 | android {
10 | compileSdkVersion config.android.compileSdkVersion
11 | buildToolsVersion config.android.buildToolsVersion
12 | defaultConfig {
13 | if (!isNeedStoreModule.toBoolean()) {
14 | applicationId "com.demo.lizejun.module.store"
15 | }
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [moduleName: project.getName()]
19 | }
20 | }
21 | minSdkVersion config.android.minSdkVersion
22 | targetSdkVersion config.android.targetSdkVersion
23 | versionCode 1
24 | versionName "1.0"
25 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
26 |
27 | }
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 | sourceSets {
35 | main {
36 | if (!isNeedStoreModule.toBoolean()) {
37 | manifest.srcFile 'src/debug/AndroidManifest.xml'
38 | } else {
39 | manifest.srcFile 'src/main/AndroidManifest.xml'
40 | java {
41 | exclude '**/debug/**'
42 | }
43 | }
44 | }
45 | }
46 |
47 | }
48 |
49 | dependencies {
50 | compile fileTree(dir: 'libs', include: ['*.jar'])
51 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
52 | exclude group: 'com.android.support', module: 'support-annotations'
53 | })
54 | compile config.dependencies["support-v7"]
55 | testCompile config.dependencies["junit"]
56 | //在业务组件中,需要导入路由的编译期依赖库、以及所有的基础组件。
57 | annotationProcessor config.dependencies["arouter-compiler"]
58 | compile project(":lib-base")
59 | }
60 |
--------------------------------------------------------------------------------
/module-store/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/lizejun/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/module-store/src/androidTest/java/com/lizejun/demo/module/store/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.store;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.lizejun.demo.module.store.test", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/module-store/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/module-store/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
--------------------------------------------------------------------------------
/module-store/src/main/java/com/lizejun/demo/module/store/StoreModuleServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.store;
2 |
3 |
4 | import android.content.Context;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Route;
7 | import com.lizejun.demo.lib.base.RouterMap;
8 | import com.lizejun.demo.lib.base.service.IStoreModuleService;
9 |
10 | @Route(path = RouterMap.STORE_MODULE_SERVICE)
11 | public class StoreModuleServiceImpl implements IStoreModuleService {
12 |
13 | private static final String FILE = "account";
14 | private static final String IS_LOGIN = "is_login";
15 |
16 |
17 | private Context mContext;
18 |
19 | @Override
20 | public void init(Context context) {
21 | mContext = context;
22 | }
23 |
24 | @Override
25 | public boolean isLogin() {
26 | return mContext.getSharedPreferences(FILE, Context.MODE_PRIVATE).getBoolean(IS_LOGIN, false);
27 | }
28 |
29 | @Override
30 | public void setLogin(boolean login) {
31 | mContext.getSharedPreferences(FILE, Context.MODE_PRIVATE).edit().putBoolean(IS_LOGIN, login).apply();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/module-store/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | module-store
3 |
4 |
--------------------------------------------------------------------------------
/module-store/src/test/java/com/lizejun/demo/module/store/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.lizejun.demo.module.store;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':lib-base', ':module-home', ':module-other', ':module-store'
2 |
--------------------------------------------------------------------------------