Skip to content

Commit

Permalink
结构调整
Browse files Browse the repository at this point in the history
  • Loading branch information
beaven11 committed Jun 4, 2018
1 parent 3c5a7b0 commit 59a7970
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions library/src/main/java/mejust/frame/net/NetManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import java.util.HashMap;
import mejust.frame.data.FrameConfig;
import mejust.frame.data.annotation.ServiceUrl;
import mejust.frame.mvp.view.BaseActivity;
import mejust.frame.net.config.NetWorkException;
import mejust.frame.data.FrameConfig;
import mejust.frame.net.config.IHttpResult;
import mejust.frame.net.config.NetConfig;
import mejust.frame.net.config.NetWorkException;
import mejust.frame.utils.AnnotationUtils;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
Expand Down Expand Up @@ -53,7 +53,7 @@ public <S> S getApi(Class<S> sClass) {
String baseUrl = serviceUrl.value();
Retrofit retrofit = retrofitMap.get(baseUrl);
if (retrofit == null) {
retrofit = retrofitBuild().baseUrl(baseUrl).build();
retrofit = buildRetrofit(baseUrl);
retrofitMap.put(baseUrl, retrofit);
}
return retrofit.create(sClass);
Expand Down Expand Up @@ -145,10 +145,12 @@ public <T> ObservableTransformer<T, T> handleLoadView(final Handler handler, boo
/**
* 基础Retrofit构建
*/
private Retrofit.Builder retrofitBuild() {
private Retrofit buildRetrofit(String baseUrl) {
return new Retrofit.Builder().addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create(
new GsonBuilder().setDateFormat(netConfig.getDateFormat()).create()))
.client(okHttpClient);
.client(okHttpClient)
.baseUrl(baseUrl)
.build();
}
}

0 comments on commit 59a7970

Please sign in to comment.