• Stars
    star
    1,157
  • Rank 40,327 (Top 0.8 %)
  • Language
    Java
  • Created almost 9 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RxVolley = Volley + RxJava(RxJava3.0) + OkHttp(OkHttp3)

OSL

RxVolley = Volley + RxAndroid3 + OkHttp3

中文帮助

Retrofit? No, I Love Volley.

RxVolley is modified Volley. Removed the HttpClient, and support RxJava.

If you are building with Gradle, simply add the following line to the dependencies section of your build.gradle file:

latest version numbers:

implementation 'com.github.kymjs.rxvolley:rxvolley:3.0.0'

// If use okhttp function
implementation 'com.github.kymjs.rxvolley:okhttp3:3.0.0'
//or okhttp2
implementation 'com.github.kymjs.rxvolley:okhttp:3.0.0'

// If use image-loader function
implementation 'com.github.kymjs.rxvolley:image:3.0.0'

Getting Started

Builder pattern to create objects.

Callback method do Get request and contenttype is form

HttpParams params = new HttpParams();

//http header, optional parameters
params.putHeaders("cookie", "your cookie");
params.putHeaders("User-Agent", "rxvolley"); 

//request parameters
params.put("name", "kymjs");
params.put("age", "18");

HttpCallback callBack = new HttpCallback(){
	@Override
    public void onSuccess(String t) {
    }
    @Override
    public void onFailure(int errorNo, String strMsg) {
    }
}

new RxVolley.Builder()
	.url("https://www.kymjs.com/rss.xml")
    .httpMethod(RxVolley.Method.GET) //default GET or POST/PUT/DELETE/HEAD/OPTIONS/TRACE/PATCH
    .cacheTime(6) //default: get 5min, post 0min
    .contentType(RxVolley.ContentType.FORM)//default FORM or JSON
    .params(params)
    .shouldCache(true) //default: get true, post false
    .callback(callBack)
    .encoding("UTF-8") //default
    .doTask();

Callback method do Post request and contenttype is json


String paramJson = "{\n" +
                "    \"name\": \"kymjs\", " +
                "    \"age\": \"18\" " +
                "}";

//request parameters, json format
HttpParams params = new HttpParams();
params.putJsonParams(paramJson);

// upload progress
ProgressListener listener = new ProgressListener(){
    @Override
    public void onProgress(long transferredBytes, long totalSize){
    }
}

new RxVolley.Builder()
	.url("https://www.kymjs.com/rss.xml")
    .httpMethod(RxVolley.Method.POST) //default GET or POST/PUT/DELETE/HEAD/OPTIONS/TRACE/PATCH
    .cacheTime(6) //default: get 5min, post 0min
    .params(params)
    .contentType(RxVolley.ContentType.JSON)
    .shouldCache(true) //default: get true, post false
    .progressListener(listener) //upload progress
    .callback(callback)
    .encoding("UTF-8") //default
    .doTask();

return Observable<Result> type

Observable<Result> observable = new RxVolley.Builder()
	.url("https://www.kymjs.com/rss.xml")
    .httpMethod(RxVolley.Method.POST) //default GET or POST/PUT/DELETE/HEAD/OPTIONS/TRACE/PATCH
    .cacheTime(6) //default: get 5min, post 0min
    .params(params)
    .contentType(RxVolley.ContentType.JSON)
    .getResult(); 
    
//do something
observable.subscribe(subscriber);

Requirements

RxVolley can be included in any Android application.

RxVolley supports Android 3.1, API12 (HONEYCOMB_MR1) and later.

License

Licensed under the Apache License Version 2.0. The "License"

More Repositories

1

KJFrameForAndroid

An Android library and includes ActivityFrame, KJHttp, KJBitmap, KJDataBase. KJFrameForAndroid is designed to wrap complexity of the Android native SDK and keep things simple.
Java
1,948
star
2

TheMVP

An Android MVP Architecture Diagram Framwork.
Java
1,693
star
3

EmojiChat

Android聊天界面+emoji表情+大表情实现
Java
1,353
star
4

CJFrameForAndroid

Android插件开发库,动态加载apk文件。
Java
427
star
5

KJGallery

一个支持Gif图片以及普通图片预览,支持双击缩放,单机退出,同时可以选择使用jni的形式去高效加载gif或者更更精简的(仅2个类)gif控件
Java
303
star
6

KotlinPrimer

极客时间视频中的PPT与代码
Kotlin
303
star
7

KotlinDoc-cn

Kotlin语言文档翻译项目
272
star
8

CodeCafe

开源实验室手机客户端
Java
264
star
9

Contacts

Android联系人列表界面
Java
221
star
10

Modularity

Modular App Architecture
Java
206
star
11

FaceRecognition

一个智能裁剪照片所需部分的项目
Java
148
star
12

KJController

我未来房间的综合控制器
Java
56
star
13

Common

common library
Java
41
star
14

CoreModule

myself core module.
Java
39
star
15

RecyclerViewDemo

RecyclerViewDemo 常用操作演示
Java
39
star
16

OpenLicense

The open source license translate to chinese project.
29
star
17

PWAblog

Progressive Web Apps Blog
CSS
17
star
18

TheRouterIdeaPlugin

TheRouter 路由跳转IDE插件
Kotlin
10
star
19

AndroidCoroutine

C++
10
star
20

Chidori

A library for using EventBus between processes, base on BroadcastReceiver.
Java
8
star
21

IO2017

Google I/O 2017 Android related demo
Java
4
star
22

kymjs.github.io

Progressive Web App Blog
CSS
4
star
23

oschina-gam

kotlin for android project
Java
3
star
24

flutter_demo

flutter demo
Dart
2
star
25

Faraday

A set of perfect H5 hybrid jsbridge solution of Android
Java
2
star
26

IDEASetting

Android Studio or Idea Setting
Java
1
star