diff --git a/README.md b/README.md index c7ef488f..d5670b3b 100644 --- a/README.md +++ b/README.md @@ -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' //下载管理和上传管理扩展,根据需要添加 或者 @@ -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 diff --git a/app/build.gradle b/app/build.gradle index d9a6d816..815608f8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,6 +46,10 @@ android { signingConfig signingConfigs.appkey } } + lintOptions { + abortOnError false + } + } task makeApk { diff --git a/app/src/main/java/com/lzy/demo/okgo/TestActivity.java b/app/src/main/java/com/lzy/demo/okgo/TestActivity.java index 75b628b1..625047d4 100644 --- a/app/src/main/java/com/lzy/demo/okgo/TestActivity.java +++ b/app/src/main/java/com/lzy/demo/okgo/TestActivity.java @@ -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 { @@ -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) { + + } + }); } } \ No newline at end of file diff --git a/jar/okgo-2.1.3.jar b/jar/okgo-2.1.4.jar similarity index 97% rename from jar/okgo-2.1.3.jar rename to jar/okgo-2.1.4.jar index ecd86592..d7c8f70f 100644 Binary files a/jar/okgo-2.1.3.jar and b/jar/okgo-2.1.4.jar differ diff --git a/jar/okserver-1.1.2.jar b/jar/okserver-1.1.3.jar similarity index 98% rename from jar/okserver-1.1.2.jar rename to jar/okserver-1.1.3.jar index b5930b42..881ac93d 100644 Binary files a/jar/okserver-1.1.2.jar and b/jar/okserver-1.1.3.jar differ diff --git a/okgo/bintray.gradle b/okgo/bintray.gradle index 3391ec3d..0e5ca7e9 100644 --- a/okgo/bintray.gradle +++ b/okgo/bintray.gradle @@ -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' diff --git a/okgo/build.gradle b/okgo/build.gradle index ea20dbc6..370f59c2 100644 --- a/okgo/build.gradle +++ b/okgo/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 24 - versionCode 23 - versionName "2.1.3" + versionCode 24 + versionName "2.1.4" } } @@ -17,4 +17,4 @@ dependencies { compile 'com.squareup.okhttp3:okhttp:3.4.1' } -//apply from: 'bintray.gradle' \ No newline at end of file +//apply from: 'bintray.gradle'、 \ No newline at end of file diff --git a/okgo/src/main/java/com/lzy/okgo/request/DeleteRequest.java b/okgo/src/main/java/com/lzy/okgo/request/DeleteRequest.java index c92a7a1d..715043c1 100644 --- a/okgo/src/main/java/com/lzy/okgo/request/DeleteRequest.java +++ b/okgo/src/main/java/com/lzy/okgo/request/DeleteRequest.java @@ -20,10 +20,9 @@ */ public class DeleteRequest extends BaseBodyRequest { - protected String method = "DELETE"; - public DeleteRequest(String url) { super(url); + method = "DELETE"; } @Override diff --git a/okgo/src/main/java/com/lzy/okgo/request/GetRequest.java b/okgo/src/main/java/com/lzy/okgo/request/GetRequest.java index feb7f2c4..15ff70e2 100644 --- a/okgo/src/main/java/com/lzy/okgo/request/GetRequest.java +++ b/okgo/src/main/java/com/lzy/okgo/request/GetRequest.java @@ -16,10 +16,9 @@ */ public class GetRequest extends BaseRequest { - protected String method = "GET"; - public GetRequest(String url) { super(url); + method = "GET"; } @Override diff --git a/okgo/src/main/java/com/lzy/okgo/request/HeadRequest.java b/okgo/src/main/java/com/lzy/okgo/request/HeadRequest.java index a64ce7e8..fbb3df2d 100644 --- a/okgo/src/main/java/com/lzy/okgo/request/HeadRequest.java +++ b/okgo/src/main/java/com/lzy/okgo/request/HeadRequest.java @@ -16,10 +16,9 @@ */ public class HeadRequest extends BaseRequest { - protected String method = "HEAD"; - public HeadRequest(String url) { super(url); + method = "HEAD"; } @Override diff --git a/okgo/src/main/java/com/lzy/okgo/request/OptionsRequest.java b/okgo/src/main/java/com/lzy/okgo/request/OptionsRequest.java index 31674523..e30f38a8 100644 --- a/okgo/src/main/java/com/lzy/okgo/request/OptionsRequest.java +++ b/okgo/src/main/java/com/lzy/okgo/request/OptionsRequest.java @@ -20,10 +20,9 @@ */ public class OptionsRequest extends BaseBodyRequest { - protected String method = "OPTIONS"; - public OptionsRequest(String url) { super(url); + method = "OPTIONS"; } @Override diff --git a/okgo/src/main/java/com/lzy/okgo/request/PostRequest.java b/okgo/src/main/java/com/lzy/okgo/request/PostRequest.java index bf92e8c9..bc42f2f6 100644 --- a/okgo/src/main/java/com/lzy/okgo/request/PostRequest.java +++ b/okgo/src/main/java/com/lzy/okgo/request/PostRequest.java @@ -20,10 +20,9 @@ */ public class PostRequest extends BaseBodyRequest { - protected String method = "POST"; - public PostRequest(String url) { super(url); + method = "POST"; } @Override diff --git a/okgo/src/main/java/com/lzy/okgo/request/PutRequest.java b/okgo/src/main/java/com/lzy/okgo/request/PutRequest.java index 525da5a4..35c6610c 100644 --- a/okgo/src/main/java/com/lzy/okgo/request/PutRequest.java +++ b/okgo/src/main/java/com/lzy/okgo/request/PutRequest.java @@ -20,10 +20,9 @@ */ public class PutRequest extends BaseBodyRequest { - protected String method = "PUT"; - public PutRequest(String url) { super(url); + method = "PUT"; } @Override diff --git a/okserver/bintray.gradle b/okserver/bintray.gradle index 8d6bd7d8..9cf0062e 100644 --- a/okserver/bintray.gradle +++ b/okserver/bintray.gradle @@ -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' diff --git a/okserver/build.gradle b/okserver/build.gradle index a470daca..b6453f80 100644 --- a/okserver/build.gradle +++ b/okserver/build.gradle @@ -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') } diff --git a/okserver/src/main/java/com/lzy/okserver/download/DownloadManager.java b/okserver/src/main/java/com/lzy/okserver/download/DownloadManager.java index 5a034696..e2c626a1 100644 --- a/okserver/src/main/java/com/lzy/okserver/download/DownloadManager.java +++ b/okserver/src/main/java/com/lzy/okserver/download/DownloadManager.java @@ -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); } }