author:wangyimiao

desc:更新RXJAVA为RXJAVA3
master
yimiao 3 years ago
parent 295019d54a
commit cfedcf0965

@ -16,14 +16,12 @@ import com.common.commonlibtest.manager.InternetLoader;
import com.common.commonlibtest.manager.LoginLoader; import com.common.commonlibtest.manager.LoginLoader;
import com.yinuo.commonlibtest.databinding.ActivityMainBinding; import com.yinuo.commonlibtest.databinding.ActivityMainBinding;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import okhttp3.Headers; import okhttp3.Headers;
import okhttp3.Response;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private static final String TAG = MainActivity.class.getSimpleName(); private static final String TAG = MainActivity.class.getSimpleName();

@ -3,7 +3,7 @@ package com.common.commonlibtest.manager
import com.common.commonlib.net.BaseObserve import com.common.commonlib.net.BaseObserve
import com.common.commonlib.net.RequestCallBack import com.common.commonlib.net.RequestCallBack
import com.common.commonlibtest.bean.CollectionResponse import com.common.commonlibtest.bean.CollectionResponse
import io.reactivex.Observable import io.reactivex.rxjava3.core.Observable
import okhttp3.Interceptor import okhttp3.Interceptor
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Headers import retrofit2.http.Headers

@ -3,7 +3,7 @@ package com.common.commonlibtest.manager
import com.common.commonlib.net.RequestCallBack import com.common.commonlib.net.RequestCallBack
import com.common.commonlib.net.BaseObserve import com.common.commonlib.net.BaseObserve
import com.common.commonlibtest.bean.ArticlesResponse import com.common.commonlibtest.bean.ArticlesResponse
import io.reactivex.Observable import io.reactivex.rxjava3.core.Observable
import retrofit2.http.GET import retrofit2.http.GET
import retrofit2.http.Headers import retrofit2.http.Headers
import retrofit2.http.Path import retrofit2.http.Path

@ -3,7 +3,7 @@ package com.common.commonlibtest.manager
import com.common.commonlib.net.BaseObserve import com.common.commonlib.net.BaseObserve
import com.common.commonlib.net.RequestCallBack import com.common.commonlib.net.RequestCallBack
import com.common.commonlibtest.bean.LoginResponse import com.common.commonlibtest.bean.LoginResponse
import io.reactivex.Observable import io.reactivex.rxjava3.core.Observable
import okhttp3.Interceptor import okhttp3.Interceptor
import retrofit2.http.* import retrofit2.http.*

@ -3,11 +3,11 @@ package com.common.commonlib.net
import android.net.ParseException import android.net.ParseException
import android.util.Log import android.util.Log
import com.google.gson.JsonParseException import com.google.gson.JsonParseException
import io.reactivex.Observable import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.Observer import io.reactivex.rxjava3.core.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.core.Observer
import io.reactivex.disposables.Disposable import io.reactivex.rxjava3.disposables.Disposable
import io.reactivex.schedulers.Schedulers import io.reactivex.rxjava3.schedulers.Schedulers
import okhttp3.Interceptor import okhttp3.Interceptor
import org.json.JSONException import org.json.JSONException
import retrofit2.HttpException import retrofit2.HttpException

@ -5,7 +5,7 @@ import com.common.commonlib.utils.BaseUtils
import okhttp3.Interceptor import okhttp3.Interceptor
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import retrofit2.Retrofit import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -58,14 +58,14 @@ object RequestManager {
} }
mRetrofitWithIntercept = Retrofit.Builder() mRetrofitWithIntercept = Retrofit.Builder()
.client(builder.build()) .client(builder.build())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.baseUrl("https://www") .baseUrl("https://www")
.build() .build()
} else { } else {
mRetrofit = Retrofit.Builder() mRetrofit = Retrofit.Builder()
.client(builder.build()) .client(builder.build())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create())
.baseUrl("https://www") .baseUrl("https://www")
.build() .build()

@ -23,9 +23,9 @@ ext {
appcompat : "1.2.0", appcompat : "1.2.0",
material : "1.2.1", material : "1.2.1",
okhttp : "4.9.1", okhttp : "4.9.1",
retrofit : "2.4.0", retrofit : "2.9.0",
rxjava : "2.1.16", rxjava : "3.0.13",
rxandroid : "2.0.2", rxandroid : "3.0.0",
kotlin : "1.5.10", kotlin : "1.5.10",
converter_gson : "2.4.0", converter_gson : "2.4.0",
retrofit_rxjava : "2.9.0", retrofit_rxjava : "2.9.0",
@ -42,16 +42,16 @@ ext {
dependencies = [ dependencies = [
okhttp : "com.squareup.okhttp3:okhttp:${versions.okhttp}", okhttp : "com.squareup.okhttp3:okhttp:${versions.okhttp}",
retrofit : "com.squareup.retrofit2:retrofit:${versions.retrofit}", retrofit : "com.squareup.retrofit2:retrofit:${versions.retrofit}",
rxjava : "io.reactivex.rxjava2:rxjava:${versions.rxjava}", rxjava : "io.reactivex.rxjava3:rxjava:${versions.rxjava}",
rxandroid : "io.reactivex.rxjava2:rxandroid:${versions.rxandroid}", rxandroid : "io.reactivex.rxjava3:rxandroid:${versions.rxandroid}",
kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}", kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
kotlin_android : "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin_android}", kotlin_android : "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin_android}",
converter_gson : "com.squareup.retrofit2:converter-gson:${versions.converter_gson}", converter_gson : "com.squareup.retrofit2:converter-gson:${versions.converter_gson}",
retrofit_rxjava : "com.squareup.retrofit2:adapter-rxjava2:${versions.retrofit_rxjava}", retrofit_rxjava : "com.squareup.retrofit2:adapter-rxjava3:${versions.retrofit_rxjava}",
room : "androidx.room:room-runtime:${versions.room}", room : "androidx.room:room-runtime:${versions.room}",
room_compiler : "androidx.room:room-compiler:${versions.room}", room_compiler : "androidx.room:room-compiler:${versions.room}",
room_ktx : "androidx.room:room-ktx:${versions.room}", room_ktx : "androidx.room:room-ktx:${versions.room}",
room_rxjava : "androidx.room:room-rxjava2:${versions.room}", room_rxjava : "androidx.room:room-rxjava3:${versions.room}",
jxl : "net.sourceforge.jexcelapi:jxl:${versions.jxl}", jxl : "net.sourceforge.jexcelapi:jxl:${versions.jxl}",
navigation_fragment_ktx: "androidx.navigation:navigation-fragment-ktx:${versions.navigation_fragment_ktx}", navigation_fragment_ktx: "androidx.navigation:navigation-fragment-ktx:${versions.navigation_fragment_ktx}",
navigation_ui_ktx : "androidx.navigation:navigation-ui-ktx:${versions.navigation_ui_ktx}", navigation_ui_ktx : "androidx.navigation:navigation-ui-ktx:${versions.navigation_ui_ktx}",

Loading…
Cancel
Save