Skip to content

Commit 72e5ccc

Browse files
committed
Android:替换自动生成的用来测试封装 Request JSON 和解析 Response JSON 的 Java 和 Kotlin 代码
1 parent 886bc90 commit 72e5ccc

File tree

3 files changed

+674
-575
lines changed

3 files changed

+674
-575
lines changed

APIJSON-Android/APIJSONApp/app/src/main/java/apijson/demo/client/activity_fragment/MainTabActivity.java

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import zuo.biao.library.manager.HttpManager.OnHttpResponseListener;
4141
import zuo.biao.library.ui.EditTextInfoWindow;
4242
import zuo.biao.library.util.Log;
43-
import zuo.biao.library.util.SettingUtil;
4443
import zuo.biao.library.util.StringUtil;
4544

4645
/**应用主页
@@ -86,14 +85,26 @@ protected void onCreate(Bundle savedInstanceState) {
8685
, new String[]{ACTION_EXIT_APP, ActionUtil.ACTION_RELOAD_CURRENT_USER});
8786

8887

89-
if (SettingUtil.isOnTestMode) {
88+
// if (SettingUtil.isOnTestMode) {
9089
showShortToast("测试服务器\n" + HttpRequest.URL_BASE);
9190

9291
HttpRequest.get(JSON.parseObject(JSON.toJSONString(TestRequestAndResponseJava.request()), zuo.biao.apijson.JSONObject.class), 0, new OnHttpResponseListener() {
9392
@Override
9493
public void onHttpResponse(int requestCode, String resultJson, Exception e) {
9594
TestRequestAndResponseJava.response(resultJson);
95+
if (e != null) {
96+
e.printStackTrace();
97+
}
98+
}
99+
});
100+
101+
HttpRequest.get(JSON.parseObject(JSON.toJSONString(TestRequestAndResponseJava.smartRequest()), zuo.biao.apijson.JSONObject.class), 0, new OnHttpResponseListener() {
102+
@Override
103+
public void onHttpResponse(int requestCode, String resultJson, Exception e) {
96104
TestRequestAndResponseJava.smartResponse(resultJson);
105+
if (e != null) {
106+
e.printStackTrace();
107+
}
97108
}
98109
});
99110

@@ -102,10 +113,22 @@ public void onHttpResponse(int requestCode, String resultJson, Exception e) {
102113
@Override
103114
public void onHttpResponse(int requestCode, String resultJson, Exception e) {
104115
TestRequestAndResponseKt.response(resultJson);
116+
if (e != null) {
117+
e.printStackTrace();
118+
}
119+
}
120+
});
121+
122+
HttpRequest.get(JSON.parseObject(JSON.toJSONString(TestRequestAndResponseKt.smartRequest()), zuo.biao.apijson.JSONObject.class), 0, new OnHttpResponseListener() {
123+
@Override
124+
public void onHttpResponse(int requestCode, String resultJson, Exception e) {
105125
TestRequestAndResponseKt.smartResponse(resultJson);
126+
if (e != null) {
127+
e.printStackTrace();
128+
}
106129
}
107130
});
108-
}
131+
// }
109132

110133
}
111134

0 commit comments

Comments
 (0)