diff --git a/app/src/main/java/com/common/commonlibtest/MainActivity.java b/app/src/main/java/com/common/commonlibtest/MainActivity.java index 70d9082..c71ad34 100644 --- a/app/src/main/java/com/common/commonlibtest/MainActivity.java +++ b/app/src/main/java/com/common/commonlibtest/MainActivity.java @@ -16,14 +16,12 @@ import com.common.commonlibtest.manager.InternetLoader; import com.common.commonlibtest.manager.LoginLoader; import com.yinuo.commonlibtest.databinding.ActivityMainBinding; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; import okhttp3.Headers; -import okhttp3.Response; public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); diff --git a/app/src/main/java/com/common/commonlibtest/manager/CollectionLoader.kt b/app/src/main/java/com/common/commonlibtest/manager/CollectionLoader.kt index 8d51636..746eb53 100644 --- a/app/src/main/java/com/common/commonlibtest/manager/CollectionLoader.kt +++ b/app/src/main/java/com/common/commonlibtest/manager/CollectionLoader.kt @@ -3,7 +3,7 @@ package com.common.commonlibtest.manager import com.common.commonlib.net.BaseObserve import com.common.commonlib.net.RequestCallBack import com.common.commonlibtest.bean.CollectionResponse -import io.reactivex.Observable +import io.reactivex.rxjava3.core.Observable import okhttp3.Interceptor import retrofit2.http.GET import retrofit2.http.Headers diff --git a/app/src/main/java/com/common/commonlibtest/manager/InternetLoader.kt b/app/src/main/java/com/common/commonlibtest/manager/InternetLoader.kt index c88a652..593cfab 100644 --- a/app/src/main/java/com/common/commonlibtest/manager/InternetLoader.kt +++ b/app/src/main/java/com/common/commonlibtest/manager/InternetLoader.kt @@ -3,7 +3,7 @@ package com.common.commonlibtest.manager import com.common.commonlib.net.RequestCallBack import com.common.commonlib.net.BaseObserve import com.common.commonlibtest.bean.ArticlesResponse -import io.reactivex.Observable +import io.reactivex.rxjava3.core.Observable import retrofit2.http.GET import retrofit2.http.Headers import retrofit2.http.Path diff --git a/app/src/main/java/com/common/commonlibtest/manager/LoginLoader.kt b/app/src/main/java/com/common/commonlibtest/manager/LoginLoader.kt index 0492134..c005bcf 100644 --- a/app/src/main/java/com/common/commonlibtest/manager/LoginLoader.kt +++ b/app/src/main/java/com/common/commonlibtest/manager/LoginLoader.kt @@ -3,7 +3,7 @@ package com.common.commonlibtest.manager import com.common.commonlib.net.BaseObserve import com.common.commonlib.net.RequestCallBack import com.common.commonlibtest.bean.LoginResponse -import io.reactivex.Observable +import io.reactivex.rxjava3.core.Observable import okhttp3.Interceptor import retrofit2.http.* diff --git a/commonLib/src/main/java/com/common/commonlib/net/BaseObserve.kt b/commonLib/src/main/java/com/common/commonlib/net/BaseObserve.kt index dfa50f6..a951ca5 100644 --- a/commonLib/src/main/java/com/common/commonlib/net/BaseObserve.kt +++ b/commonLib/src/main/java/com/common/commonlib/net/BaseObserve.kt @@ -3,11 +3,11 @@ package com.common.commonlib.net import android.net.ParseException import android.util.Log import com.google.gson.JsonParseException -import io.reactivex.Observable -import io.reactivex.Observer -import io.reactivex.android.schedulers.AndroidSchedulers -import io.reactivex.disposables.Disposable -import io.reactivex.schedulers.Schedulers +import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers +import io.reactivex.rxjava3.core.Observable +import io.reactivex.rxjava3.core.Observer +import io.reactivex.rxjava3.disposables.Disposable +import io.reactivex.rxjava3.schedulers.Schedulers import okhttp3.Interceptor import org.json.JSONException import retrofit2.HttpException diff --git a/commonLib/src/main/java/com/common/commonlib/net/RequestManager.kt b/commonLib/src/main/java/com/common/commonlib/net/RequestManager.kt index 7051402..84caadb 100644 --- a/commonLib/src/main/java/com/common/commonlib/net/RequestManager.kt +++ b/commonLib/src/main/java/com/common/commonlib/net/RequestManager.kt @@ -5,7 +5,7 @@ import com.common.commonlib.utils.BaseUtils import okhttp3.Interceptor import okhttp3.OkHttpClient import retrofit2.Retrofit -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory +import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory import retrofit2.converter.gson.GsonConverterFactory import java.util.concurrent.TimeUnit @@ -58,14 +58,14 @@ object RequestManager { } mRetrofitWithIntercept = Retrofit.Builder() .client(builder.build()) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .baseUrl("https://www") .build() } else { mRetrofit = Retrofit.Builder() .client(builder.build()) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + .addCallAdapterFactory(RxJava3CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .baseUrl("https://www") .build() diff --git a/commonLibConfig.gradle b/commonLibConfig.gradle index 1fb9e7c..e98bfc8 100644 --- a/commonLibConfig.gradle +++ b/commonLibConfig.gradle @@ -23,9 +23,9 @@ ext { appcompat : "1.2.0", material : "1.2.1", okhttp : "4.9.1", - retrofit : "2.4.0", - rxjava : "2.1.16", - rxandroid : "2.0.2", + retrofit : "2.9.0", + rxjava : "3.0.13", + rxandroid : "3.0.0", kotlin : "1.5.10", converter_gson : "2.4.0", retrofit_rxjava : "2.9.0", @@ -42,16 +42,16 @@ ext { dependencies = [ okhttp : "com.squareup.okhttp3:okhttp:${versions.okhttp}", retrofit : "com.squareup.retrofit2:retrofit:${versions.retrofit}", - rxjava : "io.reactivex.rxjava2:rxjava:${versions.rxjava}", - rxandroid : "io.reactivex.rxjava2:rxandroid:${versions.rxandroid}", + rxjava : "io.reactivex.rxjava3:rxjava:${versions.rxjava}", + rxandroid : "io.reactivex.rxjava3:rxandroid:${versions.rxandroid}", kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}", kotlin_android : "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin_android}", 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_compiler : "androidx.room:room-compiler:${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}", navigation_fragment_ktx: "androidx.navigation:navigation-fragment-ktx:${versions.navigation_fragment_ktx}", navigation_ui_ktx : "androidx.navigation:navigation-ui-ktx:${versions.navigation_ui_ktx}",