Skip to content

Commit

Permalink
ajuste na assinatura
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Thomaz committed Jan 27, 2016
1 parent b2da20f commit f337e1f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/src/main/java/thomaz/com/br/httpproject/suport/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
public class Request extends SafeAsyncTask<JSONObject> {

private AsyncTaskListener taskListener;
private ResultRequest result;
private Tasked task;

public Request(Tasked task) {
Expand All @@ -19,10 +19,10 @@ public Request(Tasked task) {

@Override
protected void onPreExecute() throws Exception {
if( taskListener == null )
if( result == null )
throw new NullPointerException("Must to be instance of AsyncTaskListener.");

taskListener.onPreExecute();
result.onPreExecute();
}

@Override
Expand All @@ -34,19 +34,19 @@ public JSONObject call() throws Exception {

@Override
protected void onSuccess(JSONObject object) throws Exception {
taskListener.onSuccess(object, object.getBoolean("success"));
result.onSuccess(object, object.getBoolean("success"));
}

@Override
protected void onFinally() throws RuntimeException {
taskListener.onFinally();
result.onFinally();
}

/**
* @param taskListener
* @param result
*/
public void setListener(AsyncTaskListener taskListener) {
this.taskListener = taskListener;
public void setListener(ResultRequest result) {
this.result = result;
}

}

0 comments on commit f337e1f

Please sign in to comment.