├── .gitignore ├── README.md ├── basemodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── basemodule │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wustor │ │ │ └── basemodule │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── CommonUtils.java │ │ │ ├── EmptyUtils.java │ │ │ └── ModuleApplication.java │ └── res │ │ ├── drawable │ │ ├── selector_message.xml │ │ ├── selector_mine.xml │ │ ├── selector_shop_cart.xml │ │ ├── selector_sort.xml │ │ └── selector_text_color_black.xml │ │ ├── layout │ │ ├── bottom.xml │ │ ├── layout_common.xml │ │ └── widget_toolbar.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ ├── arrow_back.png │ │ ├── ic_launcher.png │ │ ├── iv_find_checked.png │ │ ├── iv_find_unchecked.png │ │ ├── iv_message_checked.png │ │ ├── iv_message_unchecked.png │ │ ├── iv_mine_checked.png │ │ ├── iv_mine_unchecked.png │ │ ├── iv_shop_checked.png │ │ └── iv_shop_unchecked.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── arrays.xml │ │ ├── attr_header_progress.xml │ │ ├── attrs.xml │ │ ├── color.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── ids.xml │ │ ├── integers.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── wustor │ └── basemodule │ └── ExampleUnitTest.java ├── build.gradle ├── cartmodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── cartmodule │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wustor │ │ │ └── cartmodule │ │ │ ├── CartActivity.java │ │ │ ├── CartFragment.java │ │ │ ├── CartServiceImpl.java │ │ │ └── debug │ │ │ └── CartApplication.java │ └── res │ │ ├── layout │ │ ├── activity_cart.xml │ │ └── fragment_cart.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── wustor │ └── cartmodule │ └── ExampleUnitTest.java ├── component.jks ├── config.gradle ├── goodsmodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── goodsmodule │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wustor │ │ │ └── goodsmodule │ │ │ ├── GoodsDetailActivity.java │ │ │ ├── GoodsServiceImpl.java │ │ │ ├── HomeFragment.java │ │ │ ├── SortFragment.java │ │ │ └── debug │ │ │ └── GoodsApplication.java │ └── res │ │ ├── layout │ │ ├── activity_goods_detail.xml │ │ ├── fragment_home.xml │ │ └── fragment_sort.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── wustor │ └── goodsmodule │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── librarymodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── librarymodule │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── wustor │ └── librarymodule │ └── ExampleUnitTest.java ├── local.properties ├── mainModule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── androidcomponent │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wustor │ │ │ └── androidcomponent │ │ │ ├── AppServiceImpl.java │ │ │ ├── MainActivity.java │ │ │ ├── MainApplication.java │ │ │ └── debug │ │ │ ├── MainDebugActivity.java │ │ │ └── MainDebugApplication.java │ └── res │ │ ├── layout │ │ ├── activity_main.xml │ │ └── activity_main_debug.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── wustor │ └── androidcomponent │ └── ExampleUnitTest.java ├── ordermodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── ordermodule │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wustor │ │ │ └── ordermodule │ │ │ ├── OrderActivity.java │ │ │ ├── OrderFragment.java │ │ │ ├── OrderModuleService.java │ │ │ └── debug │ │ │ └── OrderApplication.java │ └── res │ │ ├── layout │ │ ├── activity_order.xml │ │ └── fragment_order.xml │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── wustor │ └── ordermodule │ └── ExampleUnitTest.java ├── routermodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wustor │ │ └── routermodule │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wustor │ │ │ └── routermodule │ │ │ ├── AppService.java │ │ │ ├── CartModuleService.java │ │ │ ├── GoodsModuleService.java │ │ │ ├── ModuleCall.java │ │ │ ├── OrderModuleService.java │ │ │ ├── ReflectUtils.java │ │ │ └── UserModuleService.java │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── com │ └── wustor │ └── routermodule │ └── ExampleUnitTest.java ├── settings.gradle └── usermodule ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src ├── androidTest └── java │ └── com │ └── wustor │ └── usermodule │ └── ExampleInstrumentedTest.java ├── main ├── AndroidManifest.xml ├── debug │ └── AndroidManifest.xml ├── java │ └── com │ │ └── wustor │ │ └── usermodule │ │ ├── MineFragment.java │ │ ├── UserActivity.java │ │ ├── UserServiceImpl.java │ │ └── debug │ │ └── UserApplication.java └── res │ ├── layout │ ├── activity_user.xml │ └── fragment_user.xml │ └── values │ └── strings.xml └── test └── java └── com └── wustor └── usermodule └── ExampleUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidComponent 2 | Androdid组件化 3 | 4 | ![Component](http://orbm62bsw.bkt.clouddn.com/Component.png) 5 | -------------------------------------------------------------------------------- /basemodule/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /basemodule/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | def cfg = rootProject.ext.android 4 | 5 | android { 6 | compileSdkVersion cfg.compileSdkVersion 7 | buildToolsVersion cfg.buildToolsVersion 8 | 9 | defaultConfig { 10 | minSdkVersion cfg.minSdkVersion 11 | targetSdkVersion cfg.targetSdkVersion 12 | versionCode cfg.versionCode//更新次数 13 | versionName cfg.versionName//版本号 14 | if (isDebug.toBoolean()) { 15 | //debug模式 16 | buildConfigField "String", "AlphaUrl", "\"${url["debug"]}\"" 17 | 18 | } else { 19 | //release模式 20 | buildConfigField "String", "AlphaUrl", "\"${url["release"]}\"" 21 | 22 | } 23 | 24 | 25 | } 26 | 27 | } 28 | 29 | dependencies { 30 | compile fileTree(include: ['*.jar'], dir: 'libs') 31 | testCompile 'junit:junit:4.12' 32 | compile project(':librarymodule') 33 | } 34 | -------------------------------------------------------------------------------- /basemodule/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/chmyy/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /basemodule/src/androidTest/java/com/wustor/basemodule/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.wustor.basemodule; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.wustor.basemodule.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /basemodule/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /basemodule/src/main/java/com/wustor/basemodule/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.wustor.basemodule; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | import android.widget.TextView; 9 | 10 | public abstract class BaseActivity extends AppCompatActivity { 11 | protected Toolbar mToolbar; 12 | protected TextView mTitle; 13 | protected Context mContext; 14 | 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | mContext = this; 19 | setContentView(getLayoutId()); 20 | initToolbar(); 21 | initView(); 22 | } 23 | 24 | protected abstract int getLayoutId(); 25 | 26 | protected abstract void initView(); 27 | 28 | 29 | protected void initToolbar() { 30 | mToolbar = findViewById(R.id.toolbar); 31 | mTitle = findViewById(R.id.tv_title); 32 | if (mToolbar != null) { 33 | if (mToolbar.getVisibility() == View.GONE) 34 | mToolbar.setVisibility(View.VISIBLE); 35 | mToolbar.setNavigationIcon(R.mipmap.arrow_back); 36 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View v) { 39 | onLeftClick(); 40 | } 41 | }); 42 | } 43 | 44 | } 45 | 46 | //点击事件 47 | private void onLeftClick() { 48 | finish(); 49 | 50 | } 51 | 52 | //设置标题 53 | protected void setTitle(String title) { 54 | mTitle.setText(title); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /basemodule/src/main/java/com/wustor/basemodule/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.wustor.basemodule; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | /** 12 | * author chmyy 13 | * created on 2018/1/22 14 | * email fat_chao@163.com. 15 | */ 16 | 17 | public abstract class BaseFragment extends Fragment { 18 | protected Context mContext; 19 | 20 | @Nullable 21 | @Override 22 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 23 | mContext = getActivity(); 24 | ViewGroup view = (ViewGroup) inflater.inflate(getLayoutId(), container, false); 25 | return initView(view); 26 | } 27 | 28 | protected abstract int getLayoutId(); 29 | 30 | protected abstract View initView(View parent); 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /basemodule/src/main/java/com/wustor/basemodule/CommonUtils.java: -------------------------------------------------------------------------------- 1 | package com.wustor.basemodule; 2 | 3 | import android.content.Context; 4 | import android.content.pm.ApplicationInfo; 5 | import android.content.pm.PackageManager; 6 | import android.os.Looper; 7 | import android.text.TextUtils; 8 | import android.view.Gravity; 9 | import android.widget.Toast; 10 | 11 | /** 12 | * author chmyy 13 | * created on 2018/1/21 14 | * email fat_chao@163.com. 15 | */ 16 | 17 | public class CommonUtils { 18 | 19 | 20 | public static boolean isDebug(Context context) { 21 | if (TextUtils.isEmpty(context.getPackageName())) 22 | return false; 23 | try { 24 | PackageManager pm = context.getPackageManager(); 25 | ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), 0); 26 | return ai != null && (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; 27 | } catch (PackageManager.NameNotFoundException e) { 28 | e.printStackTrace(); 29 | return false; 30 | } 31 | } 32 | 33 | //弹出消息 34 | public static void showToast(final Context context, final String msg) { 35 | if (EmptyUtils.isEmpty(msg) || EmptyUtils.isNull(context)) { 36 | return; 37 | } 38 | new Thread(new Runnable() { 39 | @Override 40 | public void run() { 41 | Looper.prepare(); 42 | Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT); 43 | toast.setGravity(Gravity.CENTER, 0, 0); 44 | toast.show(); 45 | Looper.loop(); 46 | } 47 | }).start(); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /basemodule/src/main/java/com/wustor/basemodule/EmptyUtils.java: -------------------------------------------------------------------------------- 1 | package com.wustor.basemodule; 2 | 3 | import android.text.TextUtils; 4 | 5 | 6 | public class EmptyUtils { 7 | public static boolean isEmpty(String target) { 8 | if (target != null && !TextUtils.isEmpty(target)) { 9 | return false; 10 | } else { 11 | return true; 12 | } 13 | } 14 | 15 | public static boolean isNotEmpty(String target) { 16 | if (target != null && !TextUtils.isEmpty(target)) { 17 | return true; 18 | } else { 19 | return false; 20 | } 21 | } 22 | 23 | public static boolean isNull(Object obj) { 24 | return null == obj; 25 | } 26 | 27 | public static String NullToEmpty(String obj) { 28 | if (isNull(obj)) 29 | return ""; 30 | else 31 | return obj; 32 | } 33 | 34 | 35 | public static String getNullString() { 36 | return "暂无"; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /basemodule/src/main/java/com/wustor/basemodule/ModuleApplication.java: -------------------------------------------------------------------------------- 1 | package com.wustor.basemodule; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import android.support.multidex.MultiDex; 6 | 7 | public class ModuleApplication extends Application { 8 | 9 | private static ModuleApplication instance; 10 | 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | 15 | 16 | } 17 | 18 | public static ModuleApplication getInstance() { 19 | return instance; 20 | } 21 | 22 | @Override 23 | protected void attachBaseContext(Context base) { 24 | super.attachBaseContext(base); 25 | // 65535 26 | MultiDex.install(this); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /basemodule/src/main/res/drawable/selector_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /basemodule/src/main/res/drawable/selector_mine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /basemodule/src/main/res/drawable/selector_shop_cart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /basemodule/src/main/res/drawable/selector_sort.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /basemodule/src/main/res/drawable/selector_text_color_black.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /basemodule/src/main/res/layout/bottom.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 8 | 9 | 14 | 15 | 22 | 23 | 36 | 37 | 49 | 50 | 62 | 63 | 64 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /basemodule/src/main/res/layout/layout_common.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 16 | 17 |