You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
917 B
Java

2 years ago
package com.rehome.sbcksyy.base;
import android.content.Context;
import android.widget.Toast;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Created by Rehome-rjb1 on 2017/5/17.
* dialog
*/
public abstract class BaseCallBackNoProgress<T> implements Callback<T> {
private final Context context;
public BaseCallBackNoProgress(Context context) {
this.context = context;
}
@Override
public void onResponse(Call<T> call, Response<T> response) {
onSuccess(call, response);
}
@Override
public void onFailure(Call<T> call, Throwable t) {
Toast.makeText(context, "网络连接失败", Toast.LENGTH_SHORT).show();
onError(call, t);
}
public abstract void onSuccess(Call<T> call, Response<T> response);
public abstract void onError(Call<T> call, Throwable t);
}