/*
-
网络请求封装
-
*/
public class RetrofitManager {
private static final String TAG = “test—”;
private static RetrofitManager retrofitManager;public static RetrofitManager getInstance() {
if (retrofitManager==null){
retrofitManager=new RetrofitManager();
}
return retrofitManager;
}private Retrofit retrofit;
public Retrofit getRetrofit() {
if (retrofit==null){
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);OkHttpClient.Builder okbuilder = new OkHttpClient.Builder(); okbuilder.addInterceptor(interceptor); okbuilder.addInterceptor(interceptorTag); okbuilder.retryOnConnectionFailure(true); okbuilder.connectTimeout(60, TimeUnit.MINUTES); okbuilder.readTimeout(60,TimeUnit.MINUTES