Skip to content

Commit

Permalink
升级2.1.4,修复getMethod返回值值异常的问题,优化同一key下载同一文件无回调的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonlzy committed Dec 7, 2016
1 parent 04dc292 commit f1da37a
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 24 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
* 对于Android Studio的用户,可以选择添加:

```java
compile 'com.lzy.net:okgo:2.1.3' //可以单独使用,不需要依赖下方的扩展包
compile 'com.lzy.net:okgo:2.1.4' //可以单独使用,不需要依赖下方的扩展包
compile 'com.lzy.net:okrx:0.1.2' //RxJava扩展支持,根据需要添加
compile 'com.lzy.net:okserver:1.1.2' //下载管理和上传管理扩展,根据需要添加
compile 'com.lzy.net:okserver:1.1.3' //下载管理和上传管理扩展,根据需要添加

或者

Expand All @@ -80,10 +80,10 @@ compile 'com.lzy.net:okserver:+' //版本号使用 + 可以自动引用最新
```java
okhttp-3.4.1.jar //okhttp官方包 (必须导)
okio-1.9.0.jar //okio官方包(必须导)
okgo-2.1.3.jar //okgo基本功能包(必须导)
okgo-2.1.4.jar //okgo基本功能包(必须导)

okrx-0.1.2.jar //okrx扩展支持包,想用rxjava调用的必须要导(同时还需要rxjava的jar,自行下载,不提供)
okserver-1.1.2.jar //okserver扩展支持包,使用下载管理必须要
okserver-1.1.3.jar //okserver扩展支持包,使用下载管理必须要
```
* 如果是以jar包的形式引入`okserver`,需要在清单文件中额外注册一个服务
```java
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ android {
signingConfig signingConfigs.appkey
}
}
lintOptions {
abortOnError false
}

}

task makeApk {
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/java/com/lzy/demo/okgo/TestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@
import com.lzy.demo.callback.JsonConvert;
import com.lzy.demo.model.LzyResponse;
import com.lzy.demo.model.ServerModel;
import com.lzy.demo.utils.Urls;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.adapter.Call;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.convert.BitmapConvert;
import com.lzy.okgo.convert.FileConvert;
import com.lzy.okgo.convert.StringConvert;
import com.lzy.okgo.request.BaseRequest;
import com.lzy.okrx.RxAdapter;

import java.io.File;

import butterknife.Bind;
import butterknife.OnClick;
import okhttp3.Response;
import rx.Observable;

public class TestActivity extends BaseActivity {
Expand Down Expand Up @@ -54,5 +58,20 @@ public void btn2(View view) {

@OnClick(R.id.btn3)
public void btn3(View view) {
OkGo.get(Urls.URL_METHOD)//
.tag(this)//
.execute(new StringCallback() {
@Override
public void onBefore(BaseRequest request) {
super.onBefore(request);
System.out.println("---" + request.getMethod());
System.out.println("---" + request.getMethod());
}

@Override
public void onSuccess(String s, okhttp3.Call call, Response response) {

}
});
}
}
Binary file renamed jar/okgo-2.1.3.jar → jar/okgo-2.1.4.jar
Binary file not shown.
Binary file renamed jar/okserver-1.1.2.jar → jar/okserver-1.1.3.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion okgo/bintray.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "2.1.3" // 数据仓库依赖第三部分
version = "2.1.4" // 数据仓库依赖第三部分

def siteUrl = 'https://github.com/jeasonlzy/OkGo'
def gitUrl = 'https://github.com/jeasonlzy/OkGo.git'
Expand Down
6 changes: 3 additions & 3 deletions okgo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
versionCode 23
versionName "2.1.3"
versionCode 24
versionName "2.1.4"
}
}

Expand All @@ -17,4 +17,4 @@ dependencies {
compile 'com.squareup.okhttp3:okhttp:3.4.1'
}

//apply from: 'bintray.gradle'
//apply from: 'bintray.gradle'
3 changes: 1 addition & 2 deletions okgo/src/main/java/com/lzy/okgo/request/DeleteRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
*/
public class DeleteRequest extends BaseBodyRequest<DeleteRequest> {

protected String method = "DELETE";

public DeleteRequest(String url) {
super(url);
method = "DELETE";
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions okgo/src/main/java/com/lzy/okgo/request/GetRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
*/
public class GetRequest extends BaseRequest<GetRequest> {

protected String method = "GET";

public GetRequest(String url) {
super(url);
method = "GET";
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions okgo/src/main/java/com/lzy/okgo/request/HeadRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
*/
public class HeadRequest extends BaseRequest<HeadRequest> {

protected String method = "HEAD";

public HeadRequest(String url) {
super(url);
method = "HEAD";
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions okgo/src/main/java/com/lzy/okgo/request/OptionsRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
*/
public class OptionsRequest extends BaseBodyRequest<OptionsRequest> {

protected String method = "OPTIONS";

public OptionsRequest(String url) {
super(url);
method = "OPTIONS";
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions okgo/src/main/java/com/lzy/okgo/request/PostRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
*/
public class PostRequest extends BaseBodyRequest<PostRequest> {

protected String method = "POST";

public PostRequest(String url) {
super(url);
method = "POST";
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions okgo/src/main/java/com/lzy/okgo/request/PutRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
*/
public class PutRequest extends BaseBodyRequest<PutRequest> {

protected String method = "PUT";

public PutRequest(String url) {
super(url);
method = "PUT";
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion okserver/bintray.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

version = "1.1.2" // 数据仓库依赖第三部分
version = "1.1.3" // 数据仓库依赖第三部分

def siteUrl = 'https://github.com/jeasonlzy/OkGo'
def gitUrl = 'https://github.com/jeasonlzy/OkGo.git'
Expand Down
6 changes: 3 additions & 3 deletions okserver/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
versionCode 18
versionName "1.1.2"
versionCode 19
versionName "1.1.3"
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile 'com.lzy.net:okgo:2.1.2'
// compile 'com.lzy.net:okgo:2.1.4'
compile project(':okgo')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ private void addTask(String fileName, String taskTag, Serializable data, BaseReq
//构造即开始执行
DownloadTask downloadTask = new DownloadTask(downloadInfo, isRestart, listener);
downloadInfo.setTask(downloadTask);
} else if (downloadInfo.getState() == DownloadManager.FINISH) {
if (listener != null) listener.onFinish(downloadInfo);
}
}

Expand Down

0 comments on commit f1da37a

Please sign in to comment.