├── .gitignore
├── .idea
├── compiler.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── allure
│ │ └── modularization
│ │ ├── MyApplication.java
│ │ └── SplashActivity.java
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ ├── activity_main.xml
│ └── app_activity_splash.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.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
├── base
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── allure
│ │ └── base
│ │ └── application
│ │ ├── ApplicationImpl.java
│ │ ├── BaseApplication.java
│ │ └── ModulesApplicationConfig.java
│ └── res
│ └── values
│ └── strings.xml
├── build.gradle
├── common
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── assets
│ └── schame_inchat.html
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── allure
│ │ │ └── common
│ │ │ ├── ARouterManager.java
│ │ │ ├── ARouterPathConfig.java
│ │ │ ├── SchameFilterActivity.java
│ │ │ └── bean
│ │ │ └── LoginInfoBean.java
│ └── res
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── provider
│ └── java
│ └── com
│ └── allure
│ └── provider
│ └── ILoginProvider.java
├── config.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── login2
└── build
│ └── intermediates
│ └── incremental
│ └── compileDebugAidl
│ └── dependency.store
├── modules
├── login
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── allure
│ │ │ └── login
│ │ │ ├── LoginActivity.java
│ │ │ ├── LoginInterceptor.java
│ │ │ ├── LoginProviderImpl.java
│ │ │ └── application
│ │ │ └── LoginApplication.java
│ │ └── res
│ │ ├── layout
│ │ └── login_activity_start.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── main
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── allure
│ │ │ └── main
│ │ │ ├── MainActivity.java
│ │ │ └── MainSecoendActivity.java
│ │ └── res
│ │ ├── layout
│ │ ├── main_activity_second.xml
│ │ └── main_activity_start.xml
│ │ └── values
│ │ └── strings.xml
└── shop
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── allure
│ │ └── shop
│ │ ├── ShopActivity.java
│ │ └── application
│ │ └── ShopApplication.java
│ └── res
│ ├── layout
│ └── shop_activity_start.xml
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
└── 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 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
23 |
24 |
--------------------------------------------------------------------------------
/.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 | Android Lint
43 |
44 |
45 | Data flow issuesJava
46 |
47 |
48 | Groovy
49 |
50 |
51 | Initialization issuesJava
52 |
53 |
54 | Java
55 |
56 |
57 | Serialization issuesJava
58 |
59 |
60 | Threading issuesGroovy
61 |
62 |
63 | Threading issuesJava
64 |
65 |
66 |
67 |
68 | Android Lint
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | 1.8
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AndroidComponentDemo
2 |
3 | Android组件化,插件自动完成依赖特性
4 |
5 |
6 |
7 | [ComponentPlugin](https://github.com/Allure0/AndroidComponentPlugin)
8 |
9 | |自动完成特性 |含义|
10 | | :--------: | :-----: |
11 | | 组件单独运行 | 如何将一个庞大的项目分而治之,可单独运行和集成为一个整体 |
12 | | UI跳转 | 每个业务组件之间如何跳转 |
13 | | 组件通信 | 如何在业务之间进行数据传递 |
14 | | 代码隔离 | 组件与组件之间如何避免直接引用 |
15 |
16 | ## 插件使用方式
17 |
18 | ### Step1:整个项目build.gralde之下添加以下代码
19 |
20 | ```
21 | /**--引用插件----**/
22 | apply plugin: 'com.allure.appconfig'
23 |
24 | buildscript {
25 | repositories {
26 | maven {
27 | url "http://dl.bintray.com/allure0/maven"
28 | }
29 | }
30 | dependencies {
31 | //格式为-->group:module:version
32 | classpath 'com.allure.plugin:Component:1.0.0'
33 | }
34 | }
35 | /**--引用插件----**/
36 |
37 | /**--插件配置宿主壳App与组件----**/
38 | hostAppConfig {
39 | isDebug true
40 |
41 | //宿主载体
42 | apps {
43 | app {
44 |
45 | mainActivity "com.allure.modularization.SplashActivity"
46 | modules ':modules:login',
47 | ':modules:shop',
48 | ':modules:main'
49 | }
50 | }
51 |
52 | //组件
53 | modules {
54 | login {
55 | isRunAlone true
56 | name ":modules:login"
57 | applicationId "com.allure.login"
58 | mainActivity ".LoginActivity"
59 |
60 | }
61 | shop {
62 | isRunAlone false
63 | name ":modules:shop"
64 | applicationId "com.allure.shop"
65 | mainActivity ".ShopActivity"
66 |
67 | }
68 | main {
69 | isRunAlone false
70 | name ":modules:main"
71 | applicationId "com.allure.main"
72 | mainActivity ".MainActivity"
73 |
74 | }
75 | }
76 | }
77 | /**--插件配置宿主壳App与组件----**/
78 | ```
79 | ### Step2:在每一个组件的build.gradle下定义插件的引用
80 | ```
81 | apply plugin: 'com.allure.appmodules'
82 | ```
83 |
84 | ## 插件解释
85 |
86 | ##### hostAppConfig:
87 |
88 | | hostAppConfig |解释|
89 | | :--------: | :-----: |
90 | | isDebug | 是否开启debug模式,只有当isDebug为true时,modules的isRunAlone才能生效。同时注意更改此属性后需要清除app的壳工程app的缓存在运行 |
91 | | apps | 壳工程列表,可以有多个壳工程 |
92 | | modules | 各个组件Lib |
93 |
94 |
95 | ##### app:
96 |
97 | | app |解释|
98 | | :--------: | :-----: |
99 | | modules | 依赖的组件列表 |
100 | | applicationId | 启动的application,可默认为空,在测试微信支付分享时可以动态配置使用测试 |
101 | | mainActivity | 启动Activity |
102 |
103 | ##### Modules:
104 |
105 | | app |解释|
106 | | :--------: | :-----: |
107 | | name | 依赖的组件列表 |
108 | | isRunAlone | 是否可以单独运行(必须在isDebug=true情况下可运行) |
109 | | applicationId | 启动的application,必须设置 |
110 | | mainActivity | 启动Activity |
111 |
112 |
113 | [具体插件使用以及具体分析请查看Demo](https://www.jianshu.com/p/23b0239c45aa)
114 |
115 | **Tips:注意isDebug更改后一定要清除app的缓存在重新sync and run**
116 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | //apply plugin: 'com.android.application'
2 | apply plugin: 'com.allure.appmodules'
3 |
4 |
5 | android {
6 |
7 | compileSdkVersion rootProject.ext.defaultConfig.compileSdkVersion
8 | defaultConfig {
9 | applicationId "com.allure.modularization"
10 | minSdkVersion rootProject.ext.defaultConfig.minSdkVersion
11 | targetSdkVersion rootProject.ext.defaultConfig.targetSdkVersion
12 | versionCode rootProject.ext.defaultConfig.versionCode
13 | versionName rootProject.ext.defaultConfig.versionName
14 | javaCompileOptions {
15 | annotationProcessorOptions {
16 | arguments = [moduleName: project.getName()]
17 | }
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | lintOptions {
27 | abortOnError false
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | api project(':base')
34 | //ARouter
35 | implementation rootProject.ext.dependencies.arouter_api
36 | annotationProcessor rootProject.ext.dependencies.arouter_compiler
37 |
38 |
39 |
40 | }
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/allure/modularization/MyApplication.java:
--------------------------------------------------------------------------------
1 | package com.allure.modularization;
2 |
3 | import com.allure.base.application.BaseApplication;
4 |
5 | /**
6 | *
描述:(这里用一句话描述这个类的作用)
7 | * Created by Cherish on 2018/8/22.
8 | */
9 | public class MyApplication extends BaseApplication {
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/allure/modularization/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.allure.modularization;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.view.View;
6 |
7 | import com.allure.common.ARouterManager;
8 |
9 | public class SplashActivity extends AppCompatActivity {
10 |
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_main);
15 | }
16 |
17 | public void go(View view){
18 | ARouterManager.start2Main();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/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 | Simple
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/base/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/base/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | //apply plugin: 'com.allure.appmodules'
3 |
4 |
5 | android {
6 |
7 | compileSdkVersion rootProject.ext.defaultConfig.compileSdkVersion
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.defaultConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.defaultConfig.targetSdkVersion
11 | versionCode rootProject.ext.defaultConfig.versionCode
12 | versionName rootProject.ext.defaultConfig.versionName
13 |
14 | javaCompileOptions {
15 | annotationProcessorOptions {
16 | arguments = [moduleName: project.getName()]
17 | }
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | lintOptions {
27 | abortOnError false
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 |
34 | api project(':common')
35 |
36 | api rootProject.ext.dependencies.appcompatV7
37 | api 'com.android.support.constraint:constraint-layout:1.1.2'
38 | api 'com.blankj:utilcode:1.17.3'
39 | //ARouter
40 | implementation rootProject.ext.dependencies.arouter_api
41 | annotationProcessor rootProject.ext.dependencies.arouter_compiler
42 | }
43 |
44 |
45 |
--------------------------------------------------------------------------------
/base/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/base/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/base/src/main/java/com/allure/base/application/ApplicationImpl.java:
--------------------------------------------------------------------------------
1 | package com.allure.base.application;
2 |
3 | import android.app.Application;
4 |
5 | /**
6 | * 描述:(这里用一句话描述这个类的作用)
7 | * Created by Cherish on 2018/8/16.
8 | */
9 | public interface ApplicationImpl {
10 |
11 | void onCreate(Application baseApplication);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/base/src/main/java/com/allure/base/application/BaseApplication.java:
--------------------------------------------------------------------------------
1 | package com.allure.base.application;
2 |
3 | import android.app.Application;
4 |
5 | import com.alibaba.android.arouter.BuildConfig;
6 | import com.alibaba.android.arouter.launcher.ARouter;
7 |
8 | /**
9 | * 描述:(这里用一句话描述这个类的作用)
10 | * Created by Cherish on 2018/8/16.
11 | */
12 | public class BaseApplication extends Application {
13 |
14 | public boolean isLogin=false;//只做演示,常规方案应放到sp不能在application里做
15 | public boolean isLogin() {
16 | return isLogin;
17 | }
18 |
19 | public void setLogin(boolean login) {
20 | isLogin = login;
21 | }
22 |
23 | public static BaseApplication instance = null;
24 |
25 | public static BaseApplication getInstance() {
26 | return instance;
27 | }
28 |
29 | @Override
30 | public void onCreate() {
31 | super.onCreate();
32 | instance = this;
33 | modulesApplicationInit();
34 | ARouterInit();
35 | }
36 |
37 | private void ARouterInit() {
38 | if (BuildConfig.DEBUG) { // 这两行必须写在init之前,否则这些配置在init过程中将无效
39 | ARouter.openLog(); // 打印日志
40 | ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险)
41 | }
42 | ARouter.init(instance);
43 | }
44 |
45 |
46 | /**
47 | * 利用反射思想低耦合使单独组件初始化Application(同样可以利用Base层处理)
48 | */
49 | private void modulesApplicationInit() {
50 | for (String modulesImpl : ModulesApplicationConfig.MODULES_LIST) {
51 | try {
52 | Class> aClass = Class.forName(modulesImpl);
53 | Object object = aClass.newInstance();
54 |
55 | if (object instanceof ApplicationImpl) {
56 | ((ApplicationImpl) object).onCreate(this);
57 | }
58 | } catch (ClassNotFoundException e) {
59 | e.printStackTrace();
60 | } catch (IllegalAccessException e) {
61 | e.printStackTrace();
62 | } catch (InstantiationException e) {
63 | e.printStackTrace();
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/base/src/main/java/com/allure/base/application/ModulesApplicationConfig.java:
--------------------------------------------------------------------------------
1 | package com.allure.base.application;
2 |
3 | /**
4 | * 描述:(组件的Application管理类)
5 | * Created by Cherish on 2018/8/16.
6 | */
7 | public class ModulesApplicationConfig {
8 | public static final String[] MODULES_LIST = {
9 | "com.allure.login.application.LoginApplication",
10 | "com.allure.shop.application.ShopApplication"
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/base/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Base
3 |
4 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | apply from: 'config.gradle'
4 | buildscript {
5 |
6 | repositories {
7 | google()
8 | jcenter()
9 |
10 | }
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.0.0'
13 | classpath 'com.novoda:bintray-release:0.8.0'
14 | // classpath 'com.allure.plugin:Component:1.0.0'
15 | // NOTE: Do not place your application dependencies here; they belong
16 | // in the individual module build.gradle files
17 | }
18 |
19 | }
20 |
21 | allprojects {
22 | repositories {
23 | google()
24 | jcenter()
25 | }
26 | }
27 |
28 |
29 |
30 | task clean(type: Delete) {
31 | delete rootProject.buildDir
32 | }
33 |
34 | apply plugin: 'com.allure.appconfig'
35 |
36 | buildscript {
37 | repositories {
38 | maven {
39 | //本地Maven仓库地址
40 | // url uri('/Users/mac/Downloads/ttt')
41 | url "http://dl.bintray.com/allure0/maven"
42 | }
43 | }
44 | dependencies {
45 | //格式为-->group:module:version
46 | classpath 'com.allure.plugin:Component:1.0.0'
47 |
48 | }
49 | }
50 |
51 |
52 |
53 |
54 | hostAppConfig {
55 | isDebug false
56 |
57 | //宿主载体
58 | apps {
59 | app {
60 |
61 | mainActivity "com.allure.modularization.SplashActivity"
62 | modules ':modules:login',
63 | ':modules:shop',
64 | ':modules:main'
65 |
66 | }
67 | }
68 |
69 | //组件
70 | modules {
71 |
72 |
73 | login {
74 | isRunAlone true
75 | name ":modules:login"
76 | applicationId "com.allure.login"
77 | mainActivity ".LoginActivity"
78 |
79 | }
80 | shop {
81 | isRunAlone true
82 | name ":modules:shop"
83 | applicationId "com.allure.shop"
84 | mainActivity ".ShopActivity"
85 |
86 | }
87 | main {
88 | isRunAlone true
89 | name ":modules:main"
90 | applicationId "com.allure.main"
91 | mainActivity ".MainActivity"
92 |
93 | }
94 | }
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/common/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/common/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | //apply plugin: 'com.allure.appmodules'
3 |
4 |
5 | android {
6 |
7 | compileSdkVersion rootProject.ext.defaultConfig.compileSdkVersion
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.defaultConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.defaultConfig.targetSdkVersion
11 | versionCode rootProject.ext.defaultConfig.versionCode
12 | versionName rootProject.ext.defaultConfig.versionName
13 |
14 | javaCompileOptions {
15 | annotationProcessorOptions {
16 | arguments = [moduleName: project.getName()]
17 | }
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 |
27 | lintOptions {
28 | abortOnError false
29 | }
30 |
31 | sourceSets {
32 | main {
33 |
34 |
35 | def dirs = ['provider'
36 | ]
37 | dirs.each { dir ->
38 | java.srcDir("src/$dir/java")
39 | res.srcDir("src/$dir/res")
40 | }
41 | }
42 | }
43 | }
44 |
45 | dependencies {
46 | implementation fileTree(dir: 'libs', include: ['*.jar'])
47 | api rootProject.ext.dependencies.appcompatV7
48 | //ARouter
49 | implementation rootProject.ext.dependencies.arouter_api
50 | annotationProcessor rootProject.ext.dependencies.arouter_compiler
51 | }
52 |
53 |
54 |
--------------------------------------------------------------------------------
/common/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/common/src/assets/schame_inchat.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | 1:URL普通跳转
11 |
12 | arouter://zhaoyanjun/com/URLActivity1
13 |
14 | 2:URL普通跳转携带参数
15 |
16 |
17 | arouter://zhaoyanjun/test/URLActivity2?name=alex&age=18&boy=true&high=180&obj={"name":"jack","id":"666"}
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/common/src/main/java/com/allure/common/ARouterManager.java:
--------------------------------------------------------------------------------
1 | package com.allure.common;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 |
6 | import com.alibaba.android.arouter.facade.Postcard;
7 | import com.alibaba.android.arouter.facade.callback.NavigationCallback;
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 |
10 | /**
11 | * 描述:(这里用一句话描述这个类的作用)
12 | * Created by Cherish on 2018/8/16.
13 | */
14 | public class ARouterManager {
15 |
16 |
17 |
18 |
19 |
20 | public static void start2Shop(Context mContext){
21 | ARouter.getInstance().build(ARouterPathConfig.SHOP_START)
22 | .navigation(mContext, new NavigationCallback() {
23 | @Override
24 | public void onFound(Postcard postcard) {
25 |
26 | }
27 |
28 | @Override
29 | public void onLost(Postcard postcard) {
30 |
31 | }
32 |
33 | @Override
34 | public void onArrival(Postcard postcard) {
35 |
36 | }
37 |
38 | @Override
39 | public void onInterrupt(Postcard postcard) {
40 | Log.e("","拦截成功");
41 |
42 | }
43 | });
44 | }
45 |
46 |
47 |
48 | public static void start2Main(){
49 | ARouter.getInstance().build(ARouterPathConfig.MAIN_START)
50 | .navigation();
51 | }
52 |
53 | public static void start2Login(){
54 | ARouter.getInstance().build(ARouterPathConfig.LOGIN_START)
55 | .navigation();
56 | }
57 |
58 | public static void start2MainSecond(){
59 | ARouter.getInstance().build(ARouterPathConfig.MAIN_SECOND)
60 | .navigation();
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/common/src/main/java/com/allure/common/ARouterPathConfig.java:
--------------------------------------------------------------------------------
1 | package com.allure.common;
2 |
3 | /**
4 | * 描述:(这里用一句话描述这个类的作用)
5 | * Created by Cherish on 2018/8/16.
6 | */
7 | public class ARouterPathConfig {
8 |
9 | public static final String LOGIN_START = "/login/activity_start";
10 |
11 |
12 | public static final String SHOP_START = "/shop/activity_start";
13 |
14 |
15 | public static final String MAIN_START = "/main/activity_start";
16 | public static final String MAIN_SECOND = "/main/activity_second";
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | public static final String SERVICE_LOGIN = "/service/login";
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/common/src/main/java/com/allure/common/SchameFilterActivity.java:
--------------------------------------------------------------------------------
1 | package com.allure.common;
2 |
3 | import android.net.Uri;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import com.alibaba.android.arouter.facade.Postcard;
8 | import com.alibaba.android.arouter.facade.callback.NavCallback;
9 | import com.alibaba.android.arouter.launcher.ARouter;
10 |
11 | /**
12 | * 描述:(这里用一句话描述这个类的作用)
13 | * Created by Cherish on 2018/8/17.
14 | */
15 | public class SchameFilterActivity extends AppCompatActivity {
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 |
20 | Uri uri = getIntent().getData();
21 | ARouter.getInstance().build(uri).navigation(this, new NavCallback() {
22 | @Override
23 | public void onArrival(Postcard postcard) {
24 | //判断用户的登录情况,可以把值保存在sp中
25 |
26 | finish();
27 | }
28 | });
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/common/src/main/java/com/allure/common/bean/LoginInfoBean.java:
--------------------------------------------------------------------------------
1 | package com.allure.common.bean;
2 |
3 | /**
4 | * 描述:(这里用一句话描述这个类的作用)
5 | * Created by Cherish on 2018/8/20.
6 | */
7 | public class LoginInfoBean {
8 | String name;
9 | String age;
10 | boolean isLogin;
11 |
12 | public boolean isLogin() {
13 | return isLogin;
14 | }
15 |
16 | public void setLogin(boolean login) {
17 | isLogin = login;
18 | }
19 |
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | public void setName(String name) {
25 | this.name = name;
26 | }
27 |
28 | public String getAge() {
29 | return age;
30 | }
31 |
32 | public void setAge(String age) {
33 | this.age = age;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/common/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/common/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/common/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/common/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/common/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Shop
3 |
4 |
--------------------------------------------------------------------------------
/common/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/common/src/provider/java/com/allure/provider/ILoginProvider.java:
--------------------------------------------------------------------------------
1 | package com.allure.provider;
2 |
3 | import android.content.Context;
4 |
5 | import com.alibaba.android.arouter.facade.template.IProvider;
6 | import com.allure.common.bean.LoginInfoBean;
7 |
8 | /**
9 | * 描述:(这里用一句话描述这个类的作用)
10 | * Created by Cherish on 2018/8/17.
11 | */
12 | public interface ILoginProvider extends IProvider {
13 |
14 | LoginInfoBean getLoginInfo();
15 | boolean isLogin();
16 | void start2Login();
17 |
18 | @Override
19 | void init(Context context);
20 | }
--------------------------------------------------------------------------------
/config.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 |
3 | app = [
4 | packageName: "com.chips.client",
5 | ]
6 | defaultConfig = [
7 | compileSdkVersion: 27,
8 | buildToolsVersion: "27.0.0",
9 | minSdkVersion : 19,
10 | targetSdkVersion : 9,
11 | versionCode : 1,
12 | versionName : '1.0.0',
13 | ]
14 |
15 |
16 | dependencies = [
17 | appcompatV7 : 'com.android.support:appcompat-v7:27.0.1',
18 | design : 'com.android.support:design:27.0.1',
19 | constraintLayout : 'com.android.support.constraint:constraint-layout:1.0.2',
20 | quickFragment : "com.allure0:QuickFragment:1.0.2",//Fragment框架
21 | //跳转路由Router
22 | arouter_api :'com.alibaba:arouter-api:1.3.1',
23 | arouter_compiler :'com.alibaba:arouter-compiler:1.1.4',
24 | //汉字转拼音
25 | tinyPinyin:'com.github.promeg:tinypinyin:2.0.3',
26 | //Loading content error empty等状态页
27 | loadsir: 'com.kingja.loadsir:loadsir:1.3.6',
28 | baseRecycleViewAdapter: 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
29 | ]
30 | }
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Allure0/AndroidComponentDemo/2ef45cd37d7552305dce971064993d5972472da4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Aug 14 18:49:05 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-4.1-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 |
--------------------------------------------------------------------------------
/login2/build/intermediates/incremental/compileDebugAidl/dependency.store:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/modules/login/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/modules/login/build.gradle:
--------------------------------------------------------------------------------
1 | //apply plugin: 'com.android.library'
2 | apply plugin: 'com.allure.appmodules'
3 |
4 |
5 | android {
6 |
7 | compileSdkVersion rootProject.ext.defaultConfig.compileSdkVersion
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.defaultConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.defaultConfig.targetSdkVersion
11 | versionCode rootProject.ext.defaultConfig.versionCode
12 | versionName rootProject.ext.defaultConfig.versionName
13 |
14 | javaCompileOptions {
15 | annotationProcessorOptions {
16 | arguments = [moduleName: project.getName()]
17 | }
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | lintOptions {
27 | abortOnError false
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | api project(':base')
34 |
35 | //ARouter
36 | implementation rootProject.ext.dependencies.arouter_api
37 | annotationProcessor rootProject.ext.dependencies.arouter_compiler
38 | implementation 'com.android.support:gridlayout-v7:27.0.1'
39 | }
40 |
41 |
42 |
--------------------------------------------------------------------------------
/modules/login/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/modules/login/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/modules/login/src/main/java/com/allure/login/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.allure.login;
2 |
3 | import android.os.Bundle;
4 | import android.os.Handler;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.EditText;
10 | import android.widget.ProgressBar;
11 |
12 | import com.alibaba.android.arouter.facade.annotation.Route;
13 | import com.allure.base.application.BaseApplication;
14 | import com.allure.common.ARouterPathConfig;
15 | import com.blankj.utilcode.util.ToastUtils;
16 |
17 | /**
18 | * 描述:(这里用一句话描述这个类的作用)
19 | * Created by Cherish on 2018/8/15.
20 | */
21 | @Route(path = ARouterPathConfig.LOGIN_START)
22 | public class LoginActivity extends AppCompatActivity {
23 |
24 | private Button mButtonLogin;
25 |
26 | private EditText editName;
27 | private EditText editPwd;
28 |
29 |
30 | private ProgressBar progressBar;
31 |
32 | @Override
33 | protected void onCreate(@Nullable Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.login_activity_start);
36 |
37 | progressBar = findViewById(R.id.progress_bar);
38 | editName = findViewById(R.id.et_username);
39 | editPwd = findViewById(R.id.et_password);
40 | mButtonLogin = findViewById(R.id.btn_login);
41 |
42 |
43 |
44 | mButtonLogin.setOnClickListener(new View.OnClickListener() {
45 | @Override
46 | public void onClick(View view) {
47 |
48 | if ("".equals(editName.getText().toString()) ||
49 | "".equals(editPwd.getText().toString())) {
50 | ToastUtils.showShort("请输入任意用户名和密码");
51 |
52 | } else {
53 | ToastUtils.showShort("登录中...");
54 | progressBar.setVisibility(View.VISIBLE);
55 | new Handler().postDelayed(new Runnable() {
56 | @Override
57 | public void run() {
58 |
59 | BaseApplication.getInstance().setLogin(true);
60 |
61 | progressBar.setVisibility(View.GONE);
62 | ToastUtils.showShort("登录成功");
63 | finish();
64 | }
65 | }, 2000);
66 | }
67 |
68 | }
69 | });
70 |
71 |
72 | findViewById(R.id.btn_logOut).setOnClickListener(new View.OnClickListener() {
73 | @Override
74 | public void onClick(View view) {
75 | ToastUtils.showShort("登录中...");
76 | BaseApplication.getInstance().setLogin(false);
77 | finish();
78 |
79 | }
80 | });
81 | }
82 | }
83 |
84 |
85 |
--------------------------------------------------------------------------------
/modules/login/src/main/java/com/allure/login/LoginInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.allure.login;
2 |
3 | import android.content.Context;
4 | import android.util.Log;
5 |
6 | import com.alibaba.android.arouter.facade.Postcard;
7 | import com.alibaba.android.arouter.facade.annotation.Interceptor;
8 | import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
9 | import com.alibaba.android.arouter.facade.template.IInterceptor;
10 | import com.alibaba.android.arouter.launcher.ARouter;
11 | import com.allure.base.application.BaseApplication;
12 | import com.allure.common.ARouterPathConfig;
13 | import com.allure.provider.ILoginProvider;
14 |
15 | /**
16 | * 描述:(拦截器AOP切面拦截登录)
17 | * Created by Cherish on 2018/8/20.
18 | */
19 | @Interceptor(priority = 1)
20 | public class LoginInterceptor implements IInterceptor {
21 |
22 | private static final String TAG = "LoginInterceptor";
23 |
24 | private Context mContext;
25 |
26 | @Override
27 | public void process(Postcard postcard, InterceptorCallback callback) {
28 |
29 | Log.i(TAG, "LoginInterceptor 开始执行");
30 |
31 | if (postcard.getExtra() == 1) {//extras=1,目标页面标记,代表需要拦截处理
32 |
33 | boolean isLogin = BaseApplication.getInstance().isLogin();
34 | Log.i(TAG, "是否已登录: " + isLogin);
35 | //判断用户的登录情况,可以把值保存在sp中
36 | if (isLogin) {
37 | callback.onContinue(postcard);
38 | } else {
39 | callback.onInterrupt(null);
40 | ILoginProvider iLoginProvider = (ILoginProvider) ARouter.getInstance().build(ARouterPathConfig.SERVICE_LOGIN).navigation();
41 | iLoginProvider.start2Login();
42 | }
43 | } else {
44 | callback.onContinue(postcard);
45 | }
46 |
47 | }
48 |
49 | @Override
50 | public void init(Context context) {
51 |
52 | mContext = context;
53 | Log.i(TAG, "LoginInterceptor 初始化");
54 |
55 | }
56 | }
57 |
58 |
59 |
--------------------------------------------------------------------------------
/modules/login/src/main/java/com/allure/login/LoginProviderImpl.java:
--------------------------------------------------------------------------------
1 | package com.allure.login;
2 |
3 | import android.content.Context;
4 |
5 | import com.alibaba.android.arouter.facade.Postcard;
6 | import com.alibaba.android.arouter.facade.annotation.Route;
7 | import com.alibaba.android.arouter.facade.callback.NavigationCallback;
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.allure.common.ARouterPathConfig;
10 | import com.allure.common.bean.LoginInfoBean;
11 | import com.allure.provider.ILoginProvider;
12 | import com.blankj.utilcode.util.LogUtils;
13 |
14 | /**
15 | * 描述:(IOC思想进行服务判断)
16 | * Created by Cherish on 2018/8/17.
17 | */
18 | @Route(path = ARouterPathConfig.SERVICE_LOGIN)
19 | public class LoginProviderImpl implements ILoginProvider {
20 | private static final String TAG = "LoginProviderImpl";
21 | private Context mContext;
22 |
23 | @Override
24 | public void init(Context context) {
25 | this.mContext = context;
26 | }
27 |
28 |
29 | /**
30 | * 其他快莫获取此模块组件的信息
31 | *
32 | * @return
33 | */
34 | @Override
35 | public LoginInfoBean getLoginInfo() {
36 | LoginInfoBean loginInfoBean = new LoginInfoBean();
37 | loginInfoBean.setAge("18岁");
38 | loginInfoBean.setName("我是Login组件的名字");
39 | loginInfoBean.setLogin(true);
40 | return loginInfoBean;
41 | }
42 |
43 | @Override
44 | public boolean isLogin() {
45 | return true;
46 | }
47 |
48 | @Override
49 | public void start2Login() {
50 | ARouter.getInstance().build(ARouterPathConfig.LOGIN_START)
51 | .navigation(mContext, new NavigationCallback() {
52 | @Override
53 | public void onFound(Postcard postcard) {
54 | LogUtils.d("onFound");
55 | }
56 |
57 | @Override
58 | public void onLost(Postcard postcard) {
59 | LogUtils.d("onLost");
60 | }
61 |
62 | @Override
63 | public void onArrival(Postcard postcard) {
64 | LogUtils.d("onArrival");
65 | }
66 |
67 | @Override
68 | public void onInterrupt(Postcard postcard) {
69 | LogUtils.d("onInterrupt");
70 |
71 | }
72 | });
73 | }
74 |
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/modules/login/src/main/java/com/allure/login/application/LoginApplication.java:
--------------------------------------------------------------------------------
1 | package com.allure.login.application;
2 |
3 | import android.app.Application;
4 | import android.util.Log;
5 |
6 | import com.allure.base.application.ApplicationImpl;
7 |
8 | /**
9 | * 描述:(这里用一句话描述这个类的作用)
10 | * Created by Cherish on 2018/8/16.
11 | */
12 | public class LoginApplication implements ApplicationImpl {
13 |
14 | private static final String TAG = "LoginApplication";
15 |
16 | @Override
17 | public void onCreate(Application baseApplication) {
18 | Log.e(TAG, "初始化LoginApplication");
19 |
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/modules/login/src/main/res/layout/login_activity_start.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
17 |
18 |
19 |
27 |
28 |
31 |
32 |
36 |
37 |
41 |
42 |
46 |
47 |
51 |
52 |
56 |
57 |
58 |
59 |
60 |
61 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/modules/login/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/modules/login/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Login
3 |
4 |
--------------------------------------------------------------------------------
/modules/login/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/modules/main/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/modules/main/build.gradle:
--------------------------------------------------------------------------------
1 | //apply plugin: 'com.android.library'
2 | apply plugin: 'com.allure.appmodules'
3 |
4 |
5 | android {
6 |
7 | compileSdkVersion rootProject.ext.defaultConfig.compileSdkVersion
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.defaultConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.defaultConfig.targetSdkVersion
11 | versionCode rootProject.ext.defaultConfig.versionCode
12 | versionName rootProject.ext.defaultConfig.versionName
13 |
14 | javaCompileOptions {
15 | annotationProcessorOptions {
16 | arguments = [moduleName: project.getName()]
17 | }
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | lintOptions {
27 | abortOnError false
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | api project(':base')
34 |
35 | //ARouter
36 | implementation rootProject.ext.dependencies.arouter_api
37 | annotationProcessor rootProject.ext.dependencies.arouter_compiler
38 | }
39 |
40 |
41 |
--------------------------------------------------------------------------------
/modules/main/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/modules/main/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/modules/main/src/main/java/com/allure/main/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.allure.main;
2 |
3 | import android.content.Intent;
4 | import android.content.pm.PackageManager;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.util.Log;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.TextView;
12 |
13 | import com.alibaba.android.arouter.facade.annotation.Route;
14 | import com.alibaba.android.arouter.launcher.ARouter;
15 | import com.allure.base.application.BaseApplication;
16 | import com.allure.common.ARouterManager;
17 | import com.allure.common.ARouterPathConfig;
18 | import com.allure.provider.ILoginProvider;
19 |
20 | /**
21 | * 描述:(这里用一句话描述这个类的作用)
22 | * Created by Cherish on 2018/8/17.
23 | */
24 | @Route(path = ARouterPathConfig.MAIN_START)
25 | public class MainActivity extends AppCompatActivity {
26 | private static final String TAG = "MainActivity";
27 | private Button mButtonLigin;
28 | private Button mButtonShop;
29 | private TextView mTextLogin;
30 |
31 | @Override
32 | protected void onCreate(@Nullable Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.main_activity_start);
35 | mButtonLigin = findViewById(R.id.btn_login);
36 | //登录
37 | mButtonLigin.setOnClickListener(new View.OnClickListener() {
38 | @Override
39 | public void onClick(View view) {
40 | ILoginProvider iLoginProvider = (ILoginProvider) ARouter.getInstance().build(ARouterPathConfig.SERVICE_LOGIN).navigation();
41 | iLoginProvider.start2Login();
42 | }
43 | });
44 |
45 | //商店
46 | mButtonShop = findViewById(R.id.btn_shop);
47 | mButtonShop.setOnClickListener(new View.OnClickListener() {
48 | @Override
49 | public void onClick(View view) {
50 | ARouterManager.start2Shop(MainActivity.this);
51 | }
52 | });
53 |
54 |
55 | //二级页面
56 | findViewById(R.id.btn_second).setOnClickListener(new View.OnClickListener() {
57 | @Override
58 | public void onClick(View view) {
59 | ARouterManager.start2MainSecond();
60 | }
61 | });
62 |
63 |
64 |
65 |
66 | }
67 |
68 | @Override
69 | protected void onResume() {
70 | super.onResume();
71 | //
72 | if(BaseApplication.getInstance().isLogin()){
73 | ((TextView)findViewById(R.id.text_login)).setText("已登录");
74 | }else{
75 | ((TextView)findViewById(R.id.text_login)).setText("未登录");
76 | }
77 | }
78 |
79 | public void go2Login() {
80 | try {
81 | PackageManager packageManager = MainActivity.this.getPackageManager(); // 当前Activity获得packageManager对象
82 | Intent intent = new Intent();
83 | intent = packageManager.getLaunchIntentForPackage("com.allure.login");
84 | startActivity(intent);
85 | } catch (Exception e) {
86 | Log.i(TAG, e.toString());
87 | }
88 | }
89 |
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/modules/main/src/main/java/com/allure/main/MainSecoendActivity.java:
--------------------------------------------------------------------------------
1 | package com.allure.main;
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.Route;
8 | import com.allure.common.ARouterPathConfig;
9 |
10 | /**
11 | * 描述:(这里用一句话描述这个类的作用)
12 | * Created by Cherish on 2018/8/17.
13 | */
14 | @Route(path = ARouterPathConfig.MAIN_SECOND)
15 |
16 | public class MainSecoendActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(@Nullable Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.main_activity_second);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/modules/main/src/main/res/layout/main_activity_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/modules/main/src/main/res/layout/main_activity_start.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
17 |
18 |
23 |
28 |
29 |
34 |
35 |
40 |
--------------------------------------------------------------------------------
/modules/main/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Main
3 |
4 |
--------------------------------------------------------------------------------
/modules/shop/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/modules/shop/build.gradle:
--------------------------------------------------------------------------------
1 | //apply plugin: 'com.android.library'
2 | apply plugin: 'com.allure.appmodules'
3 |
4 |
5 | android {
6 |
7 | compileSdkVersion rootProject.ext.defaultConfig.compileSdkVersion
8 | defaultConfig {
9 | minSdkVersion rootProject.ext.defaultConfig.minSdkVersion
10 | targetSdkVersion rootProject.ext.defaultConfig.targetSdkVersion
11 | versionCode rootProject.ext.defaultConfig.versionCode
12 | versionName rootProject.ext.defaultConfig.versionName
13 |
14 | javaCompileOptions {
15 | annotationProcessorOptions {
16 | arguments = [moduleName: project.getName()]
17 | }
18 | }
19 | }
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | lintOptions {
27 | abortOnError false
28 | }
29 | }
30 |
31 | dependencies {
32 | implementation fileTree(dir: 'libs', include: ['*.jar'])
33 | api project(':base')
34 |
35 | //ARouter
36 | implementation rootProject.ext.dependencies.arouter_api
37 | annotationProcessor rootProject.ext.dependencies.arouter_compiler
38 | }
39 |
40 |
41 |
--------------------------------------------------------------------------------
/modules/shop/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/modules/shop/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/modules/shop/src/main/java/com/allure/shop/ShopActivity.java:
--------------------------------------------------------------------------------
1 | package com.allure.shop;
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 |
8 | import com.alibaba.android.arouter.facade.annotation.Route;
9 | import com.alibaba.android.arouter.launcher.ARouter;
10 | import com.allure.common.ARouterManager;
11 | import com.allure.common.ARouterPathConfig;
12 | import com.allure.provider.ILoginProvider;
13 | import com.blankj.utilcode.util.ToastUtils;
14 |
15 | /**
16 | * 描述:(商店,进入商店前需要判断是否登录,没有登录进入登录页面)
17 | * Created by Cherish on 2018/8/15.
18 | */
19 | @Route(path = ARouterPathConfig.SHOP_START, extras = 1)
20 | public class ShopActivity extends AppCompatActivity {
21 |
22 | @Override
23 | protected void onCreate(@Nullable Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.shop_activity_start);
26 | findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() {
27 | @Override
28 | public void onClick(View v) {
29 | ARouterManager.start2Login();
30 | }
31 | });
32 |
33 |
34 | findViewById(R.id.btn_info).setOnClickListener(new View.OnClickListener() {
35 | @Override
36 | public void onClick(View v) {
37 | ILoginProvider iLoginProvider = (ILoginProvider) ARouter.getInstance().build(ARouterPathConfig.SERVICE_LOGIN).navigation();
38 | ToastUtils.showShort(
39 | iLoginProvider.getLoginInfo().getName()
40 | );
41 | }
42 | });
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/modules/shop/src/main/java/com/allure/shop/application/ShopApplication.java:
--------------------------------------------------------------------------------
1 | package com.allure.shop.application;
2 |
3 | import android.app.Application;
4 | import android.util.Log;
5 |
6 | import com.allure.base.application.ApplicationImpl;
7 |
8 | /**
9 | * 描述:(这里用一句话描述这个类的作用)
10 | * Created by Cherish on 2018/8/16.
11 | */
12 | public class ShopApplication implements ApplicationImpl {
13 |
14 | private static final String TAG = "ShopApplication";
15 |
16 | @Override
17 | public void onCreate(Application baseApplication) {
18 | Log.e(TAG, "初始化ShopApplication");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/modules/shop/src/main/res/layout/shop_activity_start.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
18 |
19 |
24 |
25 |
26 |
31 |
--------------------------------------------------------------------------------
/modules/shop/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/modules/shop/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Shop
3 |
4 |
--------------------------------------------------------------------------------
/modules/shop/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':modules:login', ':modules:shop', ':base', ':modules:main', ':common'
2 |
--------------------------------------------------------------------------------