All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.laputapp.http.Callbacks Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
/**
 * Created by YuGang Yang on January 19, 2015.
 * Copyright 2007-2015 Laputapp.com. All rights reserved.
 */
package com.laputapp.http;

import retrofit.RetrofitError;

public class Callbacks {

  public static interface RequestCallback {
    public void onRequestComplete(Response response);
    public void onRequestFailure(Response response);
    public void onRequestFailure(RetrofitError error);
    public void onRequestNetworkError();
    public void onFinish();

    // cache
    public boolean canCache();
    public void handleLocalCache(T data);
    public void onCacheLoaded(T localData);
  }

  public static class ApiBaseCallback implements RequestCallback {
    @Override public void onRequestComplete(Response response) {}
    @Override public void onRequestFailure(Response response) {}
    @Override public void onRequestFailure(RetrofitError error) {}

    @Override public void onRequestNetworkError() {}
    @Override public void onFinish() {}

    @Override public boolean canCache() {
      return false;
    }
    @Override public void handleLocalCache(T data) {}
    @Override public void onCacheLoaded(T localData) {}
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy