Skip to content

Commit 7eaa2f3

Browse files
committed
组件化优化
1 parent c76cae4 commit 7eaa2f3

File tree

14 files changed

+83
-34
lines changed

14 files changed

+83
-34
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

.idea/caches/gradle_models.ser

436 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
apply plugin: 'com.android.application'
22

33
android {
4+
signingConfigs {
5+
debug {
6+
keyAlias 'kson'
7+
keyPassword '111111'
8+
storeFile file('/Users/kson/Documents/workspace/key/kson.jks')
9+
storePassword '111111'
10+
}
11+
release {
12+
keyAlias 'kson'
13+
keyPassword '111111'
14+
storeFile file('/Users/kson/Documents/workspace/key/kson.jks')
15+
storePassword '111111'
16+
}
17+
}
418
compileSdkVersion rootProject.ext.android.compileSdkVersion
519
defaultConfig {
620
applicationId rootProject.ext.android.applicationId
@@ -20,8 +34,14 @@ android {
2034
}
2135
buildTypes {
2236
release {
37+
buildConfigField "String", "BASE_URL", '"http://www.baidu.com/"'
2338
minifyEnabled false
2439
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
40+
signingConfig signingConfigs.release
41+
}
42+
debug {
43+
buildConfigField "String", "BASE_URL", '"http://172.10/"'
44+
signingConfig signingConfigs.debug
2545
}
2646
}
2747
}
@@ -44,7 +64,6 @@ dependencies {
4464
annotationProcessor rootProject.ext.dependencies["arouterCompile"]
4565
implementation project(':lib-core')
4666
implementation project(':andfix')
47-
4867
}
4968
configurations.all {
5069
resolutionStrategy.eachDependency { DependencyResolveDetails details ->

app/src/main/java/com/example/kson/moduledemo/activity/MainActivity.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.example.kson.lib_net.network.http.HttpRequestPresenter;
2121
import com.example.kson.lib_net.network.http.ModelCallback;
2222
import com.example.kson.lib_net.network.http.RetrofitHttpRequest;
23+
import com.example.kson.lib_net.utils.publickeytool.RsaCoder;
2324
import com.example.kson.moduledemo.R;
2425
import com.example.kson.moduledemo.UserApi;
2526
import com.example.kson.moduledemo.common.Constants;
@@ -67,22 +68,20 @@ protected void initView() {
6768
@Override
6869
public void onClick(View view) {
6970

70-
// HashMap<String, Object> params = new HashMap<>();
71-
// params.put("uid","71");
72-
// params.put("password","222222");
73-
// params.put("phone", "18612991523");
74-
// params.put("nickName", "18612991523");
75-
// params.put("pwd", RsaCoder.encryptByPublicKey("111111"));
76-
//// params.put("phone", "18612991523");
77-
// params.put("plateId", "12");
78-
// params.put("page", "1");
79-
// params.put("count", "5");
80-
//// params.put("pwd", RsaCoder.encryptByPublicKey("111111"));
81-
//
82-
// showToast("121212121212121");
83-
// presenter.infoRecommendList(params);
84-
85-
ARouter.getInstance().build("/home/home2").navigation();
71+
HashMap<String, Object> params = new HashMap<>();
72+
73+
params.put("email","19655910@qq.com");
74+
params.put("pwd",RsaCoder.encryptByPublicKey("111111"));
75+
// params.put("code","543562");
76+
// System.out.println("pwd1=="+RsaCoder.encryptByPublicKey("111111"));
77+
// System.out.println("pwd2=="+RsaCoder.encryptByPublicKey("111111"));
78+
// String s = RsaCoder.encryptByPublicKey("111111");
79+
// params.put("pwd1",s);
80+
// params.put("pwd2",s);
81+
82+
presenter.reg(params);
83+
84+
// ARouter.getInstance().build("/home/home2").navigation();
8685

8786
// ARouter.getInstance().build(APath.PUSH_MAIN).navigation();
8887

app/src/main/java/com/example/kson/moduledemo/application/MyApp.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@ public void onCreate() {
2929
ARouter.openLog(); // 打印日志
3030
ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险) }
3131
ARouter.init(this);
32+
//网络层的初始化
3233
NetApp.init(this, Constants.BASE_URL);
34+
//网络请求框架的初始化
3335
HttpRequestPresenter.init(new RetrofitHttpRequest(true));
34-
AndFixPatchManager.getInstance().initPatch(this);
3536

36-
startService(new Intent(this, AndFixService.class));
37+
//
38+
// AndFixPatchManager.getInstance().initPatch(this);
39+
//
40+
// startService(new Intent(this, AndFixService.class));
3741

3842

3943
}

app/src/main/java/com/example/kson/moduledemo/common/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
* Description:
1010
*/
1111
public class Constants {
12-
public static String BASE_URL = BuildConfig.DEBUG?"https://172.17.8.100/":"https://172.17.8.100/";
12+
public static String BASE_URL = BuildConfig.DEBUG?"http://172.17.8.100/":"http://172.17.8.100/";
1313
public static String LOGIN_URL = "techApi/user/v1/login";
1414
public static String CHECK_URL = "techApi/user/v1/checkPhone";
1515
// public static String NEWS_URL = "techApi/chat/verify/v1/findFriendGroupList";
1616
public static String NEWS_URL = "product/getCarts";
17-
public static String REG_URL = "techApi/user/v1/register";
17+
public static String REG_URL = "health/user/v1/login";
1818
}

app/src/main/java/com/example/kson/moduledemo/model/LoginModel.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public void onSuccessMsg(String status, String message) {
9595
}
9696

9797
@Override
98-
public void reg(HashMap<String, Object> params, PresenterCallback<UserEntity> callback) {
99-
HttpRequestPresenter.getInstance().post(Constants.REG_URL, params, new ModelCallback<UserEntity>(false,UserEntity.class) {
98+
public void reg(HashMap<String, Object> params, final PresenterCallback<UserEntity> callback) {
99+
HttpRequestPresenter.getInstance().post(Constants.REG_URL, params, new ModelCallback<UserEntity>(UserEntity.class) {
100100
@Override
101101
public void onErrorMsg(int code, String msg) {
102102
ToastUtils.showLong(msg);
@@ -105,7 +105,10 @@ public void onErrorMsg(int code, String msg) {
105105
@Override
106106
public void onSuccess(UserEntity userEntity) {
107107

108+
// ToastUtils.showShort(userEntity.getMessage());
109+
108110
// ToastUtils.showLong(userEntity.userId);
111+
// callback.onSuccess(userEntity);
109112
}
110113

111114
@Override

lib-core/src/main/java/com/example/kson/lib_core/base/BaseApp.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import android.support.multidex.MultiDex;
66

77
import com.alibaba.android.arouter.launcher.ARouter;
8+
import com.example.kson.lib_core.BuildConfig;
9+
import com.example.kson.lib_core.constants.Server;
810

911
/**
1012
* Author:kson
@@ -13,17 +15,16 @@
1315
* Description:
1416
*/
1517
public class BaseApp extends Application {
16-
17-
1818
@Override
1919
public void onCreate() {
2020
super.onCreate();
2121
// 这两行必须写在init之前,否则这些配置在init过程中将无效
22-
ARouter.openLog(); // 打印日志
23-
ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险) }
22+
if (BuildConfig.DEBUG) {
23+
ARouter.openLog(); // 打印日志
24+
ARouter.openDebug(); // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险) }
25+
}
2426
ARouter.init(this);
2527

26-
2728
}
2829

2930
@Override
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.example.kson.lib_core.constants;
2+
3+
public class Server {
4+
public static boolean isRelease = false;
5+
public static final String BASE_URL = isRelease?"http://www.com":"http://172.19";
6+
}

lib-net/src/main/java/com/example/kson/lib_net/NetConstants.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.io.File;
44

55
/**
6-
*
6+
*网络常量类
77
*/
88
public class NetConstants
99
{
@@ -34,4 +34,7 @@ public class NetConstants
3434

3535
public static final String SHOW_WEBVIEW = "show_webview";
3636

37+
//rsa公钥
38+
public static final String RSA_PUB_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuQd3gESx7VdIyRYUWjmjg61VIgUK6F45hClmqUMZ7xNiT5rlLM6e78osMvBF/yP7cVm7pK+NMCDWoVS1/AETpxJYqUlIC77ZAU8/MnP96IupnJL87vqhPcpdv7+VqLM38ls++yuD/F/HSoOQTv/leJh+dgE/4EYAJjOWFAbYfXwIDAQAB";
39+
3740
}

0 commit comments

Comments
 (0)