├── .gitignore
├── .idea
├── compiler.xml
├── jarRepositories.xml
└── misc.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── app
│ │ ├── ModularizationApp.java
│ │ └── SplashActivity.java
│ └── res
│ ├── layout
│ └── activity_splash.xml
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-v19
│ └── styles.xml
│ ├── values-v21
│ └── styles.xml
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── biz-module-main
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── biz
│ │ └── module
│ │ └── main
│ │ ├── Constants.java
│ │ ├── MainActivity.java
│ │ └── http
│ │ ├── ApiService.java
│ │ └── ApiServiceWrap.java
│ └── res
│ ├── layout
│ └── activity_main.xml
│ └── values
│ ├── dimens.xml
│ └── strings.xml
├── biz-module-newhouse
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── debug
│ └── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── biz
│ │ └── module
│ │ └── newhouse
│ │ ├── Constants.java
│ │ ├── MainActivity.java
│ │ ├── NewHouseProviderImpl.java
│ │ ├── http
│ │ ├── ApiService.java
│ │ └── ApiServiceWrap.java
│ │ └── model
│ │ └── GitHubUser.java
│ ├── release
│ └── AndroidManifest.xml
│ └── res
│ ├── layout
│ └── new_house_activity_main.xml
│ ├── mipmap-xxhdpi
│ └── new_house_ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── new_house_ic_launcher.png
│ ├── values-w820dp
│ └── dimens.xml
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── biz-module-renthouse
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── debug
│ └── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── biz
│ │ └── module
│ │ └── renthouse
│ │ ├── Constants.java
│ │ ├── MainActivity.java
│ │ ├── RentHouseProviderImpl.java
│ │ └── http
│ │ ├── ApiService.java
│ │ └── ApiServiceWrap.java
│ ├── release
│ └── AndroidManifest.xml
│ └── res
│ ├── layout
│ └── rent_house_activity_main.xml
│ ├── mipmap-xxhdpi
│ └── rent_house_ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── rent_house_ic_launcher.png
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── biz-module-secondhouse
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── debug
│ └── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── biz
│ │ └── module
│ │ └── secondhouse
│ │ ├── BlankFragment.java
│ │ ├── Constants.java
│ │ ├── MainActivity.java
│ │ ├── SecondHouseProviderImpl.java
│ │ └── http
│ │ ├── ApiService.java
│ │ └── ApiServiceWrap.java
│ ├── release
│ └── AndroidManifest.xml
│ └── res
│ ├── layout
│ ├── fragment_blank.xml
│ └── second_house_activity_main.xml
│ ├── mipmap-xxhdpi
│ └── second_house_ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── second_house_ic_launcher.png
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── biz-service-base
├── .gitignore
├── build.gradle
└── src
│ └── main
│ └── java
│ └── com
│ └── modularization
│ └── biz
│ └── service
│ └── base
│ ├── ErrorMessage.java
│ └── ResponseCallback.java
├── biz-service-newhouse
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── modularization
│ └── biz
│ └── service
│ └── newhouse
│ ├── NewHouseApiData.java
│ ├── NewHouseData.java
│ ├── NewHouseProvider.java
│ ├── NewHouseProviderHelper.java
│ └── NewHouseRouterTable.java
├── biz-service-renthouse
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── modularization
│ └── biz
│ └── service
│ └── renthouse
│ ├── RentHouseData.java
│ ├── RentHouseProvider.java
│ ├── RentHouseProviderHelper.java
│ └── RentHouseRouterTable.java
├── biz-service-secondhouse
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── modularization
│ └── biz
│ └── service
│ └── secondhouse
│ ├── SecondHouseData.java
│ ├── SecondHouseProvider.java
│ ├── SecondHouseProviderHelper.java
│ └── SecondHouseRouterTable.java
├── build.gradle
├── dependencies.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── lib-common
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── common
│ │ ├── base
│ │ ├── activity
│ │ │ └── BaseActivity.java
│ │ ├── adapter
│ │ │ └── BaseRecyclerViewAdapter.java
│ │ ├── fragment
│ │ │ └── BaseFragment.java
│ │ ├── presenter
│ │ │ └── BasePresenter.java
│ │ ├── util
│ │ │ ├── ActivityUtils.java
│ │ │ ├── DateConvertUtils.java
│ │ │ ├── NetworkUtils.java
│ │ │ └── lifecycle
│ │ │ │ ├── ActivityLifecycleEvent.java
│ │ │ │ └── FragmentLifecycleEvent.java
│ │ └── view
│ │ │ └── BaseView.java
│ │ └── model
│ │ └── HouseDetail.java
│ └── res
│ ├── layout
│ └── layout_app_bar.xml
│ └── values
│ ├── strings.xml
│ └── styles.xml
├── lib-data-local
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── modularization
│ │ └── data
│ │ └── local
│ │ ├── db
│ │ ├── BaseDatabaseHelper.java
│ │ └── UserDatabaseHelper.java
│ │ ├── entities
│ │ └── User.java
│ │ └── preferences
│ │ ├── AppSettings.java
│ │ ├── ConfigurationListener.java
│ │ └── Preferences.java
│ └── res
│ └── values
│ └── strings.xml
├── lib-data-net
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── modularization
│ └── data
│ └── net
│ ├── ApiClient.java
│ ├── ApiConstants.java
│ ├── SignInterceptor.java
│ ├── configuration
│ └── ApiConfiguration.java
│ ├── converter
│ ├── FastJsonConverterFactory.java
│ ├── FastJsonRequestBodyConverter.java
│ └── FastJsonResponseBodyConvert.java
│ └── service
│ └── ServiceWrap.java
├── lib-open-source
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── res
│ └── values
│ └── strings.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.aar
4 | *.ap_
5 | *.aab
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 | # Uncomment the following line in case you need and you don't have the release build type files in your app
18 | # release/
19 |
20 | # Gradle files
21 | .gradle/
22 | build/
23 |
24 | # Local configuration file (sdk path, etc)
25 | local.properties
26 |
27 | # Proguard folder generated by Eclipse
28 | proguard/
29 |
30 | # Log Files
31 | *.log
32 |
33 | # Android Studio Navigation editor temp files
34 | .navigation/
35 |
36 | # Android Studio captures folder
37 | captures/
38 |
39 | # IntelliJ
40 | *.iml
41 | .idea/
42 |
43 | # Keystore files
44 | # Uncomment the following lines if you do not want to check your keystore files in.
45 | #*.jks
46 | #*.keystore
47 |
48 | # External native build folder generated in Android Studio 2.2 and later
49 | .externalNativeBuild
50 | .cxx/
51 |
52 | # Google Services (e.g. APIs or Firebase)
53 | # google-services.json
54 |
55 | # Freeline
56 | freeline.py
57 | freeline/
58 | freeline_project_description.json
59 |
60 | # fastlane
61 | fastlane/report.xml
62 | fastlane/Preview.html
63 | fastlane/screenshots
64 | fastlane/test_output
65 | fastlane/readme.md
66 |
67 | # Version control
68 | vcs.xml
69 |
70 | # lint
71 | lint/intermediates/
72 | lint/generated/
73 | lint/outputs/
74 | lint/tmp/
75 | # lint/reports/
76 |
77 | # Android Profiling
78 | *.hprof
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Modularization Project
2 |
3 | > Android 模块化示例项目
4 |
5 | ## 模块化项目设计方案
6 |
7 | 推荐阅读:
8 |
9 | * [安居客 Android 项目架构演进](https://mp.weixin.qq.com/s?__biz=MzU4ODM2MjczNA==&mid=2247483731&idx=1&sn=76bd5612ba723171b6ebac69aaf039f8&chksm=fddca7d2caab2ec4eec8736cf4005615c401984e2218a0cfc71dddfe3a204495c4e8a7312b4a&scene=38#wechat_redirect)
10 | * [Android 模块化探索与实践](https://mp.weixin.qq.com/s?__biz=MzU4ODM2MjczNA==&mid=2247483732&idx=1&sn=b7ee1151b2c8ad2e997b8db39adf3267&chksm=fddca7d5caab2ec33905cc3350f31c0c98794774b0d04a01845565e3989b1f20205c7f432cb9&scene=38#wechat_redirect)
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.alibaba.arouter'
3 |
4 | android {
5 | compileSdkVersion 29
6 | buildToolsVersion '29.0.3'
7 | defaultConfig {
8 | applicationId "com.modularization.app"
9 | minSdkVersion 19
10 | targetSdkVersion 29
11 | versionCode 1
12 | versionName "1.0"
13 | multiDexEnabled true
14 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
15 |
16 | javaCompileOptions {
17 | annotationProcessorOptions {
18 | arguments = [AROUTER_MODULE_NAME: project.getName()]
19 | }
20 | }
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
27 | }
28 | }
29 |
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 |
35 | lintOptions {
36 | abortOnError false
37 | }
38 | }
39 |
40 | dependencies {
41 | implementation fileTree(include: ['*.jar'], dir: 'libs')
42 |
43 | implementation 'androidx.multidex:multidex:2.0.1'
44 | implementation 'androidx.appcompat:appcompat:1.2.0'
45 | implementation 'com.google.android.material:material:1.2.1'
46 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
47 |
48 | implementation project(':biz-module-main')
49 | implementation project(':biz-module-newhouse')
50 | implementation project(':biz-module-secondhouse')
51 | implementation project(':biz-module-renthouse')
52 |
53 | implementation project(':lib-common')
54 | implementation project(':lib-data-local')
55 | implementation project(':lib-data-net')
56 |
57 | implementation rootProject.ext.dependencies["butterknife"]
58 | annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
59 |
60 | implementation 'com.alibaba:arouter-api:1.5.1'
61 | annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
62 | }
63 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/baron/develop/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 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/modularization/app/ModularizationApp.java:
--------------------------------------------------------------------------------
1 | package com.modularization.app;
2 |
3 | import android.app.Application;
4 |
5 | import androidx.multidex.MultiDex;
6 |
7 | import com.alibaba.android.arouter.launcher.ARouter;
8 | import com.modularization.data.local.preferences.Preferences;
9 | import com.modularization.data.net.ApiClient;
10 |
11 | /**
12 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
13 | */
14 | public class ModularizationApp extends Application {
15 |
16 | @Override
17 | public void onCreate() {
18 | super.onCreate();
19 | MultiDex.install(this);
20 | ARouter.init(this);
21 | ApiClient.getInstance().init(null);
22 |
23 | //初始化SP配置
24 | Preferences.getInstance(this).loadDefaults();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/modularization/app/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.modularization.app;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 |
8 | import com.modularization.biz.module.main.MainActivity;
9 |
10 |
11 | /**
12 | * App闪屏页
13 | *
14 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
15 | */
16 | public class SplashActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_splash);
22 |
23 | startActivity(new Intent(this, MainActivity.class));
24 | finish();
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v19/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
8 | @android:color/transparent
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Modularization
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/biz-module-main/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/biz-module-main/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'com.jakewharton.butterknife'
4 | }
5 |
6 | android {
7 | compileSdkVersion 29
8 | buildToolsVersion "29.0.3"
9 |
10 | defaultConfig {
11 | minSdkVersion 19
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | consumerProguardFiles "consumer-rules.pro"
18 |
19 | javaCompileOptions {
20 | annotationProcessorOptions {
21 | arguments = [AROUTER_MODULE_NAME: project.getName()]
22 | }
23 | }
24 | }
25 |
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 |
33 | compileOptions {
34 | sourceCompatibility JavaVersion.VERSION_1_8
35 | targetCompatibility JavaVersion.VERSION_1_8
36 | }
37 | }
38 |
39 | dependencies {
40 |
41 | implementation 'androidx.appcompat:appcompat:1.2.0'
42 | implementation 'com.google.android.material:material:1.2.1'
43 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
44 |
45 | implementation project(':lib-common')
46 | implementation project(':lib-data-local')
47 | implementation project(':lib-data-net')
48 |
49 | implementation project(path: ':biz-service-newhouse')
50 | implementation project(path: ':biz-service-secondhouse')
51 | implementation project(path: ':biz-service-renthouse')
52 |
53 | implementation rootProject.ext.dependencies["butterknife"]
54 | annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
55 |
56 | implementation 'com.alibaba:arouter-api:1.5.1'
57 | annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
58 | }
--------------------------------------------------------------------------------
/biz-module-main/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-main/consumer-rules.pro
--------------------------------------------------------------------------------
/biz-module-main/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/biz-module-main/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/java/com/modularization/biz/module/main/Constants.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.main;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public final class Constants {
7 |
8 | public static final class Service {
9 | public static final String ID = "id_main";
10 | public static final String MODULE_NAME = "MainModule";
11 | public static final String HOST = "https://api.github.com/";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/java/com/modularization/biz/module/main/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.main;
2 |
3 | import android.os.Bundle;
4 | import android.widget.TextView;
5 |
6 | import androidx.fragment.app.Fragment;
7 |
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.modularization.biz.service.base.ResponseCallback;
10 | import com.modularization.biz.service.newhouse.NewHouseApiData;
11 | import com.modularization.biz.service.newhouse.NewHouseProviderHelper;
12 | import com.modularization.biz.service.newhouse.NewHouseRouterTable;
13 | import com.modularization.biz.service.renthouse.RentHouseData;
14 | import com.modularization.biz.service.renthouse.RentHouseProviderHelper;
15 | import com.modularization.biz.service.renthouse.RentHouseRouterTable;
16 | import com.modularization.common.base.activity.BaseActivity;
17 | import com.modularization.common.base.util.ActivityUtils;
18 | import com.modularization.common.model.HouseDetail;
19 | import com.modularization.biz.service.newhouse.NewHouseData;
20 | import com.modularization.biz.service.secondhouse.SecondHouseData;
21 | import com.modularization.biz.service.secondhouse.SecondHouseRouterTable;
22 | import com.modularization.biz.service.secondhouse.SecondHouseProviderHelper;
23 | import com.modularization.biz.service.base.ErrorMessage;
24 |
25 | import java.util.ArrayList;
26 |
27 | import butterknife.ButterKnife;
28 | import butterknife.OnClick;
29 | import butterknife.Unbinder;
30 | import rx.Subscription;
31 | import rx.subscriptions.CompositeSubscription;
32 |
33 | /**
34 | * App首页
35 | *
36 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
37 | */
38 | public class MainActivity extends BaseActivity {
39 |
40 | private CompositeSubscription subscriptions;
41 | private Unbinder unbinder;
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_main);
47 | unbinder = ButterKnife.bind(this);
48 |
49 | setSupportActionBar(findViewById(R.id.toolbar));
50 | if (getSupportActionBar() != null) {
51 | getSupportActionBar().setDisplayShowTitleEnabled(true);
52 | getSupportActionBar().setDisplayHomeAsUpEnabled(false);
53 | }
54 |
55 | subscriptions = new CompositeSubscription();
56 |
57 | TextView newHouseTextView = findViewById(R.id.new_house_text_view);
58 | NewHouseData newHouseData = NewHouseProviderHelper.getNewHouseProvider().fetchNewHouseData();
59 | newHouseTextView.setText(newHouseData.toString());
60 | Subscription subscription = NewHouseProviderHelper.getNewHouseProvider().callNewHouseApi(new ResponseCallback() {
61 | @Override
62 | public void onSuccess(NewHouseApiData data) {
63 | newHouseTextView.setText(String.format("%s\n\n%s", newHouseTextView.getText(), data.toString()));
64 | }
65 |
66 | @Override
67 | public void onFailed(ErrorMessage errorMsg) {
68 | newHouseTextView.setText(String.format("%s\n\n%s", newHouseTextView.getText(), errorMsg));
69 | }
70 | });
71 | subscriptions.add(subscription);
72 |
73 | SecondHouseData secondHouseData = SecondHouseProviderHelper.getSecondHouseProvider().fetchSecondHouseData();
74 | ((TextView) findViewById(R.id.second_house_text_view)).setText(secondHouseData.toString());
75 |
76 | RentHouseData rentHouseData = RentHouseProviderHelper.getRentHouseProvider().fetchRentHouseData();
77 | ((TextView) findViewById(R.id.rent_house_text_view)).setText(rentHouseData.toString());
78 |
79 | Fragment fragment = SecondHouseProviderHelper.getSecondHouseProvider().getFragment(SecondHouseRouterTable.PATH_FRAGMENT_BLANK);
80 | ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), fragment, R.id.fragment_container);
81 | }
82 |
83 | @OnClick(R2.id.btn_goto_new_house)
84 | void startNewHouseActivity() {
85 | ARouter.getInstance().build(NewHouseRouterTable.PATH_ACTIVITY_MAIN)
86 | .withString("cityId", "110")
87 | .withParcelable("houseDetail", new HouseDetail("10000", "潍坊新村", 66))
88 | .navigation();
89 | }
90 |
91 | @OnClick(R2.id.btn_goto_second_house)
92 | void startSecondHouseActivity() {
93 |
94 | ArrayList houseDetailList = new ArrayList<>();
95 | houseDetailList.add(new HouseDetail("10001", "潍坊一村", 88));
96 | houseDetailList.add(new HouseDetail("10002", "潍坊二村", 120));
97 | houseDetailList.add(new HouseDetail("10004", "潍坊三村", 86));
98 |
99 | ARouter.getInstance().build(SecondHouseRouterTable.PATH_ACTIVITY_MAIN)
100 | .withString("cityId", "111")
101 | .withParcelableArrayList("houseList", houseDetailList)
102 | .navigation();
103 | }
104 |
105 | @OnClick(R2.id.btn_goto_rent_house)
106 | void startRentHouseActivity() {
107 | ArrayList brokerIdList = new ArrayList<>();
108 | brokerIdList.add(20000);
109 | brokerIdList.add(20001);
110 | brokerIdList.add(20002);
111 | ARouter.getInstance().build(RentHouseRouterTable.PATH_ACTIVITY_MAIN)
112 | .withString("cityId", "112")
113 | .withIntegerArrayList("brokerIdList", brokerIdList)
114 | .navigation();
115 | }
116 |
117 | @Override
118 | protected void onDestroy() {
119 | super.onDestroy();
120 | if (unbinder != null)
121 | unbinder.unbind();
122 | if (subscriptions != null)
123 | subscriptions.unsubscribe();
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/java/com/modularization/biz/module/main/http/ApiService.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.main.http;
2 |
3 | /**
4 | * 定义main模块API接口
5 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
6 | * 2017/1/5
7 | */
8 | public interface ApiService {
9 | }
10 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/java/com/modularization/biz/module/main/http/ApiServiceWrap.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.main.http;
2 |
3 | import com.modularization.biz.module.main.Constants;
4 | import com.modularization.data.net.service.ServiceWrap;
5 |
6 | /**
7 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
8 | */
9 | public class ApiServiceWrap implements ServiceWrap {
10 |
11 | @Override
12 | public String getIdentify() {
13 | return Constants.Service.ID;
14 | }
15 |
16 | @Override
17 | public String getModuleName() {
18 | return Constants.Service.MODULE_NAME;
19 | }
20 |
21 | @Override
22 | public String getHost() {
23 | return Constants.Service.HOST;
24 | }
25 |
26 | @Override
27 | public Class getRealService() {
28 | return ApiService.class;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
25 |
26 |
30 |
31 |
36 |
37 |
44 |
45 |
53 |
54 |
62 |
63 |
64 |
72 |
73 |
78 |
79 |
87 |
88 |
93 |
94 |
102 |
103 |
111 |
112 |
117 |
118 |
119 |
120 |
121 |
122 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/biz-module-main/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/biz-module-newhouse/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/biz-module-newhouse/build.gradle:
--------------------------------------------------------------------------------
1 | if (isBuildModule.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | } else {
4 | apply plugin: 'com.android.library'
5 | }
6 | apply plugin: 'com.jakewharton.butterknife'
7 |
8 | android {
9 | compileSdkVersion 29
10 | buildToolsVersion '29.0.3'
11 |
12 | defaultConfig {
13 | minSdkVersion 19
14 | targetSdkVersion 29
15 | versionCode 1
16 | versionName "1.0"
17 | resourcePrefix "new_house_"
18 |
19 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
20 |
21 | javaCompileOptions {
22 | annotationProcessorOptions {
23 | arguments = [AROUTER_MODULE_NAME: project.getName()]
24 | }
25 | }
26 | }
27 |
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 |
35 | compileOptions {
36 | sourceCompatibility JavaVersion.VERSION_1_8
37 | targetCompatibility JavaVersion.VERSION_1_8
38 | }
39 |
40 | sourceSets {
41 | main {
42 | if (isBuildModule.toBoolean()) {
43 | manifest.srcFile 'src/main/debug/AndroidManifest.xml'
44 | } else {
45 | manifest.srcFile 'src/main/release/AndroidManifest.xml'
46 | }
47 | }
48 | }
49 | }
50 |
51 | dependencies {
52 | implementation fileTree(include: ['*.jar'], dir: 'libs')
53 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
54 |
55 | implementation project(path: ':lib-common')
56 | implementation project(path: ':lib-data-local')
57 | implementation project(path: ':lib-data-net')
58 |
59 | implementation project(path: ':biz-service-newhouse')
60 | implementation project(path: ':biz-service-secondhouse')
61 | implementation project(path: ':biz-service-renthouse')
62 |
63 | implementation 'com.alibaba:arouter-api:1.5.1'
64 | annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
65 |
66 | implementation rootProject.ext.dependencies["butterknife"]
67 | annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
68 | }
69 |
--------------------------------------------------------------------------------
/biz-module-newhouse/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/baron/develop/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 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/java/com/modularization/biz/module/newhouse/Constants.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.newhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public final class Constants {
7 |
8 | public static final class Service {
9 | public static final String ID = "id_newhouse";
10 | public static final String MODULE_NAME = "NewHouseModule";
11 | public static final String HOST = "https://api.github.com/";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/java/com/modularization/biz/module/newhouse/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.newhouse;
2 |
3 | import android.os.Bundle;
4 | import android.widget.TextView;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Autowired;
7 | import com.alibaba.android.arouter.facade.annotation.Route;
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.modularization.biz.service.renthouse.RentHouseRouterTable;
10 | import com.modularization.biz.service.newhouse.NewHouseRouterTable;
11 | import com.modularization.common.base.activity.BaseActivity;
12 | import com.modularization.common.model.HouseDetail;
13 |
14 | import java.util.ArrayList;
15 |
16 | import butterknife.ButterKnife;
17 | import butterknife.OnClick;
18 | import butterknife.Unbinder;
19 |
20 | @Route(path = NewHouseRouterTable.PATH_ACTIVITY_MAIN)
21 | public class MainActivity extends BaseActivity {
22 |
23 | @Autowired
24 | String cityId;
25 |
26 | @Autowired
27 | HouseDetail houseDetail;
28 |
29 | private Unbinder unbinder;
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.new_house_activity_main);
35 | unbinder = ButterKnife.bind(this);
36 |
37 | setSupportActionBar(findViewById(R.id.toolbar));
38 | if (getSupportActionBar() != null) {
39 | getSupportActionBar().setDisplayShowTitleEnabled(true);
40 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
41 | }
42 |
43 | ARouter.getInstance().inject(this);
44 |
45 | TextView textView1 = findViewById(R.id.textView1);
46 | TextView textView2 = findViewById(R.id.textView2);
47 |
48 | textView1.setText("城市ID: " + cityId);
49 | textView2.setText("新房: \n" + houseDetail);
50 | }
51 |
52 | @Override
53 | protected void onDestroy() {
54 | super.onDestroy();
55 | if (unbinder != null)
56 | unbinder.unbind();
57 | }
58 |
59 | @OnClick(R2.id.button)
60 | void startIMActivity() {
61 | ArrayList brokerIdList = new ArrayList<>();
62 | brokerIdList.add(20000);
63 | brokerIdList.add(20001);
64 | brokerIdList.add(20002);
65 | ARouter.getInstance().build(RentHouseRouterTable.PATH_ACTIVITY_MAIN)
66 | .withString("cityId", "112")
67 | .withIntegerArrayList("brokerIdList", brokerIdList)
68 | .navigation();
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/java/com/modularization/biz/module/newhouse/NewHouseProviderImpl.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.newhouse;
2 |
3 | import android.content.Context;
4 |
5 | import com.alibaba.android.arouter.facade.annotation.Route;
6 | import com.modularization.biz.module.newhouse.http.ApiServiceWrap;
7 | import com.modularization.biz.module.newhouse.model.GitHubUser;
8 | import com.modularization.biz.service.newhouse.NewHouseApiData;
9 | import com.modularization.biz.service.newhouse.NewHouseProvider;
10 | import com.modularization.biz.service.newhouse.NewHouseData;
11 | import com.modularization.biz.service.newhouse.NewHouseRouterTable;
12 | import com.modularization.biz.service.base.ErrorMessage;
13 | import com.modularization.biz.service.base.ResponseCallback;
14 | import com.modularization.data.net.ApiClient;
15 |
16 | import rx.Subscriber;
17 | import rx.Subscription;
18 | import rx.android.schedulers.AndroidSchedulers;
19 | import rx.schedulers.Schedulers;
20 |
21 | /**
22 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
23 | */
24 | @Route(path = NewHouseRouterTable.PATH_SERVICE_NEW_HOUSE)
25 | public class NewHouseProviderImpl implements NewHouseProvider {
26 |
27 | @Override
28 | public void init(Context context) {
29 |
30 | }
31 |
32 | @Override
33 | public NewHouseData fetchNewHouseData() {
34 |
35 | NewHouseData data = new NewHouseData();
36 | data.setId("1");
37 | data.setTitle("国贸佘山原墅");
38 | data.setAddress("上海市松江区佘山镇");
39 | data.setPrice("1200万/幢");
40 | return data;
41 | }
42 |
43 | @Override
44 | public Subscription callNewHouseApi(ResponseCallback callback) {
45 | return ApiClient.getInstance().getService(new ApiServiceWrap()).getGitHubUser("BaronZ88").subscribeOn(Schedulers.io())
46 | .observeOn(AndroidSchedulers.mainThread())
47 | .subscribe(new Subscriber() {
48 | @Override
49 | public void onCompleted() {
50 |
51 | }
52 |
53 | @Override
54 | public void onError(Throwable e) {
55 | callback.onFailed(new ErrorMessage(403, e.getMessage()));
56 | }
57 |
58 | @Override
59 | public void onNext(GitHubUser gitHubUser) {
60 | if (gitHubUser != null) {
61 | NewHouseApiData data = new NewHouseApiData();
62 | data.setAvatarUrl(gitHubUser.getAvatarUrl());
63 | data.setBio(gitHubUser.getBio());
64 | data.setBlog(gitHubUser.getBlog());
65 | data.setCompany(gitHubUser.getCompany());
66 | data.setEmail(gitHubUser.getEmail());
67 | data.setFollowers(gitHubUser.getFollowers());
68 | data.setLocation(gitHubUser.getLocation());
69 | data.setName(gitHubUser.getName());
70 | callback.onSuccess(data);
71 | } else {
72 | callback.onFailed(new ErrorMessage(405, "未获取到数据"));
73 | }
74 | }
75 | });
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/java/com/modularization/biz/module/newhouse/http/ApiService.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.newhouse.http;
2 |
3 | import com.modularization.biz.module.newhouse.model.GitHubUser;
4 |
5 | import retrofit2.http.GET;
6 | import retrofit2.http.Path;
7 | import rx.Observable;
8 |
9 | /**
10 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
11 | * 2017/1/5
12 | */
13 | public interface ApiService {
14 |
15 | @GET("users/{user}")
16 | Observable getGitHubUser(@Path("user") String userName);
17 | }
18 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/java/com/modularization/biz/module/newhouse/http/ApiServiceWrap.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.newhouse.http;
2 |
3 | import com.modularization.data.net.service.ServiceWrap;
4 | import com.modularization.biz.module.newhouse.Constants;
5 |
6 | /**
7 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
8 | */
9 | public class ApiServiceWrap implements ServiceWrap {
10 |
11 | @Override
12 | public String getIdentify() {
13 | return Constants.Service.ID;
14 | }
15 |
16 | @Override
17 | public String getModuleName() {
18 | return Constants.Service.MODULE_NAME;
19 | }
20 |
21 | @Override
22 | public String getHost() {
23 | return Constants.Service.HOST;
24 | }
25 |
26 | @Override
27 | public Class getRealService() {
28 | return ApiService.class;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/java/com/modularization/biz/module/newhouse/model/GitHubUser.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.newhouse.model;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public class GitHubUser {
7 |
8 |
9 | /**
10 | * login : BaronZ88
11 | * id : 7449405
12 | * node_id : MDQ6VXNlcjc0NDk0MDU=
13 | * avatar_url : https://avatars2.githubusercontent.com/u/7449405?v=4
14 | * gravatar_id :
15 | * url : https://api.github.com/users/BaronZ88
16 | * html_url : https://github.com/BaronZ88
17 | * followers_url : https://api.github.com/users/BaronZ88/followers
18 | * following_url : https://api.github.com/users/BaronZ88/following{/other_user}
19 | * gists_url : https://api.github.com/users/BaronZ88/gists{/gist_id}
20 | * starred_url : https://api.github.com/users/BaronZ88/starred{/owner}{/repo}
21 | * subscriptions_url : https://api.github.com/users/BaronZ88/subscriptions
22 | * organizations_url : https://api.github.com/users/BaronZ88/orgs
23 | * repos_url : https://api.github.com/users/BaronZ88/repos
24 | * events_url : https://api.github.com/users/BaronZ88/events{/privacy}
25 | * received_events_url : https://api.github.com/users/BaronZ88/received_events
26 | * type : User
27 | * site_admin : false
28 | * name : 张磊
29 | * company : Anjuke Inc.
30 | * blog : http://baronzhang.com
31 | * location : Shanghai, China
32 | * email : null
33 | * hireable : true
34 | * bio : 公众号:BaronTalk
35 | https://zhuanlan.zhihu.com/baron
36 | * public_repos : 17
37 | * public_gists : 10
38 | * followers : 1128
39 | * following : 23
40 | * created_at : 2014-04-30T12:09:38Z
41 | * updated_at : 2018-07-26T11:12:40Z
42 | */
43 | private String login;
44 | private int id;
45 | private String avatarUrl;
46 | private String htmlUrl;
47 | private String name;
48 | private String company;
49 | private String blog;
50 | private String location;
51 | private Object email;
52 | private String bio;
53 | private int publicRepos;
54 | private int publicGists;
55 | private int followers;
56 | private int following;
57 |
58 | public String getLogin() {
59 | return login;
60 | }
61 |
62 | public void setLogin(String login) {
63 | this.login = login;
64 | }
65 |
66 | public int getId() {
67 | return id;
68 | }
69 |
70 | public void setId(int id) {
71 | this.id = id;
72 | }
73 |
74 | public String getAvatarUrl() {
75 | return avatarUrl;
76 | }
77 |
78 | public void setAvatarUrl(String avatarUrl) {
79 | this.avatarUrl = avatarUrl;
80 | }
81 |
82 | public String getHtmlUrl() {
83 | return htmlUrl;
84 | }
85 |
86 | public void setHtmlUrl(String htmlUrl) {
87 | this.htmlUrl = htmlUrl;
88 | }
89 |
90 | public String getName() {
91 | return name;
92 | }
93 |
94 | public void setName(String name) {
95 | this.name = name;
96 | }
97 |
98 | public String getCompany() {
99 | return company;
100 | }
101 |
102 | public void setCompany(String company) {
103 | this.company = company;
104 | }
105 |
106 | public String getBlog() {
107 | return blog;
108 | }
109 |
110 | public void setBlog(String blog) {
111 | this.blog = blog;
112 | }
113 |
114 | public String getLocation() {
115 | return location;
116 | }
117 |
118 | public void setLocation(String location) {
119 | this.location = location;
120 | }
121 |
122 | public Object getEmail() {
123 | return email;
124 | }
125 |
126 | public void setEmail(Object email) {
127 | this.email = email;
128 | }
129 |
130 | public String getBio() {
131 | return bio;
132 | }
133 |
134 | public void setBio(String bio) {
135 | this.bio = bio;
136 | }
137 |
138 | public int getPublicRepos() {
139 | return publicRepos;
140 | }
141 |
142 | public void setPublicRepos(int publicRepos) {
143 | this.publicRepos = publicRepos;
144 | }
145 |
146 | public int getPublicGists() {
147 | return publicGists;
148 | }
149 |
150 | public void setPublicGists(int publicGists) {
151 | this.publicGists = publicGists;
152 | }
153 |
154 | public int getFollowers() {
155 | return followers;
156 | }
157 |
158 | public void setFollowers(int followers) {
159 | this.followers = followers;
160 | }
161 |
162 | public int getFollowing() {
163 | return following;
164 | }
165 |
166 | public void setFollowing(int following) {
167 | this.following = following;
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/layout/new_house_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
30 |
31 |
43 |
44 |
56 |
57 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/mipmap-xxhdpi/new_house_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-newhouse/src/main/res/mipmap-xxhdpi/new_house_ic_launcher.png
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/mipmap-xxxhdpi/new_house_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-newhouse/src/main/res/mipmap-xxxhdpi/new_house_ic_launcher.png
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 新房
3 | 新房首页
4 |
5 |
--------------------------------------------------------------------------------
/biz-module-newhouse/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/biz-module-renthouse/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/biz-module-renthouse/build.gradle:
--------------------------------------------------------------------------------
1 | if (isBuildModule.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | } else {
4 | apply plugin: 'com.android.library'
5 | }
6 | apply plugin: 'com.jakewharton.butterknife'
7 |
8 |
9 | android {
10 | compileSdkVersion 29
11 | buildToolsVersion '29.0.3'
12 |
13 | defaultConfig {
14 | minSdkVersion 19
15 | targetSdkVersion 29
16 | versionCode 1
17 | versionName "1.0"
18 | resourcePrefix "im_"
19 |
20 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
21 |
22 | javaCompileOptions {
23 | annotationProcessorOptions {
24 | arguments = [AROUTER_MODULE_NAME: project.getName()]
25 | }
26 | }
27 | }
28 |
29 | buildTypes {
30 | release {
31 | minifyEnabled false
32 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33 | }
34 | }
35 |
36 | compileOptions {
37 | sourceCompatibility JavaVersion.VERSION_1_8
38 | targetCompatibility JavaVersion.VERSION_1_8
39 | }
40 |
41 | sourceSets {
42 | main {
43 | if (isBuildModule.toBoolean()) {
44 | manifest.srcFile 'src/main/debug/AndroidManifest.xml'
45 | } else {
46 | manifest.srcFile 'src/main/release/AndroidManifest.xml'
47 | }
48 | }
49 | }
50 | }
51 |
52 | dependencies {
53 | implementation fileTree(include: ['*.jar'], dir: 'libs')
54 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
55 |
56 | implementation project(path: ':lib-common')
57 | implementation project(path: ':lib-data-local')
58 | implementation project(path: ':lib-data-net')
59 |
60 | implementation project(path: ':biz-service-newhouse')
61 | implementation project(path: ':biz-service-secondhouse')
62 | implementation project(path: ':biz-service-renthouse')
63 |
64 | implementation 'com.alibaba:arouter-api:1.5.1'
65 | annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
66 | }
67 |
--------------------------------------------------------------------------------
/biz-module-renthouse/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/baron/develop/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 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/java/com/modularization/biz/module/renthouse/Constants.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.renthouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public final class Constants {
7 |
8 | public static final class Service {
9 | public static final String ID = "id_renthouse";
10 | public static final String MODULE_NAME = "RentHouseModule";
11 | public static final String HOST = "https://api.github.com/";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/java/com/modularization/biz/module/renthouse/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.renthouse;
2 |
3 | import android.os.Bundle;
4 | import android.widget.TextView;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Autowired;
7 | import com.alibaba.android.arouter.facade.annotation.Route;
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.modularization.biz.service.renthouse.RentHouseRouterTable;
10 | import com.modularization.biz.service.newhouse.NewHouseProviderHelper;
11 | import com.modularization.common.base.activity.BaseActivity;
12 |
13 | import java.util.ArrayList;
14 |
15 | @Route(path = RentHouseRouterTable.PATH_ACTIVITY_MAIN)
16 | public class MainActivity extends BaseActivity {
17 |
18 | @Autowired
19 | String cityId;
20 | @Autowired
21 | ArrayList brokerIdList;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.rent_house_activity_main);
27 |
28 | setSupportActionBar(findViewById(R.id.toolbar));
29 | if (getSupportActionBar() != null) {
30 | getSupportActionBar().setDisplayShowTitleEnabled(true);
31 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
32 | }
33 |
34 | ARouter.getInstance().inject(this);
35 |
36 | TextView textView1 = findViewById(R.id.textView1);
37 | TextView textView2 = findViewById(R.id.textView2);
38 | TextView textView4 = findViewById(R.id.textView4);
39 |
40 | textView1.setText("城市ID: " + cityId);
41 | textView2.setText("经纪人ID列表: " + brokerIdList);
42 |
43 | textView4.setText(NewHouseProviderHelper.getNewHouseProvider().fetchNewHouseData().toString());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/java/com/modularization/biz/module/renthouse/RentHouseProviderImpl.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.renthouse;
2 |
3 | import android.content.Context;
4 |
5 | import com.alibaba.android.arouter.facade.annotation.Route;
6 | import com.modularization.biz.service.renthouse.RentHouseProvider;
7 | import com.modularization.biz.service.renthouse.RentHouseData;
8 | import com.modularization.biz.service.renthouse.RentHouseRouterTable;
9 |
10 | /**
11 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
12 | */
13 | @Route(path = RentHouseRouterTable.PATH_SERVICE_RENT_HOUSE)
14 | public class RentHouseProviderImpl implements RentHouseProvider {
15 |
16 | @Override
17 | public void init(Context context) {
18 |
19 | }
20 |
21 | @Override
22 | public RentHouseData fetchRentHouseData() {
23 | RentHouseData data = new RentHouseData();
24 | data.setId("123123123");
25 | data.setBrokerName("王大仙");
26 | data.setAge(25);
27 | data.setAddress("上海市浦东新区东方路1217号88楼8801号");
28 | return data;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/java/com/modularization/biz/module/renthouse/http/ApiService.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.renthouse.http;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2017/1/5
6 | */
7 | public interface ApiService {
8 | }
9 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/java/com/modularization/biz/module/renthouse/http/ApiServiceWrap.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.renthouse.http;
2 |
3 | import com.modularization.biz.module.renthouse.Constants;
4 | import com.modularization.data.net.service.ServiceWrap;
5 |
6 | /**
7 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
8 | */
9 | public class ApiServiceWrap implements ServiceWrap {
10 |
11 | @Override
12 | public String getIdentify() {
13 | return Constants.Service.ID;
14 | }
15 |
16 | @Override
17 | public String getModuleName() {
18 | return Constants.Service.MODULE_NAME;
19 | }
20 |
21 | @Override
22 | public String getHost() {
23 | return Constants.Service.HOST;
24 | }
25 |
26 | @Override
27 | public Class getRealService() {
28 | return ApiService.class;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/layout/rent_house_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
30 |
31 |
43 |
44 |
56 |
57 |
71 |
72 |
84 |
85 |
86 |
95 |
96 |
105 |
106 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/mipmap-xxhdpi/rent_house_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-renthouse/src/main/res/mipmap-xxhdpi/rent_house_ic_launcher.png
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/mipmap-xxxhdpi/rent_house_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-renthouse/src/main/res/mipmap-xxxhdpi/rent_house_ic_launcher.png
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 租房
3 | 租房首页
4 |
5 |
--------------------------------------------------------------------------------
/biz-module-renthouse/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/build.gradle:
--------------------------------------------------------------------------------
1 | if (isBuildModule.toBoolean()) {
2 | apply plugin: 'com.android.application'
3 | } else {
4 | apply plugin: 'com.android.library'
5 | }
6 | apply plugin: 'com.jakewharton.butterknife'
7 |
8 | android {
9 | compileSdkVersion 29
10 | buildToolsVersion '29.0.3'
11 |
12 | defaultConfig {
13 | minSdkVersion 19
14 | targetSdkVersion 29
15 | versionCode 1
16 | versionName "1.0"
17 | resourcePrefix "second_house_"
18 |
19 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
20 |
21 | javaCompileOptions {
22 | annotationProcessorOptions {
23 | arguments = [AROUTER_MODULE_NAME: project.getName()]
24 | }
25 | }
26 | }
27 |
28 | buildTypes {
29 | release {
30 | minifyEnabled false
31 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32 | }
33 | }
34 |
35 | compileOptions {
36 | sourceCompatibility JavaVersion.VERSION_1_8
37 | targetCompatibility JavaVersion.VERSION_1_8
38 | }
39 |
40 | sourceSets {
41 | main {
42 | if (isBuildModule.toBoolean()) {
43 | manifest.srcFile 'src/main/debug/AndroidManifest.xml'
44 | } else {
45 | manifest.srcFile 'src/main/release/AndroidManifest.xml'
46 | }
47 | }
48 | }
49 | }
50 |
51 | dependencies {
52 | implementation fileTree(include: ['*.jar'], dir: 'libs')
53 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
54 |
55 | implementation project(path: ':lib-common')
56 | implementation project(path: ':lib-data-local')
57 | implementation project(path: ':lib-data-net')
58 |
59 | implementation project(path: ':biz-service-newhouse')
60 | implementation project(path: ':biz-service-secondhouse')
61 | implementation project(path: ':biz-service-renthouse')
62 |
63 | implementation 'com.alibaba:arouter-api:1.5.1'
64 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
65 | annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
66 | }
67 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/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/baron/develop/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 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/java/com/modularization/biz/module/secondhouse/BlankFragment.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.secondhouse;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.fragment.app.Fragment;
6 |
7 | import android.text.TextUtils;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 |
13 | import com.alibaba.android.arouter.facade.annotation.Autowired;
14 | import com.alibaba.android.arouter.facade.annotation.Route;
15 | import com.modularization.biz.service.secondhouse.SecondHouseRouterTable;
16 |
17 | @Route(path = SecondHouseRouterTable.PATH_FRAGMENT_BLANK)
18 | public class BlankFragment extends Fragment {
19 |
20 | private static final String ARG_PARAM1 = "param1";
21 |
22 | @Autowired(name = "param1")
23 | String mParam1;
24 |
25 | public BlankFragment() {
26 | // Required empty public constructor
27 | }
28 |
29 | public static BlankFragment newInstance(String param1) {
30 | BlankFragment fragment = new BlankFragment();
31 | Bundle args = new Bundle();
32 | args.putString(ARG_PARAM1, param1);
33 | fragment.setArguments(args);
34 | return fragment;
35 | }
36 |
37 | @Override
38 | public void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | if (getArguments() != null) {
41 | mParam1 = getArguments().getString(ARG_PARAM1);
42 | }
43 | }
44 |
45 | @Override
46 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
47 | Bundle savedInstanceState) {
48 | View rootView = inflater.inflate(R.layout.fragment_blank, container, false);
49 | TextView textView = rootView.findViewById(R.id.textView);
50 | if(!TextUtils.isEmpty(mParam1)) {
51 | textView.setText(mParam1);
52 | }
53 | return rootView;
54 | }
55 | }
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/java/com/modularization/biz/module/secondhouse/Constants.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.secondhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public final class Constants {
7 |
8 | public static final class Service {
9 | public static final String ID = "id_secondhouse";
10 | public static final String MODULE_NAME = "SecondHouseModule";
11 | public static final String HOST = "https://api.github.com/";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/java/com/modularization/biz/module/secondhouse/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.secondhouse;
2 |
3 | import android.os.Bundle;
4 | import android.widget.TextView;
5 |
6 | import com.alibaba.android.arouter.facade.annotation.Autowired;
7 | import com.alibaba.android.arouter.facade.annotation.Route;
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.modularization.biz.service.secondhouse.SecondHouseRouterTable;
10 | import com.modularization.common.base.activity.BaseActivity;
11 | import com.modularization.common.model.HouseDetail;
12 |
13 | import java.util.ArrayList;
14 |
15 | @Route(path = SecondHouseRouterTable.PATH_ACTIVITY_MAIN)
16 | public class MainActivity extends BaseActivity {
17 |
18 | @Autowired
19 | String cityId;
20 | @Autowired
21 | ArrayList houseList;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.second_house_activity_main);
27 |
28 | setSupportActionBar(findViewById(R.id.toolbar));
29 | if (getSupportActionBar() != null) {
30 | getSupportActionBar().setDisplayShowTitleEnabled(true);
31 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
32 | }
33 |
34 | ARouter.getInstance().inject(this);
35 |
36 | TextView textView1 = findViewById(R.id.textView1);
37 | TextView textView2 = findViewById(R.id.textView2);
38 |
39 | textView1.setText("城市ID: " + cityId);
40 | StringBuilder houseListStr = new StringBuilder();
41 | for(HouseDetail houseDetail : houseList){
42 | houseListStr.append(houseDetail.toString()).append("\n");
43 | }
44 | textView2.setText("房源列表: \n" + houseListStr.substring(0, houseListStr.length()-1));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/java/com/modularization/biz/module/secondhouse/SecondHouseProviderImpl.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.secondhouse;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.fragment.app.Fragment;
6 |
7 | import com.alibaba.android.arouter.facade.annotation.Route;
8 | import com.alibaba.android.arouter.launcher.ARouter;
9 | import com.modularization.biz.service.secondhouse.SecondHouseProvider;
10 | import com.modularization.biz.service.secondhouse.SecondHouseData;
11 | import com.modularization.biz.service.secondhouse.SecondHouseRouterTable;
12 |
13 | /**
14 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
15 | */
16 | @Route(path = SecondHouseRouterTable.PATH_SERVICE_SECOND_HOUSE)
17 | public class SecondHouseProviderImpl implements SecondHouseProvider {
18 |
19 | private Context context;
20 |
21 | @Override
22 | public void init(Context context) {
23 | this.context = context;
24 | }
25 |
26 | @Override
27 | public SecondHouseData fetchSecondHouseData() {
28 | SecondHouseData data = new SecondHouseData();
29 | data.setId("123123123123342");
30 | data.setTitle("潍坊1村3室2厅");
31 | data.setAddress("上海市浦东新区东方路10000号");
32 | data.setPrice("700万/套");
33 | return data;
34 | }
35 |
36 | @Override
37 | public Fragment getFragment(String routePath) {
38 | return (Fragment) ARouter.getInstance().build(SecondHouseRouterTable.PATH_FRAGMENT_BLANK)
39 | .withString("param1", "这是一个来自二手房的Fragment")
40 | .navigation(context);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/java/com/modularization/biz/module/secondhouse/http/ApiService.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.secondhouse.http;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2017/1/5
6 | */
7 | public interface ApiService {
8 | }
9 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/java/com/modularization/biz/module/secondhouse/http/ApiServiceWrap.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.module.secondhouse.http;
2 |
3 | import com.modularization.biz.module.secondhouse.Constants;
4 | import com.modularization.data.net.service.ServiceWrap;
5 |
6 | /**
7 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
8 | */
9 | public class ApiServiceWrap implements ServiceWrap {
10 |
11 | @Override
12 | public String getIdentify() {
13 | return Constants.Service.ID;
14 | }
15 |
16 | @Override
17 | public String getModuleName() {
18 | return Constants.Service.MODULE_NAME;
19 | }
20 |
21 | @Override
22 | public String getHost() {
23 | return Constants.Service.HOST;
24 | }
25 |
26 | @Override
27 | public Class getRealService() {
28 | return ApiService.class;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/layout/fragment_blank.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/layout/second_house_activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
29 |
30 |
42 |
43 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/mipmap-xxhdpi/second_house_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-secondhouse/src/main/res/mipmap-xxhdpi/second_house_ic_launcher.png
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/mipmap-xxxhdpi/second_house_ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-module-secondhouse/src/main/res/mipmap-xxxhdpi/second_house_ic_launcher.png
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 二手房
3 | 二手房首页
4 |
5 |
--------------------------------------------------------------------------------
/biz-module-secondhouse/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/biz-service-base/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/biz-service-base/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'java-library'
3 | }
4 |
5 | java {
6 | sourceCompatibility = JavaVersion.VERSION_1_8
7 | targetCompatibility = JavaVersion.VERSION_1_8
8 | }
--------------------------------------------------------------------------------
/biz-service-base/src/main/java/com/modularization/biz/service/base/ErrorMessage.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.base;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public class ErrorMessage {
7 |
8 | private int code;
9 | private String message;
10 |
11 | public ErrorMessage(int code, String message) {
12 | this.code = code;
13 | this.message = message;
14 | }
15 |
16 | public int getCode() {
17 | return code;
18 | }
19 |
20 | public void setCode(int code) {
21 | this.code = code;
22 | }
23 |
24 | public String getMessage() {
25 | return message;
26 | }
27 |
28 | public void setMessage(String message) {
29 | this.message = message;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | return "ErrorMessage{" +
35 | "code=" + code +
36 | ", message='" + message + '\'' +
37 | '}';
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/biz-service-base/src/main/java/com/modularization/biz/service/base/ResponseCallback.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.base;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public interface ResponseCallback {
7 |
8 | void onSuccess(T t);
9 |
10 | void onFailed(ErrorMessage errorMsg);
11 | }
12 |
--------------------------------------------------------------------------------
/biz-service-newhouse/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/biz-service-newhouse/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | minSdkVersion 19
11 | targetSdkVersion 29
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 |
18 | javaCompileOptions {
19 | annotationProcessorOptions {
20 | arguments = [AROUTER_MODULE_NAME: project.getName()]
21 | }
22 | }
23 | }
24 |
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 | }
36 |
37 | dependencies {
38 |
39 | implementation 'androidx.appcompat:appcompat:1.2.0'
40 | implementation 'com.google.android.material:material:1.2.1'
41 |
42 | implementation 'com.alibaba:arouter-api:1.5.1'
43 | implementation 'io.reactivex:rxandroid:1.2.1'
44 |
45 | api project(path: ':biz-service-base')
46 | }
--------------------------------------------------------------------------------
/biz-service-newhouse/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-service-newhouse/consumer-rules.pro
--------------------------------------------------------------------------------
/biz-service-newhouse/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/biz-service-newhouse/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/biz-service-newhouse/src/main/java/com/modularization/biz/service/newhouse/NewHouseApiData.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.newhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public class NewHouseApiData {
7 |
8 | private String avatarUrl;
9 | private String name;
10 | private String company;
11 | private String blog;
12 | private String location;
13 | private Object email;
14 | private String bio;
15 | private int followers;
16 |
17 | public String getAvatarUrl() {
18 | return avatarUrl;
19 | }
20 |
21 | public void setAvatarUrl(String avatarUrl) {
22 | this.avatarUrl = avatarUrl;
23 | }
24 |
25 | public String getName() {
26 | return name;
27 | }
28 |
29 | public void setName(String name) {
30 | this.name = name;
31 | }
32 |
33 | public String getCompany() {
34 | return company;
35 | }
36 |
37 | public void setCompany(String company) {
38 | this.company = company;
39 | }
40 |
41 | public String getBlog() {
42 | return blog;
43 | }
44 |
45 | public void setBlog(String blog) {
46 | this.blog = blog;
47 | }
48 |
49 | public String getLocation() {
50 | return location;
51 | }
52 |
53 | public void setLocation(String location) {
54 | this.location = location;
55 | }
56 |
57 | public Object getEmail() {
58 | return email;
59 | }
60 |
61 | public void setEmail(Object email) {
62 | this.email = email;
63 | }
64 |
65 | public String getBio() {
66 | return bio;
67 | }
68 |
69 | public void setBio(String bio) {
70 | this.bio = bio;
71 | }
72 |
73 | public int getFollowers() {
74 | return followers;
75 | }
76 |
77 | public void setFollowers(int followers) {
78 | this.followers = followers;
79 | }
80 |
81 | @Override
82 | public String toString() {
83 | return "NewHouseApiData:\n" +
84 | " avatarUrl=" + avatarUrl + "\n" +
85 | " name=" + name + "\n" +
86 | " company=" + company + "\n" +
87 | " blog=" + blog + "\n" +
88 | " location=" + location + "\n" +
89 | " email=" + email + "\n" +
90 | " bio=" + bio + "\n" +
91 | " followers=" + followers;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/biz-service-newhouse/src/main/java/com/modularization/biz/service/newhouse/NewHouseData.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.newhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public final class NewHouseData {
7 |
8 | private String id;
9 | private String title;
10 | private String address;
11 | private String price;
12 |
13 | public String getId() {
14 | return id;
15 | }
16 |
17 | public void setId(String id) {
18 | this.id = id;
19 | }
20 |
21 | public String getTitle() {
22 | return title;
23 | }
24 |
25 | public void setTitle(String title) {
26 | this.title = title;
27 | }
28 |
29 | public String getAddress() {
30 | return address;
31 | }
32 |
33 | public void setAddress(String address) {
34 | this.address = address;
35 | }
36 |
37 | public String getPrice() {
38 | return price;
39 | }
40 |
41 | public void setPrice(String price) {
42 | this.price = price;
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return " NewHouseData:\n" +
48 | " id='" + id + '\'' + "\n" +
49 | " title='" + title + '\'' + "\n" +
50 | " address='" + address + '\'' + "\n" +
51 | " price='" + price + '\'';
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/biz-service-newhouse/src/main/java/com/modularization/biz/service/newhouse/NewHouseProvider.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.newhouse;
2 |
3 | import com.alibaba.android.arouter.facade.template.IProvider;
4 | import com.modularization.biz.service.base.ResponseCallback;
5 |
6 | import rx.Subscription;
7 |
8 | /**
9 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
10 | */
11 | public interface NewHouseProvider extends IProvider {
12 |
13 | NewHouseData fetchNewHouseData();
14 |
15 | Subscription callNewHouseApi(ResponseCallback callback);
16 | }
--------------------------------------------------------------------------------
/biz-service-newhouse/src/main/java/com/modularization/biz/service/newhouse/NewHouseProviderHelper.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.newhouse;
2 |
3 | import com.alibaba.android.arouter.launcher.ARouter;
4 |
5 | /**
6 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
7 | */
8 | public class NewHouseProviderHelper {
9 |
10 | public static NewHouseProvider getNewHouseProvider(){
11 | return (NewHouseProvider) ARouter.getInstance().build(NewHouseRouterTable.PATH_SERVICE_NEW_HOUSE).navigation();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-service-newhouse/src/main/java/com/modularization/biz/service/newhouse/NewHouseRouterTable.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.newhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public interface NewHouseRouterTable {
7 |
8 | //Activity
9 | String PATH_ACTIVITY_MAIN = "/newhouse/mainActivity";
10 |
11 | //Service
12 | String PATH_SERVICE_NEW_HOUSE = "/newhouse/service";
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/biz-service-renthouse/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/biz-service-renthouse/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | minSdkVersion 19
11 | targetSdkVersion 29
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 |
18 | javaCompileOptions {
19 | annotationProcessorOptions {
20 | arguments = [AROUTER_MODULE_NAME: project.getName()]
21 | }
22 | }
23 | }
24 |
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 | }
36 |
37 | dependencies {
38 |
39 | implementation 'androidx.appcompat:appcompat:1.2.0'
40 | implementation 'com.google.android.material:material:1.2.1'
41 |
42 | implementation 'com.alibaba:arouter-api:1.5.1'
43 |
44 | api project(path: ':biz-service-base')
45 | }
--------------------------------------------------------------------------------
/biz-service-renthouse/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-service-renthouse/consumer-rules.pro
--------------------------------------------------------------------------------
/biz-service-renthouse/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/biz-service-renthouse/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/biz-service-renthouse/src/main/java/com/modularization/biz/service/renthouse/RentHouseData.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.renthouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public class RentHouseData {
7 |
8 | private String id;
9 | private String brokerName;
10 | private int age;
11 | private String address;
12 |
13 | public String getId() {
14 | return id;
15 | }
16 |
17 | public void setId(String id) {
18 | this.id = id;
19 | }
20 |
21 | public String getBrokerName() {
22 | return brokerName;
23 | }
24 |
25 | public void setBrokerName(String brokerName) {
26 | this.brokerName = brokerName;
27 | }
28 |
29 | public int getAge() {
30 | return age;
31 | }
32 |
33 | public void setAge(int age) {
34 | this.age = age;
35 | }
36 |
37 | public String getAddress() {
38 | return address;
39 | }
40 |
41 | public void setAddress(String address) {
42 | this.address = address;
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return " RentHouseData:\n" +
48 | " id=" + id + "\n" +
49 | " brokerName=" + brokerName + "\n" +
50 | " age=" + age + "岁" + "\n" +
51 | " address=" + address;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/biz-service-renthouse/src/main/java/com/modularization/biz/service/renthouse/RentHouseProvider.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.renthouse;
2 |
3 | import com.alibaba.android.arouter.facade.template.IProvider;
4 |
5 | /**
6 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
7 | */
8 | public interface RentHouseProvider extends IProvider {
9 |
10 | RentHouseData fetchRentHouseData();
11 | }
12 |
--------------------------------------------------------------------------------
/biz-service-renthouse/src/main/java/com/modularization/biz/service/renthouse/RentHouseProviderHelper.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.renthouse;
2 |
3 | import com.alibaba.android.arouter.launcher.ARouter;
4 |
5 | /**
6 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
7 | */
8 | public class RentHouseProviderHelper {
9 |
10 | public static RentHouseProvider getRentHouseProvider() {
11 | return (RentHouseProvider) ARouter.getInstance().build(RentHouseRouterTable.PATH_SERVICE_RENT_HOUSE).navigation();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-service-renthouse/src/main/java/com/modularization/biz/service/renthouse/RentHouseRouterTable.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.renthouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public interface RentHouseRouterTable {
7 |
8 | String PATH_ACTIVITY_MAIN = "/renthouse/mainActivity";
9 |
10 | String PATH_SERVICE_RENT_HOUSE = "/renthouse/service";
11 | }
12 |
--------------------------------------------------------------------------------
/biz-service-secondhouse/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/biz-service-secondhouse/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | minSdkVersion 19
11 | targetSdkVersion 29
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 |
18 | javaCompileOptions {
19 | annotationProcessorOptions {
20 | arguments = [AROUTER_MODULE_NAME: project.getName()]
21 | }
22 | }
23 | }
24 |
25 | buildTypes {
26 | release {
27 | minifyEnabled false
28 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | compileOptions {
32 | sourceCompatibility JavaVersion.VERSION_1_8
33 | targetCompatibility JavaVersion.VERSION_1_8
34 | }
35 | }
36 |
37 | dependencies {
38 |
39 | implementation 'androidx.appcompat:appcompat:1.2.0'
40 | implementation 'com.google.android.material:material:1.2.1'
41 |
42 | implementation 'com.alibaba:arouter-api:1.5.1'
43 |
44 | api project(path: ':biz-service-base')
45 | }
--------------------------------------------------------------------------------
/biz-service-secondhouse/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/biz-service-secondhouse/consumer-rules.pro
--------------------------------------------------------------------------------
/biz-service-secondhouse/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/biz-service-secondhouse/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/biz-service-secondhouse/src/main/java/com/modularization/biz/service/secondhouse/SecondHouseData.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.secondhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public class SecondHouseData {
7 |
8 | private String id;
9 | private String title;
10 | private String address;
11 | private String price;
12 |
13 | public String getId() {
14 | return id;
15 | }
16 |
17 | public void setId(String id) {
18 | this.id = id;
19 | }
20 |
21 | public String getTitle() {
22 | return title;
23 | }
24 |
25 | public void setTitle(String title) {
26 | this.title = title;
27 | }
28 |
29 | public String getAddress() {
30 | return address;
31 | }
32 |
33 | public void setAddress(String address) {
34 | this.address = address;
35 | }
36 |
37 | public String getPrice() {
38 | return price;
39 | }
40 |
41 | public void setPrice(String price) {
42 | this.price = price;
43 | }
44 |
45 | @Override
46 | public String toString() {
47 | return " SecondHouseData:\n" +
48 | " id='" + id + '\'' + "\n" +
49 | " title='" + title + '\'' + "\n" +
50 | " address='" + address + '\'' + "\n" +
51 | " price='" + price + '\'';
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/biz-service-secondhouse/src/main/java/com/modularization/biz/service/secondhouse/SecondHouseProvider.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.secondhouse;
2 |
3 | import androidx.fragment.app.Fragment;
4 |
5 | import com.alibaba.android.arouter.facade.template.IProvider;
6 |
7 | /**
8 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
9 | */
10 | public interface SecondHouseProvider extends IProvider {
11 |
12 | SecondHouseData fetchSecondHouseData();
13 |
14 | Fragment getFragment(String routePath);
15 | }
16 |
--------------------------------------------------------------------------------
/biz-service-secondhouse/src/main/java/com/modularization/biz/service/secondhouse/SecondHouseProviderHelper.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.secondhouse;
2 |
3 | import com.alibaba.android.arouter.launcher.ARouter;
4 |
5 | /**
6 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
7 | */
8 | public class SecondHouseProviderHelper {
9 |
10 | public static SecondHouseProvider getSecondHouseProvider(){
11 | return (SecondHouseProvider) ARouter.getInstance().build(SecondHouseRouterTable.PATH_SERVICE_SECOND_HOUSE).navigation();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/biz-service-secondhouse/src/main/java/com/modularization/biz/service/secondhouse/SecondHouseRouterTable.java:
--------------------------------------------------------------------------------
1 | package com.modularization.biz.service.secondhouse;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public interface SecondHouseRouterTable {
7 |
8 | String PATH_ACTIVITY_MAIN = "/secondhouse/mainActivity";
9 |
10 | String PATH_FRAGMENT_BLANK = "/secondhouse/blankFragment";
11 |
12 | String PATH_SERVICE_SECOND_HOUSE = "/secondhouse/service";
13 | }
14 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | apply from: "dependencies.gradle"
3 |
4 | buildscript {
5 |
6 | ext.arouter_register_version = '1.0.2'
7 |
8 | repositories {
9 | jcenter()
10 | google()
11 | }
12 | dependencies {
13 | classpath 'com.android.tools.build:gradle:4.1.1'
14 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
15 | classpath "com.alibaba:arouter-register:$arouter_register_version"
16 | classpath 'com.jakewharton:butterknife-gradle-plugin:10.2.3'
17 | }
18 | }
19 |
20 | allprojects {
21 | repositories {
22 | jcenter()
23 | maven { url 'https://jitpack.io' }
24 | google()
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/dependencies.gradle:
--------------------------------------------------------------------------------
1 | def retrofitVersion = "2.9.0"
2 | def okHttpVersion = "3.7.0"
3 | def stethoVersion = "1.5.0"
4 | def butterKnifeVersion = "10.2.3"
5 |
6 | project.ext {
7 | android = [
8 | compileSdkVersion: 29,
9 | buildToolsVersion: "29.0.3",
10 | applicationId : "com.modularization.app",
11 | minSdkVersion : 19,
12 | targetSdkVersion : 29,
13 | versionCode : 1,
14 | versionName : "1.0"
15 | ]
16 |
17 | dependencies = [
18 | //android-support
19 |
20 | //java8-support
21 | "stream" : "com.annimon:stream:1.0.8",
22 |
23 | //retrofit
24 | "retrofit" : "com.squareup.retrofit2:retrofit:${retrofitVersion}",
25 | "adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}",
26 |
27 | //router
28 | "router" : "",
29 | "router-compiler" : "",
30 |
31 | //butterKnife
32 | "butterknife" : "com.jakewharton:butterknife:${butterKnifeVersion}",
33 | "butterknife-compiler" : "com.jakewharton:butterknife-compiler:${butterKnifeVersion}",
34 |
35 | //facebook
36 | "stetho" : "com.facebook.stetho:stetho:${stethoVersion}",
37 | "stetho-okhttp3" : "com.facebook.stetho:stetho-okhttp3:${stethoVersion}",
38 |
39 | //okHttp3
40 | "okhttp3" : "com.squareup.okhttp3:okhttp:${okHttpVersion}",
41 | "okhttp3-logging-interceptor" : "com.squareup.okhttp3:logging-interceptor:${okHttpVersion}",
42 |
43 | //others
44 | "ormlite-android" : "com.j256.ormlite:ormlite-android:5.1",
45 | "fastjson" : "com.alibaba:fastjson:1.2.73",
46 | "retrofit2-fastjson-converter": "com.github.BaronZ88:Retrofit2-FastJson-Converter:1.2",
47 | ]
48 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | #org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | android.enableJetifier=true
20 | android.useAndroidX=true
21 | isBuildModule=false
22 |
23 | org.gradle.daemon=true
24 | org.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Nov 03 16:06:14 CST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/lib-common/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/lib-common/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion '29.0.3'
6 |
7 | defaultConfig {
8 | minSdkVersion 19
9 | targetSdkVersion 29
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
14 |
15 | javaCompileOptions {
16 | annotationProcessorOptions {
17 | arguments = [AROUTER_MODULE_NAME: project.getName()]
18 | }
19 | }
20 | }
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 | }
27 |
28 | compileOptions {
29 | sourceCompatibility JavaVersion.VERSION_1_8
30 | targetCompatibility JavaVersion.VERSION_1_8
31 | }
32 | }
33 |
34 | dependencies {
35 | api fileTree(dir: 'libs', include: ['*.jar'])
36 | implementation 'androidx.appcompat:appcompat:1.2.0'
37 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
38 |
39 | implementation 'com.alibaba:arouter-api:1.5.1'
40 | implementation 'com.google.android.material:material:1.2.1'
41 | annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
42 | }
43 |
--------------------------------------------------------------------------------
/lib-common/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/baron/develop/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/lib-common/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/activity/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.activity;
2 |
3 | import android.os.Bundle;
4 | import android.view.MenuItem;
5 |
6 | import androidx.annotation.NonNull;
7 | import androidx.appcompat.app.AppCompatActivity;
8 | import androidx.appcompat.app.AppCompatDelegate;
9 |
10 | /**
11 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
12 | */
13 | public class BaseActivity extends AppCompatActivity {
14 |
15 | /*
16 | * 解决Vector兼容性问题
17 | *
18 | * First up, this functionality was originally released in 23.2.0,
19 | * but then we found some memory usage and Configuration updating
20 | * issues so we it removed in 23.3.0. In 23.4.0 (technically a fix
21 | * release) we’ve re-added the same functionality but behind a flag
22 | * which you need to manually enable.
23 | *
24 | * http://www.jianshu.com/p/e3614e7abc03
25 | */
26 | static {
27 | AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
28 | }
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | }
34 |
35 | @Override
36 | protected void onDestroy() {
37 | super.onDestroy();
38 | }
39 |
40 | @Override
41 | public boolean onOptionsItemSelected(@NonNull MenuItem item) {
42 | int id = item.getItemId();
43 | if (id == android.R.id.home) {
44 | finish();
45 | return true;
46 | }
47 | return super.onOptionsItemSelected(item);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/adapter/BaseRecyclerViewAdapter.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.adapter;
2 |
3 | import android.widget.AdapterView;
4 |
5 | import androidx.recyclerview.widget.RecyclerView;
6 |
7 | /**
8 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
9 | * 16/4/15
10 | */
11 | public abstract class BaseRecyclerViewAdapter extends RecyclerView.Adapter{
12 |
13 | protected AdapterView.OnItemClickListener onItemClickListener;
14 |
15 | public void setOnItemClickListener(AdapterView.OnItemClickListener onItemClickListener) {
16 |
17 | this.onItemClickListener = onItemClickListener;
18 | }
19 |
20 | protected void onItemHolderClick(RecyclerView.ViewHolder itemHolder) {
21 | if (onItemClickListener != null) {
22 | onItemClickListener.onItemClick(null, itemHolder.itemView,
23 | itemHolder.getAdapterPosition(), itemHolder.getItemId());
24 | } else {
25 | throw new IllegalStateException("Please call setOnItemClickListener method set the click event listeners");
26 | }
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/fragment/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.fragment;
2 |
3 |
4 | import android.os.Bundle;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import androidx.annotation.Nullable;
10 | import androidx.fragment.app.Fragment;
11 |
12 | /**
13 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
14 | */
15 | public class BaseFragment extends Fragment {
16 |
17 | // private PublishSubject fragmentLifecycleSubject = PublishSubject.create();
18 |
19 | @Override
20 | public void onCreate(@Nullable Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | }
23 |
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
26 | Bundle savedInstanceState) {
27 | return super.onCreateView(inflater, container, savedInstanceState);
28 | }
29 |
30 | @Override
31 | public void onDestroyView() {
32 | // fragmentLifecycleSubject.onNext(FragmentLifecycleEvent.DESTROY_VIEW);
33 | super.onDestroyView();
34 | }
35 |
36 | @Override
37 | public void onDestroy() {
38 | super.onDestroy();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/presenter/BasePresenter.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.presenter;
2 |
3 | /**
4 | * presenter interface,所有Presenter必须实现此接口
5 | *
6 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
7 | */
8 | public interface BasePresenter {
9 |
10 | void subscribe();
11 |
12 | void unSubscribe();
13 | }
14 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/util/ActivityUtils.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.util;
2 |
3 |
4 | import androidx.fragment.app.Fragment;
5 | import androidx.fragment.app.FragmentManager;
6 | import androidx.fragment.app.FragmentTransaction;
7 |
8 | /**
9 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
10 | * 16/4/13
11 | */
12 | public final class ActivityUtils {
13 |
14 | public static void addFragmentToActivity(FragmentManager fragmentManager, Fragment fragment, int frameId) {
15 | FragmentTransaction transaction = fragmentManager.beginTransaction();
16 | transaction.add(frameId, fragment);
17 | transaction.commit();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/util/DateConvertUtils.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.util;
2 |
3 | import android.annotation.SuppressLint;
4 |
5 | import java.text.ParseException;
6 | import java.text.SimpleDateFormat;
7 | import java.util.Date;
8 |
9 | /**
10 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
11 | * 2016/12/12
12 | */
13 | public final class DateConvertUtils {
14 |
15 | public static final String DATA_FORMAT_PATTEN_YYYY_MMMM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
16 | public static final String DATA_FORMAT_PATTEN_YYYY_MMMM_DD_HH_MM = "yyyy-MM-dd HH:mm";
17 |
18 | /**
19 | * 将时间转换为时间戳
20 | *
21 | * @param data 待转换的日期
22 | * @param dataFormatPatten 待转换日期格式
23 | */
24 | public static long dateToTimeStamp(String data, String dataFormatPatten) {
25 | @SuppressLint("SimpleDateFormat")
26 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dataFormatPatten);
27 | Date date = null;
28 | try {
29 | date = simpleDateFormat.parse(data);
30 | } catch (ParseException e) {
31 | e.printStackTrace();
32 | }
33 | assert date != null;
34 | return date.getTime();
35 | }
36 |
37 | /**
38 | * 将时间戳转换为日期
39 | *
40 | * @param time 待转换的时间戳
41 | * @param dataFormatPatten 转换出的日期格式
42 | */
43 | public static String timeStampToDate(long time, String dataFormatPatten) {
44 | @SuppressLint("SimpleDateFormat")
45 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dataFormatPatten);
46 | Date date = new Date(time);
47 | return simpleDateFormat.format(date);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/util/NetworkUtils.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.util;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.Network;
6 | import android.net.NetworkCapabilities;
7 | import android.net.NetworkInfo;
8 | import android.os.Build;
9 |
10 | /**
11 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
12 | */
13 | public final class NetworkUtils {
14 |
15 | /**
16 | * 判断网络连接是否可用
17 | */
18 | public static Boolean isNetworkConnected(Context context) {
19 | ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
20 | if (manager == null) {
21 | return false;
22 | }
23 | if (Build.VERSION.SDK_INT < 23) {
24 | NetworkInfo mWiFiNetworkInfo = manager.getActiveNetworkInfo();
25 | if (mWiFiNetworkInfo != null) {
26 | return mWiFiNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI
27 | || mWiFiNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE;
28 | }
29 | } else {
30 | Network network = manager.getActiveNetwork();
31 | if (network != null) {
32 | NetworkCapabilities nc = manager.getNetworkCapabilities(network);
33 | if (nc != null) {
34 | return nc.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)
35 | || nc.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR);
36 | }
37 | }
38 | }
39 | return false;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/util/lifecycle/ActivityLifecycleEvent.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.util.lifecycle;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2017/2/17
6 | */
7 | public enum ActivityLifecycleEvent {
8 |
9 | CREATE,
10 | START,
11 | RESUME,
12 | PAUSE,
13 | STOP,
14 | DESTROY,
15 | }
16 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/util/lifecycle/FragmentLifecycleEvent.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.util.lifecycle;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2017/2/17
6 | */
7 | public enum FragmentLifecycleEvent {
8 |
9 | ATTACH,
10 | CREATE,
11 | CREATE_VIEW,
12 | START,
13 | RESUME,
14 | PAUSE,
15 | STOP,
16 | DESTROY_VIEW,
17 | DESTROY,
18 | DETACH,
19 | }
20 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/base/view/BaseView.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.base.view;
2 |
3 | /**
4 | * view interface,所有View(此项目中的View主要是Fragment和自定义的ViewGroup)必须实现此接口
5 | *
6 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
7 | */
8 | public interface BaseView {
9 |
10 | void setPresenter(T presenter);
11 | }
12 |
--------------------------------------------------------------------------------
/lib-common/src/main/java/com/modularization/common/model/HouseDetail.java:
--------------------------------------------------------------------------------
1 | package com.modularization.common.model;
2 |
3 | import android.os.Parcel;
4 | import android.os.Parcelable;
5 |
6 | /**
7 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
8 | * 2017/3/13
9 | */
10 | public class HouseDetail implements Parcelable {
11 |
12 | private String houseId;
13 | private String communityName;
14 | private int area;
15 |
16 | public HouseDetail() {
17 | }
18 |
19 | public HouseDetail(String houseId, String communityName, int area) {
20 | this.area = area;
21 | this.communityName = communityName;
22 | this.houseId = houseId;
23 | }
24 |
25 | @Override
26 | public String toString() {
27 | return " 房源ID:'" + houseId + '\'' +
28 | ", 小区:'" + communityName + '\'' +
29 | ", 面积:" + area;
30 | }
31 |
32 | public String getHouseId() {
33 | return houseId;
34 | }
35 |
36 | public void setHouseId(String houseId) {
37 | this.houseId = houseId;
38 | }
39 |
40 | public String getCommunityName() {
41 | return communityName;
42 | }
43 |
44 | public void setCommunityName(String communityName) {
45 | this.communityName = communityName;
46 | }
47 |
48 | public int getArea() {
49 | return area;
50 | }
51 |
52 | public void setArea(int area) {
53 | this.area = area;
54 | }
55 |
56 | @Override
57 | public int describeContents() {
58 | return 0;
59 | }
60 |
61 | @Override
62 | public void writeToParcel(Parcel dest, int flags) {
63 | dest.writeString(this.houseId);
64 | dest.writeString(this.communityName);
65 | dest.writeInt(this.area);
66 | }
67 |
68 | protected HouseDetail(Parcel in) {
69 | this.houseId = in.readString();
70 | this.communityName = in.readString();
71 | this.area = in.readInt();
72 | }
73 |
74 | public static final Creator CREATOR = new Creator() {
75 | @Override
76 | public HouseDetail createFromParcel(Parcel source) {
77 | return new HouseDetail(source);
78 | }
79 |
80 | @Override
81 | public HouseDetail[] newArray(int size) {
82 | return new HouseDetail[size];
83 | }
84 | };
85 | }
86 |
--------------------------------------------------------------------------------
/lib-common/src/main/res/layout/layout_app_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
--------------------------------------------------------------------------------
/lib-common/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/lib-common/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/lib-data-local/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/lib-data-local/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion '29.0.3'
6 |
7 | defaultConfig {
8 | minSdkVersion 19
9 | targetSdkVersion 29
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
14 | }
15 |
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 |
23 | compileOptions {
24 | sourceCompatibility JavaVersion.VERSION_1_8
25 | targetCompatibility JavaVersion.VERSION_1_8
26 | }
27 |
28 | lintOptions {
29 | abortOnError false
30 | }
31 | }
32 |
33 | dependencies {
34 | api fileTree(include: ['*.jar'], dir: 'libs')
35 | api project(':lib-open-source')
36 | }
37 |
--------------------------------------------------------------------------------
/lib-data-local/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/baron/develop/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 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/java/com/modularization/data/local/db/BaseDatabaseHelper.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.local.db;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 |
6 | import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
7 | import com.j256.ormlite.dao.Dao;
8 | import com.j256.ormlite.dao.DaoManager;
9 |
10 | import java.io.File;
11 | import java.io.InputStream;
12 | import java.sql.SQLException;
13 |
14 | /**
15 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
16 | * 2017/1/12
17 | */
18 | public abstract class BaseDatabaseHelper extends OrmLiteSqliteOpenHelper {
19 |
20 |
21 | public BaseDatabaseHelper(Context context, String databaseName, SQLiteDatabase.CursorFactory factory, int databaseVersion) {
22 | super(context, databaseName, factory, databaseVersion);
23 | }
24 |
25 | public BaseDatabaseHelper(Context context, String databaseName, SQLiteDatabase.CursorFactory factory, int databaseVersion, int configFileId) {
26 | super(context, databaseName, factory, databaseVersion, configFileId);
27 | }
28 |
29 | public BaseDatabaseHelper(Context context, String databaseName, SQLiteDatabase.CursorFactory factory, int databaseVersion, File configFile) {
30 | super(context, databaseName, factory, databaseVersion, configFile);
31 | }
32 |
33 | public BaseDatabaseHelper(Context context, String databaseName, SQLiteDatabase.CursorFactory factory, int databaseVersion, InputStream stream) {
34 | super(context, databaseName, factory, databaseVersion, stream);
35 | }
36 |
37 |
38 | @Override
39 | public void close() {
40 | super.close();
41 | DaoManager.clearCache();
42 | }
43 |
44 | public , T> D getAppDao(Class clazz) {
45 | try {
46 | return getDao(clazz);
47 | } catch (SQLException e) {
48 | e.printStackTrace();
49 | }
50 | return null;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/java/com/modularization/data/local/db/UserDatabaseHelper.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.local.db;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 |
6 | import com.j256.ormlite.support.ConnectionSource;
7 | import com.j256.ormlite.table.TableUtils;
8 | import com.modularization.data.local.entities.User;
9 |
10 | import java.sql.SQLException;
11 |
12 | /**
13 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
14 | * 2017/1/12
15 | */
16 | public class UserDatabaseHelper extends BaseDatabaseHelper {
17 |
18 | private static final String TAG = "UserDatabaseHelper";
19 |
20 | private static final String DATABASE_NAME = "user.db";
21 | private static final int DATABASE_VERSION = 1;
22 |
23 | private static volatile UserDatabaseHelper instance;
24 |
25 | public UserDatabaseHelper(Context context) {
26 | super(context, DATABASE_NAME, null, DATABASE_VERSION);
27 | }
28 |
29 | @Override
30 | public void onCreate(SQLiteDatabase database, ConnectionSource connectionSource) {
31 | try {
32 | TableUtils.createTable(connectionSource, User.class);
33 | } catch (SQLException e) {
34 | e.printStackTrace();
35 | }
36 | }
37 |
38 | @Override
39 | public void onUpgrade(SQLiteDatabase database, ConnectionSource connectionSource, int oldVersion, int newVersion) {
40 |
41 | }
42 |
43 | /**
44 | * 单例获取OpenHelper实例
45 | *
46 | * @param context application context
47 | * @return instance
48 | */
49 | public static UserDatabaseHelper getInstance(Context context) {
50 |
51 | context = context.getApplicationContext();
52 | if (instance == null) {
53 | synchronized (UserDatabaseHelper.class) {
54 | if (instance == null) {
55 | instance = new UserDatabaseHelper(context);
56 | }
57 | }
58 | }
59 | return instance;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/java/com/modularization/data/local/entities/User.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.local.entities;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2017/1/12
6 | */
7 | public class User {
8 | }
9 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/java/com/modularization/data/local/preferences/AppSettings.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.local.preferences;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public enum AppSettings {
7 |
8 | /*默认配置项*/
9 | SETTINGS_FIRST_USE("first_use", Boolean.TRUE),
10 | SETTINGS_CURRENT_CITY_ID("current_city_id", ""),
11 | SETTINGS_CURRENT_CITY_NAME("current_city_name", "");
12 |
13 | private final String mId;
14 | private final Object mDefaultValue;
15 |
16 | AppSettings(String id, Object defaultValue) {
17 | this.mId = id;
18 | this.mDefaultValue = defaultValue;
19 | }
20 |
21 | public String getId() {
22 | return this.mId;
23 | }
24 |
25 | public Object getDefaultValue() {
26 | return this.mDefaultValue;
27 | }
28 |
29 | public static AppSettings fromId(String id) {
30 | AppSettings[] values = values();
31 | for (AppSettings value : values) {
32 | if (value.mId.equals(id)) {
33 | return value;
34 | }
35 | }
36 | return null;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/java/com/modularization/data/local/preferences/ConfigurationListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 BaronZhang(BaronZ88)
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.modularization.data.local.preferences;
17 |
18 | public interface ConfigurationListener {
19 |
20 | void onConfigurationChanged(AppSettings pref, Object newValue);
21 | }
22 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/java/com/modularization/data/local/preferences/Preferences.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.local.preferences;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.util.Log;
6 |
7 | import java.io.InvalidClassException;
8 | import java.util.ArrayList;
9 | import java.util.Collections;
10 | import java.util.HashMap;
11 | import java.util.List;
12 | import java.util.Map;
13 | import java.util.Set;
14 |
15 | /**
16 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
17 | * 16/2/6
18 | */
19 | public final class Preferences {
20 |
21 | private static final String TAG = "Preferences";
22 |
23 | private static final String SETTINGS_FILENAME = "com.baronzhang.android.modularization";
24 |
25 | private static final List CONFIGURATION_LISTENERS = Collections.synchronizedList(new ArrayList<>());
26 |
27 | private Context context;
28 | private static volatile Preferences instance;
29 |
30 | private Preferences(Context context) {
31 | this.context = context.getApplicationContext();
32 | }
33 |
34 | public static Preferences getInstance(Context context) {
35 | if (instance == null) {
36 | synchronized (Preferences.class) {
37 | if (instance == null) {
38 | instance = new Preferences(context);
39 | }
40 | }
41 | }
42 | return instance;
43 | }
44 |
45 | public void loadDefaults() {
46 | //设置SharedPreferences默认值
47 | try {
48 | Map defaultPrefs = new HashMap<>();
49 | AppSettings[] values = AppSettings.values();
50 | for (AppSettings value : values) {
51 | defaultPrefs.put(value, value.getDefaultValue());
52 | }
53 | savePreferences(defaultPrefs, true);
54 | } catch (Exception ex) {
55 | Log.e(TAG, "Save default settings fails", ex);
56 | }
57 | }
58 |
59 | public void addConfigurationListener(ConfigurationListener listener) {
60 | CONFIGURATION_LISTENERS.add(listener);
61 | }
62 |
63 | public void removeConfigurationListener(ConfigurationListener listener) {
64 | CONFIGURATION_LISTENERS.remove(listener);
65 | }
66 |
67 | public SharedPreferences getSharedPreferences(Context context) {
68 | return context.getSharedPreferences(SETTINGS_FILENAME, Context.MODE_PRIVATE);
69 | }
70 |
71 | public void savePreference(AppSettings pref, Object value) throws InvalidClassException {
72 | Map prefs = new HashMap<>();
73 | prefs.put(pref, value);
74 | savePreferences(prefs, false);
75 | }
76 |
77 | public void savePreferences(Map prefs) throws InvalidClassException {
78 | savePreferences(prefs, false);
79 | }
80 |
81 | private void savePreferences(Map prefs, boolean noSaveIfExists) throws InvalidClassException {
82 |
83 | SharedPreferences sp = getSharedPreferences(context);
84 | SharedPreferences.Editor editor = sp.edit();
85 |
86 | for (AppSettings pref : prefs.keySet()) {
87 |
88 | Object value = prefs.get(pref);
89 |
90 | if (noSaveIfExists && sp.contains(pref.getId())) {
91 | continue;
92 | }
93 |
94 | if (value instanceof Boolean && pref.getDefaultValue() instanceof Boolean) {
95 | editor.putBoolean(pref.getId(), (Boolean) value);
96 | } else if (value instanceof String && pref.getDefaultValue() instanceof String) {
97 | editor.putString(pref.getId(), (String) value);
98 | } else if (value instanceof Set && pref.getDefaultValue() instanceof Set) {
99 | editor.putStringSet(pref.getId(), (Set) value);
100 | } else if (value instanceof Integer && pref.getDefaultValue() instanceof Integer) {
101 | editor.putInt(pref.getId(), (Integer) value);
102 | } else if (value instanceof Float && pref.getDefaultValue() instanceof Float) {
103 | editor.putFloat(pref.getId(), (Float) value);
104 | } else if (value instanceof Long && pref.getDefaultValue() instanceof Long) {
105 | editor.putLong(pref.getId(), (Long) value);
106 | } else {
107 | //The object is not of the appropriate type
108 | String msg = String.format("%s: %s", pref.getId(), value.getClass().getName());
109 | Log.e(TAG, String.format("Configuration error. InvalidClassException: %s", msg));
110 | throw new InvalidClassException(msg);
111 | }
112 | }
113 |
114 | editor.apply();
115 |
116 | if (CONFIGURATION_LISTENERS != null && CONFIGURATION_LISTENERS.size() > 0) {
117 | for (AppSettings pref : prefs.keySet()) {
118 | Object value = prefs.get(pref);
119 | for (ConfigurationListener listener : CONFIGURATION_LISTENERS) {
120 | listener.onConfigurationChanged(pref, value);
121 | }
122 | }
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/lib-data-local/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/lib-data-net/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/lib-data-net/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | }
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "29.0.3"
8 |
9 | defaultConfig {
10 | minSdkVersion 19
11 | targetSdkVersion 29
12 | versionCode 1
13 | versionName "1.0"
14 |
15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
16 | consumerProguardFiles "consumer-rules.pro"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | }
30 |
31 | dependencies {
32 |
33 | api fileTree(include: ['*.jar'], dir: 'libs')
34 | api project(':lib-open-source')
35 | }
--------------------------------------------------------------------------------
/lib-data-net/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BaronZ88/ModularizationProject/f6f664169230d13f1188bf773d92d58140328cf0/lib-data-net/consumer-rules.pro
--------------------------------------------------------------------------------
/lib-data-net/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/lib-data-net/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/ApiClient.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net;
2 |
3 | import com.modularization.data.net.service.ServiceWrap;
4 | import com.facebook.stetho.okhttp3.StethoInterceptor;
5 |
6 | import com.modularization.data.net.configuration.ApiConfiguration;
7 | import com.modularization.data.net.converter.FastJsonConverterFactory;
8 |
9 | import java.util.HashMap;
10 | import java.util.Map;
11 |
12 | import okhttp3.OkHttpClient;
13 | import okhttp3.logging.HttpLoggingInterceptor;
14 | import retrofit2.Retrofit;
15 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
16 |
17 | /**
18 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
19 | * 2017/1/5
20 | */
21 | public final class ApiClient {
22 |
23 | private OkHttpClient client;
24 | private ApiConfiguration configuration;
25 | private Map apiServiceMap;
26 |
27 | private static volatile ApiClient instance;
28 |
29 | private ApiClient() {
30 | }
31 |
32 | public static ApiClient getInstance(){
33 | if(instance == null){
34 | synchronized (ApiClient.class){
35 | if(instance == null){
36 | instance = new ApiClient();
37 | }
38 | }
39 | }
40 | return instance;
41 | }
42 |
43 | public void init(ApiConfiguration configuration) {
44 |
45 | this.configuration = configuration;
46 | this.apiServiceMap = new HashMap<>();
47 |
48 | OkHttpClient.Builder builder = new OkHttpClient().newBuilder();
49 | if (BuildConfig.DEBUG) {
50 | HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor();
51 | httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
52 | builder.addInterceptor(httpLoggingInterceptor).addNetworkInterceptor(new StethoInterceptor());
53 | }
54 | builder.addNetworkInterceptor(new SignInterceptor());
55 | this.client = builder.build();
56 | }
57 |
58 | public synchronized T getService(ServiceWrap proxy) {
59 |
60 | String host = proxy.getHost();
61 | Class serviceClass = proxy.getRealService();
62 |
63 | String key = proxy.getModuleName() + "$$" + proxy.getIdentify();
64 |
65 | if (apiServiceMap.containsKey(key)) {
66 | Object service = apiServiceMap.get(key);
67 | if (serviceClass.isInstance(service)) {
68 | return serviceClass.cast(service);
69 | }
70 | }
71 |
72 | Retrofit retrofit = new Retrofit.Builder()
73 | .baseUrl(host)
74 | .addConverterFactory(FastJsonConverterFactory.create())
75 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
76 | .client(client)
77 | .build();
78 | T service = retrofit.create(serviceClass);
79 | apiServiceMap.put(key, service);
80 | return service;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/ApiConstants.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2017/1/5
6 | */
7 | public final class ApiConstants {
8 | }
9 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/SignInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net;
2 |
3 | import java.io.IOException;
4 |
5 | import okhttp3.Interceptor;
6 | import okhttp3.Response;
7 |
8 | /**
9 | * 用于API签名的拦截器
10 | *
11 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
12 | */
13 | public class SignInterceptor implements Interceptor {
14 |
15 | @Override
16 | public Response intercept(Chain chain) throws IOException {
17 | return chain.proceed(chain.request());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/configuration/ApiConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net.configuration;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | * 2016/12/10
6 | */
7 | public class ApiConfiguration {
8 |
9 | private ApiEnv apiEnv;
10 |
11 | private ApiConfiguration(Builder builder) {
12 | assert builder != null;
13 | initialize(builder);
14 | }
15 |
16 | public static Builder builder() {
17 | return new Builder();
18 | }
19 |
20 | private void initialize(final Builder builder) {
21 | this.apiEnv = builder.apiEnv;
22 | }
23 |
24 | public ApiEnv getApiEnv() {
25 | return apiEnv;
26 | }
27 |
28 | public static final class Builder {
29 |
30 | private ApiEnv apiEnv;
31 |
32 | private Builder() {
33 | }
34 |
35 | public ApiConfiguration build() {
36 | return new ApiConfiguration(this);
37 | }
38 |
39 | public Builder apiEnv(ApiEnv apiEnv) {
40 | this.apiEnv = apiEnv;
41 | return this;
42 | }
43 | }
44 |
45 | public enum ApiEnv{
46 | ENV_TEST,
47 | ENV_RELEASE,
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/converter/FastJsonConverterFactory.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net.converter;
2 |
3 | import com.alibaba.fastjson.serializer.SerializeConfig;
4 |
5 | import java.lang.annotation.Annotation;
6 | import java.lang.reflect.Type;
7 |
8 | import okhttp3.RequestBody;
9 | import okhttp3.ResponseBody;
10 | import retrofit2.Converter;
11 | import retrofit2.Retrofit;
12 |
13 | /**
14 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
15 | * 16/2/25
16 | */
17 | public class FastJsonConverterFactory extends Converter.Factory {
18 |
19 | private final SerializeConfig serializeConfig;
20 |
21 | private FastJsonConverterFactory(SerializeConfig serializeConfig) {
22 | if (serializeConfig == null)
23 | throw new NullPointerException("serializeConfig == null");
24 | this.serializeConfig = serializeConfig;
25 | }
26 |
27 | public static FastJsonConverterFactory create() {
28 | return create(SerializeConfig.getGlobalInstance());
29 | }
30 |
31 | public static FastJsonConverterFactory create(SerializeConfig serializeConfig) {
32 | return new FastJsonConverterFactory(serializeConfig);
33 | }
34 |
35 | @Override
36 | public Converter, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
37 | return new FastJsonRequestBodyConverter<>(serializeConfig);
38 | }
39 |
40 | @Override
41 | public Converter responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
42 | return new FastJsonResponseBodyConvert<>(type);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/converter/FastJsonRequestBodyConverter.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net.converter;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.alibaba.fastjson.serializer.SerializeConfig;
5 |
6 | import java.io.IOException;
7 |
8 | import okhttp3.MediaType;
9 | import okhttp3.RequestBody;
10 | import retrofit2.Converter;
11 |
12 | /**
13 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
14 | * 16/2/25
15 | */
16 | final class FastJsonRequestBodyConverter implements Converter {
17 |
18 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
19 |
20 | private SerializeConfig serializeConfig;
21 |
22 | public FastJsonRequestBodyConverter(SerializeConfig serializeConfig) {
23 | this.serializeConfig = serializeConfig;
24 | }
25 |
26 | @Override
27 | public RequestBody convert(T value) throws IOException {
28 | return RequestBody.create(MEDIA_TYPE, JSON.toJSONBytes(value, serializeConfig));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/converter/FastJsonResponseBodyConvert.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net.converter;
2 |
3 | import com.alibaba.fastjson.JSON;
4 |
5 | import java.io.IOException;
6 | import java.lang.reflect.Type;
7 |
8 | import okhttp3.ResponseBody;
9 | import retrofit2.Converter;
10 |
11 | /**
12 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
13 | * 16/2/25
14 | */
15 | final class FastJsonResponseBodyConvert implements Converter {
16 |
17 | private Type type;
18 |
19 | public FastJsonResponseBodyConvert(Type type) {
20 | this.type = type;
21 | }
22 |
23 | @Override
24 | public T convert(ResponseBody value) throws IOException {
25 | return JSON.parseObject(value.string(), type);
26 | }
27 | }
--------------------------------------------------------------------------------
/lib-data-net/src/main/java/com/modularization/data/net/service/ServiceWrap.java:
--------------------------------------------------------------------------------
1 | package com.modularization.data.net.service;
2 |
3 | /**
4 | * @author baronzhang (baron[dot]zhanglei[at]gmail[dot]com)
5 | */
6 | public interface ServiceWrap {
7 |
8 | String getIdentify();
9 |
10 | String getModuleName();
11 |
12 | String getHost();
13 |
14 | Class getRealService();
15 | }
16 |
--------------------------------------------------------------------------------
/lib-open-source/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/lib-open-source/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 29
5 | buildToolsVersion '29.0.3'
6 |
7 | defaultConfig {
8 | minSdkVersion 19
9 | targetSdkVersion 29
10 | versionCode 1
11 | versionName "1.0"
12 |
13 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
14 |
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 |
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_1_8
26 | targetCompatibility JavaVersion.VERSION_1_8
27 | }
28 | }
29 |
30 | dependencies {
31 | api fileTree(include: ['*.jar'], dir: 'libs')
32 |
33 | implementation rootProject.ext.dependencies["butterknife"]
34 | annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
35 |
36 | api 'io.reactivex:rxandroid:1.2.1'
37 |
38 | api rootProject.ext.dependencies["retrofit"]
39 | api rootProject.ext.dependencies["adapter-rxjava"]
40 |
41 | api rootProject.ext.dependencies["stetho"]
42 | api rootProject.ext.dependencies["stetho-okhttp3"]
43 |
44 | api rootProject.ext.dependencies["okhttp3"]
45 | api rootProject.ext.dependencies["okhttp3-logging-interceptor"]
46 |
47 | api rootProject.ext.dependencies["fastjson"]
48 | api rootProject.ext.dependencies["ormlite-android"]
49 | }
50 |
--------------------------------------------------------------------------------
/lib-open-source/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/baron/develop/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 |
--------------------------------------------------------------------------------
/lib-open-source/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/lib-open-source/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app',
2 | ':biz-module-main',
3 | ':biz-module-newhouse',
4 | ':biz-module-secondhouse',
5 | ':biz-module-renthouse',
6 |
7 | ':biz-service-base',
8 | ':biz-service-newhouse',
9 | ':biz-service-secondhouse',
10 | ':biz-service-renthouse',
11 |
12 | ':lib-common',
13 | ':lib-data-local',
14 | ':lib-data-net',
15 | ':lib-open-source'
16 |
--------------------------------------------------------------------------------