Skip to content

Commit

Permalink
update Readme (#290)
Browse files Browse the repository at this point in the history
* update readme

* Create README.md

* update readme

* publish jcenter

* add pay
  • Loading branch information
jeasonlzy authored Jun 12, 2017
1 parent 5591705 commit 0866eea
Show file tree
Hide file tree
Showing 21 changed files with 193 additions and 26 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## OkGo - 3.0 震撼来袭, 一个基于okhttp的标准RESTful风格的网络框架

> 工程结构全新优化
支持RxJava
支持RxJava2
支持自定义缓存策略
支持下载管理
支持上传管理
> 工程结构全新优化
支持RxJava
支持RxJava2
支持自定义缓存策略
支持下载管理
支持上传管理

该库部分思想借鉴了以下项目:

Expand All @@ -18,17 +18,17 @@

## 友情链接
本项目中使用的图片选择是我的另一个开源项目
> 完全仿微信的图片选择库,自带 矩形图片裁剪 和 圆形图片裁剪 功能,有需要的可以去下载使用。
> 完全仿微信的图片选择库,自带矩形图片裁剪和圆形图片裁剪功能,有需要的可以去下载使用。
附上地址:[https://github.com/jeasonlzy/ImagePicker](https://github.com/jeasonlzy/ImagePicker)

本项目中的九宫格控件也是我的开源项目
> 类似QQ空间,微信朋友圈,微博主页等,展示图片的九宫格控件,自动根据图片的数量确定图片大小和控件大小,使用Adapter模式设置图片,对外提供接口回调,使用接口加载图片,支持任意的图片加载框架,如 Glide,ImageLoader,Fresco,xUtils3,Picasso 等,支持点击图片全屏预览大图。
> 类似QQ空间,微信朋友圈,微博主页等,展示图片的九宫格控件,自动根据图片的数量确定图片大小和控件大小,使用Adapter模式设置图片,对外提供接口回调,使用接口加载图片,支持任意的图片加载框架如:GlideImageLoaderxUtils3Picasso 等,支持点击图片全屏预览大图。
附上地址:[https://github.com/jeasonlzy/NineGridView](https://github.com/jeasonlzy/NineGridView)

## 联系方式
* email: liaojeason@126.com
* QQ群: 489873144 (建议使用QQ群,邮箱使用较少,可能看的不及时)
* 本群旨在为使用我的github项目的人提供方便,如果遇到问题欢迎在群里提问个人能力也有限,希望一起学习一起进步。
* 如果遇到问题欢迎在群里提问个人能力也有限,希望一起学习一起进步。

## 演示
![image](https://github.com/jeasonlzy/Screenshots/blob/master/okgo/demo13.gif)![image](https://github.com/jeasonlzy/Screenshots/blob/master/okgo/demo8.gif)![image](https://github.com/jeasonlzy/Screenshots/blob/master/okgo/demo11.gif)![image](https://github.com/jeasonlzy/Screenshots/blob/master/okgo/demo9.gif)![image](https://github.com/jeasonlzy/Screenshots/blob/master/okgo/demo10.gif)![image](https://github.com/jeasonlzy/Screenshots/blob/master/okgo/demo12.gif)
Expand Down Expand Up @@ -68,17 +68,18 @@ okserver-2.0.0.jar
```

## 文档
如果你不想编译项目,提供了apk供直接运行[点击下载okgo_v3.0.0.apk]()
如果你不想编译项目,提供了apk供直接运行,方便查看效果,[点击下载okgo_v3.0.0.apk](http://7xss53.com1.z0.glb.clouddn.com/file/okgo_v3.0.0.apk)

本项目Demo使用的是我自己的服务器,有时候可能不稳定,网速比较慢时请耐心等待,尴尬呀。。

如果你想查看历史版本信息,[点击历史版本](https://github.com/jeasonlzy/okhttp-OkGo/releases)
如果你想查看历史版本信息,[请点击历史版本](https://github.com/jeasonlzy/okhttp-OkGo/releases)

该项目的文档全部以Wiki的形式展示,Wiki首页[猛戳这里]()
该项目的文档全部以Wiki的形式展示,[Wiki首页猛戳这里](https://github.com/jeasonlzy/okhttp-OkGo/wiki)

如果你使用遇到了问题,首先请看控制log,如果log无法看出问题,无法确定是该库的bug还是服务端的问题,建议抓包查看网络数据,详细的抓包方法[猛戳这里]()
如果你使用遇到了问题,首先请看控制台log,如果log无法看出问题,无法确定是该库的bug还是服务端的问题,建议抓包查看网络数据,[详细的抓包方法猛戳这里](https://github.com/jeasonlzy/okhttp-OkGo/wiki#网络抓包)

如果你觉得好,对你有过帮助,请给我一点鼓励吧,一分也是爱呀!
### 如果你觉得好,对你有过帮助,请给我一点打赏鼓励吧,一分也是爱呀!
![](https://ws2.sinaimg.cn/large/006tNbRwly1fgidan2gc9j30jg0a2wg6.jpg)

## 混淆
okgo, okrx, okrx2, okserver 所有代码均可以混淆,但是由于底层使用的是 okhttp,它不能混淆,所以只需要添加以下混淆代码就可以了
Expand Down
6 changes: 3 additions & 3 deletions demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ task makeApk {
def versionName = rootProject.ext.versionName_okgo
def appName = "okgo_v${versionName}.apk"
copy {
from "./build/outputs/apk/app-miui-debug.apk"
from "./build/outputs/apk/demo-miui-debug.apk"
into "../"
rename {
appName
Expand All @@ -76,8 +76,8 @@ dependencies {
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.code.gson:gson:2.8.0'
debugCompile 'com.readystatesoftware.chuck:library:1.0.4'
releaseCompile 'com.readystatesoftware.chuck:library-no-op:1.0.4'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.readystatesoftware.chuck:library:1.0.4'

compile project(':okgo')
// compile project(':okrx')
Expand Down
1 change: 1 addition & 0 deletions demo/src/main/java/com/lzy/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ protected void onCreate(Bundle savedInstanceState) {

items = new ArrayList<>();
items.add(new Pair<String, Fragment>("OkGo", new OkGoFragment()));
items.add(new Pair<String, Fragment>("打赏", new PayFragment()));
items.add(new Pair<String, Fragment>("OkRx2", new OkRx2Fragment()));
items.add(new Pair<String, Fragment>("OkRx", new OkRxFragment()));
items.add(new Pair<String, Fragment>("OkDownload", new OkDownloadFragment()));
Expand Down
45 changes: 45 additions & 0 deletions demo/src/main/java/com/lzy/demo/PayFragment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2016 jeasonlzy(廖子尧)
*
* 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.
*/
package com.lzy.demo;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lzy.demo.base.BaseFragment;

/**
* ================================================
* 作 者:jeasonlzy(廖子尧)Github地址:https://github.com/jeasonlzy
* 版 本:1.0
* 创建日期:2017/6/9
* 描 述:
* 修订历史:
* ================================================
*/
public class PayFragment extends BaseFragment {

@Override
protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_pay, container, false);
}

@Override
protected void initData() {

}
}
80 changes: 80 additions & 0 deletions demo/src/main/java/com/lzy/demo/callback/EncryptCallback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.lzy.demo.callback;

import com.lzy.demo.utils.MD5Utils;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.request.Request;

import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.TreeMap;

/**
* ================================================
* 作 者:jeasonlzy(廖子尧)Github地址:https://github.com/jeasonlzy
* 版 本:1.0
* 创建日期:2017/6/11
* 描 述:
* 修订历史:
* ================================================
*/
public abstract class EncryptCallback<T> extends JsonCallback<T> {

private static final Random RANDOM = new Random();
private static final String CHARS = "0123456789abcdefghijklmnopqrstuvwxyz";

@Override
public void onStart(Request<T, ? extends Request> request) {
super.onStart(request);
//以下是示例加密代码,根据自己的业务需求和服务器的配合,算法自行决定,这里只是demo,不能用于商业项目
sign(request.getParams());
}

/**
* 针对URL进行签名,关于这几个参数的作用,详细请看
* http://www.cnblogs.com/bestzrz/archive/2011/09/03/2164620.html
*/
private void sign(HttpParams params) {
params.put("nonce", getRndStr(6 + RANDOM.nextInt(8)));
params.put("timestamp", "" + (System.currentTimeMillis() / 1000L));
StringBuilder sb = new StringBuilder();
Map<String, String> map = new HashMap<>();
for (Map.Entry<String, List<String>> entry : params.urlParamsMap.entrySet()) {
map.put(entry.getKey(), entry.getValue().get(0));
}
for (Map.Entry<String, String> entry : getSortedMapByKey(map).entrySet()) {
sb.append(entry.getKey()).append("=").append(entry.getValue()).append("&");
}
sb.delete(sb.length() - 1, sb.length());
String sign = MD5Utils.encode(sb.toString());
params.put("sign", sign);
}

/** 获取随机数 */
private String getRndStr(int length) {
StringBuilder sb = new StringBuilder();
char ch;
for (int i = 0; i < length; i++) {
ch = CHARS.charAt(RANDOM.nextInt(CHARS.length()));
sb.append(ch);
}
return sb.toString();
}

/** 按照key的自然顺序进行排序,并返回 */
private Map<String, String> getSortedMapByKey(Map<String, String> map) {
Comparator<String> comparator = new Comparator<String>() {
@Override
public int compare(String lhs, String rhs) {
return lhs.compareTo(rhs);
}
};
Map<String, String> treeMap = new TreeMap<>(comparator);
for (Map.Entry<String, String> entry : map.entrySet()) {
treeMap.put(entry.getKey(), entry.getValue());
}
return treeMap;
}
}
43 changes: 43 additions & 0 deletions demo/src/main/res/layout/fragment_pay.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2016 jeasonlzy(廖子尧)
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.
-->
<android.support.v4.widget.NestedScrollView
android:id="@+id/refreshLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:padding="10dp"
android:text="如果你觉得好,对你有过帮助,请给我一点打赏鼓励吧,一分也是爱呀!"
android:textColor="#FFF"
android:textSize="16sp"/>

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@mipmap/pay"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>

Binary file added demo/src/main/res/mipmap-xhdpi/pay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed jar/okgo-2.1.4.jar
Binary file not shown.
Binary file added jar/okgo-3.0.0.jar
Binary file not shown.
Binary file removed jar/okrx-0.1.2.jar
Binary file not shown.
Binary file added jar/okrx-1.0.0.jar
Binary file not shown.
Binary file added jar/okrx2-2.0.0.jar
Binary file not shown.
Binary file removed jar/okserver-1.1.3.jar
Binary file not shown.
Binary file added jar/okserver-2.0.0.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion okgo/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ artifacts {

// 生成jar包
task releaseJar(type: Copy) {
from( 'build/intermediates/bundles/release')
from( 'build/intermediates/bundles/default')
into( '../jar')
include('classes.jar')
rename('classes.jar', 'okgo-' + version + '.jar')
Expand Down
2 changes: 1 addition & 1 deletion okrx/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ artifacts {

// 生成jar包
task releaseJar(type: Copy) {
from( 'build/intermediates/bundles/release')
from( 'build/intermediates/bundles/default')
into( '../jar')
include('classes.jar')
rename('classes.jar', 'okrx-' + version + '.jar')
Expand Down
1 change: 0 additions & 1 deletion okrx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'io.reactivex:rxjava:1.3.0'
compile 'io.reactivex:rxandroid:1.2.1'
// compile "com.lzy.net:okgo:$versionName_okgo"
compile project(':okgo')
}
Expand Down
4 changes: 2 additions & 2 deletions okrx2/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ artifacts {

// 生成jar包
task releaseJar(type: Copy) {
from( 'build/intermediates/bundles/release')
from( 'build/intermediates/bundles/default')
into( '../jar')
include('classes.jar')
rename('classes.jar', 'okserver-' + version + '.jar')
rename('classes.jar', 'okrx2-' + version + '.jar')
}

Properties properties = new Properties()
Expand Down
3 changes: 1 addition & 2 deletions okrx2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'io.reactivex.rxjava2:rxjava:2.1.0'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
// compile "com.lzy.net:okgo:$versionName_okgo"
// compile "com.lzy.net:okgo:$versionName_okgo"
compile project(':okgo')
}

Expand Down
2 changes: 1 addition & 1 deletion okserver/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ artifacts {

// 生成jar包
task releaseJar(type: Copy) {
from( 'build/intermediates/bundles/release')
from( 'build/intermediates/bundles/default')
into( '../jar')
include('classes.jar')
rename('classes.jar', 'okserver-' + version + '.jar')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.lzy.okserver.download;

import com.lzy.okgo.model.Progress;
import com.lzy.okserver.ProgressListener;

import java.io.File;
Expand Down

0 comments on commit 0866eea

Please sign in to comment.