@@ -141,7 +141,7 @@ private ResponseInfo<T> sendRequest(HttpRequestBase request) throws HttpExceptio
141
141
142
142
@ Override
143
143
protected Void doInBackground (Object ... params ) {
144
- if (mStopped || params == null || params .length == 0 ) return null ;
144
+ if (this . state == State . STOPPED || params == null || params .length == 0 ) return null ;
145
145
146
146
if (params .length > 3 ) {
147
147
fileSavePath = String .valueOf (params [1 ]);
@@ -151,7 +151,7 @@ protected Void doInBackground(Object... params) {
151
151
}
152
152
153
153
try {
154
- if (mStopped ) return null ;
154
+ if (this . state == State . STOPPED ) return null ;
155
155
// init request & requestUrl
156
156
request = (HttpRequestBase ) params [0 ];
157
157
requestUrl = request .getURI ().toString ();
@@ -183,7 +183,7 @@ protected Void doInBackground(Object... params) {
183
183
@ Override
184
184
@ SuppressWarnings ("unchecked" )
185
185
protected void onProgressUpdate (Object ... values ) {
186
- if (mStopped || values == null || values .length == 0 || callback == null ) return ;
186
+ if (this . state == State . STOPPED || values == null || values .length == 0 || callback == null ) return ;
187
187
switch ((Integer ) values [0 ]) {
188
188
case UPDATE_START :
189
189
this .state = State .STARTED ;
@@ -254,14 +254,10 @@ private ResponseInfo<T> handleResponse(HttpResponse response) throws HttpExcepti
254
254
return null ;
255
255
}
256
256
257
- private boolean mStopped = false ;
258
-
259
257
/**
260
258
* stop request task.
261
259
*/
262
- @ Override
263
260
public void stop () {
264
- this .mStopped = true ;
265
261
this .state = State .STOPPED ;
266
262
267
263
if (request != null && !request .isAborted ()) {
@@ -282,9 +278,8 @@ public void stop() {
282
278
}
283
279
}
284
280
285
- @ Override
286
281
public boolean isStopped () {
287
- return mStopped ;
282
+ return this . state == State . STOPPED ;
288
283
}
289
284
290
285
public RequestCallBack <T > getRequestCallBack () {
@@ -295,7 +290,7 @@ public RequestCallBack<T> getRequestCallBack() {
295
290
296
291
@ Override
297
292
public boolean updateProgress (long total , long current , boolean forceUpdateUI ) {
298
- if (callback != null && ! mStopped ) {
293
+ if (callback != null && this . state != State . STOPPED ) {
299
294
if (forceUpdateUI ) {
300
295
this .publishProgress (UPDATE_LOADING , total , current );
301
296
} else {
@@ -306,7 +301,7 @@ public boolean updateProgress(long total, long current, boolean forceUpdateUI) {
306
301
}
307
302
}
308
303
}
309
- return ! mStopped ;
304
+ return this . state != State . STOPPED ;
310
305
}
311
306
312
307
public enum State {
0 commit comments