com.duowan.mobile.netroid
Class Listener<T>

java.lang.Object
  extended by com.duowan.mobile.netroid.Listener<T>
Type Parameters:
T - Parsed type of this response

public abstract class Listener<T>
extends java.lang.Object

Callback interface for delivering request status or response result. Note : all method are calls over UI thread.


Constructor Summary
Listener()
           
 
Method Summary
 void onCancel()
          Inform when the Request is truly cancelled.
 void onError(NetroidError error)
          Callback method that an error has been occurred with the provided error code and optional user-readable message.
 void onFinish()
          Inform when Request execute is finish, whatever success or error or cancel, this callback method always invoke if request is done.
 void onNetworking()
          Inform When the Request cache non-exist or expired, this callback method is opposite by the onUsedCache(), means the http retrieving will happen soon.
 void onPreExecute()
          Inform when start to handle this Request.
 void onProgressChange(long fileSize, long downloadedSize)
          Inform when download progress change, this callback method only available when request was FileDownloadRequest.
 void onRetry()
          Inform when Request execute is going to retry.
abstract  void onSuccess(T response)
          Called when response success.
 void onUsedCache()
          Inform when the cache already use, it means http networking won't execute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Listener

public Listener()
Method Detail

onPreExecute

public void onPreExecute()
Inform when start to handle this Request.


onFinish

public void onFinish()
Inform when Request execute is finish, whatever success or error or cancel, this callback method always invoke if request is done.


onSuccess

public abstract void onSuccess(T response)
Called when response success.


onError

public void onError(NetroidError error)
Callback method that an error has been occurred with the provided error code and optional user-readable message.


onCancel

public void onCancel()
Inform when the Request is truly cancelled.


onNetworking

public void onNetworking()
Inform When the Request cache non-exist or expired, this callback method is opposite by the onUsedCache(), means the http retrieving will happen soon.


onUsedCache

public void onUsedCache()
Inform when the cache already use, it means http networking won't execute.


onRetry

public void onRetry()
Inform when Request execute is going to retry.


onProgressChange

public void onProgressChange(long fileSize,
                             long downloadedSize)
Inform when download progress change, this callback method only available when request was FileDownloadRequest.