diff --git a/.idea/misc.xml b/.idea/misc.xml
index b568e40..004d721 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -74,9 +74,6 @@
-
- $USER_HOME$/.subversion
-
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 57b6fc6..a1bbaf9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,25 +6,26 @@
-
+
-
-
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
@@ -35,7 +36,6 @@
-
@@ -61,72 +61,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -136,53 +71,84 @@
-
-
+
+
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
+
@@ -194,6 +160,8 @@
+
+
@@ -201,6 +169,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -302,6 +280,11 @@
+
+
+
+
+
@@ -310,6 +293,11 @@
+
+
+
+
+
@@ -370,6 +358,11 @@
+
+
+
+
+
@@ -477,6 +470,11 @@
+
+
+
+
+
@@ -580,6 +578,11 @@
+
+
+
+
+
@@ -598,6 +601,11 @@
+
+
+
+
+
@@ -773,6 +781,11 @@
+
+
+
+
+
@@ -821,11 +834,6 @@
-
-
-
-
-
@@ -849,6 +857,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -988,6 +1006,11 @@
+
+
+
+
+
@@ -1079,11 +1102,6 @@
-
-
-
-
-
@@ -1312,6 +1330,11 @@
+
+
+
+
+
@@ -1964,11 +1987,6 @@
-
-
-
-
-
@@ -2009,6 +2027,11 @@
+
+
+
+
+
@@ -2519,11 +2542,6 @@
-
-
-
-
-
@@ -2761,6 +2779,11 @@
+
+
+
+
+
@@ -3467,6 +3490,11 @@
+
+
+
+
+
@@ -3980,11 +4008,6 @@
-
-
-
-
-
@@ -4038,6 +4061,11 @@
+
+
+
+
+
@@ -4063,6 +4091,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -4145,11 +4183,6 @@
-
-
-
-
-
@@ -4168,18 +4201,28 @@
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -4197,11 +4240,6 @@
-
-
-
-
-
@@ -4238,11 +4276,6 @@
-
-
-
-
-
@@ -4264,11 +4297,6 @@
-
-
-
-
-
@@ -4330,6 +4358,11 @@
+
+
+
+
+
@@ -4362,11 +4395,6 @@
-
-
-
-
-
@@ -4392,11 +4420,6 @@
-
-
-
-
-
@@ -4446,11 +4469,6 @@
-
-
-
-
-
@@ -4480,6 +4498,11 @@
+
+
+
+
+
@@ -4489,6 +4512,11 @@
+
+
+
+
+
@@ -4499,6 +4527,11 @@
+
+
+
+
+
@@ -4527,11 +4560,6 @@
-
-
-
-
-
@@ -4588,11 +4616,6 @@
-
-
-
-
-
@@ -4627,11 +4650,6 @@
-
-
-
-
-
@@ -4642,11 +4660,6 @@
-
-
-
-
-
@@ -4672,11 +4685,6 @@
-
-
-
-
-
@@ -4889,6 +4897,11 @@
+
+
+
+
+
@@ -5595,6 +5608,11 @@
+
+
+
+
+
@@ -6301,6 +6319,11 @@
+
+
+
+
+
@@ -7007,6 +7030,11 @@
+
+
+
+
+
@@ -7513,23 +7541,24 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -7544,78 +7573,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -7629,78 +7668,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -7714,78 +7763,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -7799,78 +7858,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -7884,78 +7953,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -7969,78 +8048,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -8054,78 +8143,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -8139,78 +8238,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -8224,78 +8333,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -8309,78 +8428,88 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
+
+
-
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
-
-
-
-
-
@@ -8542,42 +8671,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -8585,21 +8678,58 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
@@ -8626,6 +8756,9 @@
+
+
+
@@ -8729,7 +8862,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8829,7 +8978,7 @@
-
+
@@ -8866,6 +9015,10 @@
+
+
+
+
@@ -8877,11 +9030,7 @@
-
-
-
-
-
+
@@ -8895,35 +9044,104 @@
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
@@ -8932,31 +9150,32 @@
+
-
+
+
+
-
-
-
-
+
+
+
-
+
-
-
+
-
-
+
+
-
-
-
+
+
+
-
+
@@ -9011,6 +9230,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -9018,37 +9261,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9056,7 +9303,7 @@
-
+
@@ -9064,37 +9311,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9140,30 +9391,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -9281,37 +9508,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9326,37 +9557,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9371,37 +9606,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9416,37 +9655,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9461,37 +9704,41 @@
-
-
+
+
+
+
+
+
+
+
-
-
@@ -9516,6 +9763,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -9532,6 +9823,9 @@
+
+ $USER_HOME$/.subversion
+
@@ -9552,45 +9846,53 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
@@ -9611,7 +9913,7 @@
file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
- 248
+ 251
@@ -9629,435 +9931,480 @@
file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
- 175
+ 211
-
+
- file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
- 208
+ file://$PROJECT_DIR$/app/src/main/java/com/cangwang/modulebus/ModuleMainActivity.java
+ 18
-
+
- file://$PROJECT_DIR$/app/src/main/java/com/cangwang/modulebus/ModuleExampleFragment.java
- 39
+ file://$PROJECT_DIR$/page_body/src/main/java/com/cangwang/page_body/PageBodyExModule.java
+ 67
-
+
- file://$PROJECT_DIR$/app/src/main/java/com/cangwang/modulebus/ModuleExampleFragment.java
- 42
+ file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExActivity.java
+ 131
-
+
- file://$PROJECT_DIR$/app/src/main/java/com/cangwang/modulebus/ModuleMainActivity.java
- 18
+ file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExActivity.java
+ 155
-
+
- file://$PROJECT_DIR$/app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java
- 17
+ file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
+ 163
-
+
+
+
+ file://$PROJECT_DIR$/page_name/src/main/java/com/cangwang/page_name/PageNameExModule.java
+ 60
+
+
-
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
-
-
+
+
-
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
+
+
-
+
-
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
-
-
+
-
-
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
-
-
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
-
+
-
-
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
+
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
-
-
-
-
-
-
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index 48f70ac..670d1b8 100644
--- a/README.md
+++ b/README.md
@@ -1,51 +1,13 @@
-# ModuleBus
-Module Bus is use for diffent modules communication.
+# ModuleBus_Ex
+ModuleBus_Ex is use for diffent modules display in one Activity or Fragment.
+One function one module ,to make module independence.
-ModuleBus in 3 steps
--------------------
-1. Define events:
+like this
- ```java
- public static class MessageClient extend IBaseClient { /* Additional fields if needed */ }
- ```
-
-2. Prepare ModuleEvent and function:
- Declare and annotate your subscribing method.
-
- ```java
- @ModuleEvent(coreClientClass = MessageClient.Class)
- public void fun(Object...args) {/* Do something */};
- ```
- Register and unregister your ModuleBus. For example on Android, activities and fragments should usually register according to their life cycle:
-
- ```java
- @Override
- public void onStart() {
- super.onStart();
- ModuleBus.getInstance().register(this);
- }
-
- @Override
- public void onDestroy() {
- super.onStop();
- ModuleBus.getInstance().unregister(this);
- }
- ```
-
-3. Post function:
-
- ```java
- ModuleBus.getInstance().post(MessageClient.class,"fun",Object...args);
- ```
-
-
-
-Add ModuleBus to your project
-----------------------------
Gradle:
```gradle
-compile 'com.cangwang.core:modulebus:2.0.0'
+compile 'com.cangwang.core:modulebus:3.0.0'
```
Maven:
@@ -53,23 +15,21 @@ Maven:
com.cangwang.core
modulebus
- 2.0.0
+ 3.0.0
pom
```
*Important
-need to set base module depend with ModuleBus and ,other communicated modules depend with base module.
-
+1.need to set base module depend with ModuleBus and ,other communicated modules depend with base module.
+2.need to import rxjava2 and rxandroid,to make loading high efficiency.
-*2016.12.12 update
-(1)Use ArrayMap to change with HashMap.
-(2)Add startModuleActivity function.
-(3)Fix bugs and develop speeds in ModuleBus.
+```gradle
+compile 'io.reactivex.rxjava2:rxjava:2.+'
+compile 'io.reactivex.rxjava2:rxandroid:+'
+```
-*2017.2.27 update
-(1) Add Module architecture inclue activity,fragment and view.
-(2) Add Application util ModuleImpl.
-*2017.3.3 update moduleBus 2.0.0
-(1) update Module architecture inclue activity,fragment and view.
+*2017.6.15 update
+make modules can layout free in sreen.
+make modules load high efficiency with rxjava and rxandroid.
diff --git a/a/a.iml b/a/a.iml
index 302f1b2..7fcd8a8 100644
--- a/a/a.iml
+++ b/a/a.iml
@@ -9,7 +9,6 @@
-
@@ -20,7 +19,7 @@
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,7 +61,6 @@
-
@@ -72,7 +68,6 @@
-
@@ -80,11 +75,9 @@
-
-
@@ -108,7 +101,6 @@
-
@@ -118,7 +110,7 @@
-
+
@@ -135,14 +127,28 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/app.iml b/app/app.iml
index 8e1766e..af1cf5f 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -9,7 +9,6 @@
-
@@ -47,7 +46,6 @@
-
@@ -55,7 +53,6 @@
-
@@ -63,7 +60,6 @@
-
@@ -71,7 +67,6 @@
-
@@ -79,7 +74,6 @@
-
@@ -116,7 +110,7 @@
-
+
@@ -145,10 +139,22 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 362cc58..ccf312c 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,58 +1,56 @@
-//apply from: rootProject.getRootDir().getAbsolutePath() + "/common_config.gradle"
-apply from: "${rootProject.rootDir}/common_config.gradle"
-if(project.ext.isLib){
- apply plugin: 'com.android.library'
- apply from: 'fat-aar.gradle'
-}else {
- apply plugin: 'com.android.application'
-}
-
-android {
- compileSdkVersion project.ext.compileSdkVersion
- buildToolsVersion project.ext.buildToolsVersion
- defaultConfig {
- if (!project.ext.isLib) {
- applicationId project.ext.applicationId
- }
- minSdkVersion project.ext.minSdkVersion
- targetSdkVersion project.ext.targetSdkVersion
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:design:25.0.1'
- compile 'com.android.support:appcompat-v7:25.0.1'
-
- if(project.ext.isLib) {
- embedded project(':page_body')
- embedded project(':page_body_bt')
- embedded project(':page_name')
- embedded project(':page_view')
- }else{
- if (!project.ext.isDebug) {
- compile project(':a')
- compile project(':b')
- compile project(':page_body')
- compile project(':page_body_bt')
- compile project(':page_name')
- compile project(':page_view')
- }else{
- compile project(':core')
- }
- }
-}
-
-
+//apply from: rootProject.getRootDir().getAbsolutePath() + "/common_config.gradle"
+apply from: "${rootProject.rootDir}/common_config.gradle"
+if(project.ext.isLib){
+ apply plugin: 'com.android.library'
+ apply from: 'fat-aar.gradle'
+}else {
+ apply plugin: 'com.android.application'
+}
+
+android {
+ compileSdkVersion project.ext.compileSdkVersion
+ buildToolsVersion project.ext.buildToolsVersion
+ defaultConfig {
+ if (!project.ext.isLib) {
+ applicationId project.ext.applicationId
+ }
+ minSdkVersion project.ext.minSdkVersion
+ targetSdkVersion project.ext.targetSdkVersion
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:design:25.0.1'
+ compile 'com.android.support:appcompat-v7:25.0.1'
+
+ if(project.ext.isLib) {
+ embedded project(':page_body')
+ embedded project(':page_body_bt')
+ embedded project(':page_name')
+ embedded project(':page_view')
+ }else{
+ if (!project.ext.isDebug) {
+ compile project(':page_body')
+ compile project(':page_body_bt')
+ compile project(':page_name')
+ compile project(':page_view')
+ }else{
+ compile project(':core')
+ }
+ }
+}
+
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 169effa..aec4214 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,48 +1,64 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/ic_launcher-web.png b/app/src/main/ic_launcher-web.png
new file mode 100644
index 0000000..5ecd224
Binary files /dev/null and b/app/src/main/ic_launcher-web.png differ
diff --git a/app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java b/app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java
index 3caa145..8b0a871 100644
--- a/app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java
+++ b/app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java
@@ -1,25 +1,27 @@
-package com.cangwang.modulebus;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.view.Window;
-import android.view.WindowManager;
-
-/**
- * Created by cangwang on 2017/2/26.
- */
-
-public class AdaviceActivity extends AppCompatActivity{
- @Override
- public void onCreate(Bundle savedInstanceState) {
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_start);
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
-
- startActivity(new Intent(this,ModuleMainActivity.class));
- finish();
- }
-}
+package com.cangwang.modulebus;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.Window;
+import android.view.WindowManager;
+
+import com.cangwang.modulebus.ExModule.ModuleMainExActivity;
+
+/**
+ * Created by cangwang on 2017/2/26.
+ */
+
+public class AdaviceActivity extends AppCompatActivity{
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_start);
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ startActivity(new Intent(this,ModuleMainExActivity.class));
+ finish();
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ExModule/BaseController.java b/app/src/main/java/com/cangwang/modulebus/ExModule/BaseController.java
new file mode 100644
index 0000000..288fa1f
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/BaseController.java
@@ -0,0 +1,38 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public class BaseController implements IView{
+ private Context context;
+
+ public void onAttach(Activity activity){
+ context= activity;
+ }
+
+ public void create(Bundle saveInstanceState, Activity activity,ViewGroup container){
+
+ }
+
+ @Override
+ public View getView() {
+ return null;
+ }
+
+ @Override
+ public void hide() {
+
+ }
+
+ @Override
+ public void show() {
+
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ExModule/IView.java b/app/src/main/java/com/cangwang/modulebus/ExModule/IView.java
new file mode 100644
index 0000000..e907e02
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/IView.java
@@ -0,0 +1,13 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.view.View;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public interface IView {
+ View getView();
+ void show();
+ void hide();
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExActivity.java b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExActivity.java
new file mode 100644
index 0000000..d8fa515
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExActivity.java
@@ -0,0 +1,22 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AppCompatActivity;
+
+import com.cangwang.modulebus.ModuleExampleFragment;
+import com.cangwang.modulebus.R;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public class ModuleExActivity extends AppCompatActivity{
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_example);
+ getSupportFragmentManager().beginTransaction().replace(R.id.container,new ModuleExFragment()).commit();
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExFragment.java b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExFragment.java
new file mode 100644
index 0000000..2a3dd25
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExFragment.java
@@ -0,0 +1,40 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.os.Bundle;
+
+import com.cangwang.core.cwmodule.ex.ModuleManageExFragment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+public class ModuleExFragment extends ModuleManageExFragment {
+ public static ModuleExFragment newInstance(){
+ ModuleExFragment fragment = new ModuleExFragment();
+ Bundle bundle = new Bundle();
+ fragment.setArguments(bundle);
+ return fragment;
+ }
+
+ public static ModuleExFragment newInstance(List modules){
+ PageExConfig.moduleList = modules;
+ ModuleExFragment fragment = new ModuleExFragment();
+ Bundle bundle = new Bundle();
+ fragment.setArguments(bundle);
+ return fragment;
+ }
+
+
+ @Override
+ public List moduleConfig() {
+ if (PageExConfig.moduleList.size()>0)
+ return PageExConfig.moduleList;
+
+ List moduleList= new ArrayList<>();
+ moduleList.add(PageExConfig.MODULE_PAGE_NAME);
+ moduleList.add(PageExConfig.MODULE_BODY_BT_NAME);
+ return moduleList;
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleMainExActivity.java b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleMainExActivity.java
new file mode 100644
index 0000000..9a1428b
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleMainExActivity.java
@@ -0,0 +1,31 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import com.cangwang.core.cwmodule.ex.ModuleManageExActivity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public class ModuleMainExActivity extends ModuleManageExActivity{
+
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+
+ @Override
+ public List moduleConfig() {
+// ArrayMap> map = new ArrayMap<>();
+// map.put(PageConfig.MODULE_PAGE_NAME,new ArrayList(){{add(R.id.page_name);}});
+// map.put(PageConfig.MODULE_BODY_NAME,new ArrayList(){{add(R.id.page_bodyT);add(R.id.page_bodyB);}});
+ List moduleList= new ArrayList<>();
+ moduleList.add(PageExConfig.MODULE_PAGE_NAME);
+ moduleList.add(PageExConfig.MODULE_BODY_NAME);
+ return moduleList;
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ExModule/PageExConfig.java b/app/src/main/java/com/cangwang/modulebus/ExModule/PageExConfig.java
new file mode 100644
index 0000000..c3cfe76
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/PageExConfig.java
@@ -0,0 +1,54 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.content.Context;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by cangeang on 17/6/15.
+ */
+public class PageExConfig {
+ public static List pageTitles = new ArrayList();
+
+ public static List getPageTitles(Context context) {
+ pageTitles.clear();
+ pageTitles.add("a");
+ pageTitles.add("b");
+ pageTitles.add("b");
+ pageTitles.add("b");
+ return pageTitles;
+ }
+
+ private static final String FragmentA = "com.cangwang.a.FragmentA";
+
+ private static final String FragmentB = "com.cangwang.b.FragmentB";
+
+ public static String[] fragmentNames = {
+ FragmentA,
+ FragmentB,
+ FragmentB,
+ FragmentB
+ };
+
+ public static final String ActivityB = "com.cangwang.b.BActivity";
+
+
+ public static final String MODULE_PAGE_NAME ="com.cangwang.page_name.PageNameExModule";
+ public static final String MODULE_BODY_NAME ="com.cangwang.page_body.PageBodyExModule";
+ public static final String MODULE_BODY_BT_NAME ="com.cangwang.page_body_bt.PageBodyExModule";
+
+ public static final String MODULE_VIEW_PAGE_NAME ="com.cangwang.page_view.PageViewModule";
+
+ public static final String BODY_CREATE ="com.cangwang.page_body.BodyCreate";
+ public static final String NAME_CREATE ="com.cangwang.page_name.NameCreate";
+
+ public static List moduleList = new ArrayList<>();
+
+
+ public static final String[] moduleCreate = {
+ BODY_CREATE,
+ NAME_CREATE
+ };
+
+}
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index cde69bc..7377ed1 100644
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index c133a0c..529ecf5 100644
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index bfa42f0..4e0a609 100644
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index 324e72c..75de77c 100644
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index aee44e1..33f066d 100644
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/b/b.iml b/b/b.iml
index ae05e44..167f35e 100644
--- a/b/b.iml
+++ b/b/b.iml
@@ -9,7 +9,6 @@
-
@@ -20,7 +19,7 @@
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,27 +61,23 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
@@ -108,7 +101,6 @@
-
@@ -118,7 +110,7 @@
-
+
@@ -135,14 +127,28 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/base/base.iml b/base/base.iml
index 5e06982..965460c 100644
--- a/base/base.iml
+++ b/base/base.iml
@@ -9,7 +9,6 @@
-
@@ -20,7 +19,7 @@
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,7 +61,6 @@
-
@@ -72,7 +68,6 @@
-
@@ -80,7 +75,6 @@
-
@@ -102,6 +96,7 @@
+
@@ -116,31 +111,45 @@
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/base/build.gradle b/base/build.gradle
index 546335b..b1f91d0 100644
--- a/base/build.gradle
+++ b/base/build.gradle
@@ -35,5 +35,7 @@ dependencies {
})
// compile 'com.cangwang.core:modulebus:1.0'
compile 'com.android.support:appcompat-v7:25.0.1'
+ compile 'io.reactivex.rxjava2:rxjava:2.1.0'
+ compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile project(':core')
}
diff --git a/core/build.gradle b/core/build.gradle
index 0985154..2487c4d 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -1,40 +1,38 @@
-apply plugin: 'com.android.library'
-apply from: "${rootProject.rootDir}/common_config.gradle"
-
-android {
- compileSdkVersion project.ext.compileSdkVersion
- buildToolsVersion project.ext.buildToolsVersion
-
- defaultConfig {
- minSdkVersion project.ext.minSdkVersion
- targetSdkVersion project.ext.targetSdkVersion
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- compile 'com.android.support:appcompat-v7:25.0.1'
- compile 'com.android.support:support-v4:25.0.1'
-}
-
-ext {
- PUBLISH_GROUP_ID = 'com.cangwang.core'
- PUBLISH_ARTIFACT_ID = 'modulebus'
- PUBLISH_VERSION = '2.0.0'
-}
-
-apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
+apply plugin: 'com.android.library'
+apply from: "${rootProject.rootDir}/common_config.gradle"
+
+android {
+ compileSdkVersion project.ext.compileSdkVersion
+ buildToolsVersion project.ext.buildToolsVersion
+
+ defaultConfig {
+ minSdkVersion project.ext.minSdkVersion
+ targetSdkVersion project.ext.targetSdkVersion
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ provided 'com.android.support:appcompat-v7:25.+'
+ provided 'io.reactivex.rxjava2:rxjava:2.+'
+ provided 'io.reactivex.rxjava2:rxandroid:+'
+}
+
+ext {
+ PUBLISH_GROUP_ID = 'com.cangwang.core'
+ PUBLISH_ARTIFACT_ID = 'modulebus'
+ PUBLISH_VERSION = '3.0.0'
+}
+
+apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
diff --git a/core/core.iml b/core/core.iml
index 7dbb035..52181f4 100644
--- a/core/core.iml
+++ b/core/core.iml
@@ -9,7 +9,6 @@
-
@@ -20,7 +19,7 @@
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,7 +61,6 @@
-
@@ -72,7 +68,6 @@
-
@@ -80,7 +75,6 @@
-
@@ -88,20 +82,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -116,30 +106,20 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/java/com/cangwang/core/ModuleBus.java b/core/src/main/java/com/cangwang/core/ModuleBus.java
index 5e4d9a0..885a132 100644
--- a/core/src/main/java/com/cangwang/core/ModuleBus.java
+++ b/core/src/main/java/com/cangwang/core/ModuleBus.java
@@ -1,268 +1,273 @@
-package com.cangwang.core;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.util.ArrayMap;
-import android.util.Log;
-
-import com.cangwang.core.info.MethodInfo;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * Created by zjl on 16/10/19.
- */
-public class ModuleBus {
- private static final String TAG = "ModuleBus";
-
- public static final int MODULE_RESULT = 1001;
-
-// private static ArrayMap> moduleEventMethods = new ArrayMap<>();
- /**
- * Object methodClass
- * String methodName;
- * MethodInfo method info
- */
- private static ArrayMap> moduleEventMethods = new ArrayMap<>();
-// private static ArrayMap,ArrayList> moduleClients = new ArrayMap<>();
-
- /**
- * Class IBaseClient.class
- * String methodName
- * Object methodClass
- */
- private static ArrayMap,ArrayMap>> moduleMethodClient = new ArrayMap<>();
-
- private static ModuleBus instance;
-
- private String PK_NAME ="";
-
- public static ModuleBus getInstance(){
- if(instance == null){
- synchronized (ModuleBus.class){
- if (instance == null){
- instance = new ModuleBus();
- }
- }
- }
- return instance;
- }
-
-
- public void register(Object client){
- if(client == null) return;
-
- Class> orginalClass = client.getClass();
- if(orginalClass == null) return;
-
-
- Method[] methods = orginalClass.getMethods();
-
- for(Method method:methods){
- ModuleEvent event = method.getAnnotation(ModuleEvent.class);
- if(event !=null){
- Class> clientClass = event.coreClientClass();
-
-// addClient(clientClass,client);
-// addEventMethod(client,clientClass,method);
- addClient(clientClass, client, method);
-// addEventMethod(clientClass, method);
- addEventMethod(client,method,event.single());
- }
- }
- }
-
-// private void addClient(Class> clientClass,Object client){
-// ArrayList clientList = moduleClients.get(clientClass);
-//
-// if (clientList == null)
-// clientList = new ArrayList<>();
-//
-// clientList.add(client);
-// moduleClients.put(clientClass,clientList);
-// }
-
- private void addClient(Class> clientClass,Object client,Method m){
- ArrayMap> clientMethodList = moduleMethodClient.get(clientClass);
-
- if (clientMethodList == null) {
- clientMethodList = new ArrayMap<>();
- }
-
- ArrayList clientList = clientMethodList.get(m.getName());
- if (clientList ==null){
- clientList = new ArrayList<>();
- }
-
- clientList.add(client);
- clientMethodList.put(m.getName(),clientList);
- moduleMethodClient.put(clientClass,clientMethodList);
- }
-
-// private void addEventMethod(Object client,Class> clientClass, Method m){
-// ArrayMap methods = moduleEventMethods.get(clientClass);
-//
-// if(methods == null){
-// methods = new ArrayMap<>();
-// moduleEventMethods.put(clientClass,methods);
-// }
-// methods.put(m.getName(),m);
-// }
-
-// private void addEventMethod(Class> clientClass, Method m){
-// ArrayMap methods = moduleEventMethods.get(clientClass);
-//
-// if(methods == null){
-// methods = new ArrayMap<>();
-// moduleEventMethods.put(clientClass,methods);
-// }
-// methods.put(m.getName(),m);
-// }
-
- private void addEventMethod(Object client, Method m,boolean single){
- ArrayMap methods = moduleEventMethods.get(client);
- if (methods == null) {
- methods = new ArrayMap<>();
- moduleEventMethods.put(client, methods);
- }
- methods.put(m.getName(), new MethodInfo(m.getName(), m, single));
- }
-
- public void unregister(Object client){
- if(client == null) return;
-
- Class> orginalClass = client.getClass();
- if(orginalClass == null) return;
-
-
- Method[] methods = orginalClass.getMethods();
-
- for(Method method:methods) {
- ModuleEvent event = method.getAnnotation(ModuleEvent.class);
- if(event !=null) {
- Class> clientClass = event.coreClientClass();
-// moduleClients.remove(clientClass);
- moduleMethodClient.remove(clientClass);
- }
- }
- }
-
-// public ArrayList getClient(Class> clientClass){
-//
-// if(clientClass == null) return null;
-// ArrayList clientList = moduleClients.get(clientClass);
-// if(clientList != null){
-// clientList = new ArrayList<>(clientList);
-// }
-//
-// return clientList;
-// }
-
- public ArrayList getClient(Class> clientClass,String methodName){
- if(clientClass == null || methodName == null) return null;
- return moduleMethodClient.get(clientClass).get(methodName);
- }
-
- public void post(Class> clientClass,String methodName,Object...args){
- if(clientClass == null || methodName == null ||methodName.length() == 0) return;
-
- ArrayList clientList = getClient(clientClass,methodName);
-
- if(clientList == null) return;
-
- try{
- for(Object c: clientList){
- try{
- ArrayMap methods = moduleEventMethods.get(c);
- Method method = methods.get(methodName).m;
- if(method == null){
- Log.e(TAG,"cannot find client method"+methodName +"for args["+args.length+"]" + Arrays.toString(args));
- return;
- }else if(method.getParameterTypes() == null){
- Log.e(TAG,"cannot find client method param:"+method.getParameterTypes() +"for args["+args.length+"]" + Arrays.toString(args));
- return;
- }else if(method.getParameterTypes().length != args.length){
- Log.e(TAG,"method "+methodName +" param number not matched:method("+method.getParameterTypes().length+"), args(" + args.length+")");
- return;
- }
- method.invoke(c,args);
- }catch (Throwable e){
- Log.e(TAG,"Notifiy client method invoke error.",e);
- }
- }
-
- }catch (Throwable e){
- Log.e(TAG,"Notify client error",e);
- }
- }
-
- public Object postSingle(Class> clientClass,String methodName,Object...args){
- if(clientClass == null || methodName == null ||methodName.length() == 0) return null;
-
- ArrayList clientList = getClient(clientClass,methodName);
-
- if(clientList == null) return null;
-
- try{
- MethodInfo methodInfo = moduleEventMethods.get(clientClass).get(methodName);
- boolean single = methodInfo.single;
- Method method = methodInfo.m;
-
- if (!single || clientList.size() != 1){
- Log.e(TAG,"method"+methodName +"for args["+args.length+"]" + Arrays.toString(args) + " i s not single");
- return null;
- } else if(method == null){
- Log.e(TAG,"cannot find client method"+methodName +"for args["+args.length+"]" + Arrays.toString(args));
- return null;
- }else if(method.getParameterTypes() == null){
- Log.e(TAG,"cannot find client method param:"+method.getParameterTypes() +"for args["+args.length+"]" + Arrays.toString(args));
- return null;
- }else if(method.getParameterTypes().length != args.length){
- Log.e(TAG,"method "+methodName +" param number not matched:method("+method.getParameterTypes().length+"), args(" + args.length+")");
- return null;
- }
-
- for(Object c: clientList){
- try{
- return method.invoke(c,args);
- }catch (Throwable e){
- Log.e(TAG,"Notifiy client method invoke error.",e);
- }
- }
-
- }catch (Throwable e){
- Log.e(TAG,"Notify client error",e);
- return null;
- }
- return null;
- }
-
- private ArrayMap moduleAct = new ArrayMap<>();
-
- public void startModuleActivity(Object object,String className){
- startModuleActivity(object,className,null);
- }
-
- public void startModuleActivity(Object object,String className, Bundle bundle){
- if(className == null) return;
- moduleAct.put(className,object);
- post(IBaseClient.class,"startModuleActivity",className,bundle);
- }
-
-
- public void moduleResult(Object object,Intent data){
- if (data==null)return;
- post(IBaseClient.class,"moduleResult",moduleAct.get(object.getClass().getName()),data);
- }
-
- public void setPackageName(String name){
- this.PK_NAME = name;
- }
-
- public String getPacketName(){
- return PK_NAME;
- }
-
-}
+package com.cangwang.core;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.util.ArrayMap;
+import android.util.Log;
+
+import com.cangwang.core.info.MethodInfo;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * Created by zjl on 16/10/19.
+ */
+public class ModuleBus {
+ private static final String TAG = "ModuleBus";
+
+ public static final int MODULE_RESULT = 1001;
+
+// private static ArrayMap> moduleEventMethods = new ArrayMap<>();
+ /**
+ * Object methodClass
+ * String methodName;
+ * MethodInfo method info
+ */
+ private static ArrayMap> moduleEventMethods = new ArrayMap<>();
+// private static ArrayMap,ArrayList> moduleClients = new ArrayMap<>();
+
+ /**
+ * Class IBaseClient.class
+ * String methodName
+ * Object methodClass
+ */
+ private static ArrayMap,ArrayMap>> moduleMethodClient = new ArrayMap<>();
+
+ private static ModuleBus instance;
+
+ private String PK_NAME ="";
+
+ public static ModuleBus getInstance(){
+ if(instance == null){
+ synchronized (ModuleBus.class){
+ if (instance == null){
+ instance = new ModuleBus();
+ }
+ }
+ }
+ return instance;
+ }
+
+
+ public void register(Object client){
+ if(client == null) return;
+
+ Class> orginalClass = client.getClass();
+ if(orginalClass == null) return;
+
+
+ Method[] methods = orginalClass.getMethods();
+
+ for(Method method:methods){
+ ModuleEvent event = method.getAnnotation(ModuleEvent.class);
+ if(event !=null){
+ Class> clientClass = event.coreClientClass();
+
+// addClient(clientClass,client);
+// addEventMethod(client,clientClass,method);
+ addClient(clientClass, client, method);
+// addEventMethod(clientClass, method);
+ addEventMethod(client,method,event.single());
+ }
+ }
+ }
+
+// private void addClient(Class> clientClass,Object client){
+// ArrayList clientList = moduleClients.get(clientClass);
+//
+// if (clientList == null)
+// clientList = new ArrayList<>();
+//
+// clientList.add(client);
+// moduleClients.put(clientClass,clientList);
+// }
+
+ private void addClient(Class> clientClass,Object client,Method m){
+ ArrayMap> clientMethodList = moduleMethodClient.get(clientClass);
+
+ if (clientMethodList == null) {
+ clientMethodList = new ArrayMap<>();
+ }
+
+ ArrayList clientList = clientMethodList.get(m.getName());
+ if (clientList ==null){
+ clientList = new ArrayList<>();
+ }
+
+ clientList.add(client);
+ clientMethodList.put(m.getName(),clientList);
+ moduleMethodClient.put(clientClass,clientMethodList);
+ }
+
+// private void addEventMethod(Object client,Class> clientClass, Method m){
+// ArrayMap methods = moduleEventMethods.get(clientClass);
+//
+// if(methods == null){
+// methods = new ArrayMap<>();
+// moduleEventMethods.put(clientClass,methods);
+// }
+// methods.put(m.getName(),m);
+// }
+
+// private void addEventMethod(Class> clientClass, Method m){
+// ArrayMap methods = moduleEventMethods.get(clientClass);
+//
+// if(methods == null){
+// methods = new ArrayMap<>();
+// moduleEventMethods.put(clientClass,methods);
+// }
+// methods.put(m.getName(),m);
+// }
+
+ private void addEventMethod(Object client, Method m,boolean single){
+ ArrayMap methods = moduleEventMethods.get(client);
+ if (methods == null) {
+ methods = new ArrayMap<>();
+ moduleEventMethods.put(client, methods);
+ }
+ methods.put(m.getName(), new MethodInfo(m.getName(), m, single));
+ }
+
+ public void unregister(Object client){
+ if(client == null) return;
+
+ Class> orginalClass = client.getClass();
+ if(orginalClass == null) return;
+
+
+ Method[] methods = orginalClass.getMethods();
+ for(Method method:methods) {
+ ModuleEvent event = method.getAnnotation(ModuleEvent.class);
+ if(event !=null) {
+ Class> clientClass = event.coreClientClass();
+ if (moduleEventMethods.get(clientClass)==null) return;
+ moduleEventMethods.get(clientClass).remove(method); //移除方法
+// moduleClients.remove(clientClass);
+ if (moduleEventMethods.get(clientClass).isEmpty()) //如果此类中已经无方法,移除此类
+ moduleMethodClient.remove(clientClass);
+ }
+ }
+ }
+
+// public ArrayList getClient(Class> clientClass){
+//
+// if(clientClass == null) return null;
+// ArrayList clientList = moduleClients.get(clientClass);
+// if(clientList != null){
+// clientList = new ArrayList<>(clientList);
+// }
+//
+// return clientList;
+// }
+
+ public ArrayList getClient(Class> clientClass,String methodName){
+ if(clientClass == null || methodName == null) return null;
+ if (moduleMethodClient.get(clientClass)!=null)
+ return moduleMethodClient.get(clientClass).get(methodName);
+ else
+ return null;
+ }
+
+ public void post(Class> clientClass,String methodName,Object...args){
+ if(clientClass == null || methodName == null ||methodName.length() == 0) return;
+
+ ArrayList clientList = getClient(clientClass,methodName);
+
+ if(clientList == null) return;
+
+ try{
+ for(Object c: clientList){
+ try{
+ ArrayMap methods = moduleEventMethods.get(c);
+ Method method = methods.get(methodName).m;
+ if(method == null){
+ Log.e(TAG,"cannot find client method"+methodName +"for args["+args.length+"]" + Arrays.toString(args));
+ return;
+ }else if(method.getParameterTypes() == null){
+ Log.e(TAG,"cannot find client method param:"+method.getParameterTypes() +"for args["+args.length+"]" + Arrays.toString(args));
+ return;
+ }else if(method.getParameterTypes().length != args.length){
+ Log.e(TAG,"method "+methodName +" param number not matched:method("+method.getParameterTypes().length+"), args(" + args.length+")");
+ return;
+ }
+ method.invoke(c,args);
+ }catch (Throwable e){
+ Log.e(TAG,"Notifiy client method invoke error.",e);
+ }
+ }
+
+ }catch (Throwable e){
+ Log.e(TAG,"Notify client error",e);
+ }
+ }
+
+ public Object postSingle(Class> clientClass,String methodName,Object...args){
+ if(clientClass == null || methodName == null ||methodName.length() == 0) return null;
+
+ ArrayList clientList = getClient(clientClass,methodName);
+
+ if(clientList == null) return null;
+
+ try{
+ MethodInfo methodInfo = moduleEventMethods.get(clientClass).get(methodName);
+ boolean single = methodInfo.single;
+ Method method = methodInfo.m;
+
+ if (!single || clientList.size() != 1){
+ Log.e(TAG,"method"+methodName +"for args["+args.length+"]" + Arrays.toString(args) + " i s not single");
+ return null;
+ } else if(method == null){
+ Log.e(TAG,"cannot find client method"+methodName +"for args["+args.length+"]" + Arrays.toString(args));
+ return null;
+ }else if(method.getParameterTypes() == null){
+ Log.e(TAG,"cannot find client method param:"+method.getParameterTypes() +"for args["+args.length+"]" + Arrays.toString(args));
+ return null;
+ }else if(method.getParameterTypes().length != args.length){
+ Log.e(TAG,"method "+methodName +" param number not matched:method("+method.getParameterTypes().length+"), args(" + args.length+")");
+ return null;
+ }
+
+ for(Object c: clientList){
+ try{
+ return method.invoke(c,args);
+ }catch (Throwable e){
+ Log.e(TAG,"Notifiy client method invoke error.",e);
+ }
+ }
+
+ }catch (Throwable e){
+ Log.e(TAG,"Notify client error",e);
+ return null;
+ }
+ return null;
+ }
+
+ private ArrayMap moduleAct = new ArrayMap<>();
+
+ public void startModuleActivity(Object object,String className){
+ startModuleActivity(object,className,null);
+ }
+
+ public void startModuleActivity(Object object,String className, Bundle bundle){
+ if(className == null) return;
+ moduleAct.put(className,object);
+ post(IBaseClient.class,"startModuleActivity",className,bundle);
+ }
+
+
+ public void moduleResult(Object object,Intent data){
+ if (data==null)return;
+ post(IBaseClient.class,"moduleResult",moduleAct.get(object.getClass().getName()),data);
+ }
+
+ public void setPackageName(String name){
+ this.PK_NAME = name;
+ }
+
+ public String getPacketName(){
+ return PK_NAME;
+ }
+
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ActivityModuleManager.java b/core/src/main/java/com/cangwang/core/cwmodule/ActivityModuleManager.java
index 9e2d109..4fa31cc 100644
--- a/core/src/main/java/com/cangwang/core/cwmodule/ActivityModuleManager.java
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ActivityModuleManager.java
@@ -1,55 +1,54 @@
-package com.cangwang.core.cwmodule;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.support.v4.util.ArrayMap;
-import android.support.v4.util.SparseArrayCompat;
-import android.util.Log;
-import android.view.ViewGroup;
-
-import java.util.ArrayList;
-
-/**
- * Created by cangwang on 2016/12/26.
- */
-
-public class ActivityModuleManager extends ModuleManager{
- private static final String TAG = "ActivityModuleManager";
-
-
- public void initModules(Bundle saveInstance, Activity activity,ArrayMap> modules){
- if (activity == null || modules == null) return;
- moduleConfig(modules);
- initModules(saveInstance,activity);
- }
-
- public void initModules(Bundle saveInstance, Activity activity){
- if (getModules() ==null) return;
-
- //获取配置
- for(String moduleName: getModules().keySet()){
- ELAbsModule module = ELModuleFactory.newModuleInstance(moduleName);
- Log.d(TAG,"ActivityModuleManager init module name: "+ moduleName);
-
- if (module!=null){
- ELModuleContext moduleContext =new ELModuleContext();
- moduleContext.setActivity(activity);
- moduleContext.setSaveInstance(saveInstance);
-
- //关联视图
- SparseArrayCompat viewGroups =new SparseArrayCompat<>();
- ArrayList mViewIds = getModules().get(moduleName);
- if (mViewIds !=null &&mViewIds.size()>0) {
- for (int i = 0; i < mViewIds.size(); i++) {
- viewGroups.put(i, (ViewGroup) activity.findViewById(mViewIds.get(i).intValue()));
- }
- }
-
- moduleContext.setViewGroups(viewGroups);
- module.init(moduleContext,"");
-
- allModules.put(moduleName,module);
- }
- }
- }
-}
+package com.cangwang.core.cwmodule;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v4.util.ArrayMap;
+import android.support.v4.util.SparseArrayCompat;
+import android.util.Log;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+
+/**
+ * Created by cangwang on 2016/12/26.
+ */
+
+public class ActivityModuleManager extends ModuleManager{
+ private static final String TAG = "ActivityModuleManager";
+
+
+ public void initModules(Bundle saveInstance, Activity activity,ArrayMap> modules){
+ if (activity == null || modules == null) return;
+ moduleConfig(modules);
+ initModules(saveInstance,activity);
+ }
+
+ public void initModules(Bundle saveInstance, Activity activity){
+ if (getModules() ==null) return;
+
+ ELModuleContext moduleContext =new ELModuleContext();
+ moduleContext.setActivity(activity);
+ moduleContext.setSaveInstance(saveInstance);
+
+ //获取配置
+ for(String moduleName: getModules().keySet()){
+ ELAbsModule module = ELModuleFactory.newModuleInstance(moduleName);
+ Log.d(TAG,"ActivityModuleManager init module name: "+ moduleName);
+
+ if (module!=null){
+ //关联视图
+ SparseArrayCompat viewGroups =new SparseArrayCompat<>();
+ ArrayList mViewIds = getModules().get(moduleName);
+ if (mViewIds !=null &&mViewIds.size()>0) {
+ for (int i = 0; i < mViewIds.size(); i++) {
+ viewGroups.put(i, (ViewGroup) activity.findViewById(mViewIds.get(i).intValue()));
+ }
+ }
+ moduleContext.setViewGroups(viewGroups);
+ module.init(moduleContext,"");
+
+ allModules.put(moduleName,module);
+ }
+ }
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ELModuleContext.java b/core/src/main/java/com/cangwang/core/cwmodule/ELModuleContext.java
index cc74de6..16bb8e3 100644
--- a/core/src/main/java/com/cangwang/core/cwmodule/ELModuleContext.java
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ELModuleContext.java
@@ -1,44 +1,48 @@
-package com.cangwang.core.cwmodule;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.support.v4.util.SparseArrayCompat;
-import android.view.ViewGroup;
-
-/**
- * Created by cangwang on 2016/12/26.
- */
-
-public class ELModuleContext {
- private Activity component;
- private Bundle saveInstance;
- private SparseArrayCompat viewGroups = new SparseArrayCompat<>();
-
- public Activity getActivity(){
- return component;
- }
-
- public void setActivity(Activity component){
- this.component = component;
- }
-
- public Bundle getSaveInstance(){
- return saveInstance;
- }
-
- public void setSaveInstance(Bundle saveInstance){
- this.saveInstance = saveInstance;
- }
-
- public ViewGroup getView(int key){
- return viewGroups.get(key);
- }
-
- public SparseArrayCompat getViewGroups(){
- return viewGroups;
- }
-
- public void setViewGroups(SparseArrayCompat viewGroups){
- this.viewGroups = viewGroups;
- }
-}
+package com.cangwang.core.cwmodule;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v4.util.SparseArrayCompat;
+import android.view.ViewGroup;
+
+/**
+ * Created by cangwang on 2016/12/26.
+ */
+
+public class ELModuleContext {
+ public static final int TOP_VIEW_GROUP = 0;
+ public static final int BOTTOM_VIEW_GROUP = 1;
+ public static final int PLUGIN_CENTER_VIEW = 2;
+
+ private Activity context;
+ private Bundle saveInstance;
+ private SparseArrayCompat viewGroups = new SparseArrayCompat<>();
+
+ public Activity getActivity(){
+ return context;
+ }
+
+ public void setActivity(Activity component){
+ this.context = component;
+ }
+
+ public Bundle getSaveInstance(){
+ return saveInstance;
+ }
+
+ public void setSaveInstance(Bundle saveInstance){
+ this.saveInstance = saveInstance;
+ }
+
+ public ViewGroup getView(int key){
+ return viewGroups.get(key);
+ }
+
+ public SparseArrayCompat getViewGroups(){
+ return viewGroups;
+ }
+
+ public void setViewGroups(SparseArrayCompat viewGroups){
+ this.viewGroups = viewGroups;
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ModuleManager.java b/core/src/main/java/com/cangwang/core/cwmodule/ModuleManager.java
index 7f97714..482a896 100644
--- a/core/src/main/java/com/cangwang/core/cwmodule/ModuleManager.java
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ModuleManager.java
@@ -1,67 +1,75 @@
-package com.cangwang.core.cwmodule;
-
-import android.content.res.Configuration;
-import android.support.v4.util.ArrayMap;
-
-
-import com.cangwang.core.util.ModuleUtil;
-
-import java.util.ArrayList;
-
-/**
- * Created by cangwang on 2016/12/26.
- */
-
-public class ModuleManager {
- private ArrayMap> modules = new ArrayMap<>();
- protected ArrayMap allModules = new ArrayMap<>();
-
- public ArrayMap> getModules() {
- return modules;
- }
-
- public void setModules(ArrayMap> modules) {
- this.modules = modules;
- }
-
- public void moduleConfig(ArrayMap> modules) {
- this.modules = modules;
- }
-
- public ELAbsModule getModuleByNames(String name){
- if (!ModuleUtil.empty(allModules))
- return allModules.get(name);
- return null;
- }
-
- public void onResume(){
- for (ELAbsModule module:allModules.values())
- if (module !=null)
- module.onResume();
- }
-
- public void onPause(){
- for (ELAbsModule module:allModules.values())
- if (module !=null)
- module.onPause();
- }
-
- public void onStop(){
- for (ELAbsModule module:allModules.values())
- if (module !=null)
- module.onStop();
- }
-
- public void onConfigurationChanged(Configuration newConfig){
- for (ELAbsModule module:allModules.values())
- if (module!=null)
- module.onOrientationChanges(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
- }
-
- public void onDestroy(){
- for (ELAbsModule module:allModules.values())
- if (module !=null){
- module.onDestroy();
- }
- }
-}
+package com.cangwang.core.cwmodule;
+
+import android.content.res.Configuration;
+import android.support.v4.util.ArrayMap;
+
+
+import com.cangwang.core.util.ModuleUtil;
+
+import java.util.ArrayList;
+
+/**
+ * Created by cangwang on 2016/12/26.
+ */
+
+public class ModuleManager {
+ private ArrayMap> modules = new ArrayMap<>();
+ protected ArrayMap allModules = new ArrayMap<>();
+
+ public ArrayMap> getModules() {
+ return modules;
+ }
+
+ public String[] getModuleNames(){
+ return (String[]) modules.keySet().toArray();
+ }
+
+ public void setModules(ArrayMap> modules) {
+ this.modules = modules;
+ }
+
+ public void moduleConfig(ArrayMap> modules) {
+ this.modules = modules;
+ }
+
+ public ELAbsModule getModuleByNames(String name){
+ if (!ModuleUtil.empty(allModules))
+ return allModules.get(name);
+ return null;
+ }
+
+ public void putModule(String name,ELAbsModule module){
+ allModules.put(name,module);
+ }
+
+ public void onResume(){
+ for (ELAbsModule module:allModules.values())
+ if (module !=null)
+ module.onResume();
+ }
+
+ public void onPause(){
+ for (ELAbsModule module:allModules.values())
+ if (module !=null)
+ module.onPause();
+ }
+
+ public void onStop(){
+ for (ELAbsModule module:allModules.values())
+ if (module !=null)
+ module.onStop();
+ }
+
+ public void onConfigurationChanged(Configuration newConfig){
+ for (ELAbsModule module:allModules.values())
+ if (module!=null)
+ module.onOrientationChanges(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
+ }
+
+ public void onDestroy(){
+ for (ELAbsModule module:allModules.values())
+ if (module !=null){
+ module.onDestroy();
+ }
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ELAbsExModule.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ELAbsExModule.java
new file mode 100644
index 0000000..7624dca
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ELAbsExModule.java
@@ -0,0 +1,30 @@
+package com.cangwang.core.cwmodule.ex;
+
+import android.os.Bundle;
+
+import com.cangwang.core.cwmodule.ELModuleContext;
+
+/**
+ * Created by cangwang on 2016/12/26.
+ */
+
+public abstract class ELAbsExModule {
+
+ public abstract boolean init(ELModuleContext moduleContext,Bundle extend);
+
+ public abstract void onSaveInstanceState(Bundle outState);
+
+ public abstract void onResume();
+
+ public abstract void onPause();
+
+ public abstract void onStop();
+
+ public abstract void onOrientationChanges(boolean isLandscape);
+
+ public abstract void onDestroy();
+
+ public abstract void detachView();
+
+ public abstract void setVisible(boolean visible);
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ELBasicExModule.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ELBasicExModule.java
new file mode 100644
index 0000000..dc5fc46
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ELBasicExModule.java
@@ -0,0 +1,103 @@
+package com.cangwang.core.cwmodule.ex;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.support.annotation.LayoutRes;
+import android.support.v4.app.FragmentActivity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.cangwang.core.cwmodule.ELAbsModule;
+import com.cangwang.core.cwmodule.ELModuleContext;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by cangwang on 2016/12/26.
+ */
+
+public class ELBasicExModule extends ELAbsExModule{
+ public Activity context;
+ public FragmentActivity mContext;
+ public ELModuleContext moduleContext;
+ public Handler handler;
+ public ViewGroup parentTop;
+ public ViewGroup parentBottom;
+ public ViewGroup parentPlugin;
+ public View own;
+ public List viewList = new ArrayList<>();
+
+ @Override
+ public boolean init(ELModuleContext moduleContext, Bundle extend) {
+ context = moduleContext.getActivity();
+ parentTop = moduleContext.getView(ELModuleContext.TOP_VIEW_GROUP);
+ parentBottom = moduleContext.getView(ELModuleContext.BOTTOM_VIEW_GROUP);
+ parentPlugin = moduleContext.getView(ELModuleContext.PLUGIN_CENTER_VIEW);
+ handler = new Handler();
+ return true;
+ }
+
+ public T genericFindViewById(int id) {
+ //return返回view时,加上泛型T
+ T view = (T) context.findViewById(id);
+ viewList.add(view);
+ return view;
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+
+ }
+
+ @Override
+ public void onResume() {
+
+ }
+
+ @Override
+ public void onOrientationChanges(boolean isLandscape) {
+
+ }
+
+ @Override
+ public void onPause() {
+
+ }
+
+ @Override
+ public void onStop() {
+
+ }
+
+ @Override
+ public void detachView(){
+ ViewGroup viewGroup;
+ if (viewList!=null && viewList.size()>0) {
+ viewGroup = (ViewGroup) viewList.get(0).getParent();
+ if(viewGroup!=null)
+ viewGroup.removeAllViewsInLayout();
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ ViewGroup viewGroup;
+ if (viewList!=null && viewList.size()>0) {
+ viewGroup = (ViewGroup) viewList.get(0).getParent();
+ viewGroup.setVisibility(visible?View.VISIBLE:View.GONE);
+ }
+ }
+
+ public View initLayout(@LayoutRes int id, ViewGroup parentTop){
+ own = LayoutInflater.from(context).inflate(id,parentTop,true);
+ return own;
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ELModuleExFactory.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ELModuleExFactory.java
new file mode 100644
index 0000000..4a85414
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ELModuleExFactory.java
@@ -0,0 +1,30 @@
+package com.cangwang.core.cwmodule.ex;
+
+/**
+ * Created by cangwang on 2017/6/16.
+ */
+
+public class ELModuleExFactory {
+
+ public static ELAbsExModule newModuleInstance(String name){
+ if (name ==null || name.equals("")){
+ return null;
+ }
+
+ try{
+ Class extends ELAbsExModule> moduleClzz = (Class extends ELAbsExModule>) Class.forName(name);
+ if (moduleClzz !=null){
+ ELAbsExModule instance = (ELAbsExModule)moduleClzz.newInstance();
+ return instance;
+ }
+ return null;
+ }catch (ClassNotFoundException e){
+ e.printStackTrace();
+ }catch (InstantiationException e){
+ e.printStackTrace();
+ }catch (IllegalAccessException e){
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleExManager.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleExManager.java
new file mode 100644
index 0000000..5903990
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleExManager.java
@@ -0,0 +1,74 @@
+package com.cangwang.core.cwmodule.ex;
+
+import android.content.res.Configuration;
+import android.support.v4.util.ArrayMap;
+
+import com.cangwang.core.cwmodule.ELAbsModule;
+import com.cangwang.core.util.ModuleUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by cangwang on 2016/12/26.
+ */
+
+public class ModuleExManager {
+ private List modules = new ArrayList<>(); //模块名字
+ protected ArrayMap allModules = new ArrayMap<>(); //模块实体
+
+ public List getModuleNames(){
+ return modules;
+ }
+
+ public void moduleConfig(List modules) {
+ this.modules = modules;
+ }
+
+ public ELAbsExModule getModuleByNames(String name){
+ if (!ModuleUtil.empty(allModules))
+ return allModules.get(name);
+ return null;
+ }
+
+ public void remove(String name){
+ if (!ModuleUtil.empty(allModules)){
+ allModules.remove(name);
+ }
+ }
+
+ public void putModule(String name,ELAbsExModule module){
+ allModules.put(name,module);
+ }
+
+ public void onResume(){
+ for (ELAbsExModule module:allModules.values())
+ if (module !=null)
+ module.onResume();
+ }
+
+ public void onPause(){
+ for (ELAbsExModule module:allModules.values())
+ if (module !=null)
+ module.onPause();
+ }
+
+ public void onStop(){
+ for (ELAbsExModule module:allModules.values())
+ if (module !=null)
+ module.onStop();
+ }
+
+ public void onConfigurationChanged(Configuration newConfig){
+ for (ELAbsExModule module:allModules.values())
+ if (module!=null)
+ module.onOrientationChanges(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE);
+ }
+
+ public void onDestroy(){
+ for (ELAbsExModule module:allModules.values())
+ if (module !=null){
+ module.onDestroy();
+ }
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleLoadListener.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleLoadListener.java
new file mode 100644
index 0000000..dbf0f94
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleLoadListener.java
@@ -0,0 +1,9 @@
+package com.cangwang.core.cwmodule.ex;
+
+/**
+ * Created by cangwang on 2017/6/16.
+ */
+
+public interface ModuleLoadListener {
+ void laodResult(boolean success);
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExActivity.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExActivity.java
new file mode 100644
index 0000000..db7ce46
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExActivity.java
@@ -0,0 +1,180 @@
+package com.cangwang.core.cwmodule.ex;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.util.SparseArrayCompat;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.ViewGroup;
+
+import com.cangwang.core.IBaseClient;
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.ModuleEvent;
+import com.cangwang.core.R;
+import com.cangwang.core.cwmodule.ELModuleContext;
+import com.cangwang.core.info.ModuleInfo;
+
+import java.util.List;
+import io.reactivex.Observable;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.annotations.NonNull;
+import io.reactivex.functions.Consumer;
+import io.reactivex.functions.Function;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public abstract class ModuleManageExActivity extends AppCompatActivity{
+ private final String TAG = "ModuleManageExActivity";
+ private ViewGroup mTopViewGroup;
+ private ViewGroup mBottomViewGroup;
+ private ViewGroup pluginViewGroup;
+
+ private ModuleExManager moduleManager;
+ private ELModuleContext moduleContext;
+
+ @SuppressWarnings("deprecation")
+ @Override
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.module_rank_layout);
+ ModuleBus.getInstance().register(this);
+ mTopViewGroup = (ViewGroup) findViewById(R.id.layout_top);
+ mBottomViewGroup = (ViewGroup) findViewById(R.id.layout_bottom);
+ pluginViewGroup = (ViewGroup) findViewById(R.id.layout_plugincenter);
+ moduleManager = new ModuleExManager();
+ moduleManager.moduleConfig(moduleConfig());
+ initView(savedInstanceState);
+ }
+
+ public void initView(Bundle mSavedInstanceState){
+ moduleContext = new ELModuleContext();
+ moduleContext.setActivity(this);
+ moduleContext.setSaveInstance(mSavedInstanceState);
+ //关联视图
+ SparseArrayCompat sVerticalViews = new SparseArrayCompat<>();
+ sVerticalViews.put(ELModuleContext.TOP_VIEW_GROUP, mTopViewGroup);
+ sVerticalViews.put(ELModuleContext.BOTTOM_VIEW_GROUP, mBottomViewGroup);
+ sVerticalViews.put(ELModuleContext.PLUGIN_CENTER_VIEW, pluginViewGroup);
+ moduleContext.setViewGroups(sVerticalViews);
+
+ Observable.fromIterable(moduleManager.getModuleNames())
+ .map(new Function() {
+ @Override
+ public ModuleInfo apply(@NonNull String s){
+ return new ModuleInfo(s, ELModuleExFactory.newModuleInstance(s));
+ }
+ })
+// .delay(10, TimeUnit.MILLISECONDS)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Consumer() {
+ @Override
+ public void accept(@NonNull ModuleInfo elAbsModule){
+ try {
+ if(elAbsModule!=null){
+ long before = System.currentTimeMillis();
+ elAbsModule.module.init(moduleContext, null);
+ Log.d(TAG, "modulename: " + elAbsModule.getClass().getSimpleName() + " init time = " + (System.currentTimeMillis() - before) + "ms");
+ moduleManager.putModule(elAbsModule.name, elAbsModule.module);
+ }
+ }catch (Exception ex){
+ Log.e(TAG,ex.toString());
+ }
+ }
+ });
+ }
+
+
+ public abstract List moduleConfig();
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ moduleManager.onResume();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ moduleManager.onPause();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ moduleManager.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ moduleManager.onDestroy();
+ ModuleBus.getInstance().unregister(this);
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ moduleManager.onConfigurationChanged(newConfig);
+ }
+
+ /**
+ * 添加模块
+ * @param moduleName
+ * @param extend
+ */
+ @ModuleEvent(coreClientClass = IBaseClient.class)
+ public void addModule(String moduleName,Bundle extend){
+ addModule(moduleName,extend,null);
+ }
+
+ public void addModule(String moduleName,Bundle extend,ModuleLoadListener listener){
+ if (moduleName !=null && !moduleName.isEmpty()){
+ if (moduleManager.allModules.containsKey(moduleName)) //模块不重复添加
+ return;
+ ELAbsExModule module = moduleManager.getModuleByNames(moduleName);
+ if (module == null){
+ module = ELModuleExFactory.newModuleInstance(moduleName);
+ }
+ if (moduleContext !=null &&module!=null){
+ boolean result = module.init(moduleContext,extend);
+ if (listener!=null)
+ listener.laodResult(result); //监听回调
+ if (result)
+ moduleManager.putModule(moduleName,module);
+ }
+ }
+ }
+
+ /**
+ * 移除模块
+ * @param moduleName
+ */
+ @ModuleEvent(coreClientClass = IBaseClient.class)
+ public void removeModule(String moduleName){
+ if (moduleName!=null &&!moduleName.isEmpty()) {
+ ELAbsExModule module = moduleManager.getModuleByNames(moduleName);
+ if (module != null) {
+ module.detachView(); //先移除界面,再销毁
+ module.onDestroy();
+ moduleManager.remove(moduleName);
+ }
+ }
+ }
+
+ @ModuleEvent(coreClientClass = IBaseClient.class)
+ public void moduleVisible(String moduleName,boolean isVisible){
+ if (moduleName !=null && !moduleName.isEmpty()){
+ ELAbsExModule module = moduleManager.getModuleByNames(moduleName);
+ if (module !=null){
+ module.setVisible(isVisible);
+ }
+ }
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExFragment.java b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExFragment.java
new file mode 100644
index 0000000..856ebdc
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/cwmodule/ex/ModuleManageExFragment.java
@@ -0,0 +1,181 @@
+package com.cangwang.core.cwmodule.ex;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.Fragment;
+import android.support.v4.util.SparseArrayCompat;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.cangwang.core.IBaseClient;
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.ModuleEvent;
+import com.cangwang.core.R;
+import com.cangwang.core.cwmodule.ELModuleContext;
+import com.cangwang.core.info.ModuleInfo;
+
+import java.util.List;
+
+import io.reactivex.Observable;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.annotations.NonNull;
+import io.reactivex.functions.Consumer;
+import io.reactivex.functions.Function;
+import io.reactivex.schedulers.Schedulers;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public abstract class ModuleManageExFragment extends Fragment{
+
+ private final String TAG = "ModuleManageExFragment";
+ private ViewGroup mTopViewGroup;
+ private ViewGroup mBottomViewGroup;
+ private ViewGroup pluginViewGroup;
+ private View rootView;
+
+ private ModuleExManager moduleManager;
+ private ELModuleContext moduleContext;
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ rootView = inflater.inflate(R.layout.module_rank_layout,container,false);
+ mTopViewGroup = (ViewGroup) rootView.findViewById(R.id.layout_top);
+ mBottomViewGroup = (ViewGroup) rootView.findViewById(R.id.layout_bottom);
+ pluginViewGroup = (ViewGroup) rootView.findViewById(R.id.layout_plugincenter);
+ moduleManager = new ModuleExManager();
+ moduleManager.moduleConfig(moduleConfig());
+ ModuleBus.getInstance().register(this);
+ return rootView;
+ }
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ moduleContext = new ELModuleContext();
+ moduleContext.setActivity(getActivity());
+ moduleContext.setSaveInstance(savedInstanceState);
+ //关联视图
+ SparseArrayCompat sVerticalViews = new SparseArrayCompat<>();
+ sVerticalViews.put(ELModuleContext.TOP_VIEW_GROUP, mTopViewGroup);
+ sVerticalViews.put(ELModuleContext.BOTTOM_VIEW_GROUP, mBottomViewGroup);
+ sVerticalViews.put(ELModuleContext.PLUGIN_CENTER_VIEW, pluginViewGroup);
+ moduleContext.setViewGroups(sVerticalViews);
+
+ Observable.fromIterable(moduleManager.getModuleNames())
+ .map(new Function() {
+ @Override
+ public ModuleInfo apply(@NonNull String s){
+ return new ModuleInfo(s, ELModuleExFactory.newModuleInstance(s));
+ }
+ })
+// .delay(10, TimeUnit.MILLISECONDS)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Consumer() {
+ @Override
+ public void accept(@NonNull ModuleInfo elAbsModule){
+ try {
+ if(elAbsModule!=null){
+ long before = System.currentTimeMillis();
+ elAbsModule.module.init(moduleContext, null);
+ Log.d(TAG, "modulename: " + elAbsModule.getClass().getSimpleName() + " init time = " + (System.currentTimeMillis() - before) + "ms");
+ moduleManager.putModule(elAbsModule.name, elAbsModule.module);
+ }
+ }catch (Exception ex){
+ Log.e(TAG,ex.toString());
+ }
+ }
+ });
+ }
+ public abstract List moduleConfig();
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (moduleManager !=null)
+ moduleManager.onResume();
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ if (moduleManager !=null)
+ moduleManager.onStop();
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ ModuleBus.getInstance().unregister(this);
+ if (moduleManager !=null)
+ moduleManager.onDestroy();
+ if (moduleContext !=null)
+ moduleContext =null;
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ if (moduleManager !=null)
+ moduleManager.onConfigurationChanged(newConfig);
+ }
+ /**
+ * 添加模块
+ * @param moduleName
+ * @param extend
+ */
+ @ModuleEvent(coreClientClass = IBaseClient.class)
+ public void addModule(String moduleName,Bundle extend){
+ addModule(moduleName,extend,null);
+ }
+
+ public void addModule(String moduleName,Bundle extend,ModuleLoadListener listener){
+ if (moduleName !=null && !moduleName.isEmpty()){
+ if (moduleManager.allModules.containsKey(moduleName)) //模块不重复添加
+ return;
+ ELAbsExModule module = moduleManager.getModuleByNames(moduleName);
+ if (module == null){
+ module = ELModuleExFactory.newModuleInstance(moduleName);
+ }
+ if (moduleContext !=null &&module!=null){
+ boolean result = module.init(moduleContext,extend);
+ if (listener!=null)
+ listener.laodResult(result); //监听回调
+ if (result)
+ moduleManager.putModule(moduleName,module);
+ }
+ }
+ }
+
+ /**
+ * 移除模块
+ * @param moduleName
+ */
+ @ModuleEvent(coreClientClass = IBaseClient.class)
+ public void removeModule(String moduleName){
+ if (moduleName!=null &&!moduleName.isEmpty()) {
+ ELAbsExModule module = moduleManager.getModuleByNames(moduleName);
+ if (module != null) {
+ module.detachView(); //先移除界面,再销毁
+ module.onDestroy();
+ moduleManager.remove(moduleName);
+ }
+ }
+ }
+
+ @ModuleEvent(coreClientClass = IBaseClient.class)
+ public void moduleVisible(String moduleName,boolean isVisible){
+ if (moduleName !=null && !moduleName.isEmpty()){
+ ELAbsExModule module = moduleManager.getModuleByNames(moduleName);
+ if (module !=null){
+ module.setVisible(isVisible);
+ }
+ }
+ }
+}
diff --git a/core/src/main/java/com/cangwang/core/info/ModuleInfo.java b/core/src/main/java/com/cangwang/core/info/ModuleInfo.java
new file mode 100644
index 0000000..816eeeb
--- /dev/null
+++ b/core/src/main/java/com/cangwang/core/info/ModuleInfo.java
@@ -0,0 +1,18 @@
+package com.cangwang.core.info;
+
+
+import com.cangwang.core.cwmodule.ex.ELAbsExModule;
+
+/**
+ * Created by zjl on 2017/5/18.
+ */
+
+public class ModuleInfo {
+ public String name;
+ public ELAbsExModule module;
+
+ public ModuleInfo(String name, ELAbsExModule module) {
+ this.name = name;
+ this.module = module;
+ }
+}
diff --git a/core/src/main/res/layout/module_rank_layout.xml b/core/src/main/res/layout/module_rank_layout.xml
new file mode 100644
index 0000000..3a58c84
--- /dev/null
+++ b/core/src/main/res/layout/module_rank_layout.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
diff --git a/img/yy.png b/img/yy.png
new file mode 100644
index 0000000..fa57476
Binary files /dev/null and b/img/yy.png differ
diff --git a/local.properties b/local.properties
index db364c7..07891a7 100644
--- a/local.properties
+++ b/local.properties
@@ -1,12 +1,12 @@
-## This file is automatically generated by Android Studio.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked into Version Control Systems,
-# as it contains information specific to your local configuration.
-#
-# Location of the SDK. This is only used by Gradle.
-# For customization when using a Version Control System, please read the
-# header note.
-#Fri Nov 18 15:57:44 CST 2016
-ndk.dir=/Users/air/Library/Android/sdk/ndk-bundle
-sdk.dir=/Users/air/Library/Android/sdk
+## This file is automatically generated by Android Studio.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+#
+# Location of the SDK. This is only used by Gradle.
+# For customization when using a Version Control System, please read the
+# header note.
+#Thu Jun 15 11:58:50 CST 2017
+ndk.dir=D\:\\android_sdk\\ndk-bundle
+sdk.dir=D\:\\android_sdk
diff --git a/page_body/src/main/java/com/cangwang/page_body/PageBodyExModule.java b/page_body/src/main/java/com/cangwang/page_body/PageBodyExModule.java
new file mode 100644
index 0000000..907422c
--- /dev/null
+++ b/page_body/src/main/java/com/cangwang/page_body/PageBodyExModule.java
@@ -0,0 +1,88 @@
+package com.cangwang.page_body;
+
+import android.app.Application;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.cangwang.core.IBaseClient;
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.cwmodule.ELModuleContext;
+import com.cangwang.core.cwmodule.ex.ELBasicExModule;
+import com.cangwang.core.util.ModuleImpl;
+
+/**
+ * Created by cangwang on 2016/12/28.
+ */
+
+public class PageBodyExModule extends ELBasicExModule implements ModuleImpl{
+ private View pageBodyView_fi;
+ private View pageBodyView_se;
+ private TextView pageBodyTop;
+ private TextView pageBodyBottom;
+ private Button changeNameBtn;
+ private Button addTitle;
+ private Button removeTitle;
+
+ @Override
+ public boolean init(ELModuleContext moduleContext, Bundle extend) {
+ super.init(moduleContext, extend);
+ this.moduleContext = moduleContext;
+ initView();
+ return true;
+ }
+
+ private void initView(){
+ //直接添加布局到父布局
+ pageBodyView_fi = LayoutInflater.from(context).inflate(R.layout.page_body_fi,parentTop,true);
+ pageBodyTop = (TextView) pageBodyView_fi.findViewById(R.id.page_body_top);
+
+// pageBodyView_se = LayoutInflater.from(context).inflate(R.layout.page_body_se,parentBottom,true);
+// pageBodyBottom = (TextView) pageBodyView_se.findViewById(R.id.page_body_bottom);
+ //动态添加布局
+ pageBodyView_se = LayoutInflater.from(context).inflate(R.layout.page_body_se,null);
+ RelativeLayout.LayoutParams rl = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
+ if (parentBottom!=null)
+ parentBottom.addView(pageBodyView_se,rl);
+
+ removeTitle = genericFindViewById(R.id.remove_title);
+ addTitle = genericFindViewById(R.id.add_title);
+
+ removeTitle.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ModuleBus.getInstance().post(IBaseClient.class,"removeModule","com.cangwang.page_name.PageNameExModule");
+ }
+ });
+
+ addTitle.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Bundle bundle =new Bundle();
+ ModuleBus.getInstance().post(IBaseClient.class,"addModule","com.cangwang.page_name.PageNameExModule",bundle);
+ }
+ });
+
+ changeNameBtn = (Button) pageBodyView_se.findViewById(R.id.change_page_Name);
+ changeNameBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+// ModuleBus.getInstance().post(IBaseClient.class,"changeNameTxt","Cang_Wang");
+ context.startActivity(new Intent("com.cangwang.moduleExFg"));
+ }
+ });
+ }
+
+ @Override
+ public void onLoad(Application app) {
+ for (int i=0;i<5;i++){
+ Log.v("PageBodyModule","PageBodyModule onLoad");
+ }
+ }
+}
diff --git a/page_body/src/main/res/layout/page_body_se.xml b/page_body/src/main/res/layout/page_body_se.xml
index fa3b7d0..8c09bb9 100644
--- a/page_body/src/main/res/layout/page_body_se.xml
+++ b/page_body/src/main/res/layout/page_body_se.xml
@@ -1,25 +1,49 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyBTModule.java b/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyBTModule.java
index ebcd691..9cbfce1 100644
--- a/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyBTModule.java
+++ b/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyBTModule.java
@@ -1,54 +1,54 @@
-package com.cangwang.page_body_bt;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.TextView;
-
-import com.cangwang.core.IBaseClient;
-import com.cangwang.core.ModuleBus;
-import com.cangwang.core.cwmodule.ELBasicModule;
-import com.cangwang.core.cwmodule.ELModuleContext;
-
-/**
- * Created by air on 2016/12/28.
- */
-
-public class PageBodyBTModule extends ELBasicModule {
- private Activity activity;
- private ViewGroup parentViewGroup_BT;
- private ViewGroup parentViewGroup_B;
- private View pageBodyView_bt;
- private View pageBodyView_bts;
- private TextView pageBodyTop;
- private TextView pageBodyBottom;
- private Button changeNameBtn;
-
- @Override
- public void init(ELModuleContext moduleContext, String extend) {
- super.init(moduleContext, extend);
- activity = moduleContext.getActivity();
- parentViewGroup_BT = moduleContext.getView(0);
- parentViewGroup_B = moduleContext.getView(1);
- this.moduleContext = moduleContext;
- initView();
- }
-
- private void initView(){
- pageBodyView_bt = LayoutInflater.from(activity).inflate(R.layout.page_body_bt,parentViewGroup_BT,true);
- pageBodyTop = (TextView) pageBodyView_bt.findViewById(R.id.page_body_top);
-
- pageBodyView_bts = LayoutInflater.from(activity).inflate(R.layout.page_body_bts,parentViewGroup_B,true);
-
- changeNameBtn = (Button) pageBodyView_bts.findViewById(R.id.change_name);
- changeNameBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- ModuleBus.getInstance().post(IBaseClient.class,"changeNameTxt","Cang_Wang");
- }
- });
- }
-}
+package com.cangwang.page_body_bt;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.cangwang.core.IBaseClient;
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.cwmodule.ELBasicModule;
+import com.cangwang.core.cwmodule.ELModuleContext;
+
+/**
+ * Created by cangwang on 2016/12/28.
+ */
+
+public class PageBodyBTModule extends ELBasicModule {
+ private Activity activity;
+ private ViewGroup parentViewGroup_BT;
+ private ViewGroup parentViewGroup_B;
+ private View pageBodyView_bt;
+ private View pageBodyView_bts;
+ private TextView pageBodyTop;
+ private TextView pageBodyBottom;
+ private Button changeNameBtn;
+
+ @Override
+ public void init(ELModuleContext moduleContext, String extend) {
+ super.init(moduleContext, extend);
+ activity = moduleContext.getActivity();
+ parentViewGroup_BT = moduleContext.getView(0);
+ parentViewGroup_B = moduleContext.getView(1);
+ this.moduleContext = moduleContext;
+ initView();
+ }
+
+ private void initView(){
+ pageBodyView_bt = LayoutInflater.from(activity).inflate(R.layout.page_body_bt,parentViewGroup_BT,true);
+ pageBodyTop = (TextView) pageBodyView_bt.findViewById(R.id.page_body_top);
+
+ pageBodyView_bts = LayoutInflater.from(activity).inflate(R.layout.page_body_bts,parentViewGroup_B,true);
+
+ changeNameBtn = (Button) pageBodyView_bts.findViewById(R.id.change_name);
+ changeNameBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ ModuleBus.getInstance().post(IBaseClient.class,"changeNameTxt","Cang_Wang");
+ }
+ });
+ }
+}
diff --git a/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyExModule.java b/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyExModule.java
new file mode 100644
index 0000000..045e851
--- /dev/null
+++ b/page_body_bt/src/main/java/com/cangwang/page_body_bt/PageBodyExModule.java
@@ -0,0 +1,69 @@
+package com.cangwang.page_body_bt;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.cangwang.core.IBaseClient;
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.cwmodule.ELBasicModule;
+import com.cangwang.core.cwmodule.ELModuleContext;
+import com.cangwang.core.cwmodule.ex.ELBasicExModule;
+
+/**
+ * Created by cangwang on 2017/6/15.
+ */
+
+public class PageBodyExModule extends ELBasicExModule {
+ private View pageBodyView_bt;
+ private View pageBodyView_bts;
+ private TextView pageBodyTop;
+ private TextView pageBodyBottom;
+ private Button changeNameBtn;
+ private Button showTitle;
+ private Button goneTitle;
+
+ @Override
+ public boolean init(ELModuleContext moduleContext, Bundle extend) {
+ super.init(moduleContext, extend);
+ this.moduleContext = moduleContext;
+ initView();
+ return true;
+ }
+
+ private void initView(){
+ pageBodyView_bt = LayoutInflater.from(context).inflate(R.layout.page_body_bt,parentTop,true);
+ pageBodyTop = genericFindViewById(R.id.page_body_top);
+
+ showTitle = genericFindViewById(R.id.show_title);
+ goneTitle = genericFindViewById(R.id.gone_title);
+
+ showTitle.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ModuleBus.getInstance().post(IBaseClient.class,"moduleVisible","com.cangwang.page_name.PageNameExModule",true);
+ }
+ });
+
+ goneTitle.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ModuleBus.getInstance().post(IBaseClient.class,"moduleVisible","com.cangwang.page_name.PageNameExModule",false);
+ }
+ });
+
+ pageBodyView_bts = LayoutInflater.from(context).inflate(R.layout.page_body_bts,parentBottom,true);
+
+ changeNameBtn = genericFindViewById(R.id.change_name);
+ changeNameBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ ModuleBus.getInstance().post(IBaseClient.class,"changeNameTxt","Cang_Wang");
+ }
+ });
+ }
+}
diff --git a/page_body_bt/src/main/res/layout/page_body_bt.xml b/page_body_bt/src/main/res/layout/page_body_bt.xml
index 6160aab..7b8b692 100644
--- a/page_body_bt/src/main/res/layout/page_body_bt.xml
+++ b/page_body_bt/src/main/res/layout/page_body_bt.xml
@@ -5,6 +5,28 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
>
+
+
+
+
-
-
-
-
+
+
+
+
+