diff --git a/.gitignore b/.gitignore
index 2665975..0635ee0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,8 @@
/.idea/libraries
.DS_Store
/build
-/captures
\ No newline at end of file
+/captures
+/news
+*.iml
+
+local.properties
\ No newline at end of file
diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
new file mode 100644
index 0000000..b922840
--- /dev/null
+++ b/.idea/checkstyle-idea.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 2168595..06d6270 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -9,9 +9,13 @@
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b568e40..7bc8000 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,8 +1,5 @@
-
-
-
@@ -58,25 +55,12 @@
-
-
-
-
-
-
-
-
-
-
-
+
-
- $USER_HOME$/.subversion
-
diff --git a/.idea/modules.xml b/.idea/modules.xml
index c33f8bd..3eca561 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -4,9 +4,13 @@
+
+
+
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 57b6fc6..2a7a7ca 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,25 +6,25 @@
-
+
-
-
+<<<<<<< Updated upstream
+
+
+
+
+=======
-
-
-
-
-
-
+
+>>>>>>> Stashed changes
@@ -61,72 +61,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -136,64 +71,166 @@
-
-
+
+
-
-
+<<<<<<< Updated upstream
+
+
+
+
+
+=======
+
+
+
+
+>>>>>>> Stashed changes
+
+
+
+
+
+
+
+
+<<<<<<< Updated upstream
+
+
+
+
+
+
+
+=======
+
+
+>>>>>>> Stashed changes
-
-
+
+
-
-
+<<<<<<< Updated upstream
+
+
+=======
+
+
+
+
+
+>>>>>>> Stashed changes
-
-
+<<<<<<< Updated upstream
+
+
+
+
+
+=======
+
+
-
+
-
-
+
+
+
+
+
+>>>>>>> Stashed changes
+
+
+
+
+
+
+
+
+
+<<<<<<< Updated upstream
+
+
+
+
+
+=======
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+>>>>>>> Stashed changes
-
-
+<<<<<<< Updated upstream
+
+
+
+
+
+=======
+
+
-
-
+
+
-
+
+
+
+
+
+
+
+>>>>>>> Stashed changes
+
+
+
+
+
@@ -213,44 +250,52 @@
-
-
+
+
-
-
+
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
@@ -288,11 +333,6 @@
-
-
-
-
-
@@ -302,6 +342,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -310,19 +360,28 @@
+
+
+
+
+
-
-
+
-
+
+
+
+
+
+
@@ -341,6 +400,11 @@
+
+
+
+
+
@@ -370,6 +434,11 @@
+
+
+
+
+
@@ -378,6 +447,11 @@
+
+
+
+
+
@@ -386,6 +460,11 @@
+
+
+
+
+
@@ -420,10 +499,18 @@
+
+
+
+
+
+
+
+
@@ -477,6 +564,11 @@
+
+
+
+
+
@@ -522,6 +614,10 @@
+
+
+
+
@@ -535,6 +631,10 @@
+
+
+
+
@@ -580,6 +680,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -599,18 +709,18 @@
-
+
-
+
+
-
+
-
-
+
@@ -631,18 +741,23 @@
-
+
-
+
+
-
+
+
+
+
+
+
-
-
+
@@ -684,8 +799,9 @@
+
-
+
@@ -719,6 +835,10 @@
+
+
+
+
@@ -751,6 +871,11 @@
+
+
+
+
+
@@ -773,6 +898,11 @@
+
+
+
+
+
@@ -804,11 +934,6 @@
-
-
-
-
-
@@ -817,15 +942,6 @@
-
-
-
-
-
-
-
-
-
@@ -835,10 +951,6 @@
-
-
-
-
@@ -849,11 +961,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -905,6 +1031,14 @@
+
+
+
+
+
+
+
+
@@ -917,11 +1051,11 @@
-
+
-
+
@@ -975,18 +1109,22 @@
+
+
+
+
-
+
-
+
-
+
@@ -1001,10 +1139,6 @@
-
-
-
-
@@ -1043,10 +1177,6 @@
-
-
-
-
@@ -1079,11 +1209,6 @@
-
-
-
-
-
@@ -1133,6 +1258,10 @@
+
+
+
+
@@ -1217,6 +1346,10 @@
+
+
+
+
@@ -1253,20 +1386,21 @@
+
-
+
-
+
-
+
-
+
@@ -1286,10 +1420,6 @@
-
-
-
-
@@ -1312,6 +1442,11 @@
+
+
+
+
+
@@ -1329,6 +1464,10 @@
+
+
+
+
@@ -1342,6 +1481,10 @@
+
+
+
+
@@ -1362,10 +1505,18 @@
+
+
+
+
+
+
+
+
@@ -1458,6 +1609,14 @@
+
+
+
+
+
+
+
+
@@ -1474,17 +1633,17 @@
-
-
+
+
-
+
-
+
@@ -1500,6 +1659,10 @@
+
+
+
+
@@ -1512,6 +1675,10 @@
+
+
+
+
@@ -1534,6 +1701,10 @@
+
+
+
+
@@ -1590,11 +1761,11 @@
-
+
-
+
@@ -1604,11 +1775,6 @@
-
-
-
-
-
@@ -1618,6 +1784,10 @@
+
+
+
+
@@ -1644,11 +1814,6 @@
-
-
-
-
-
@@ -1680,6 +1845,11 @@
+
+
+
+
+
@@ -1753,10 +1923,6 @@
-
-
-
-
@@ -1814,12 +1980,143 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1848,11 +2145,6 @@
-
-
-
-
-
@@ -1900,13 +2192,12 @@
-
-
+
-
+
@@ -1948,9 +2239,9 @@
-
+
-
+
@@ -1960,15 +2251,6 @@
-
-
-
-
-
-
-
-
-
@@ -2009,6 +2291,11 @@
+
+
+
+
+
@@ -2025,6 +2312,10 @@
+
+
+
+
@@ -2059,6 +2350,10 @@
+
+
+
+
@@ -2151,6 +2446,14 @@
+
+
+
+
+
+
+
+
@@ -2172,17 +2475,17 @@
-
-
+
+
-
+
-
+
@@ -2217,6 +2520,10 @@
+
+
+
+
@@ -2244,6 +2551,10 @@
+
+
+
+
@@ -2300,11 +2611,11 @@
-
+
-
+
@@ -2314,11 +2625,6 @@
-
-
-
-
-
@@ -2328,6 +2634,10 @@
+
+
+
+
@@ -2359,10 +2669,6 @@
-
-
-
-
@@ -2371,11 +2677,6 @@
-
-
-
-
-
@@ -2408,18 +2709,18 @@
-
+
-
+
+
-
+
-
-
+
@@ -2455,10 +2756,6 @@
-
-
-
-
@@ -2519,11 +2816,6 @@
-
-
-
-
-
@@ -2582,6 +2874,10 @@
+
+
+
+
@@ -2666,6 +2962,10 @@
+
+
+
+
@@ -2702,20 +3002,21 @@
+
-
+
-
+
-
+
-
+
@@ -2735,10 +3036,6 @@
-
-
-
-
@@ -2761,6 +3058,11 @@
+
+
+
+
+
@@ -2778,6 +3080,10 @@
+
+
+
+
@@ -2791,6 +3097,10 @@
+
+
+
+
@@ -2811,10 +3121,18 @@
+
+
+
+
+
+
+
+
@@ -2907,6 +3225,14 @@
+
+
+
+
+
+
+
+
@@ -2923,17 +3249,17 @@
-
-
+
+
-
+
-
+
@@ -2949,6 +3275,10 @@
+
+
+
+
@@ -2961,6 +3291,10 @@
+
+
+
+
@@ -2983,6 +3317,10 @@
+
+
+
+
@@ -3039,11 +3377,11 @@
-
+
-
+
@@ -3053,11 +3391,6 @@
-
-
-
-
-
@@ -3067,6 +3400,10 @@
+
+
+
+
@@ -3093,11 +3430,6 @@
-
-
-
-
-
@@ -3129,6 +3461,11 @@
+
+
+
+
+
@@ -3202,10 +3539,6 @@
-
-
-
-
@@ -3288,6 +3621,10 @@
+
+
+
+
@@ -3372,6 +3709,10 @@
+
+
+
+
@@ -3408,20 +3749,21 @@
+
-
+
-
+
-
+
-
+
@@ -3441,10 +3783,6 @@
-
-
-
-
@@ -3467,6 +3805,11 @@
+
+
+
+
+
@@ -3484,6 +3827,10 @@
+
+
+
+
@@ -3497,6 +3844,10 @@
+
+
+
+
@@ -3517,10 +3868,18 @@
+
+
+
+
+
+
+
+
@@ -3613,6 +3972,14 @@
+
+
+
+
+
+
+
+
@@ -3628,6 +3995,10 @@
+
+
+
+
@@ -3638,13 +4009,9 @@
+
-
-
-
-
-
-
+
@@ -3655,6 +4022,10 @@
+
+
+
+
@@ -3667,6 +4038,10 @@
+
+
+
+
@@ -3689,6 +4064,10 @@
+
+
+
+
@@ -3745,11 +4124,11 @@
-
+
-
+
@@ -3759,11 +4138,6 @@
-
-
-
-
-
@@ -3773,6 +4147,10 @@
+
+
+
+
@@ -3830,6 +4208,11 @@
+
+
+
+
+
@@ -3903,10 +4286,6 @@
-
-
-
-
@@ -3964,6 +4343,137 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3981,13 +4491,12 @@
-
-
+
-
+
@@ -4038,6 +4547,11 @@
+
+
+
+
+
@@ -4063,6 +4577,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -4077,6 +4601,10 @@
+
+
+
+
@@ -4116,6 +4644,11 @@
+
+
+
+
+
@@ -4132,10 +4665,6 @@
-
-
-
-
@@ -4146,39 +4675,40 @@
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
+
-
+
@@ -4198,9 +4728,8 @@
-
-
+
@@ -4230,18 +4759,21 @@
+
+
+
+
-
+
-
-
+
@@ -4264,11 +4796,6 @@
-
-
-
-
-
@@ -4330,6 +4857,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -4349,23 +4889,18 @@
-
-
-
-
-
-
+
+
-
+
-
-
+
@@ -4390,12 +4925,11 @@
-
+
-
-
+
@@ -4410,6 +4944,10 @@
+
+
+
+
@@ -4446,11 +4984,6 @@
-
-
-
-
-
@@ -4466,11 +4999,11 @@
-
+
-
+
@@ -4480,6 +5013,11 @@
+
+
+
+
+
@@ -4489,6 +5027,15 @@
+
+
+
+
+
+
+
+
+
@@ -4499,6 +5046,11 @@
+
+
+
+
+
@@ -4527,11 +5079,6 @@
-
-
-
-
-
@@ -4546,6 +5093,11 @@
+
+
+
+
+
@@ -4588,11 +5140,6 @@
-
-
-
-
-
@@ -4619,19 +5166,10 @@
-
-
-
-
-
-
-
-
-
@@ -4642,11 +5180,6 @@
-
-
-
-
-
@@ -4672,11 +5205,6 @@
-
-
-
-
-
@@ -4710,6 +5238,10 @@
+
+
+
+
@@ -4794,6 +5326,10 @@
+
+
+
+
@@ -4830,20 +5366,21 @@
+
-
+
-
+
-
+
-
+
@@ -4863,10 +5400,6 @@
-
-
-
-
@@ -4889,6 +5422,11 @@
+
+
+
+
+
@@ -4906,6 +5444,10 @@
+
+
+
+
@@ -4919,6 +5461,10 @@
+
+
+
+
@@ -4939,10 +5485,18 @@
+
+
+
+
+
+
+
+
@@ -5035,6 +5589,14 @@
+
+
+
+
+
+
+
+
@@ -5051,17 +5613,17 @@
-
-
+
+
-
+
-
+
@@ -5077,6 +5639,10 @@
+
+
+
+
@@ -5089,6 +5655,10 @@
+
+
+
+
@@ -5111,6 +5681,10 @@
+
+
+
+
@@ -5167,11 +5741,11 @@
-
+
-
+
@@ -5181,11 +5755,6 @@
-
-
-
-
-
@@ -5195,6 +5764,10 @@
+
+
+
+
@@ -5221,11 +5794,6 @@
-
-
-
-
-
@@ -5257,6 +5825,11 @@
+
+
+
+
+
@@ -5330,10 +5903,6 @@
-
-
-
-
@@ -5416,6 +5985,10 @@
+
+
+
+
@@ -5500,6 +6073,10 @@
+
+
+
+
@@ -5536,20 +6113,21 @@
+
-
+
-
+
-
+
-
+
@@ -5569,10 +6147,6 @@
-
-
-
-
@@ -5595,6 +6169,11 @@
+
+
+
+
+
@@ -5612,6 +6191,10 @@
+
+
+
+
@@ -5625,6 +6208,10 @@
+
+
+
+
@@ -5645,10 +6232,18 @@
+
+
+
+
+
+
+
+
@@ -5741,6 +6336,14 @@
+
+
+
+
+
+
+
+
@@ -5757,17 +6360,17 @@
-
-
+
+
-
+
-
+
@@ -5783,6 +6386,10 @@
+
+
+
+
@@ -5795,6 +6402,10 @@
+
+
+
+
@@ -5817,6 +6428,10 @@
+
+
+
+
@@ -5873,11 +6488,11 @@
-
+
-
+
@@ -5887,11 +6502,6 @@
-
-
-
-
-
@@ -5901,6 +6511,10 @@
+
+
+
+
@@ -5927,11 +6541,6 @@
-
-
-
-
-
@@ -5963,6 +6572,11 @@
+
+
+
+
+
@@ -6036,10 +6650,6 @@
-
-
-
-
@@ -6122,6 +6732,10 @@
+
+
+
+
@@ -6206,6 +6820,10 @@
+
+
+
+
@@ -6242,20 +6860,21 @@
+
-
+
-
+
-
+
-
+
@@ -6275,10 +6894,6 @@
-
-
-
-
@@ -6301,6 +6916,11 @@
+
+
+
+
+
@@ -6318,6 +6938,10 @@
+
+
+
+
@@ -6331,6 +6955,10 @@
+
+
+
+
@@ -6351,10 +6979,18 @@
+
+
+
+
+
+
+
+
@@ -6447,6 +7083,14 @@
+
+
+
+
+
+
+
+
@@ -6463,17 +7107,17 @@
-
-
+
+
-
+
-
+
@@ -6489,6 +7133,10 @@
+
+
+
+
@@ -6501,6 +7149,10 @@
+
+
+
+
@@ -6523,6 +7175,10 @@
+
+
+
+
@@ -6579,11 +7235,11 @@
-
+
-
+
@@ -6593,11 +7249,6 @@
-
-
-
-
-
@@ -6607,6 +7258,10 @@
+
+
+
+
@@ -6633,11 +7288,6 @@
-
-
-
-
-
@@ -6669,6 +7319,11 @@
+
+
+
+
+
@@ -6742,10 +7397,6 @@
-
-
-
-
@@ -6828,6 +7479,10 @@
+
+
+
+
@@ -6912,6 +7567,10 @@
+
+
+
+
@@ -6948,20 +7607,21 @@
+
-
+
-
+
-
+
-
+
@@ -6981,10 +7641,6 @@
-
-
-
-
@@ -7007,6 +7663,11 @@
+
+
+
+
+
@@ -7024,6 +7685,10 @@
+
+
+
+
@@ -7037,6 +7702,10 @@
+
+
+
+
@@ -7057,10 +7726,18 @@
+
+
+
+
+
+
+
+
@@ -7153,6 +7830,14 @@
+
+
+
+
+
+
+
+
@@ -7169,17 +7854,17 @@
-
-
+
+
-
+
-
+
@@ -7195,6 +7880,10 @@
+
+
+
+
@@ -7207,6 +7896,10 @@
+
+
+
+
@@ -7229,6 +7922,10 @@
+
+
+
+
@@ -7285,11 +7982,11 @@
-
+
-
+
@@ -7299,11 +7996,6 @@
-
-
-
-
-
@@ -7313,6 +8005,10 @@
+
+
+
+
@@ -7339,11 +8035,6 @@
-
-
-
-
-
@@ -7375,6 +8066,11 @@
+
+
+
+
+
@@ -7448,10 +8144,6 @@
-
-
-
-
@@ -7513,23 +8205,24 @@
@@ -7544,33 +8237,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -7578,22 +8292,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -7604,7 +8327,8 @@
-
+
+
@@ -7615,9 +8339,10 @@
+
+
-
@@ -7629,33 +8354,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -7663,22 +8409,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -7689,7 +8444,8 @@
-
+
+
@@ -7700,47 +8456,186 @@
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -7748,22 +8643,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -7774,7 +8678,8 @@
-
+
+
@@ -7785,9 +8690,10 @@
+
+
-
@@ -7799,33 +8705,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -7833,22 +8760,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -7859,7 +8795,8 @@
-
+
+
@@ -7870,9 +8807,10 @@
+
+
-
@@ -7884,33 +8822,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -7918,22 +8877,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -7944,7 +8912,8 @@
-
+
+
@@ -7955,47 +8924,186 @@
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -8003,22 +9111,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -8029,7 +9146,8 @@
-
+
+
@@ -8040,9 +9158,10 @@
+
+
-
@@ -8054,33 +9173,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -8088,22 +9228,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -8114,7 +9263,8 @@
-
+
+
@@ -8125,9 +9275,10 @@
+
+
-
@@ -8139,33 +9290,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -8173,22 +9345,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -8199,7 +9380,8 @@
-
+
+
@@ -8210,9 +9392,10 @@
+
+
-
@@ -8224,33 +9407,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -8258,22 +9462,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -8284,7 +9497,8 @@
-
+
+
@@ -8295,9 +9509,10 @@
+
+
-
@@ -8309,33 +9524,54 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
@@ -8343,22 +9579,31 @@
-
-
+
+
+
+
-
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
@@ -8369,7 +9614,8 @@
-
+
+
@@ -8380,9 +9626,10 @@
+
+
-
@@ -8394,138 +9641,141 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -8542,64 +9792,63 @@
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
@@ -8627,28 +9876,29 @@
+<<<<<<< Updated upstream
+=======
+
+
+
+
+
+>>>>>>> Stashed changes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+<<<<<<< Updated upstream
+=======
+
+
+
+
+>>>>>>> Stashed changes
@@ -8658,10 +9908,6 @@
-
-
-
-
@@ -8673,15 +9919,7 @@
-
-
-
-
-
-
-
-
-
+
@@ -8695,23 +9933,11 @@
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+
@@ -8725,25 +9951,19 @@
-
+
-
+
-
-
-
-
-
-
-
+
-
+
@@ -8757,41 +9977,35 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
@@ -8809,27 +10023,15 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
@@ -8843,27 +10045,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -8877,11 +10059,7 @@
-
-
-
-
-
+
@@ -8895,7 +10073,7 @@
-
+
@@ -8904,6 +10082,9 @@
+
+
+
@@ -8914,49 +10095,52 @@
-
-
-
-
+
-
-
+
+
-
+
-
+
+<<<<<<< Updated upstream
+
+=======
+
+
+>>>>>>> Stashed changes
+
-
+
+
+
+
-
-
-
-
+
-
-
+
@@ -9149,9 +10333,9 @@
-
+
-
+
@@ -9516,6 +10700,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -9532,6 +10764,9 @@
+
+ $USER_HOME$/.subversion
+
@@ -9552,33 +10787,51 @@
-
-
+<<<<<<< Updated upstream
+
+=======
+
+>>>>>>> Stashed changes
+
-
-
+
+
-
-
+
+
-
+<<<<<<< Updated upstream
+
+
+
+
+
+
+=======
+
+>>>>>>> Stashed changes
-
+
-
-
-
-
+<<<<<<< Updated upstream
+
+
+
+=======
+
+
+>>>>>>> Stashed changes
+
@@ -9587,10 +10840,19 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -9599,7 +10861,7 @@
file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
- 104
+ 106
@@ -9611,7 +10873,7 @@
file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
- 248
+ 255
@@ -9629,431 +10891,641 @@
file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleBus.java
- 175
+ 215
-
+
- 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
+ 71
-
+
- 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
+ 133
-
+
- 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
+ 160
-
+
- 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
+ 167
-
+
+
+
+ file://$PROJECT_DIR$/page_name/src/main/java/com/cangwang/page_name/PageNameExModule.java
+ 55
+
+
+
+
+ file://$PROJECT_DIR$/core/src/main/java/com/cangwang/core/ModuleCenter.java
+ 32
+
+
-
+
-
+<<<<<<< Updated upstream
+=======
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+>>>>>>> Stashed changes
+
-
-
+
+
+<<<<<<< Updated upstream
+
+=======
+>>>>>>> Stashed changes
-
+
+
+
+
-
-
+
+
-
-
-
-
-
+
-
-
+
+
+
-
+<<<<<<< Updated upstream
+=======
+
-
-
+
+
-
+>>>>>>> Stashed changes
+
-
-
+
+
-
+
-
-
+
+
+<<<<<<< Updated upstream
+=======
-
+
-
-
+
+
+
+
+
+
+>>>>>>> Stashed changes
-
+
-
-
+
+
-
+
-
-
-
-
-
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+
+
+<<<<<<< Updated upstream
+=======
-
+
-
-
+
+
+>>>>>>> Stashed changes
-
-
-
+
-
-
+
+
-
+<<<<<<< Updated upstream
+=======
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+>>>>>>> Stashed changes
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<<<<<<< Updated upstream
+
+
+
-
-
+
+
+
+
+
+=======
+
+
+
+
+
-
+
+
-
-
+
+
+>>>>>>> Stashed changes
-
-
+
+
+
+
+
+
+
+<<<<<<< Updated upstream
+
+
-
+
-
-
+
+
+=======
+>>>>>>> Stashed changes
-
+
+
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
-
+
-
-
+<<<<<<< Updated upstream
+
+
+
+=======
+
+
+>>>>>>> Stashed changes
-
+
-
-
+<<<<<<< Updated upstream
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+=======
+
+
+
+
+
+>>>>>>> Stashed changes
+
+
+
+
+
+
+
+<<<<<<< Updated upstream
+
+=======
+
+>>>>>>> Stashed changes
-
+
-
-
+<<<<<<< Updated upstream
+
+
+=======
+
+
+>>>>>>> Stashed changes
-
+
-
-
+<<<<<<< Updated upstream
+
+
+=======
+
+
+
+
+
+>>>>>>> Stashed changes
-
-
+
+
+
+<<<<<<< Updated upstream
+
+
+=======
+
+
+>>>>>>> Stashed changes
+
+
+
+
+
+
-
+
-
-
+<<<<<<< Updated upstream
+
+
+=======
+
+
+
+
+
+>>>>>>> Stashed changes
-
+
-
-
+<<<<<<< Updated upstream
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
+=======
+
+
-
+
+>>>>>>> Stashed changes
-
+
-
-
+<<<<<<< Updated upstream
+
+
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+=======
+
+
+>>>>>>> Stashed changes
+
-
+
-
-
+
+
+
-
+
-
-
-
+
+
+
+
+
+
-
+
-
-
+<<<<<<< Updated upstream
+
+
-
+
+
+
+=======
+
+
+
+>>>>>>> Stashed changes
-
+
-
-
+
+
-
+
-
-
+<<<<<<< Updated upstream
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+=======
+
+
+>>>>>>> Stashed changes
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..21f422c 100644
--- a/a/a.iml
+++ b/a/a.iml
@@ -9,7 +9,6 @@
-
@@ -20,11 +19,11 @@
-
+
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,7 +61,6 @@
-
@@ -72,7 +68,6 @@
-
@@ -80,15 +75,12 @@
-
-
-
@@ -103,46 +95,48 @@
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/a/build.gradle b/a/build.gradle
index 8378fb6..501383b 100644
--- a/a/build.gradle
+++ b/a/build.gradle
@@ -39,7 +39,9 @@ android {
}
}
}
-
+ lintOptions {
+ abortOnError false
+ }
}
dependencies {
diff --git a/annotation/.gitignore b/annotation/.gitignore
new file mode 100644
index 0000000..3543521
--- /dev/null
+++ b/annotation/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/annotation/build.gradle b/annotation/build.gradle
new file mode 100644
index 0000000..7f27082
--- /dev/null
+++ b/annotation/build.gradle
@@ -0,0 +1,8 @@
+apply plugin: 'java'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+}
+
+sourceCompatibility = "1.7"
+targetCompatibility = "1.7"
diff --git a/annotation/src/main/java/com/cangwang/ModuleConfig.java b/annotation/src/main/java/com/cangwang/ModuleConfig.java
new file mode 100644
index 0000000..f567fb3
--- /dev/null
+++ b/annotation/src/main/java/com/cangwang/ModuleConfig.java
@@ -0,0 +1,4 @@
+package com.cangwang;
+
+public class ModuleConfig {
+}
diff --git a/annotation/src/main/java/com/cangwang/annotation/ModuleGroup.java b/annotation/src/main/java/com/cangwang/annotation/ModuleGroup.java
new file mode 100644
index 0000000..0dd1bbc
--- /dev/null
+++ b/annotation/src/main/java/com/cangwang/annotation/ModuleGroup.java
@@ -0,0 +1,16 @@
+package com.cangwang.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *
+ * Created by cangwang on 2017/8/31.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface ModuleGroup {
+ ModuleUnit[] value();
+}
diff --git a/annotation/src/main/java/com/cangwang/annotation/ModuleUnit.java b/annotation/src/main/java/com/cangwang/annotation/ModuleUnit.java
new file mode 100644
index 0000000..b78e64e
--- /dev/null
+++ b/annotation/src/main/java/com/cangwang/annotation/ModuleUnit.java
@@ -0,0 +1,21 @@
+package com.cangwang.annotation;
+
+import com.cangwang.enums.LayoutLevel;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Module单元注解
+ * Created by cangwang on 2017/8/31.
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.CLASS)
+public @interface ModuleUnit {
+ String templet() default "normal";
+ String title() default "CangWang";
+ LayoutLevel layoutlevel() default LayoutLevel.NORMAL;
+ int extralevel() default 0;
+}
diff --git a/annotation/src/main/java/com/cangwang/enums/LayoutLevel.java b/annotation/src/main/java/com/cangwang/enums/LayoutLevel.java
new file mode 100644
index 0000000..86c0901
--- /dev/null
+++ b/annotation/src/main/java/com/cangwang/enums/LayoutLevel.java
@@ -0,0 +1,18 @@
+package com.cangwang.enums;
+
+/**
+ * 布局层级
+ * Created by cangwang on 2017/8/31.
+ */
+
+public enum LayoutLevel {
+ VERY_HIGHT(100),
+ HIGHT(200),
+ NORMAL(300),
+ LOW(400),
+ VERY_LOW(500);
+
+ public int getValue(){return value;}
+ private int value;
+ LayoutLevel(int value){this.value = value;}
+}
diff --git a/annotation/src/main/java/com/cangwang/model/ModuleMeta.java b/annotation/src/main/java/com/cangwang/model/ModuleMeta.java
new file mode 100644
index 0000000..17bb7ff
--- /dev/null
+++ b/annotation/src/main/java/com/cangwang/model/ModuleMeta.java
@@ -0,0 +1,64 @@
+package com.cangwang.model;
+
+import com.cangwang.annotation.ModuleUnit;
+import com.cangwang.enums.LayoutLevel;
+
+import javax.lang.model.element.Element;
+
+/**
+ * 模块信息
+ * Created by cangwang on 2017/9/1.
+ */
+
+public class ModuleMeta {
+// public Element rwaType;
+ public String templet;
+ public String moduleName;
+ public String title;
+ public LayoutLevel layoutlevel;
+ public int extralevel;
+
+ public ModuleMeta(String templet,String moduleName,String title,int layoutlevel,int extralevel){
+// this.rwaType = rawType;
+ this.templet = templet;
+ this.moduleName = moduleName;
+ this.title = title;
+ if (layoutlevel == 500){
+ this.layoutlevel = LayoutLevel.VERY_LOW;
+ }else if (layoutlevel == 400){
+ this.layoutlevel = LayoutLevel.LOW;
+ }else if (layoutlevel == 300){
+ this.layoutlevel = LayoutLevel.NORMAL;
+ }else if (layoutlevel == 200){
+ this.layoutlevel = LayoutLevel.HIGHT;
+ }else if (layoutlevel == 100){
+ this.layoutlevel = LayoutLevel.VERY_HIGHT;
+ }
+ this.extralevel = extralevel;
+ }
+
+ public ModuleMeta(ModuleUnit unit,String moduleName){
+// this.rwaType = rawType;
+ this.moduleName = moduleName;
+ this.templet = unit.templet();
+ this.layoutlevel = unit.layoutlevel();
+ this.extralevel = unit.extralevel();
+ this.title = unit.title();
+ }
+
+// public static ModuleMeta build(ModuleUnit unit, Element rawType){
+// return new ModuleMeta(unit,rawType);
+// }
+
+
+ @Override
+ public String toString() {
+ return "ModuleMeta{" +
+ "templet='" + templet + '\'' +
+ ", moduleName='" + moduleName + '\'' +
+ ", title='" + title + '\'' +
+ ", layoutlevel=" + layoutlevel +
+ ", extralevel=" + extralevel +
+ '}';
+ }
+}
diff --git a/app/app.iml b/app/app.iml
index 8e1766e..855c0e3 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -9,7 +9,6 @@
-
@@ -23,7 +22,7 @@
-
+
@@ -47,7 +46,6 @@
-
@@ -55,7 +53,6 @@
-
@@ -63,45 +60,26 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -114,41 +92,41 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 362cc58..56ab7f3 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,58 +1,71 @@
-//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'
+ }
+ }
+
+ gradle.taskGraph.whenReady {
+ tasks.each {
+ task ->
+ if(task.name.contains("Test")){
+ task.enabled=false;
+ }
+ }
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+}
+
+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'
+ annotationProcessor project(":compiler")
+
+ 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/fat-aar.gradle b/app/fat-aar.gradle
index ea90408..8261ab7 100755
--- a/app/fat-aar.gradle
+++ b/app/fat-aar.gradle
@@ -1,11 +1,9 @@
/**
* This is free and unencumbered software released into the public domain.
-
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
-
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@@ -13,7 +11,6 @@
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -21,7 +18,6 @@
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
-
For more information, please refer to
*/
@@ -54,7 +50,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:manifest-merger:25.2.0'
+ classpath 'com.android.tools.build:manifest-merger:25.3.2'
}
}
@@ -67,15 +63,17 @@ dependencies {
}
// Paths to embedded jar files
-ext.embeddedJars = new ArrayList()
+ext.embeddedJars = new ArrayList()
// Paths to embedded aar projects
-ext.embeddedAarDirs = new ArrayList()
+ext.embeddedAarDirs = new ArrayList()
+// Embedded aar files dependencies
+ext.embeddedAarFiles = new ArrayList()
// List of embedded R classes
-ext.embeddedRClasses = new ArrayList()
+ext.embeddedRClasses = new ArrayList()
// Change backslash to forward slash on windows
ext.build_dir = buildDir.path.replace(File.separator, '/');
-
+ext.root_dir = project.rootDir.absolutePath.replace(File.separator, '/');
ext.exploded_aar_dir = "$build_dir/intermediates/exploded-aar";
ext.classs_release_dir = "$build_dir/intermediates/classes/release";
ext.bundle_release_dir = "$build_dir/intermediates/bundles/release";
@@ -84,15 +82,40 @@ ext.generated_rsrc_dir = "$build_dir/generated/source/r/release";
ext.base_r2x_dir = "$build_dir/fat-aar/release/";
+def gradleVersionStr = GradleVersion.current().getVersion();
+ext.gradleApiVersion = gradleVersionStr.substring(0, gradleVersionStr.lastIndexOf(".")).toFloat();
+
+println "Gradle version: " + gradleVersionStr;
+
afterEvaluate {
// the list of dependency must be reversed to use the right overlay order.
def dependencies = new ArrayList(configurations.embedded.resolvedConfiguration.firstLevelModuleDependencies)
dependencies.reverseEach {
- def aarPath = "${exploded_aar_dir}/${it.moduleGroup}/${it.moduleName}/${it.moduleVersion}"
+
+ def aarPath;
+ if (gradleApiVersion >= 2.3f)
+ aarPath = "${root_dir}/${it.moduleName}/build/intermediates/bundles/default"
+ else
+ aarPath = "${exploded_aar_dir}/${it.moduleGroup}/${it.moduleName}/${it.moduleVersion}"
it.moduleArtifacts.each {
artifact ->
+
+ println "ARTIFACT 3 : "
+ println artifact
if (artifact.type == 'aar') {
+ if (!embeddedAarFiles.contains(artifact)) {
+ embeddedAarFiles.add(artifact)
+ }
if (!embeddedAarDirs.contains(aarPath)) {
+ if( artifact.file.isFile() ){
+ println artifact.file
+ println aarPath
+
+ copy {
+ from zipTree( artifact.file )
+ into aarPath
+ }
+ }
embeddedAarDirs.add(aarPath)
}
} else if (artifact.type == 'jar') {
@@ -116,7 +139,14 @@ afterEvaluate {
// Embed JNI Libraries
bundleRelease.dependsOn embedJniLibs
- embedJniLibs.dependsOn transformNative_libsWithSyncJniLibsForRelease
+
+ if(gradleApiVersion >= 2.3f) {
+ embedJniLibs.dependsOn transformNativeLibsWithSyncJniLibsForRelease
+ ext.bundle_release_dir = "$build_dir/intermediates/bundles/default"
+ }else{
+ embedJniLibs.dependsOn transformNative_libsWithSyncJniLibsForRelease
+ ext.bundle_release_dir = "$build_dir/intermediates/bundles/release";
+ }
// Merge Embedded Manifests
bundleRelease.dependsOn embedManifests
@@ -159,12 +189,35 @@ private List getMergedInputResourceSets(List inputResourceSet) {
List newInputResourceSet = new ArrayList(inputResourceSet)
+ println "getMergedInputResourceSets"
+
+ println embeddedAarDirs
embeddedAarDirs.each { aarPath ->
try {
- def resname = (aarPath.split(exploded_aar_dir)[1]).replace('/', ':');
+ println aarPath
+ def resname
+ if (gradleApiVersion >= 2.3f) {
+ def parentProject = project.rootProject.name.toString()
+ println "parent: "
+ println parentProject
+
+ def startIndex = aarPath.indexOf('/' + parentProject)
+ def endIndex = aarPath.indexOf('/build/')
+
+ println "start"
+ println startIndex
+ println "end"
+ println endIndex
+ if (startIndex < 1 || endIndex < 1)
+ return;
+ resname = aarPath.substring(startIndex, endIndex).replace('/', ':')
+ }
+ else
+ resname = (aarPath.split(exploded_aar_dir)[1]).replace('/', ':');
def rs = ResourceSetClass.newInstance([resname, true] as Object[])
rs.addSource(file("$aarPath/res"))
- // println "ResourceSet is " + rs
+ println "ResourceSet is " + rs
+ println resname
newInputResourceSet += rs
} catch (Exception e) {
e.printStackTrace();
@@ -198,7 +251,7 @@ task embedProguard << {
try {
def proguardLibFile = file("$aarPath/proguard.txt")
if (proguardLibFile.exists())
- proguardRelease.append(proguardLibFile.text)
+ proguardRelease.append("\n" + proguardLibFile.text)
} catch (Exception e) {
e.printStackTrace();
throw e;
@@ -211,52 +264,68 @@ task generateRJava << {
println "Running FAT-AAR Task :generateRJava"
// Now generate the R.java file for each embedded dependency
- def libPackageName = new XmlParser().parse(android.sourceSets.main.manifest.srcFile).@package
+ def mainManifestFile = android.sourceSets.main.manifest.srcFile;
+ def libPackageName = "";
+
+ if(mainManifestFile.exists()) {
+
+ libPackageName = new XmlParser().parse(mainManifestFile).@package
+ }
embeddedAarDirs.each { aarPath ->
- def aarManifest = new XmlParser().parse(file("$aarPath/AndroidManifest.xml"));
- def aarPackageName = aarManifest.@package
- String packagePath = aarPackageName.replace('.', '/')
-
- // Generate the R.java file and map to current project's R.java
- // This will recreate the class file
- def rTxt = file("$aarPath/R.txt")
- def rMap = new ConfigObject()
-
- if (rTxt.exists()) {
- rTxt.eachLine {
- line ->
- //noinspection GroovyUnusedAssignment
- def (type, subclass, name, value) = line.tokenize(' ')
- rMap[subclass].putAt(name, type)
- }
+ def manifestFile = file("$aarPath/AndroidManifest.xml");
+ if(!manifestFile.exists()) {
+ manifestFile = file("./src/main/AndroidManifest.xml");
}
- def sb = "package $aarPackageName;" << '\n' << '\n'
- sb << 'public final class R {' << '\n'
+ if(manifestFile.exists()) {
+ def aarManifest = new XmlParser().parse(manifestFile);
+ def aarPackageName = aarManifest.@package
- rMap.each {
- subclass, values ->
- sb << " public static final class $subclass {" << '\n'
- values.each {
- name, type ->
- sb << " public static $type $name = ${libPackageName}.R.${subclass}.${name};" << '\n'
+ String packagePath = aarPackageName.replace('.', '/')
+
+ // Generate the R.java file and map to current project's R.java
+ // This will recreate the class file
+ def rTxt = file("$aarPath/R.txt")
+ def rMap = new ConfigObject()
+
+ if (rTxt.exists()) {
+ rTxt.eachLine {
+ line ->
+ //noinspection GroovyUnusedAssignment
+ def (type, subclass, name, value) = line.tokenize(' ')
+ rMap[subclass].putAt(name, type)
}
- sb << " }" << '\n'
- }
+ }
+
+ def sb = "package $aarPackageName;" << '\n' << '\n'
+ sb << 'public final class R {' << '\n'
- sb << '}' << '\n'
+ rMap.each {
+ subclass, values ->
+ sb << " public static final class $subclass {" << '\n'
+ values.each {
+ name, type ->
+ sb << " public static $type $name = ${libPackageName}.R.${subclass}.${name};" << '\n'
+ }
+ sb << " }" << '\n'
+ }
+
+ sb << '}' << '\n'
- mkdir("$generated_rsrc_dir/$packagePath")
- file("$generated_rsrc_dir/$packagePath/R.java").write(sb.toString())
+ mkdir("$generated_rsrc_dir/$packagePath")
+ file("$generated_rsrc_dir/$packagePath/R.java").write(sb.toString())
+
+ embeddedRClasses += "$packagePath/R.class"
+ embeddedRClasses += "$packagePath/R\$*.class"
+ }
- embeddedRClasses += "$packagePath/R.class"
- embeddedRClasses += "$packagePath/R\$*.class"
}
}
task collectRClass << {
+ println "COLLECTRCLASS"
delete base_r2x_dir
mkdir base_r2x_dir
@@ -268,8 +337,12 @@ task collectRClass << {
}
task embedRClass(type: org.gradle.jvm.tasks.Jar, dependsOn: collectRClass) {
+ println "EMBED R CLASS"
+
destinationDir file("$bundle_release_dir/libs/")
+ println destinationDir
from base_r2x_dir
+ println base_r2x_dir
}
/**
@@ -280,15 +353,44 @@ task embedJavaJars(dependsOn: embedRClass) << {
println "Running FAT-AAR Task :embedJavaJars"
embeddedAarDirs.each { aarPath ->
+
// Explode all classes.jar files to classes so that they can be proguarded
- copy {
- from zipTree("$aarPath/jars/classes.jar")
- into classs_release_dir
+ def jar_dir
+ if (gradleApiVersion >= 2.3f)
+ jar_dir = "$aarPath"
+ else
+ jar_dir = "$aarPath/jars"
+
+ if(embeddedAarFiles.size() > 0){
+
+ embeddedAarFiles.each {
+ artifact ->
+ FileTree aarFileTree = zipTree(artifact.file.getAbsolutePath());
+
+ def aarFile = aarFileTree.files.find { it.name.contains("classes.jar") }
+
+ copy {
+ from zipTree(aarFile)
+ into classs_release_dir
+ }
+ }
+
+ }else{
+
+ println jar_dir
+ println classs_release_dir
+ println bundle_release_dir
+ println embeddedJars
+
+ copy {
+ from zipTree(jar_dir + "/classes.jar")
+ into classs_release_dir
+ }
}
// Copy all additional jar files to bundle lib
- FileTree jars = fileTree(dir: "$aarPath/jars", include: '*.jar', exclude: 'classes.jar')
- jars += fileTree(dir: "$aarPath/jars/libs", include: '*.jar')
+ FileTree jars = fileTree(dir: jar_dir, include: '*.jar', exclude: 'classes.jar')
+ jars += fileTree(dir: jar_dir + "/libs", include: '*.jar')
jars += fileTree(dir: "$aarPath/libs", include: '*.jar')
copy {
@@ -324,11 +426,13 @@ task embedManifests << {
println "Running FAT-AAR Task :embedManifests"
ILogger mLogger = new MiLogger()
- List libraryManifests = new ArrayList<>()
+ List libraryManifests = new ArrayList<>()
embeddedAarDirs.each { aarPath ->
- if (!libraryManifests.contains(aarPath)) {
- libraryManifests.add(file("$aarPath/AndroidManifest.xml"))
+ File dependencyManifest = file("$aarPath/AndroidManifest.xml")
+
+ if (!libraryManifests.contains(aarPath) && dependencyManifest.exists()) {
+ libraryManifests.add(dependencyManifest)
}
}
@@ -338,6 +442,14 @@ task embedManifests << {
File copyManifest = file("$bundle_release_dir/AndroidManifest.orig.xml")
File aaptManifest = file("$manifest_aaapt_dir/AndroidManifest.xml")
+ if(!origManifest.exists()) {
+ origManifest = file("./src/main/AndroidManifest.xml")
+ }
+
+ if(!origManifest.exists()) {
+ return;
+ }
+
copy {
from origManifest.parentFile
into copyManifest.parentFile
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 169effa..91c218a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,48 +1,39 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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/AdviceActivity.java
similarity index 77%
rename from app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java
rename to app/src/main/java/com/cangwang/modulebus/AdviceActivity.java
index 3caa145..7fb2f0a 100644
--- a/app/src/main/java/com/cangwang/modulebus/AdaviceActivity.java
+++ b/app/src/main/java/com/cangwang/modulebus/AdviceActivity.java
@@ -6,11 +6,13 @@
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{
+public class AdviceActivity extends AppCompatActivity{
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
@@ -19,7 +21,7 @@ public void onCreate(Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
- startActivity(new Intent(this,ModuleMainActivity.class));
+ 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/ModuleExampleActivity.java b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExActivity.java
similarity index 55%
rename from app/src/main/java/com/cangwang/modulebus/ModuleExampleActivity.java
rename to app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExActivity.java
index a0f9cfb..517d1ef 100644
--- a/app/src/main/java/com/cangwang/modulebus/ModuleExampleActivity.java
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExActivity.java
@@ -1,24 +1,21 @@
-package com.cangwang.modulebus;
-
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.util.ArrayMap;
-import android.support.v7.app.AppCompatActivity;
-
-import com.cangwang.core.cwmodule.ModuleManageActivity;
-
-import java.util.ArrayList;
-
-/**
- * Created by air on 2016/12/28.
- */
-
-public class ModuleExampleActivity extends AppCompatActivity{
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_example);
- getSupportFragmentManager().beginTransaction().replace(R.id.container,new ModuleExampleFragment()).commit();
- }
-}
+package com.cangwang.modulebus.ExModule;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v7.app.AppCompatActivity;
+
+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..aa76bdf
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleExFragment.java
@@ -0,0 +1,35 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.os.Bundle;
+
+import com.cangwang.core.ModuleBus;
+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() {
+ return ModuleBus.getInstance().getModuleList("normal");
+ }
+}
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..7ff3a41
--- /dev/null
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/ModuleMainExActivity.java
@@ -0,0 +1,26 @@
+package com.cangwang.modulebus.ExModule;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.cwmodule.ex.ModuleManageExActivity;
+
+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() {
+ return ModuleBus.getInstance().getModuleList("top");
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/PageConfig.java b/app/src/main/java/com/cangwang/modulebus/ExModule/PageExConfig.java
similarity index 80%
rename from app/src/main/java/com/cangwang/modulebus/PageConfig.java
rename to app/src/main/java/com/cangwang/modulebus/ExModule/PageExConfig.java
index dc92df9..5753176 100644
--- a/app/src/main/java/com/cangwang/modulebus/PageConfig.java
+++ b/app/src/main/java/com/cangwang/modulebus/ExModule/PageExConfig.java
@@ -1,58 +1,54 @@
-package com.cangwang.modulebus;
-
-import android.content.Context;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by zjl on 16/7/6.
- */
-public class PageConfig {
- 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.PageNameModule";
- public static final String MODULE_BODY_NAME ="com.cangwang.page_body.PageBodyModule";
- public static final String MODULE_BODY_BT_NAME ="com.cangwang.page_body_bt.PageBodyBTModule";
-
- 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 final String[] modulesList = {
- MODULE_PAGE_NAME,
- MODULE_BODY_NAME,
- MODULE_BODY_BT_NAME
- };
-
-
- public static final String[] moduleCreate = {
- BODY_CREATE,
- NAME_CREATE
- };
-
-}
+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.PageBodyBTExModule";
+
+ 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/java/com/cangwang/modulebus/MainActivity.java b/app/src/main/java/com/cangwang/modulebus/MainActivity.java
deleted file mode 100644
index 89273f4..0000000
--- a/app/src/main/java/com/cangwang/modulebus/MainActivity.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.cangwang.modulebus;
-
-import android.content.Intent;
-import android.support.annotation.NonNull;
-import android.support.design.widget.BottomNavigationView;
-import android.support.v4.app.Fragment;
-import android.support.v4.view.ViewPager;
-import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.view.MenuItem;
-
-import com.cangwang.core.IBaseClient;
-import com.cangwang.core.ModuleBus;
-import com.cangwang.core.ModuleEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MainActivity extends AppCompatActivity {
-
- private BottomNavigationView bottomNavigationView;
- private ViewPager mViewPager;
- private ViewPagerAdapter mViewPagerAdapter;
- private List pageFagments = new ArrayList();
- private List pageTitles = new ArrayList();
-
- private MenuItem prevMenuItem;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- ModuleBus.getInstance().setPackageName(getPackageName());
-
- setContentView(R.layout.activity_main);
-
- pageTitles = PageConfig.getPageTitles(this);
- try {
- //遍历Fragment地址
- for(String address:PageConfig.fragmentNames){
- //反射获得Class
- Class clazz = Class.forName(address);
- //创建类
- Fragment tab = (Fragment) clazz.newInstance();
- //添加到viewPagerAdapter的资源
- pageFagments.add(tab);
- }
-
- }catch (ClassNotFoundException e){
-
- }catch (IllegalAccessException e){
-
- }catch (InstantiationException e){
-
- }
-
- mViewPager = (ViewPager) findViewById(R.id.viewpager);
- bottomNavigationView = (BottomNavigationView) findViewById(R.id.navigation);
-
- mViewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager(),pageFagments,pageTitles);
- mViewPager.setAdapter(mViewPagerAdapter);
- mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
- @Override
- public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
-
- }
-
- @Override
- public void onPageSelected(int position) {
- if(prevMenuItem != null){
- prevMenuItem.setChecked(false);
- }else{
- bottomNavigationView.getMenu().getItem(0).setChecked(false);
- }
- bottomNavigationView.getMenu().getItem(position).setChecked(true);
- prevMenuItem = bottomNavigationView.getMenu().getItem(position);
- }
-
- @Override
- public void onPageScrollStateChanged(int state) {
-
- }
- });
- //全部预加载
- mViewPager.setOffscreenPageLimit(pageFagments.size());
-
- bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
- @Override
- public boolean onNavigationItemSelected(@NonNull MenuItem item) {
-// switch (item.getItemId()){
-// case R.id.a:
-// mViewPager.setCurrentItem(0);
-// break;
-// case R.id.b:
-// mViewPager.setCurrentItem(1);
-// break;
-// case R.id.c:
-// mViewPager.setCurrentItem(2);
-// break;
-// case R.id.d:
-// mViewPager.setCurrentItem(3);
-// break;
-//
-// }
- int id = item.getItemId();
- if (id == R.id.a){
- mViewPager.setCurrentItem(0);
- }else if (id == R.id.b){
- mViewPager.setCurrentItem(1);
- }else if (id == R.id.c){
- mViewPager.setCurrentItem(2);
- }else if (id == R.id.d){
- mViewPager.setCurrentItem(3);
- }
-
- return true;
- }
- });
- ModuleBus.getInstance().register(this);
- }
-
- @Override
- protected void onDestroy() {
- ModuleBus.getInstance().unregister(this);
- super.onDestroy();
- }
-
- @ModuleEvent(coreClientClass = IBaseClient.class)
- public void startModuleActivity(String className,Bundle bundle){
- try {
- Class clazz = Class.forName(className);
- Intent intent = new Intent(this,clazz);
- if (bundle!=null)
- intent.putExtras(bundle);
- startActivityForResult(intent,ModuleBus.MODULE_RESULT);
- }catch (ClassNotFoundException e){
- e.printStackTrace();
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == ModuleBus.MODULE_RESULT){
- ModuleBus.getInstance().moduleResult(this,data);
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-}
diff --git a/app/src/main/java/com/cangwang/modulebus/ModuleApplication.java b/app/src/main/java/com/cangwang/modulebus/ModuleApplication.java
index 63c5158..d5aaec3 100644
--- a/app/src/main/java/com/cangwang/modulebus/ModuleApplication.java
+++ b/app/src/main/java/com/cangwang/modulebus/ModuleApplication.java
@@ -1,61 +1,48 @@
-package com.cangwang.modulebus;
-
-import android.app.Application;
-import android.util.Log;
-
-import com.cangwang.core.util.ModuleImpl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * Created by cangwang on 2017/2/25.
- */
-
-public class ModuleApplication extends Application{
- private static final String TAG="ModuleApplication";
-
- @Override
- public void onCreate() {
- super.onCreate();
- long time = System.currentTimeMillis();
-// for (String implName:PageConfig.moduleCreate){
-// try {
-// Class> clazz = Class.forName(implName);
-// Object impl = clazz.newInstance();
-// if (clazz.newInstance() instanceof ModuleImpl){
-// Method m = clazz.getDeclaredMethod("onLoad",Application.class);
-// m.invoke(impl,this);
-// }
-// }catch (ClassNotFoundException e){
-// e.printStackTrace();
-// }catch (IllegalAccessException e){
-// e.printStackTrace();
-// }catch (InstantiationException e){
-// e.printStackTrace();
-// }catch (NoSuchMethodException e){
-// e.printStackTrace();
-// }catch (InvocationTargetException e){
-// e.printStackTrace();
-// }
-// }
-// Log.v(TAG,"invoke load time = " +(System.currentTimeMillis()-time));
-// time=System.currentTimeMillis();
- for (String implName:PageConfig.moduleCreate){
- try {
- Class> clazz = Class.forName(implName);
- if (clazz.newInstance() instanceof ModuleImpl){
- ModuleImpl impl = (ModuleImpl) clazz.newInstance();
- impl.onLoad(this);
- }
- }catch (ClassNotFoundException e){
- e.printStackTrace();
- }catch (IllegalAccessException e){
- e.printStackTrace();
- }catch (InstantiationException e){
- e.printStackTrace();
- }
- }
- Log.v(TAG,"interface load time = " +(System.currentTimeMillis()-time));
- }
-}
+package com.cangwang.modulebus;
+
+import android.app.Application;
+import android.content.Context;
+import android.util.Log;
+
+import com.cangwang.core.ModuleBus;
+import com.cangwang.core.util.ModuleImpl;
+import com.cangwang.modulebus.ExModule.PageExConfig;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Created by cangwang on 2017/2/25.
+ */
+
+public class ModuleApplication extends Application{
+ private static final String TAG="ModuleApplication";
+
+ @Override
+ protected void attachBaseContext(Context base) {
+ super.attachBaseContext(base);
+ ModuleBus.init(base);
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ long time = System.currentTimeMillis();
+ for (String implName: PageExConfig.moduleCreate){
+ try {
+ Class> clazz = Class.forName(implName);
+ if (clazz.newInstance() instanceof ModuleImpl){
+ ModuleImpl impl = (ModuleImpl) clazz.newInstance();
+ impl.onLoad(this);
+ }
+ }catch (ClassNotFoundException e){
+ e.printStackTrace();
+ }catch (IllegalAccessException e){
+ e.printStackTrace();
+ }catch (InstantiationException e){
+ e.printStackTrace();
+ }
+ }
+ Log.v(TAG,"interface load time = " +(System.currentTimeMillis()-time));
+ }
+}
diff --git a/app/src/main/java/com/cangwang/modulebus/ModuleExampleFragment.java b/app/src/main/java/com/cangwang/modulebus/ModuleExampleFragment.java
deleted file mode 100644
index 3a85a5c..0000000
--- a/app/src/main/java/com/cangwang/modulebus/ModuleExampleFragment.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.cangwang.modulebus;
-
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.util.ArrayMap;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.cangwang.core.cwmodule.ModuleManageFragment;
-import com.cangwang.core.cwmodule.ModuleManagerView;
-
-import java.util.ArrayList;
-
-/**
- * Created by zjl on 2017/1/3.
- */
-
-public class ModuleExampleFragment extends ModuleManageFragment {
-
- private ModuleManagerView moduleManagerView;
-
- @Override
- public int getContentViewId() {
- return R.layout.fragment_module;
- }
-
- @Override
- public ArrayMap> moduleConfig() {
- ArrayMap> map = new ArrayMap<>();
- map.put(PageConfig.MODULE_PAGE_NAME,new ArrayList(){{add(R.id.page_name);}});
- map.put(PageConfig.MODULE_BODY_BT_NAME,new ArrayList(){{add(R.id.page_bodyT);add(R.id.page_bodyB);}});
- return map;
- }
-
- @Nullable
- @Override
- public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- View view = super.onCreateView(inflater, container, savedInstanceState);
- moduleManagerView = new ModuleManagerView(getActivity(),savedInstanceState,view.findViewById(R.id.page_view)) {
- @Override
- public ArrayMap> moduleConfig() {
- ArrayMap> map = new ArrayMap<>();
- map.put(PageConfig.MODULE_VIEW_PAGE_NAME,new ArrayList(){{add(R.id.page_view);}});
- return map;
- }
- };
- return view;
- }
-
- @Override
- public void onStop() {
- super.onStop();
- if (moduleManagerView !=null)
- moduleManagerView.onStop();
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if (moduleManagerView !=null)
- moduleManagerView.onPause();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (moduleManagerView !=null)
- moduleManagerView.onResume();
- }
-
-// @Override
-// public void onDestroy() {
-// if (moduleManagerView !=null)
-// moduleManagerView.onDestroy();
-// super.onDestroy();
-// }
-}
diff --git a/app/src/main/java/com/cangwang/modulebus/ModuleMainActivity.java b/app/src/main/java/com/cangwang/modulebus/ModuleMainActivity.java
deleted file mode 100644
index d624a8b..0000000
--- a/app/src/main/java/com/cangwang/modulebus/ModuleMainActivity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.cangwang.modulebus;
-
-import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v4.util.ArrayMap;
-
-import com.cangwang.core.cwmodule.ModuleManageActivity;
-
-import java.util.ArrayList;
-
-/**
- * Created by air on 2016/12/28.
- */
-
-public class ModuleMainActivity extends ModuleManageActivity{
-
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-
- @Override
- public int getContentViewId() {
- return R.layout.activity_main_module;
- }
-
-
- @Override
- public ArrayMap> 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);}});
- return map;
- }
-}
diff --git a/app/src/main/res/layout/activity_start.xml b/app/src/main/res/layout/activity_start.xml
index 5fc839c..907f839 100644
--- a/app/src/main/res/layout/activity_start.xml
+++ b/app/src/main/res/layout/activity_start.xml
@@ -4,6 +4,6 @@
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.cangwang.modulebus.AdaviceActivity">
+ tools:context="com.cangwang.modulebus.AdviceActivity">
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..7434342 100644
--- a/b/b.iml
+++ b/b/b.iml
@@ -9,7 +9,6 @@
-
@@ -20,11 +19,11 @@
-
+
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,85 +61,67 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/b/build.gradle b/b/build.gradle
index 28967c3..ae3f409 100644
--- a/b/build.gradle
+++ b/b/build.gradle
@@ -24,6 +24,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
+ lintOptions {
+ abortOnError false
+ }
}
dependencies {
diff --git a/base/base.iml b/base/base.iml
index 5e06982..24d6ea9 100644
--- a/base/base.iml
+++ b/base/base.iml
@@ -9,7 +9,6 @@
-
@@ -20,11 +19,11 @@
-
+
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,83 +61,66 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/base/build.gradle b/base/build.gradle
index 546335b..9302b77 100644
--- a/base/build.gradle
+++ b/base/build.gradle
@@ -25,7 +25,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
-
+ lintOptions {
+ abortOnError false
+ }
}
dependencies {
@@ -35,5 +37,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/base/src/main/java/com/cangwang/base/util/ColorUtil.java b/base/src/main/java/com/cangwang/base/util/ColorUtil.java
new file mode 100644
index 0000000..920e137
--- /dev/null
+++ b/base/src/main/java/com/cangwang/base/util/ColorUtil.java
@@ -0,0 +1,25 @@
+package com.cangwang.base.util;
+
+import android.graphics.Color;
+
+import java.util.Random;
+
+/**颜色工具
+ * Created by cangwang on 2018/2/5.
+ */
+
+public class ColorUtil {
+
+ public static int getRandomColor(){
+ String r,g,b;
+ Random random = new Random();
+ r = Integer.toHexString(random.nextInt(256)).toUpperCase();
+ g = Integer.toHexString(random.nextInt(256)).toUpperCase();
+ b = Integer.toHexString(random.nextInt(256)).toUpperCase();
+
+ r = r.length()==1 ? "0" + r : r ;
+ g = g.length()==1 ? "0" + g : g ;
+ b = b.length()==1 ? "0" + b : b ;
+ return Color.parseColor("#" + r + g + b);
+ }
+}
diff --git a/bottom/.gitignore b/bottom/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/bottom/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/bottom/build.gradle b/bottom/build.gradle
new file mode 100644
index 0000000..6d3b4eb
--- /dev/null
+++ b/bottom/build.gradle
@@ -0,0 +1,35 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "25.0.0"
+
+ defaultConfig {
+ minSdkVersion 15
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+
+ // 资源前缀名,所有资源文件都必须加上这个前缀,以防止与其他插件的资源名字冲突
+ resourcePrefix "bottom_"
+
+ 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')
+ compile 'com.android.support:appcompat-v7:25.0.1'
+ compile project(':base')
+ annotationProcessor project(":compiler")
+
+}
diff --git a/bottom/proguard-rules.pro b/bottom/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/bottom/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/bottom/src/main/AndroidManifest.xml b/bottom/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..fd1296c
--- /dev/null
+++ b/bottom/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
diff --git a/bottom/src/main/java/com/cangwang/bottom/InputModule.java b/bottom/src/main/java/com/cangwang/bottom/InputModule.java
new file mode 100644
index 0000000..f302933
--- /dev/null
+++ b/bottom/src/main/java/com/cangwang/bottom/InputModule.java
@@ -0,0 +1,44 @@
+package com.cangwang.bottom;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.ImageView;
+
+import com.cangwang.annotation.ModuleUnit;
+import com.cangwang.core.cwmodule.CWModuleContext;
+import com.cangwang.core.cwmodule.ex.CWBasicExModule;
+import com.cangwang.enums.LayoutLevel;
+
+/**输入模块
+ * Created by cangwang on 2018/2/5.
+ */
+
+@ModuleUnit(templet = "top",layoutlevel = LayoutLevel.LOW)
+public class InputModule extends CWBasicExModule{
+
+ private View inputLayout;
+ private EditText inputText;
+ private ImageView inputBtn;
+
+ @Override
+ public boolean init(CWModuleContext moduleContext, Bundle extend) {
+ super.init(moduleContext, extend);
+ initView();
+ return true;
+ }
+
+
+ private void initView() {
+ inputLayout = LayoutInflater.from(context).inflate(R.layout.bottom_input_layout, parentPlugin, true);
+ inputText = (EditText) inputLayout.findViewById(R.id.bottom_input_txt);
+ inputBtn = (ImageView) inputLayout.findViewById(R.id.bottom_input_btn);
+ inputBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+// if ()
+ }
+ });
+ }
+}
diff --git a/bottom/src/main/res/layout/bottom_input_layout.xml b/bottom/src/main/res/layout/bottom_input_layout.xml
new file mode 100644
index 0000000..38f098c
--- /dev/null
+++ b/bottom/src/main/res/layout/bottom_input_layout.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
diff --git a/bottom/src/main/res/values/strings.xml b/bottom/src/main/res/values/strings.xml
new file mode 100644
index 0000000..08cbc74
--- /dev/null
+++ b/bottom/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ bottom
+
diff --git a/build.gradle b/build.gradle
index 53f4fad..337677a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,23 +1,47 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:2.2.1'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- }
-}
-
-allprojects {
- repositories {
- jcenter()
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.3"
+ classpath 'cz.malohlava:visteg:1.0.3'
+// classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
+// NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+ apply plugin: "com.dorongold.task-tree"
+ apply plugin: 'cz.malohlava.visteg'
+// plugins {
+// id 'cz.malohlava.visteg' version '1.0.3'
+// }
+
+}
+
+visteg {
+ enabled = true
+ colouredNodes = true
+ colouredEdges = true
+ destination = 'build/reports/visteg.dot'
+ exporter = 'dot'
+ colorscheme = 'spectral11'
+ nodeShape = 'box'
+ startNodeShape = 'hexagon'
+ endNodeShape = 'doubleoctagon'
+}
+
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/chat/.gitignore b/chat/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/chat/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/chat/build.gradle b/chat/build.gradle
new file mode 100644
index 0000000..23511b1
--- /dev/null
+++ b/chat/build.gradle
@@ -0,0 +1,35 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "25.0.0"
+
+ defaultConfig {
+ minSdkVersion 15
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+
+ // 资源前缀名,所有资源文件都必须加上这个前缀,以防止与其他插件的资源名字冲突
+ resourcePrefix "chat_"
+
+ 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')
+ compile 'com.android.support:appcompat-v7:25.0.1'
+ compile project(':base')
+ annotationProcessor project(":compiler")
+ compile 'com.android.support:recyclerview-v7:25.0.1'
+}
diff --git a/chat/proguard-rules.pro b/chat/proguard-rules.pro
new file mode 100644
index 0000000..f1b4245
--- /dev/null
+++ b/chat/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
diff --git a/chat/src/main/AndroidManifest.xml b/chat/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..3c0b498
--- /dev/null
+++ b/chat/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
diff --git a/chat/src/main/java/com/cangwang/chat/ChatImpl.java b/chat/src/main/java/com/cangwang/chat/ChatImpl.java
new file mode 100644
index 0000000..e38a0d7
--- /dev/null
+++ b/chat/src/main/java/com/cangwang/chat/ChatImpl.java
@@ -0,0 +1,8 @@
+package com.cangwang.chat;
+
+/**
+ * Created by cangwang on 2018/2/5.
+ */
+
+public class ChatImpl {
+}
diff --git a/chat/src/main/java/com/cangwang/chat/ChatModule.java b/chat/src/main/java/com/cangwang/chat/ChatModule.java
new file mode 100644
index 0000000..6965bcf
--- /dev/null
+++ b/chat/src/main/java/com/cangwang/chat/ChatModule.java
@@ -0,0 +1,97 @@
+package com.cangwang.chat;
+
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.cangwang.annotation.ModuleGroup;
+import com.cangwang.annotation.ModuleUnit;
+import com.cangwang.chat.bean.ChatMessage;
+import com.cangwang.chat.recycle.ChatAdapter;
+import com.cangwang.core.cwmodule.CWModuleContext;
+import com.cangwang.core.cwmodule.ex.CWBasicExModule;
+import com.cangwang.enums.LayoutLevel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 发言模块
+ * Created by cangwang on 2018/2/3.
+ */
+@ModuleGroup({
+ @ModuleUnit(templet = "top",layoutlevel = LayoutLevel.LOW),
+})
+public class ChatModule extends CWBasicExModule{
+ private View chatLayout;
+ private RecyclerView chatRecyle;
+ private ChatAdapter adapter;
+
+ private int i = 10;
+ private boolean isScolling =false;
+
+ @Override
+ public boolean init(CWModuleContext moduleContext, Bundle extend) {
+ super.init(moduleContext, extend);
+ initView();
+ initData();
+
+ return true;
+ }
+
+ private void initView(){
+ chatLayout = LayoutInflater.from(context).inflate(R.layout.chat_layout,parentPlugin,true);
+ chatRecyle = (RecyclerView) chatLayout.findViewById(R.id.chat_recyle);
+ adapter = new ChatAdapter(context);
+ chatRecyle.setLayoutManager(new LinearLayoutManager(context));
+ chatRecyle.addOnScrollListener(new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+ super.onScrollStateChanged(recyclerView, newState);
+ if (newState == RecyclerView.SCROLL_STATE_IDLE){
+ isScolling = true;
+ }else {
+ isScolling = false;
+ }
+ }
+
+ @Override
+ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+ super.onScrolled(recyclerView, dx, dy);
+ }
+ });
+ chatRecyle.setAdapter(adapter);
+ }
+
+ private void initData(){
+ List list =new ArrayList<>();
+ for (int i=0;i<10;i++){
+ ChatMessage m = new ChatMessage("cangwang","abc "+i);
+ list.add(m);
+ }
+ adapter.addMsgList(list);
+ chatRecyle.smoothScrollToPosition(10);
+ handler.post(runChat);
+ }
+
+ public Runnable runChat = new Runnable() {
+ @Override
+ public void run() {
+ adapter.addMsg(new ChatMessage("cangwang","efg"+ (i++)));
+ if (isScolling)
+ chatRecyle.smoothScrollToPosition(i-1);
+ handler.postDelayed(runChat,1000);
+ }
+ };
+
+
+ @Override
+ public void onDestroy() {
+ handler.removeCallbacks(runChat);
+ super.onDestroy();
+ }
+}
diff --git a/chat/src/main/java/com/cangwang/chat/bean/ChatMessage.java b/chat/src/main/java/com/cangwang/chat/bean/ChatMessage.java
new file mode 100644
index 0000000..62d4a9e
--- /dev/null
+++ b/chat/src/main/java/com/cangwang/chat/bean/ChatMessage.java
@@ -0,0 +1,19 @@
+package com.cangwang.chat.bean;
+
+import com.cangwang.base.util.ColorUtil;
+
+/**发言条目
+ * Created by cangwang on 2018/2/5.
+ */
+
+public class ChatMessage {
+ public String user;
+ public String text;
+ public int color;
+
+ public ChatMessage(String user,String text){
+ this.user = user;
+ this.text = text;
+ color = ColorUtil.getRandomColor();
+ }
+}
diff --git a/chat/src/main/java/com/cangwang/chat/recycle/ChatAdapter.java b/chat/src/main/java/com/cangwang/chat/recycle/ChatAdapter.java
new file mode 100644
index 0000000..d685734
--- /dev/null
+++ b/chat/src/main/java/com/cangwang/chat/recycle/ChatAdapter.java
@@ -0,0 +1,70 @@
+package com.cangwang.chat.recycle;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import com.cangwang.chat.R;
+import com.cangwang.chat.bean.ChatMessage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**发言适配器
+ * Created by cangwang on 2018/2/5.
+ */
+
+public class ChatAdapter extends RecyclerView.Adapter{
+
+ private List list= new ArrayList<>();
+ private Context context;
+
+ public ChatAdapter(Context context){
+ this.context = context;
+ }
+
+ public void addMsg(ChatMessage message){
+ if (message!=null) {
+ list.add(message);
+ notifyDataSetChanged();
+ }
+
+ }
+
+ public void addMsgList(List list){
+ this.list.addAll(list);
+ notifyDataSetChanged();
+ }
+
+ @Override
+ public ChatHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.chat_item,parent,false);
+ return new ChatHolder(view);
+ }
+
+
+
+ @Override
+ public void onBindViewHolder(ChatHolder holder, int position) {
+ ChatMessage message = list.get(position);
+ holder.chatText.setText(message.text);
+ holder.chatText.setTextColor(message.color);
+ }
+
+ @Override
+ public int getItemCount() {
+ return list.size();
+ }
+
+ public class ChatHolder extends RecyclerView.ViewHolder{
+ TextView chatText;
+
+ public ChatHolder(View itemView){
+ super(itemView);
+ chatText= (TextView)itemView.findViewById(R.id.chat_item);
+ }
+ }
+}
diff --git a/chat/src/main/res/drawable/chat_item_coner.xml b/chat/src/main/res/drawable/chat_item_coner.xml
new file mode 100644
index 0000000..ac394e1
--- /dev/null
+++ b/chat/src/main/res/drawable/chat_item_coner.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/chat/src/main/res/layout/chat_item.xml b/chat/src/main/res/layout/chat_item.xml
new file mode 100644
index 0000000..4fc80fb
--- /dev/null
+++ b/chat/src/main/res/layout/chat_item.xml
@@ -0,0 +1,11 @@
+
+
diff --git a/chat/src/main/res/layout/chat_layout.xml b/chat/src/main/res/layout/chat_layout.xml
new file mode 100644
index 0000000..8d13228
--- /dev/null
+++ b/chat/src/main/res/layout/chat_layout.xml
@@ -0,0 +1,15 @@
+
+
+
+
diff --git a/chat/src/main/res/values/strings.xml b/chat/src/main/res/values/strings.xml
new file mode 100644
index 0000000..1afbf05
--- /dev/null
+++ b/chat/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ chat
+
diff --git a/common_config.gradle b/common_config.gradle
index b3fee13..cdd6229 100644
--- a/common_config.gradle
+++ b/common_config.gradle
@@ -1,15 +1,15 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-project.ext {
- compileSdkVersion = 25
- buildToolsVersion = "24.0.2"
- minSdkVersion = 15
- targetSdkVersion = 25
- applicationId = "com.cangwang.modulebus"
-
- isDebug = false;
- isLib = false;
-
- //混淆
-// minifyEnable = true
-// shrinkResEnable = minifyEnable
-}
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+project.ext {
+ compileSdkVersion = 25
+ buildToolsVersion = "25.0.2"
+ minSdkVersion = 15
+ targetSdkVersion = 25
+ applicationId = "com.cangwang.modulebus"
+
+ isDebug = false;
+ isLib = false;
+
+ //混淆
+// minifyEnable = true
+// shrinkResEnable = minifyEnable
+}
diff --git a/compiler/.gitignore b/compiler/.gitignore
new file mode 100644
index 0000000..3543521
--- /dev/null
+++ b/compiler/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/compiler/build.gradle b/compiler/build.gradle
new file mode 100644
index 0000000..7b7cbdf
--- /dev/null
+++ b/compiler/build.gradle
@@ -0,0 +1,18 @@
+apply plugin: 'java'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.google.auto.service:auto-service:1.0-rc2'
+ compile 'com.squareup:javapoet:1.7.0'
+ compile project(':annotation')
+ compile 'org.apache.commons:commons-lang3:3.4'
+ compile 'org.apache.commons:commons-collections4:4.1'
+}
+
+sourceCompatibility = "1.7"
+targetCompatibility = "1.7"
+
+tasks.withType(JavaCompile) {
+ options.encoding = "UTF-8"
+}
+
diff --git a/compiler/src/main/java/com/cangwang/process/ModuleGroupProcessor.java b/compiler/src/main/java/com/cangwang/process/ModuleGroupProcessor.java
new file mode 100644
index 0000000..a87b8de
--- /dev/null
+++ b/compiler/src/main/java/com/cangwang/process/ModuleGroupProcessor.java
@@ -0,0 +1,103 @@
+package com.cangwang.process;
+
+import com.cangwang.annotation.ModuleGroup;
+import com.cangwang.annotation.ModuleUnit;
+import com.cangwang.model.ModuleMeta;
+import com.cangwang.utils.Logger;
+import com.cangwang.utils.ModuleUtil;
+import com.squareup.javapoet.ClassName;
+import com.squareup.javapoet.JavaFile;
+import com.squareup.javapoet.MethodSpec;
+import com.squareup.javapoet.ParameterSpec;
+import com.squareup.javapoet.ParameterizedTypeName;
+import com.squareup.javapoet.TypeSpec;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.processing.Filer;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+
+public class ModuleGroupProcessor {
+
+ public static void parseModulesGroup(Set extends Element> modulesElements, Logger logger, Filer mFiler, Elements elements) throws IOException{
+ if (CollectionUtils.isNotEmpty(modulesElements)) {
+ logger.info(">>> Found moduleGroup, size is " + modulesElements.size() + " <<<");
+ for (Element element:modulesElements){
+ if (element!=null){
+ //遍历moduleGroup
+ ModuleGroup group = element.getAnnotation(ModuleGroup.class);
+ if (group!=null){
+ ModuleUnit[] units = group.value();
+ //解析ModuleUnit数据,并生成IModuleUnit文件
+ parseModules(units,element,logger,mFiler,elements);
+ }
+ }
+ }
+ }
+ }
+
+ public static void parseModules(ModuleUnit[] modulesElements,Element element,Logger logger,Filer mFiler,Elements elements) throws IOException {
+ if (modulesElements.length > 0){
+ logger.info(">>> Found moduleUnit, size is " + modulesElements.length + " <<<");
+
+ //ModuleMeta类
+ ClassName moduleMetaCn = ClassName.get(ModuleMeta.class);
+
+ ParameterizedTypeName inputMapTypeOfGroup = ParameterizedTypeName.get(
+ ClassName.get(List.class),
+ ClassName.get(ModuleMeta.class)
+ );
+
+ //groups参数
+ ParameterSpec groupParamSpec = ParameterSpec.builder(inputMapTypeOfGroup,"metaSet").build();
+
+ //添加loadInto方法
+ MethodSpec.Builder loadIntoMethodOfRootBuilder = MethodSpec.methodBuilder(ModuleUtil.METHOD_LOAD_INTO)
+ .returns(void.class)
+ .addAnnotation(Override.class)
+ .addModifiers(Modifier.PUBLIC)
+ .addParameter(groupParamSpec);
+
+ ClassName name = ClassName.get(((TypeElement)element));
+ String address = name.packageName()+"."+name.simpleName(); //真实模块入口地址 包名+类名
+ for (int i = 0;i groupMap = new HashMap<>();
+ groupMap.put(element.getSimpleName().toString(),moduleMeta);
+
+ String[] nameZone = ModuleUtil.splitDot(moduleMeta.moduleName);
+ moduleMeta.title = !moduleMeta.title.equals("CangWang") ? moduleMeta.title:nameZone[ nameZone.length-1];
+
+ loadIntoMethodOfRootBuilder.addStatement("metaSet.add(new $T($S,$S,$S,$L,$L))",
+ moduleMetaCn,
+ moduleMeta.templet,
+ moduleMeta.moduleName,
+ moduleMeta.title,
+ moduleMeta.layoutlevel.getValue(),
+ moduleMeta.extralevel
+ );
+ logger.info(">>> build moduleUnit,moduleMeta = " + moduleMeta.toString() + " <<<");
+ }
+
+ //构造java文件
+ JavaFile.builder(ModuleUtil.FACADE_PACKAGE,
+ TypeSpec.classBuilder(ModuleUtil.NAME_OF_MODULEUNIT+name.simpleName())
+ .addJavadoc(ModuleUtil.WARNING_TIPS)
+ .addSuperinterface(ClassName.get(elements.getTypeElement(ModuleUtil.IMODULE_UNIT)))
+ .addModifiers(Modifier.PUBLIC)
+ .addMethod(loadIntoMethodOfRootBuilder.build())
+ .build()
+ ).build().writeTo(mFiler);
+ }
+ }
+}
diff --git a/compiler/src/main/java/com/cangwang/process/ModuleProcessor.java b/compiler/src/main/java/com/cangwang/process/ModuleProcessor.java
new file mode 100644
index 0000000..c80bb91
--- /dev/null
+++ b/compiler/src/main/java/com/cangwang/process/ModuleProcessor.java
@@ -0,0 +1,77 @@
+package com.cangwang.process;
+
+import com.cangwang.annotation.ModuleGroup;
+import com.cangwang.annotation.ModuleUnit;
+import com.cangwang.model.ModuleMeta;
+import com.cangwang.utils.Logger;
+import com.google.auto.service.AutoService;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+import javax.annotation.processing.ProcessingEnvironment;
+import javax.annotation.processing.Processor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+
+/**
+ * Created by cangwang on 2017/12/6.
+ */
+@AutoService(Processor.class)
+public class ModuleProcessor extends AbstractProcessor {
+ private Filer mFiler; // File util, write class file into disk.
+ private Logger logger;
+ private Types types;
+ private Elements elements;
+
+ @Override
+ public synchronized void init(ProcessingEnvironment processingEnvironment) {
+ super.init(processingEnvironment);
+ mFiler = processingEnv.getFiler(); // Generate class.
+ logger = new Logger(processingEnv.getMessager()); // Package the log utils.
+ types = processingEnv.getTypeUtils(); // Get type utils.
+ elements = processingEnv.getElementUtils(); // Get class meta.
+ System.out.println("------------------------------");
+ System.out.println("ModuleProcess init");
+ }
+
+ @Override
+ public Set getSupportedAnnotationTypes() {
+ Set annotations = new LinkedHashSet<>();
+ annotations.add(ModuleUnit.class.getCanonicalName());
+ annotations.add(ModuleGroup.class.getCanonicalName());
+ return annotations;
+ }
+
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latestSupported();
+ }
+
+ @Override
+ public boolean process(Set extends TypeElement> set, RoundEnvironment roundEnvironment) {
+ if(CollectionUtils.isNotEmpty(set)){
+ Set extends Element> moduleUnitElements = roundEnvironment.getElementsAnnotatedWith(ModuleUnit.class);
+ Set extends Element> moduleGroupElements = roundEnvironment.getElementsAnnotatedWith(ModuleGroup.class);
+ try {
+ logger.info(">>> Found moduleUnit, start... <<<");
+ ModuleUnitProcessor.parseModules(moduleUnitElements,logger,mFiler,elements);
+ logger.info(">>> Found moduleGroup, start... <<<");
+ ModuleGroupProcessor.parseModulesGroup(moduleGroupElements,logger,mFiler,elements);
+ } catch (Exception e) {
+ logger.error(e);
+ }
+ }
+ return true;
+ }
+}
diff --git a/compiler/src/main/java/com/cangwang/process/ModuleUnitProcessor.java b/compiler/src/main/java/com/cangwang/process/ModuleUnitProcessor.java
new file mode 100644
index 0000000..9bf2a88
--- /dev/null
+++ b/compiler/src/main/java/com/cangwang/process/ModuleUnitProcessor.java
@@ -0,0 +1,96 @@
+package com.cangwang.process;
+
+import com.cangwang.annotation.ModuleUnit;
+import com.cangwang.model.ModuleMeta;
+import com.cangwang.utils.Logger;
+import com.cangwang.utils.ModuleUtil;
+import com.squareup.javapoet.ClassName;
+import com.squareup.javapoet.JavaFile;
+import com.squareup.javapoet.MethodSpec;
+import com.squareup.javapoet.ParameterSpec;
+import com.squareup.javapoet.ParameterizedTypeName;
+import com.squareup.javapoet.TypeSpec;
+
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.processing.Filer;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+
+import javax.lang.model.util.Elements;
+
+/**
+ * 注解
+ * Created by cangwang on 2017/8/30.
+ */
+public class ModuleUnitProcessor {
+
+ public static void parseModules(Set extends Element> modulesElements,Logger logger,Filer mFiler,Elements elements) throws IOException {
+ if (CollectionUtils.isNotEmpty(modulesElements)){
+ logger.info(">>> Found moduleUnit, size is " + modulesElements.size() + " <<<");
+
+ //ModuleMeta类
+ ClassName moduleMetaCn = ClassName.get(ModuleMeta.class);
+
+ ParameterizedTypeName inputMapTypeOfGroup = ParameterizedTypeName.get(
+ ClassName.get(List.class),
+ ClassName.get(ModuleMeta.class)
+ );
+
+ //groups参数
+ ParameterSpec groupParamSpec = ParameterSpec.builder(inputMapTypeOfGroup,"metaSet").build();
+
+ //添加loadInto方法
+ MethodSpec.Builder loadIntoMethodOfRootBuilder = MethodSpec.methodBuilder(ModuleUtil.METHOD_LOAD_INTO)
+ .returns(void.class)
+ .addAnnotation(Override.class)
+ .addModifiers(Modifier.PUBLIC)
+ .addParameter(groupParamSpec);
+
+ for (Element element:modulesElements){
+ ModuleUnit moduleUnit=element.getAnnotation(ModuleUnit.class);
+ ClassName name = ClassName.get(((TypeElement)element));
+ String address = name.packageName()+"."+name.simpleName(); //真实模块入口地址 包名+类名
+ ModuleMeta moduleMeta= new ModuleMeta(moduleUnit,address);
+ Map groupMap = new HashMap<>();
+ groupMap.put(element.getSimpleName().toString(),moduleMeta);
+
+ String[] nameZone = ModuleUtil.splitDot(moduleMeta.moduleName);
+ moduleMeta.title = !moduleMeta.title.equals("CangWang") ? moduleMeta.title:nameZone[ nameZone.length-1];
+
+ String[] templets = ModuleUtil.split(moduleMeta.templet);
+ for (String templet:templets) {
+ loadIntoMethodOfRootBuilder.addStatement("metaSet.add(new $T($S,$S,$S,$L,$L))",
+ moduleMetaCn,
+ templet,
+ moduleMeta.moduleName,
+ moduleMeta.title,
+ moduleMeta.layoutlevel.getValue(),
+ moduleMeta.extralevel
+ );
+ }
+
+ logger.info(">>> build moduleUnit,moduleMeta = " + moduleMeta.toString() + " <<<");
+
+ //构造java文件
+ JavaFile.builder(ModuleUtil.FACADE_PACKAGE,
+ TypeSpec.classBuilder(ModuleUtil.NAME_OF_MODULEUNIT+name.simpleName())
+ .addJavadoc(ModuleUtil.WARNING_TIPS)
+ .addSuperinterface(ClassName.get(elements.getTypeElement(ModuleUtil.IMODULE_UNIT)))
+ .addModifiers(Modifier.PUBLIC)
+ .addMethod(loadIntoMethodOfRootBuilder.build())
+ .build()
+ ).build().writeTo(mFiler);
+ }
+ }
+ }
+
+}
diff --git a/compiler/src/main/java/com/cangwang/utils/Logger.java b/compiler/src/main/java/com/cangwang/utils/Logger.java
new file mode 100644
index 0000000..2aa11b9
--- /dev/null
+++ b/compiler/src/main/java/com/cangwang/utils/Logger.java
@@ -0,0 +1,56 @@
+package com.cangwang.utils;
+
+import org.apache.commons.lang3.StringUtils;
+
+import javax.annotation.processing.Messager;
+import javax.tools.Diagnostic;
+
+/**
+ *
+ * Created by cangwang on 2017/8/30.
+ */
+public class Logger {
+ public static final String PROJECT = "ModuleBus";
+ static final String PREFIX_OF_LOGGER = PROJECT + "::Compiler ";
+ private Messager msg;
+
+ public Logger(Messager messager) {
+ msg = messager;
+ }
+
+ /**
+ * Print info log.
+ */
+ public void info(CharSequence info) {
+ if (StringUtils.isNotEmpty(info)) {
+ msg.printMessage(Diagnostic.Kind.NOTE, PREFIX_OF_LOGGER + info);
+ }
+ }
+
+ public void error(CharSequence error) {
+ if (StringUtils.isNotEmpty(error)) {
+ msg.printMessage(Diagnostic.Kind.ERROR, PREFIX_OF_LOGGER + "An exception is encountered, [" + error + "]");
+ }
+ }
+
+ public void error(Throwable error) {
+ if (null != error) {
+ msg.printMessage(Diagnostic.Kind.ERROR, PREFIX_OF_LOGGER + "An exception is encountered, [" + error.getMessage() + "]" + "\n" + formatStackTrace(error.getStackTrace()));
+ }
+ }
+
+ public void warning(CharSequence warning) {
+ if (StringUtils.isNotEmpty(warning)) {
+ msg.printMessage(Diagnostic.Kind.WARNING, PREFIX_OF_LOGGER + warning);
+ }
+ }
+
+ private String formatStackTrace(StackTraceElement[] stackTrace) {
+ StringBuilder sb = new StringBuilder();
+ for (StackTraceElement element : stackTrace) {
+ sb.append(" at ").append(element.toString());
+ sb.append("\n");
+ }
+ return sb.toString();
+ }
+}
diff --git a/compiler/src/main/java/com/cangwang/utils/ModuleUtil.java b/compiler/src/main/java/com/cangwang/utils/ModuleUtil.java
new file mode 100644
index 0000000..979a737
--- /dev/null
+++ b/compiler/src/main/java/com/cangwang/utils/ModuleUtil.java
@@ -0,0 +1,31 @@
+package com.cangwang.utils;
+
+public class ModuleUtil {
+
+ public static final String PROJECT = "ModuleBus";
+ public static final String MODULE_UNIT = "ModuleUnit";
+ public static final String SEPARATOR = "$$";
+
+ public static final String FACADE_PACKAGE = "com.cangwang.core";
+ public static final String MODULE_ANNOTATION = "com.cangwang.annotation";
+ private static final String TEMPLATE_PACKAGE = ".template";
+ public static final String NAME_OF_MODULEGROUP = PROJECT + SEPARATOR + "Group" + SEPARATOR;
+ public static final String WARNING_TIPS = "DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY MODULEBUS.";
+
+
+ public static final String IMODULE_GROUP = FACADE_PACKAGE + TEMPLATE_PACKAGE + ".IModuleGroup";
+ public static final String IMODULE_UNIT = FACADE_PACKAGE + TEMPLATE_PACKAGE + ".IModuleUnit";
+ public static final String METHOD_LOAD_INTO = "loadInto";
+
+ public static final String NAME_OF_MODULEUNIT = MODULE_UNIT + SEPARATOR;
+
+ public static final String ANNOTATION_TYPE_MODULEUNIT = MODULE_ANNOTATION + "ModuleUnit";
+
+ public static String[] splitDot(String groupName){
+ return groupName.split("\\.");
+ }
+
+ public static String[] split(String groupName){
+ return groupName.split(",");
+ }
+}
diff --git a/compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor b/compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor
new file mode 100644
index 0000000..0672a38
--- /dev/null
+++ b/compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor
@@ -0,0 +1 @@
+com.cangwang.process.ModuleProcessor
\ No newline at end of file
diff --git a/core/build.gradle b/core/build.gradle
index 0985154..0d4a081 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -1,40 +1,71 @@
-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"
+
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+repositories{
+ flatDir{
+ dirs 'libs'
+ }
+}
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ provided 'com.android.support:appcompat-v7:23.+'
+// provided 'io.reactivex.rxjava2:rxjava:2.+'
+// provided 'io.reactivex.rxjava2:rxandroid:+'
+ compile project(':annotation')
+ annotationProcessor project(":compiler")
+}
+
+task clearJar(type: Delete) {
+ delete 'libs/modulebus.jar' //sdk是jar包的名字,随便命名
+}
+
+task makeJar(type:org.gradle.api.tasks.bundling.Jar) {
+ //指定生成的jar名
+ baseName 'modulebus'
+ //从哪里打包class文件
+ from('build/intermediates/classes/debug/')
+ //打包到jar后的目录结构
+ into('build/outputs/')
+ //去掉不需要打包的目录和文件
+ exclude('test/','BuildConfig.class','R.class')
+ //去掉R开头的文件
+ exclude{
+ it.name.startsWith('R');
+ }
+}
+
+makeJar.dependsOn(clearJar, build)
+
+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..dd17356 100644
--- a/core/core.iml
+++ b/core/core.iml
@@ -9,7 +9,6 @@
-
@@ -20,11 +19,11 @@
-
+
-
+
@@ -48,7 +47,6 @@
-
@@ -56,7 +54,6 @@
-
@@ -64,82 +61,49 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/java/com/cangwang/core/IBaseClient.java b/core/src/main/java/com/cangwang/core/IBaseClient.java
index db7e5bf..494546c 100644
--- a/core/src/main/java/com/cangwang/core/IBaseClient.java
+++ b/core/src/main/java/com/cangwang/core/IBaseClient.java
@@ -1,8 +1,7 @@
-package com.cangwang.core;
-
-/**
- * Created by zjl on 16/11/18.
- */
-
-public class IBaseClient {
-}
+package com.cangwang.core;
+
+/**
+ * Created by zjl on 16/11/18.
+ */
+public class IBaseClient {
+}
diff --git a/core/src/main/java/com/cangwang/core/ModuleBus.java b/core/src/main/java/com/cangwang/core/ModuleBus.java
index 5e4d9a0..83c1a36 100644
--- a/core/src/main/java/com/cangwang/core/ModuleBus.java
+++ b/core/src/main/java/com/cangwang/core/ModuleBus.java
@@ -1,268 +1,283 @@
-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