Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Coil | 9,549 | 40 | a day ago | 23 | May 21, 2023 | 30 | apache-2.0 | Kotlin | ||
Image loading for Android backed by Kotlin Coroutines. | ||||||||||
Rxhttp | 3,574 | 8 days ago | 6 | apache-2.0 | Kotlin | |||||
🔥🔥🔥 Based on OkHttp encapsulation, support Kotlin Coroutines、RxJava2、RxJava3; 30s to get started. | ||||||||||
Androidbaseframemvvm | 962 | 6 days ago | 2 | Kotlin | ||||||
基于 Jetpack + Kotlin 的 Android 组件化 MVVM 框架 | ||||||||||
Jetpack_github | 373 | 2 years ago | mit | Roff | ||||||
基于Kotlin + Jetpack全家桶 + Coroutines(协程) + Flutter等架构实现的一款精简版Github客户端项目,望与广大小伙伴一起成长,欢迎start or fork! | ||||||||||
Wanandroidjetpack | 134 | 9 months ago | apache-2.0 | Kotlin | ||||||
🔥 WanAndroid 客户端,Kotlin + MVVM + Jetpack + Retrofit + Glide。基于 MVVM 架构,用 Jetpack 实现,网络采用 Kotlin 的协程和 Retrofit 配合使用!精美的 UI,便捷突出的功能实现,欢迎下载体验! | ||||||||||
Kotlin Coroutines Okhttp | 115 | 4 years ago | 1 | March 17, 2019 | 2 | apache-2.0 | Kotlin | |||
Kotlin Coroutines await() extension for OkHttp Call | ||||||||||
Pixel | 80 | 8 months ago | 1 | April 09, 2021 | 12 | Kotlin | ||||
A lightweight image loader for Android backed by Kotlin Coroutines. | ||||||||||
Updater For Spotify | 62 | a year ago | 8 | mit | Kotlin | |||||
Updater For Spotify allows you to download the latest version of Spotify | ||||||||||
Gitmessengerbot Android | 51 | 2 years ago | 9 | gpl-3.0 | ||||||
타입스크립트, V8 엔진의 자바스크립트, 파이썬 그리고 Git을 지원하는 최첨단 메신저 봇! | ||||||||||
Kotlin Coroutine Retrofit Okhttp Sample | 38 | 5 years ago | 1 | Kotlin | ||||||
Kotlin,Coroutine,Retrofit,Okhttp use Sample |
English | 中文文档
A type-safe HTTP client for Android. Written based on OkHttp
Await | Flow | RxJava (Kotlin) |
RxJava (Java) |
---|---|---|---|
|
|
|
|
Support kotlin coroutines, RxJava2, RxJava3
Support Gson, Xml, ProtoBuf, FastJson and other third-party data parsing tools
Supports automatic closure of requests in FragmentActivity, Fragment, View, ViewModel, and any class
Support global encryption and decryption, add common parameters and headers, network cache, all support a request set up separately
1、Adding dependencies and configurations
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
plugins {
// kapt/ksp choose one
// id 'kotlin-kapt'
id 'com.google.devtools.ksp' version '1.9.10-1.0.13'
}
dependencies {
def rxhttp_version = '3.2.0'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation "com.github.liujingxing.rxhttp:rxhttp:$rxhttp_version"
// ksp/kapt/annotationProcessor choose one
ksp "com.github.liujingxing.rxhttp:rxhttp-compiler:$rxhttp_version"
}
implementation "com.github.liujingxing.rxhttp:converter-serialization:$rxhttp_version"
implementation "com.github.liujingxing.rxhttp:converter-fastjson:$rxhttp_version"
implementation "com.github.liujingxing.rxhttp:converter-jackson:$rxhttp_version"
implementation "com.github.liujingxing.rxhttp:converter-moshi:$rxhttp_version"
implementation "com.github.liujingxing.rxhttp:converter-protobuf:$rxhttp_version"
implementation "com.github.liujingxing.rxhttp:converter-simplexml:$rxhttp_version"
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava3:2.2.2' //RxJava3, Automatic close request
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.github.liujingxing.rxlife:rxlife-rxjava2:2.2.2' //RxJava2, Automatic close request
ksp {
arg("rxhttp_rxjava", "3.1.6")
}
kapt {
arguments {
arg("rxhttp_rxjava", "3.1.6")
}
}
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [
rxhttp_rxjava: '3.1.6',
]
}
}
}
}
ksp {
arg("rxhttp_package", "rxhttp.xxx")
}
kapt {
arguments {
arg("rxhttp_package", "rxhttp.xxx")
}
}
android {
defaultConfig {
javaCompileOptions {
annotationProcessorOptions {
arguments = [
rxhttp_package: 'rxhttp.xxx'
]
}
}
}
}
Finally, rebuild the project, which is necessary
2、Initialize the SDK
This step is optional
RxHttpPlugins.init(OkHttpClient)
.setDebug(boolean)
.setOnParamAssembly(Consumer)
....
3、Configuration BaseUrl
This step is optional
public class Url {
//Add the @defaultDomain annotation to BASE_URL
@DefaultDomain
public static BASE_URL = "https://..."
}
4、Perform the requested
// java
RxHttp.get("/service/...") //1、You can choose get,postFrom,postJson etc
.addQuery("key", "value") //add query param
.addHeader("headerKey", "headerValue") //add request header
.toObservable(Student.class) //2、Use the toXxx method to determine the return value type, customizable
.subscribe(student -> { //3、Subscribing observer
//Success callback,Default IO thread
}, throwable -> {
//Abnormal callback
});
// kotlin
RxHttp.postForm("/service/...") //post FormBody
.add("key", "value") //add param to body
.addQuery("key1", "value1") //add query param
.addFile("file", File(".../1.png")) //add file to body
.toObservable<Student>()
.subscribe({ student ->
//Default IO thread
}, { throwable ->
})
// kotlin coroutine
val students = RxHttp.postJson("/service/...") //1、post {application/json; charset=utf-8}
.toAwaitList<Student>() //2、Use the toXxx method to determine the return value type, customizable
.await() //3、Get the return value, await is the suspend method
1、Close the request
//In Rxjava2 , Automatic close request
RxHttp.get("/service/...")
.toObservableString()
.as(RxLife.as(this)) //The Activity destroys and automatically closes the request
.subscribe(s -> {
//Default IO thread
}, throwable -> {
});
//In Rxjava3 , Automatic close request
RxHttp.get("/service/...")
.toObservableString()
.to(RxLife.to(this)) //The Activity destroys and automatically closes the request
.subscribe(s -> {
//Default IO thread
}, throwable -> {
});
//In RxJava2/RxJava3, close the request manually
Disposable disposable = RxHttp.get("/service/...")
.toObservableString()
.subscribe(s -> {
//Default IO thread
}, throwable -> {
});
disposable.dispose(); //Close the request at the appropriate time
If you are using RxHttp v2.2.8 or above the shrinking and obfuscation rules are included automatically. Otherwise you must manually add the options in rxhttp.pro.
If this project helps you a lot and you want to support the project's development and maintenance of this project, feel free to scan the following QR code for donation. Your donation is highly appreciated. Thank you!
Copyright 2019 liujingxing
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.