Commit 4fc05a61ce01420612499429eed0f707bfa534fe

Authored by YangShuai
1 parent 556ee8b2

1 base提交maven

app/strike/src/main/java/com/cnlive/strike/MyFragment1.java
... ... @@ -2,6 +2,7 @@ package com.cnlive.strike;
2 2  
3 3  
4 4 import android.os.Bundle;
  5 +import android.util.Log;
5 6 import android.view.LayoutInflater;
6 7 import android.view.View;
7 8 import android.view.ViewGroup;
... ... @@ -11,6 +12,11 @@ import androidx.annotation.Nullable;
11 12  
12 13 import com.cnlive.core.libs.base.frame.fragment.BaseFragment;
13 14 import com.cnlive.core.libs.base.util.StatusBarConfig;
  15 +import com.cnlive.core.network.HttpConn;
  16 +import com.cnlive.core.network.NetCallBack;
  17 +import com.cnlive.strike.network.BaseRequest;
  18 +import com.cnlive.strike.network.api.ApiService;
  19 +import com.cnlive.strike.network.bean.TestBean;
14 20  
15 21  
16 22 public class MyFragment1 extends BaseFragment {
... ... @@ -26,6 +32,33 @@ public class MyFragment1 extends BaseFragment {
26 32 super.initView();
27 33 setStatusBarColor(R.color.qmui_config_color_red, 0);
28 34 setStatusBarTextColor(StatusBarConfig.BLACK);
  35 + baseView.findViewById(R.id.btn_test).setOnClickListener(new View.OnClickListener() {
  36 + @Override
  37 + public void onClick(View v) {
  38 + //单个请求
  39 + HttpConn.action(
  40 + BaseRequest
  41 + .init()
  42 + .setUrl("http://gank.io/api/data/")
  43 + .service(ApiService.class)
  44 + .getTest(), new NetCallBack<TestBean>() {
  45 + @Override
  46 + public void onRequestState(int state) {
29 47  
  48 + }
  49 +
  50 + @Override
  51 + public void onSuccess(TestBean data) {
  52 + Log.e(TAG, "onSuccess: " + data.getResults().size());
  53 + }
  54 +
  55 + @Override
  56 + public void onFailure(String errCode, String errMsg) {
  57 + Log.e(TAG, "onFailure: " + errMsg);
  58 + }
  59 +
  60 + });
  61 + }
  62 + });
30 63 }
31 64 }
... ...
build.gradle
... ... @@ -14,7 +14,6 @@ buildscript {
14 14 }
15 15 dependencies {
16 16 classpath 'com.android.tools.build:gradle:3.5.1'
17   -
18 17 // NOTE: Do not place your application dependencies here; they belong
19 18 // in the individual module build.gradle files
20 19 classpath "com.alibaba:arouter-register:1.0.2"
... ... @@ -109,7 +108,8 @@ allprojects {
109 108 imput("implementation", project, moudle.core_base)
110 109  
111 110 //Tripartite Base
112   - for (String moudle : base_librarys) imput('implementation', project, moudle)
  111 +// for (String moudle : base_librarys) imput('implementation', project, moudle)
  112 + for (String moudle : base_librarys) imput('api', project, moudle)
113 113 for (String moudle : base_compilers) imput('annotationProcessor', project, moudle)
114 114  
115 115 }
... ... @@ -118,11 +118,22 @@ allprojects {
118 118 google()
119 119 jcenter()
120 120 maven {
121   - url mixedUrl
122   - credentials { username = mavenUsername; password = mavenPassword }
  121 + url maven.mixedUrl
  122 + credentials { username = nexusId; password = nexusPw }
  123 + }
  124 + //------------------ 资源库配置 END------------------
  125 + maven {
  126 + url 'https://dl.bintray.com/granzon/cnlive'
  127 + }
  128 + maven {
  129 + url 'https://dl.bintray.com/granzon/cnliveLibs'
  130 + }
  131 + maven {
  132 + url "https://jitpack.io"
  133 + }
  134 + maven {
  135 + url 'http://developer.huawei.com/repo'
123 136 }
124   - maven { url 'https://jitpack.io' }
125   - maven { url 'http://developer.huawei.com/repo' }
126 137 }
127 138 }
128 139 task clean(type: Delete) {
... ... @@ -131,6 +142,6 @@ task clean(type: Delete) {
131 142  
132 143 //配置全局变量
133 144 ext {
134   - libEmoj='2.0.9'
  145 + libEmoj = '2.0.9'
135 146 libMediaPicker = '1.5.8'
136 147 }
... ...
config.gradle
1 1 ext {
2   - mixedUrl = "http://android.nexus.cnlive.com/repository/cnlive-mixed/"
3   - mavenUsername = "developer"
4   - mavenPassword = "android_2019"
  2 + //Nexus 访问账号
  3 + nexusId = "developer"
  4 + nexusPw = "android_2019"
5 5  
6 6 //Nexus 发布配置
7 7 maven = [
... ... @@ -46,6 +46,17 @@ ext {
46 46 espresso: 'androidx.test.espresso:espresso-core:3.2.0'
47 47 ]
48 48  
  49 + //Maven Base库配置
  50 + moudle_cnlive_base = [
  51 + //编译方式
  52 + debug : false,
  53 + //版本号
  54 + version: "0.0.2",
  55 + //Lib库前缀
  56 + packeg : "com.cnlive.core",
  57 + //Lib库名称
  58 + name : "base"
  59 + ]
49 60 library = [
50 61  
51 62 //fragment滑动返回( https://github.com/YoKeyword/Fragmentation ,源码导入修改)
... ... @@ -54,15 +65,15 @@ ext {
54 65 fragmentationx : 'me.yokeyword:fragmentationx:1.0.2',
55 66 //log日志
56 67 logger : 'com.orhanobut:logger:2.2.0',
57   -// //空祖对话框 https://github.com/kongzue/DialogV3
58   -// kongzueDailog : 'com.kongzue.dialog_v3x:dialog:3.1.6',
  68 + //空祖对话框 https://github.com/kongzue/DialogV3 (源码导入,修改)
  69 + kongzueDailog : 'com.kongzue.dialog_v3x:dialog:3.1.6',
59 70 //视讯云加密
60 71 libCnencipher : 'com.cnlive:lib-cnencipher:1.1.1',
61 72 //视频库
62 73 libVideoQiniu : 'com.cnlive.libs:video_qiniu:1.0.6',
63 74 //视讯云播放器
64 75 libCnVideo : 'com.cnlive:lib_cnvideo2.0:3.3.11',
65   - //权限
  76 +// //权限
66 77 easypermissions : 'pub.devrel:easypermissions:1.0.0',
67 78 //MVP
68 79 mvp : 'com.hannesdorfmann.mosby3:mvp:3.0.4',
... ... @@ -102,65 +113,48 @@ ext {
102 113 cardviewV7 : 'com.android.support:cardview-v7:28.0.0',
103 114 dataBinding : 'com.android.databinding.library:3.5.1'
104 115 ]
105   -// library_jar = [
106   -// pinyin4j: ('libs/pinyin4j-2.5.0.jar')
107   -// ]
108 116 //基础三方库
109 117 base_librarys = [
110   -// library.fragmentation_swipeback,
111   -// library.fragmentationx,
112   -library.logger,
113   -//对话框
114   -// library.kongzueDailog,
115   -//视讯云加密库
116   -library.libCnencipher,
117   -//视频库
118   -library.libVideoQiniu,
119   -//视讯云播放器
120   -library.libCnVideo,
121   -//权限
122   -library.easypermissions,
123   -//EvenBus
124   -library.eventBus,
125   -//QMUI
126   -library.qmui,
127   -library.qmui_arch,
128   -//mvp
  118 + library.logger,
  119 + //视讯云加密库
  120 + library.libCnencipher,
  121 + //视频库
  122 + library.libVideoQiniu,
  123 + //视讯云播放器
  124 + library.libCnVideo,
  125 + //权限
  126 + library.easypermissions,
  127 + //EvenBus
  128 + library.eventBus,
  129 + //QMUI
  130 + library.qmui,
  131 + library.qmui_arch,
  132 + //mvp
129 133 // library.mvp,
130 134 // library.mvp_lce,
131 135 // library.mvp_nullobject_presenter,
132 136 // library.mvp_viewstate,
133   -//图片加载Glide
134   -glide.api,
135   -glide.transformations,
136   -//兼容旧版
137   -// library.supportV4,
138   -// library.appcompatV7,
139   -// library.design,
140   -// library.supportV13,
141   -// library.recyclerviewV7,
142   -// library.cardviewV7,
143   -// library.dataBinding,
144   -//使用androidx
145   -androidx.appcompat,
146   -androidx.constraintlayout,
147   -androidx.multidex,
148   -//其他库
149   -library.rxjava,
150   -library.rxandroid,
151   -library.retrofit,
152   -library.retrofitConverterGson,
153   -library.retrofitAdapterRxjava2,
154   -library.okhttp,
155   -library.okhttpLoggingInterceptor,
156   -library.greendao,
157   -//管理rxjava生命周期
158   -// library.rx
159   -router.api,
160   -
161   -test.junit,
162   -test.runner,
163   -test.espresso
  137 + //图片加载Glide
  138 + glide.api,
  139 + glide.transformations,
  140 + //使用androidx
  141 + androidx.appcompat,
  142 + androidx.constraintlayout,
  143 + androidx.multidex,
  144 + //其他库
  145 + library.rxjava,
  146 + library.rxandroid,
  147 + library.retrofit,
  148 + library.retrofitConverterGson,
  149 + library.retrofitAdapterRxjava2,
  150 + library.okhttp,
  151 + library.okhttpLoggingInterceptor,
  152 + //数据库
  153 + library.greendao,
  154 + router.api,
  155 + test.junit,
  156 + test.runner,
  157 + test.espresso
164 158 ]
165 159  
166 160 base_compilers = [
... ... @@ -170,10 +164,6 @@ test.espresso
170 164 router.compiler
171 165 ]
172 166  
173   -// base_jar = [
174   -// library_jar.pinyin4j
175   -// ]
176   -
177 167 //正式签名配置
178 168 Properties properties = new Properties()
179 169 properties.load(project.rootProject.file('local.properties').newDataInputStream())
... ...
core/base/base_maven_push.gradle 0 → 100644
  1 +apply plugin: 'maven'
  2 +
  3 +uploadArchives() {
  4 + repositories {
  5 + mavenDeployer {
  6 + def lib = moudle_cnlive_base
  7 + //发布环境(正式/测试)
  8 + android.defaultPublishConfig lib.debug ? "debug" : "release"
  9 + //发布渠道(地址/账号)
  10 + repository(url: maven.mixedUrl) {
  11 + authentication(userName: maven.username, password: maven.password)
  12 + }
  13 + //发布信息(包名/别名/版本)
  14 + pom.project {
  15 + groupId lib.packeg
  16 + artifactId lib.name
  17 + version = lib.debug ? lib.version.concat("-SNAPSHOT") : lib.version
  18 + }
  19 + pom.whenConfigured { pom ->
  20 + pom.dependencies.clear()
  21 + }
  22 +
  23 + }
  24 + }
  25 +}
0 26 \ No newline at end of file
... ...
core/base/build.gradle
1 1 apply plugin: 'com.android.library'
2   -
  2 +apply from: './base_maven_push.gradle'
3 3 android {
4 4 // compileSdkVersion 29
5 5 // buildToolsVersion "29.0.2"
... ... @@ -27,6 +27,5 @@ android {
27 27 dependencies {
28 28 implementation fileTree(include: ['*.jar'], dir: 'libs')
29 29 api files('libs/pinyin4j-2.5.0.jar')
30   -
31 30 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
32 31 }
... ...
core/base/src/main/java/com/cnlive/core/libs/base/frame/activity/BaseActivity.java
... ... @@ -272,7 +272,7 @@ public abstract class BaseActivity&lt;V extends BaseView, P extends BasePresenter&lt;V
272 272 }
273 273 //activity管理
274 274 AppManager.getInstance().deleteActivity(me);
275   - //清除所有订阅
  275 + //清除当前订阅
276 276 SubscriptionManager.getInstance().cancel(TAG);
277 277 }
278 278  
... ...
core/base/src/main/java/com/cnlive/core/libs/base/frame/fragment/BaseFragment.java
... ... @@ -23,6 +23,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
23 23 import com.cnlive.core.libs.base.frame.activity.BaseActivity;
24 24 import com.cnlive.core.libs.base.frame.presenter.BasePresenter;
25 25 import com.cnlive.core.libs.base.interfaces.OnPermissionResponseListener;
  26 +import com.cnlive.core.libs.base.network.manager.SubscriptionManager;
26 27 import com.cnlive.core.libs.base.util.ParameterCache;
27 28 import com.cnlive.core.libs.base.util.ReflectUtil;
28 29 import com.cnlive.core.libs.base.frame.view.BaseView;
... ... @@ -97,6 +98,8 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
97 98 @Override
98 99 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
99 100 super.onViewCreated(view, savedInstanceState);
  101 + //创建订阅映射
  102 + SubscriptionManager.getInstance().setCurrentDisposables(TAG);
100 103 mSwipeDelegate.onViewCreated(view, savedInstanceState);
101 104 if (null != getMvpView() && null != getPresenter()) {
102 105 initBindingData();
... ... @@ -190,6 +193,8 @@ public abstract class BaseFragment&lt;V extends BaseView, P extends BasePresenter&lt;V
190 193 public void onDestroy() {
191 194 mDelegate.onDestroy();
192 195 mSwipeDelegate.onDestroyView();
  196 + //清除当前订阅
  197 + SubscriptionManager.getInstance().cancel(TAG);
193 198 super.onDestroy();
194 199 if (null != baseBinding) {
195 200 baseBinding.unbind();
... ...