Skip to content

Commit e1d9a22

Browse files
committed
新增支持参数嵌套解析
1 parent 5cb32e9 commit e1d9a22

File tree

15 files changed

+139
-53
lines changed

15 files changed

+139
-53
lines changed

EasyHttp.apk

-824 KB
Binary file not shown.

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
> 码云地址:[Gitee](https://gitee.com/getActivity/EasyHttp)
44
5-
![](EasyHttp.jpg)
5+
> [点击此处下载Demo](EasyHttp.apk)
66
7-
[点击此处下载Demo](https://raw.githubusercontent.com/getActivity/EasyHttp/master/EasyHttp.apk)
7+
![](EasyHttp.jpg)
88

99
#### Gradle 集成
1010

@@ -17,7 +17,7 @@
1717
}
1818

1919
dependencies {
20-
implementation 'com.hjq:http:6.5'
20+
implementation 'com.hjq:http:6.8'
2121
implementation 'com.squareup.okhttp3:okhttp:3.12.10'
2222
implementation 'com.google.code.gson:gson:2.8.5'
2323
}
@@ -47,7 +47,7 @@
4747

4848
@Override
4949
public BodyType getType() {
50-
// 参数以 Json 格式提交(默认是表单)
50+
// 参数以 Json 格式提交(默认是表单)
5151
return BodyType.JSON;
5252
}
5353
}
@@ -204,6 +204,11 @@
204204
-dontwarn okhttp3.**
205205
-dontwarn okio.**
206206

207+
# 不混淆这个包下的字段名
208+
-keepclassmembernames class com.hjq.http.demo.http.** {
209+
<fields>;
210+
}
211+
207212
#### 作者的其他开源项目
208213

209214
* 架构工程:[AndroidProject](https://github.com/getActivity/AndroidProject)

app/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ android {
1313
applicationId "com.hjq.http.demo"
1414
minSdkVersion 14
1515
targetSdkVersion 28
16-
versionCode 65
17-
versionName "6.5"
16+
versionCode 68
17+
versionName "6.8"
1818
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1919
}
2020

2121
buildTypes {
22-
release {
22+
debug {
2323
minifyEnabled true
2424
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2525
}
26-
debug {
27-
minifyEnabled false
26+
release {
27+
minifyEnabled true
2828
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2929
}
3030
}
@@ -43,16 +43,16 @@ dependencies {
4343
implementation 'com.google.android.material:material:1.1.0'
4444

4545
// 标题栏:https://github.com/getActivity/TitleBar
46-
implementation 'com.hjq:titlebar:6.0'
46+
implementation 'com.hjq:titlebar:6.5'
4747
// 吐司工具类:https://github.com/getActivity/ToastUtils
4848
implementation 'com.hjq:toast:8.2'
4949
// 权限请求框架:https://github.com/getActivity/XXPermissions
50-
implementation 'com.hjq:xxpermissions:6.2'
50+
implementation 'com.hjq:xxpermissions:6.5'
5151
// Json 解析框架:https://github.com/google/gson
5252
implementation 'com.google.code.gson:gson:2.8.5'
5353
// OkHttp 框架:https://github.com/square/okhttp
5454
// 升级注意事项:https://www.jianshu.com/p/d12d0f536f55
5555
implementation 'com.squareup.okhttp3:okhttp:3.12.10'
5656
// 日志调试:https://github.com/getActivity/Logcat
57-
debugImplementation 'com.hjq:logcat:6.5'
57+
debugImplementation 'com.hjq:logcat:6.8'
5858
}

app/src/main/java/com/hjq/http/demo/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void hasPermission(List<String> granted, boolean isAll) {
8080
public void noPermission(List<String> denied, boolean quick) {
8181
if (quick) {
8282
ToastUtils.show("授权失败,请手动授予权限");
83-
XXPermissions.gotoPermissionSettings(this, true);
83+
XXPermissions.startPermissionActivity(this, true);
8484
} else {
8585
ToastUtils.show("请先授予权限");
8686
requestPermission();
@@ -90,7 +90,7 @@ public void noPermission(List<String> denied, boolean quick) {
9090
@Override
9191
protected void onRestart() {
9292
super.onRestart();
93-
if (XXPermissions.isHasPermission(this, Permission.Group.STORAGE)) {
93+
if (XXPermissions.hasPermission(this, Permission.Group.STORAGE)) {
9494
hasPermission(null, true);
9595
} else {
9696
requestPermission();

app/src/main/java/com/hjq/http/demo/http/model/HttpData.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
package com.hjq.http.demo.http.model;
22

3-
import androidx.annotation.Keep;
4-
53
/**
64
* author : Android 轮子哥
75
* github : https://github.com/getActivity/EasyHttp
86
* time : 2019/05/19
97
* desc : 统一接口数据结构
108
*/
11-
@Keep
129
public class HttpData<T> {
1310

1411
/** 返回码 */

app/src/main/java/com/hjq/http/demo/http/model/RequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Object requestSucceed(LifecycleOwner lifecycle, Response response, Type t
7171

7272
if (!response.isSuccessful()) {
7373
// 返回响应异常
74-
throw new ResponseException(mApplication.getString(R.string.http_server_error), response);
74+
throw new ResponseException(mApplication.getString(R.string.http_response_error) + ",responseCode:" + response.code() + ",message:" + response.message(), response);
7575
}
7676

7777
ResponseBody body = response.body();

app/src/main/java/com/hjq/http/demo/http/request/SearchAuthorApi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.hjq.http.demo.http.request;
22

3-
import androidx.annotation.Keep;
4-
53
import com.hjq.http.config.IRequestApi;
64

75
/**
@@ -10,7 +8,6 @@
108
* time : 2019/11/18
119
* desc : 按照作者昵称搜索文章
1210
*/
13-
@Keep
1411
public final class SearchAuthorApi implements IRequestApi {
1512

1613
@Override

app/src/main/java/com/hjq/http/demo/http/request/SearchBlogsApi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.hjq.http.demo.http.request;
22

3-
import androidx.annotation.Keep;
4-
53
import com.hjq.http.annotation.HttpRename;
64
import com.hjq.http.config.IRequestApi;
75

@@ -11,7 +9,6 @@
119
* time : 2019/06/07
1210
* desc : 搜索文章
1311
*/
14-
@Keep
1512
public final class SearchBlogsApi implements IRequestApi {
1613

1714
@Override

app/src/main/java/com/hjq/http/demo/http/request/UpdateImageApi.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.hjq.http.demo.http.request;
22

3-
import androidx.annotation.Keep;
4-
53
import com.hjq.http.config.IRequestApi;
64
import com.hjq.http.config.IRequestHost;
75

@@ -13,7 +11,6 @@
1311
* time : 2019/12/14
1412
* desc : 上传图片
1513
*/
16-
@Keep
1714
public final class UpdateImageApi implements IRequestHost, IRequestApi {
1815

1916
@Override

app/src/main/java/com/hjq/http/demo/http/response/SearchBean.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.hjq.http.demo.http.response;
22

3-
import androidx.annotation.Keep;
4-
53
import java.util.List;
64

75
/**
@@ -10,7 +8,6 @@
108
* time : 2019/11/18
119
* desc : 搜索结果
1210
*/
13-
@Keep
1411
public final class SearchBean {
1512

1613
/**

0 commit comments

Comments
 (0)