Skip to content

Commit 93e58d9

Browse files
author
Linden Darling
committed
Made cleanup changes as per loopj's feedback to pull-request-60.
1 parent bf0fc6b commit 93e58d9

File tree

1 file changed

+1
-48
lines changed

1 file changed

+1
-48
lines changed

src/com/loopj/android/http/ImageHttpResponseHandler.java

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,7 @@ public class ImageHttpResponseHandler extends AsyncHttpResponseHandler {
8383
* Creates a new AsyncHttpResponseHandler
8484
*/
8585
public ImageHttpResponseHandler() {
86-
// Set up a handler to post events back to the correct thread if possible
87-
if(Looper.myLooper() != null) {
88-
handler = new Handler(){
89-
public void handleMessage(Message msg){
90-
ImageHttpResponseHandler.this.handleMessage(msg);
91-
}
92-
};
93-
}
86+
super();
9487
}
9588

9689
/**
@@ -107,16 +100,6 @@ public ImageHttpResponseHandler(String[] allowedContentTypes) {
107100
// Callbacks to be overridden, typically anonymously
108101
//
109102

110-
/**
111-
* Fired when the request is started, override to handle in your own code
112-
*/
113-
public void onStart() {}
114-
115-
/**
116-
* Fired in all cases when the request is finished, after both success and failure, override to handle in your own code
117-
*/
118-
public void onFinish() {}
119-
120103
/**
121104
* Fired when a request returns successfully, override to handle in your own code
122105
* @param content the body of the HTTP response from the server
@@ -153,15 +136,6 @@ protected void sendFailureMessage(Throwable e, byte[] responseBody) {
153136
sendMessage(obtainMessage(FAILURE_MESSAGE, new Object[]{e, responseBody}));
154137
}
155138

156-
protected void sendStartMessage() {
157-
sendMessage(obtainMessage(START_MESSAGE, null));
158-
}
159-
160-
protected void sendFinishMessage() {
161-
sendMessage(obtainMessage(FINISH_MESSAGE, null));
162-
}
163-
164-
165139
//
166140
// Pre-processing of messages (in original calling thread, typically the UI thread)
167141
//
@@ -195,27 +169,6 @@ protected void handleMessage(Message msg) {
195169
}
196170
}
197171

198-
protected void sendMessage(Message msg) {
199-
if(handler != null){
200-
handler.sendMessage(msg);
201-
} else {
202-
handleMessage(msg);
203-
}
204-
}
205-
206-
protected Message obtainMessage(int responseMessage, Object response) {
207-
Message msg = null;
208-
if(handler != null){
209-
msg = this.handler.obtainMessage(responseMessage, response);
210-
}else{
211-
msg = new Message();
212-
msg.what = responseMessage;
213-
msg.obj = response;
214-
}
215-
return msg;
216-
}
217-
218-
219172
// Interface to AsyncHttpRequest
220173
void sendResponseMessage(HttpResponse response) {
221174
StatusLine status = response.getStatusLine();

0 commit comments

Comments
 (0)