Java Code Examples for retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory#create()
The following examples show how to use
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpHelper.java From LockDemo with Apache License 2.0 | 5 votes |
private HttpHelper() { mGsonConverterFactory = GsonConverterFactory.create(); mAdapterFactory = RxJava2CallAdapterFactory.create(); //设置超时时间 mOkHttpClient = new HttpCustomConfig().build(); }
Example 2
Source File: BaseNet.java From AFBaseLibrary with Apache License 2.0 | 5 votes |
/** * 默认使用rxjava call adapter,和{@link BaseNetService}结合使用,可避免rx引起的内存泄漏问题 */ protected CallAdapter.Factory getDefaultCallAdapterFactory() { if (rxJavaCallAdapterFactory == null) { rxJavaCallAdapterFactory = RxJava2CallAdapterFactory.create(); } return rxJavaCallAdapterFactory; }
Example 3
Source File: GeometricWeather.java From GeometricWeather with GNU Lesser General Public License v3.0 | 5 votes |
private void initialize() { instance = this; activitySet = new HashSet<>(); okHttpClient = TLSCompactHelper.getClientBuilder().build(); gsonConverterFactory = GsonConverterFactory.create( new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create()); // new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX").create()); rxJava2CallAdapterFactory = RxJava2CallAdapterFactory.create(); LanguageUtils.setLanguage( this, SettingsOptionManager.getInstance(this).getLanguage().getLocale()); BuglyHelper.init(this); }
Example 4
Source File: NetworkAPITest.java From Mysplash with GNU Lesser General Public License v3.0 | 5 votes |
@BeforeClass public static void init() { Scheduler immediate = new Scheduler() { @Override public Disposable scheduleDirect(@NonNull Runnable run, long delay, @NonNull TimeUnit unit) { return super.scheduleDirect(run, 0, unit); } @Override public Worker createWorker() { return new ExecutorScheduler.ExecutorWorker(Runnable::run, false); } }; RxJavaPlugins.setInitIoSchedulerHandler(scheduler -> immediate); RxJavaPlugins.setInitComputationSchedulerHandler(scheduler -> immediate); RxJavaPlugins.setInitNewThreadSchedulerHandler(scheduler -> immediate); RxJavaPlugins.setInitSingleSchedulerHandler(scheduler -> immediate); RxAndroidPlugins.setInitMainThreadSchedulerHandler(scheduler -> immediate); OkHttpClient httpClient = TLSCompactHelper.getOKHttpClient(); GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create(); RxJava2CallAdapterFactory rxJava2CallAdapterFactory = RxJava2CallAdapterFactory.create(); CompositeDisposable disposable = new CompositeDisposable(); photoService = new PhotoService( httpClient, gsonConverterFactory, rxJava2CallAdapterFactory, disposable ); }
Example 5
Source File: ApiServiceModule.java From mvp-android-arch-component with MIT License | 4 votes |
@Provides @Singleton CallAdapter.Factory provideRxJavaAdapterFactory() { return RxJava2CallAdapterFactory.create(); }
Example 6
Source File: NetworkModule.java From Mysplash with GNU Lesser General Public License v3.0 | 4 votes |
@Provides public RxJava2CallAdapterFactory getRxJava2CallAdapterFactory() { return RxJava2CallAdapterFactory.create(); }
Example 7
Source File: ApiModule.java From klingar with Apache License 2.0 | 4 votes |
@Provides @Singleton RxJava2CallAdapterFactory provideRxJava2CallAdapterFactory() { return RxJava2CallAdapterFactory.create(); }