Skip to content

Commit c93d2bc

Browse files
author
1170762202@qq.com
committed
1.module单独编译运行
2.module-main迁移至app,并移除module-main
1 parent f02238c commit c93d2bc

File tree

87 files changed

+642
-265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+642
-265
lines changed

.idea/gradle.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
[源码地址](https://github.com/1170762202/WanAndroid)
55
喜欢的话,记得给个star哦!
66

7+
### [1.1.1版本更新](https://github.com/1170762202/WanAndroid/releases)
8+
* module单独编译运行
9+
* module-main迁移至app,并移除module-main
10+
711
#### [历史版本](https://github.com/1170762202/WanAndroid/releases)
812

913
#### 首页有彩蛋哦,等你发现!!!
@@ -51,7 +55,6 @@
5155
||--library-common//通用库(全局Context获取等)
5256
||--library-widget// 控件封装
5357
||--modules// 功能模块
54-
||--module-main// 主页模块
5558
||--module-home// 首页模块
5659
||--module-login// 登录模块
5760
||--module-project// 项目模块
@@ -62,6 +65,11 @@
6265
||-- README.md
6366
```
6467

68+
#### module单独编译运行说明
69+
gradle.properties 文件下有个"集成开发模式" 和 "组件开发模式"的切换开关 true表示组件独立运行,false表示一个library
70+
````java
71+
isRunModule=true
72+
````
6573

6674

6775

app/build.gradle

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
apply plugin: 'com.android.application'
22
apply plugin: 'android-aspectjx'
3+
apply plugin: 'com.jakewharton.butterknife'
4+
35

46
def keystorePropertiesFile = rootProject.file("keystore.properties")
57
def keystoreProperties = new Properties()
@@ -53,33 +55,26 @@ android {
5355
dependencies {
5456
implementation fileTree(dir: 'libs', include: ['*.jar'])
5557
// AndroidJUnitRunner and JUnit Rules
56-
androidTestImplementation 'androidx.test:runner:1.1.1'
57-
androidTestImplementation 'androidx.test:rules:1.1.1'
58-
59-
60-
annotationProcessor rootProject.ext.dependencies.butterknifeCompiler
61-
62-
/*materialedittex*/
63-
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
64-
65-
66-
67-
implementation 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
68-
implementation 'com.github.ozodrukh:CircularReveal:1.0.5@aar'
69-
58+
androidTestImplementation 'androidx.test:runner:1.3.0'
59+
androidTestImplementation 'androidx.test:rules:1.3.0'
7060

7161

7262
implementation project(':library-base')
7363
implementation project(':library-widget')
7464
implementation project(':library-common')
7565
implementation project(':library-aop')
76-
implementation project(':module-main')
77-
implementation project(':module-home')
78-
implementation project(':module-project')
79-
implementation project(':module-square')
80-
implementation project(':module-public')
81-
implementation project(':module-mine')
82-
implementation project(':module-web')
83-
implementation project(':module-login')
66+
if (!isRunModule.toBoolean()) {
67+
implementation project(':module-home')
68+
implementation project(':module-project')
69+
implementation project(':module-square')
70+
implementation project(':module-public')
71+
implementation project(':module-mine')
72+
implementation project(':module-web')
73+
implementation project(':module-login')
74+
}
75+
76+
77+
annotationProcessor rootProject.ext.dependencies.butterknifeCompiler
78+
annotationProcessor rootProject.ext.dependencies.arouterCompiler
8479

8580
}

app/src/main/AndroidManifest.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
android:hardwareAccelerated="true"
1414
android:icon="@mipmap/logo"
1515
android:label="@string/app_name"
16-
android:roundIcon="@mipmap/ic_launcher_round"
16+
android:roundIcon="@mipmap/logo"
1717
android:supportsRtl="true"
1818
android:theme="@style/AppWelcome"
1919
android:usesCleartextTraffic="true"
@@ -36,6 +36,16 @@
3636
android:value="true" />
3737

3838

39+
40+
<activity android:name=".activity.MainActivity"/>
41+
<activity android:name=".activity.SplashAc"
42+
android:theme="@style/AppTheme.Splash">
43+
<intent-filter>
44+
<action android:name="android.intent.action.MAIN" />
45+
46+
<category android:name="android.intent.category.LAUNCHER" />
47+
</intent-filter>
48+
</activity>
3949
</application>
4050

4151
</manifest>

module-main/src/main/java/com/zlx/module_main/activity/MainActivity.java renamed to app/src/main/java/com/zlx/sharelive/activity/MainActivity.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.zlx.module_main.activity;
1+
package com.zlx.sharelive.activity;
22

33
import android.content.Intent;
44
import android.graphics.Typeface;
@@ -9,13 +9,12 @@
99

1010
import com.alibaba.android.arouter.facade.annotation.Route;
1111
import com.alibaba.android.arouter.launcher.ARouter;
12-
import com.zlx.module_main.R;
13-
import com.zlx.module_main.R2;
14-
import com.zlx.module_main.adapter.VpAdapterMain;
15-
import com.zlx.module_main.impl.TabPagerListener;
1612
import com.zlx.module_base.base_ac.BaseAc;
1713
import com.zlx.module_base.constant.RouterActivityPath;
1814
import com.zlx.module_base.constant.RouterFragmentPath;
15+
import com.zlx.sharelive.R;
16+
import com.zlx.sharelive.adapter.VpAdapterMain;
17+
import com.zlx.sharelive.impl.TabPagerListener;
1918
import com.zlx.widget.bubblenavigation.BubbleNavigationConstraintView;
2019
import com.zlx.widget.bubblenavigation.listener.BubbleNavigationChangeListener;
2120
import com.zlx.widget.viewpager.NoScrollViewPager;
@@ -27,9 +26,9 @@
2726
public class MainActivity extends BaseAc implements BubbleNavigationChangeListener, TabPagerListener {
2827

2928

30-
@BindView(R2.id.viewPager)
29+
@BindView(R.id.viewPager)
3130
NoScrollViewPager viewPager;
32-
@BindView(R2.id.bottom_navigation_view_linear)
31+
@BindView(R.id.bottom_navigation_view_linear)
3332
BubbleNavigationConstraintView bubbleNavigationLinearView;
3433

3534

module-login/src/main/java/com/zlx/module_login/activity/SplashAc.java renamed to app/src/main/java/com/zlx/sharelive/activity/SplashAc.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
package com.zlx.module_login.activity;
1+
package com.zlx.sharelive.activity;
22

3-
import com.zlx.module_base.database.MMkvHelper;
3+
import com.zlx.module_base.base_ac.BaseAc;
44
import com.zlx.module_base.base_api.res_data.ProjectListRes;
55
import com.zlx.module_base.base_api.util.ApiUtil;
6-
import com.zlx.module_base.base_ac.BaseAc;
76
import com.zlx.module_base.base_util.RouterUtil;
8-
import com.zlx.module_login.R;
9-
import com.zlx.module_login.R2;
7+
import com.zlx.module_base.database.MMkvHelper;
108
import com.zlx.module_network.api1.livedata.BaseObserver;
119
import com.zlx.module_network.api1.livedata.BaseObserverCallBack;
1210
import com.zlx.module_network.bean.ApiResponse;
11+
import com.zlx.sharelive.R;
1312

1413
import java.util.List;
1514

@@ -23,7 +22,7 @@
2322
*/
2423
public class SplashAc extends BaseAc {
2524

26-
@BindView(R2.id.particleview)
25+
@BindView(R.id.particleview)
2726
ParticleView particleview;
2827

2928
@Override

module-main/src/main/java/com/zlx/module_main/adapter/VpAdapterMain.java renamed to app/src/main/java/com/zlx/sharelive/adapter/VpAdapterMain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.zlx.module_main.adapter;
1+
package com.zlx.sharelive.adapter;
22

33
import androidx.fragment.app.Fragment;
44
import androidx.fragment.app.FragmentManager;
55
import androidx.fragment.app.FragmentPagerAdapter;
66

7-
import com.zlx.module_main.impl.TabPagerListener;
7+
import com.zlx.sharelive.impl.TabPagerListener;
88

99
/**
1010
* @date: 2019\3\5 0005

module-main/src/main/java/com/zlx/module_main/impl/TabPagerListener.java renamed to app/src/main/java/com/zlx/sharelive/impl/TabPagerListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.zlx.module_main.impl;
1+
package com.zlx.sharelive.impl;
22

33
import androidx.fragment.app.Fragment;
44

module-main/src/main/java/com/zlx/module_main/intercept/LoginInterceptor.java renamed to app/src/main/java/com/zlx/sharelive/intercept/LoginInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.zlx.module_main.intercept;
1+
package com.zlx.sharelive.intercept;
22

33
import android.content.Context;
44
import android.util.Log;

app/src/main/res/values/colors.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="colorPrimary">#36C1BC</color>
4-
<color name="colorPrimaryDark">#00574B</color>
5-
<color name="colorAccent">#36C1BC</color>
3+
64

75
</resources>

config.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ext {
55
compileSdkVersion: 28,
66
minSdkVersion : 21,
77
targetSdkVersion : 28,
8-
versionCode : 4,
9-
versionName : "1.0",
8+
versionCode : 1,
9+
versionName : "1.1",
1010
]
1111

1212

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ android.enableJetifier=true
1717
android.injected.testOnly = false
1818

1919

20-
# isMainModule 是 "集成开发模式" 和 "组件开发模式"的切换开关 true表示组件独立运行,false表示一个library
21-
isMainModule=false
20+
# "集成开发模式" 和 "组件开发模式"的切换开关 true表示组件独立运行,false表示一个library
21+
isRunModule=true

library-base/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ dependencies {
9797
api 'com.scwang.smart:refresh-header-two-level:2.0.1' //二级刷新头
9898

9999
api "com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4"
100+
api 'me.wangyuwei:ParticleView:1.0.4'
100101

101102
api project(':library-db')
102103
api project(':library-network')

library-base/src/main/java/com/zlx/module_base/base_api/res_data/UserInfo.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public class UserInfo implements Parcelable {
4141
private String rank;
4242
private String userId, reason, desc, date;
4343

44+
public UserInfo() {
45+
}
46+
4447
protected UserInfo(Parcel in) {
4548
email = in.readString();
4649
icon = in.readString();

module-login/src/main/res/drawable/splash_bg.xml renamed to library-base/src/main/res/drawable/splash_bg.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<item>
1515
<bitmap
1616
android:gravity="center"
17-
android:src="@mipmap/logo" />
17+
android:src="@mipmap/logo1" />
1818
</item>
1919

2020
</layer-list>

library-base/src/main/res/layout/top_bar.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
android:background="?attr/selectableItemBackgroundBorderless"
4949
android:paddingStart="10dp"
5050
android:paddingEnd="10dp"
51-
android:src="@mipmap/ic_more_menu"
5251
android:visibility="gone"
5352
tools:visibility="visible" />
5453
</LinearLayout>
5.12 KB
Loading

library-base/src/main/res/values/colors.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3+
<color name="colorPrimary">#36C1BC</color>
4+
<color name="colorPrimaryDark">#00574B</color>
5+
<color name="colorAccent">#36C1BC</color>
6+
37
<color name="black">#000000</color>
48
<color name="main">#ffffff</color>
59
<color name="dividerColor">#E6E3E3</color>

library-base/src/main/res/values/styles.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,7 @@
2525
<item name="android:windowNoTitle">true</item>
2626
<item name="android:background">@color/main</item>
2727
</style>
28+
<style name="AppTheme.Splash">
29+
<item name="android:windowBackground">@drawable/splash_bg</item>
30+
</style>
2831
</resources>

library-widget/src/main/java/com/zlx/widget/hivelayoutmanager/HiveLayoutManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import androidx.annotation.IntDef;
1010
import androidx.recyclerview.widget.RecyclerView;
1111

12+
import java.lang.annotation.Retention;
13+
import java.lang.annotation.RetentionPolicy;
1214
import java.util.ArrayList;
1315
import java.util.List;
1416

@@ -58,6 +60,7 @@ public class HiveLayoutManager extends RecyclerView.LayoutManager {
5860
* @see #VERTICAL
5961
* @see #HORIZONTAL
6062
*/
63+
@Retention(RetentionPolicy.SOURCE)
6164
@IntDef({HORIZONTAL, VERTICAL})
6265
@interface Orientation {
6366
}

module-home/build.gradle

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
apply plugin: 'com.android.library'
1+
if (isRunModule.toBoolean()) {
2+
apply plugin: 'com.android.application'
3+
} else {
4+
apply plugin: 'com.android.library'
5+
}
6+
27
apply plugin: 'com.jakewharton.butterknife'
38

49
android {
510
compileSdkVersion rootProject.ext.android.compileSdkVersion
611

712

813
defaultConfig {
9-
if (isMainModule.toBoolean()) {
10-
applicationId "com.zlx.home"
14+
if (isRunModule.toBoolean()) {
15+
applicationId "com.zlx.module_home"
1116
}
1217
minSdkVersion rootProject.ext.android.minSdkVersion
1318
targetSdkVersion rootProject.ext.android.targetSdkVersion
@@ -28,6 +33,19 @@ android {
2833
sourceCompatibility JavaVersion.VERSION_1_8
2934
targetCompatibility JavaVersion.VERSION_1_8
3035
}
36+
sourceSets {
37+
38+
main {
39+
// 1.单独调试与集成调试时使用不同的 AndroidManifest.xml 文件
40+
// 我们还可以根据不同工程配置不同的 Java 源代码、不同的 resource 资源文件等的
41+
if (isRunModule.toBoolean()) {
42+
43+
manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
44+
} else {
45+
manifest.srcFile 'src/main/AndroidManifest.xml'
46+
}
47+
}
48+
}
3149
}
3250

3351
dependencies {
@@ -41,4 +59,8 @@ dependencies {
4159
annotationProcessor rootProject.ext.dependencies.butterknifeCompiler
4260
annotationProcessor rootProject.ext.dependencies.arouterCompiler
4361

62+
if (isRunModule.toBoolean()) {
63+
implementation project(':module-web')
64+
}
65+
4466
}

module-home/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.zlx.module_home">
33

4-
/
4+
55
<application>
66
<activity android:name=".activity.SearchAc" />
77
<activity android:name=".activity.SearchResultAc" />
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.zlx.module_home;
2+
3+
import com.zlx.module_base.BaseApplication;
4+
import com.zlx.module_base.config.ModuleLifecycleConfig;
5+
6+
/**
7+
* Created by zlx on 2020/9/30 12:32
8+
* Email: 1170762202@qq.com
9+
* Description:
10+
*/
11+
public class HomeApp extends BaseApplication {
12+
@Override
13+
public void onCreate() {
14+
super.onCreate();
15+
16+
ModuleLifecycleConfig.getInstance().initModuleAhead(this);
17+
}
18+
}

0 commit comments

Comments
 (0)