From bce64a17fd7430c6f025f79788b0792ed37cd72b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Android=20=E8=BD=AE=E5=AD=90=E5=93=A5?= Date: Thu, 5 Oct 2023 11:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A1=86=E6=9E=B6=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HelpDoc.md | 22 +++++++++++----------- README.md | 8 ++++---- build.gradle | 21 ++++++++++++++++++--- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/HelpDoc.md b/HelpDoc.md index ebcc97b..dffce8d 100644 --- a/HelpDoc.md +++ b/HelpDoc.md @@ -160,9 +160,9 @@ public class RequestServer implements IRequestServer { @NonNull @Override - public BodyType getBodyType() { + public RequestBodyType getBodyType() { // 参数以 Json 格式提交(默认是表单) - return BodyType.JSON; + return RequestBodyType.JSON; } } ``` @@ -325,9 +325,9 @@ public final class UpdateImageApi implements IRequestApi, IRequestType { @NonNull @Override - public BodyType getBodyType() { + public RequestBodyType getBodyType() { // 上传文件需要使用表单的形式提交 - return BodyType.FORM; + return RequestBodyType.FORM; } /** 本地图片 */ @@ -870,8 +870,8 @@ public class XxxServer implements IRequestServer { @NonNull @Override - public BodyType getBodyType() { - return BodyType.FORM; + public RequestBodyType getBodyType() { + return RequestBodyType.FORM; } } ``` @@ -889,8 +889,8 @@ public class XxxServer implements IRequestServer { @NonNull @Override - public BodyType getBodyType() { - return BodyType.JSON; + public RequestBodyType getBodyType() { + return RequestBodyType.JSON; } } ``` @@ -908,8 +908,8 @@ public final class XxxApi implements IRequestApi, IRequestType { @NonNull @Override - public BodyType getBodyType() { - return BodyType.JSON; + public RequestBodyType getBodyType() { + return RequestBodyType.JSON; } } ``` @@ -1474,7 +1474,7 @@ EasyHttp.post(this) EasyHttp.post(this) .api(new XxxApi()) // 表示回调是在子线程中进行 - .schedulers(ThreadSchedulers.IOThread) + .schedulers(ThreadSchedulers.IO) .request(new HttpCallbackProxy>(this) { @Override diff --git a/README.md b/README.md index 6585c4f..787297d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ * 博客地址:[网络请求,如斯优雅](https://www.jianshu.com/p/93cd59dec002) -* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处下载Demo](https://github.com/getActivity/EasyHttp/releases/download/12.2/EasyHttp.apk) +* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处下载Demo](https://github.com/getActivity/EasyHttp/releases/download/12.5/EasyHttp.apk) ![](picture/demo_code.png) @@ -61,7 +61,7 @@ android { dependencies { // 网络请求框架:https://github.com/getActivity/EasyHttp - implementation 'com.github.getActivity:EasyHttp:12.2' + implementation 'com.github.getActivity:EasyHttp:12.5' // OkHttp 框架:https://github.com/square/okhttp // noinspection GradleDependency implementation 'com.squareup.okhttp3:okhttp:3.12.13' @@ -84,9 +84,9 @@ dependencies { | 功能或细节 | [EasyHttp](https://github.com/getActivity/EasyHttp) | [Retrofit](https://github.com/square/retrofit) | [OkGo](https://github.com/jeasonlzy/okhttp-OkGo) | | :----: | :------: | :-----: | :-----: | -| 对应版本 | 12.2 | 2.9.0 | 3.0.4 | +| 对应版本 | 12.5 | 2.9.0 | 3.0.4 | | issues 数 | [![](https://img.shields.io/github/issues/getActivity/EasyHttp.svg)](https://github.com/getActivity/EasyHttp/issues) | [![](https://img.shields.io/github/issues/square/retrofit.svg)](https://github.com/square/retrofit/issues) | [![](https://img.shields.io/github/issues/jeasonlzy/okhttp-OkGo.svg)](https://github.com/jeasonlzy/okhttp-OkGo/issues) | -| **aar 包大小** | 90 KB | 123 KB | 131 KB | +| **aar 包大小** | 92 KB | 123 KB | 131 KB | | minSdk 要求 | API 14+ | API 21+ | API 14+ | | 配置多域名 | ✅ | ❌ | ✅ | | **动态 Host** | ✅ | ❌ | ❌ | diff --git a/build.gradle b/build.gradle index d111a52..91c17e3 100644 --- a/build.gradle +++ b/build.gradle @@ -32,10 +32,25 @@ allprojects { jcenter() } - // 将构建文件统一输出到项目根目录下的 build 文件夹 - setBuildDir(new File(rootDir, "build/${path.replaceAll(':', '/')}")) + // 读取 local.properties 文件配置 + def properties = new Properties() + def localPropertiesFile = rootProject.file("local.properties") + if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { inputStream -> + properties.load(inputStream) + } + } + + String buildDirPath = properties.getProperty("build.dir") + if (buildDirPath != null && buildDirPath != "") { + // 将构建文件统一输出到指定的目录下 + setBuildDir(new File(buildDirPath, rootProject.name + "/build/${path.replaceAll(':', '/')}")) + } else { + // 将构建文件统一输出到项目根目录下的 build 文件夹 + setBuildDir(new File(rootDir, "build/${path.replaceAll(':', '/')}")) + } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } \ No newline at end of file