File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed
androidOne/src/main/java/com/sd/one/activity
oneCore/src/main/java/com/sd/core/network/async Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -122,9 +122,15 @@ public Object doInBackground(int requestCode) throws HttpException{
122
122
return null ;
123
123
}
124
124
125
+ @ Override
126
+ public boolean onIntercept (int requestCode , Object result ) {
127
+ //TODO 返回true表示打断,false表示继续执行onSuccess方法
128
+ return false ;
129
+ }
130
+
125
131
@ Override
126
132
public void onSuccess (int requestCode , Object result ) {
127
-
133
+ //TODO 处理成功的逻辑
128
134
}
129
135
130
136
@ Override
Original file line number Diff line number Diff line change @@ -93,9 +93,15 @@ public Object doInBackground(int requestCode) throws HttpException{
93
93
return null ;
94
94
}
95
95
96
+ @ Override
97
+ public boolean onIntercept (int requestCode , Object result ) {
98
+ //TODO 返回true表示打断,false表示继续执行onSuccess方法
99
+ return false ;
100
+ }
101
+
96
102
@ Override
97
103
public void onSuccess (int requestCode , Object result ) {
98
-
104
+ //TODO 处理成功的逻辑
99
105
}
100
106
101
107
@ Override
Original file line number Diff line number Diff line change @@ -127,7 +127,10 @@ public void onAsyncEvent(AsyncRequest bean) {
127
127
public void onMainThreadEvent (AsyncResult bean ){
128
128
switch (bean .getState ()){
129
129
case REQUEST_SUCCESS_CODE :
130
- bean .getListener ().onSuccess (bean .getRequestCode (), bean .getResult ());
130
+ boolean flag = bean .getListener ().onIntercept (bean .getRequestCode (), bean .getResult ());
131
+ if (flag == false ){
132
+ bean .getListener ().onSuccess (bean .getRequestCode (), bean .getResult ());
133
+ }
131
134
break ;
132
135
133
136
case REQUEST_ERROR_CODE :
Original file line number Diff line number Diff line change @@ -24,7 +24,14 @@ public interface OnDataListener {
24
24
* @throws HttpException
25
25
*/
26
26
public Object doInBackground (int requsetCode ) throws HttpException ;
27
-
27
+
28
+ /**
29
+ * 打断方法
30
+ * @param requestCode 请求码
31
+ * @param result 返回结果 true表示打断,false表示继续执行onSuccess方法
32
+ */
33
+ public boolean onIntercept (int requestCode , Object result );
34
+
28
35
/**
29
36
* 成功方法(可直接更新UI)
30
37
* @param requestCode 请求码
You can’t perform that action at this time.
0 commit comments