├── assert ├── README.md ├── GIF.gif ├── get.png ├── main.png ├── post.png ├── download1.png ├── Android技术交流群群二维码.png └── mainanddownload.png ├── sample ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values │ │ │ ├── dimens.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── strings.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── layout │ │ │ ├── layout_download.xml │ │ │ ├── main_item.xml │ │ │ ├── post_main.xml │ │ │ ├── activity_main.xml │ │ │ ├── get_main.xml │ │ │ └── download_item.xml │ │ ├── java │ │ └── com │ │ │ └── yang │ │ │ └── demo │ │ │ ├── activity │ │ │ ├── UploadActivity.java │ │ │ ├── GetActivity.java │ │ │ ├── PostActivity.java │ │ │ ├── RxGetActivity.java │ │ │ ├── DownloadActivity.java │ │ │ └── RxPostActivity.java │ │ │ ├── MainApplication.java │ │ │ ├── entity │ │ │ ├── PostEntity.java │ │ │ ├── MainEntity.java │ │ │ └── DownloadEntity.java │ │ │ ├── MainActivity.java │ │ │ └── adapter │ │ │ ├── MainAdapter.java │ │ │ └── DownloadAdapter.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── easy-http-library-rx ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── yang │ │ │ │ └── easyhttprx │ │ │ │ ├── converter │ │ │ │ ├── RxEasyConverter.java │ │ │ │ ├── RxEasyStringConverter.java │ │ │ │ ├── RxEasyJsonConverter.java │ │ │ │ └── RxEasyCustomConverter.java │ │ │ │ ├── RxEasyHttp.java │ │ │ │ └── manager │ │ │ │ └── RxEasyHttpManager.java │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── com │ │ └── yang │ │ └── easyhttprx │ │ └── ExampleUnitTest.java ├── proguard-rules.pro └── build.gradle ├── easy-http-library ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── yang │ │ │ │ └── easyhttp │ │ │ │ ├── utils │ │ │ │ ├── EasyConstants.java │ │ │ │ ├── Exceptions.java │ │ │ │ ├── EasyIOUtils.java │ │ │ │ ├── EasyFileUtils.java │ │ │ │ ├── EasyHttpUtils.java │ │ │ │ └── EasyNetworkUtils.java │ │ │ │ ├── converter │ │ │ │ ├── EasyResponseConverter.java │ │ │ │ └── EasyResponseJsonConverter.java │ │ │ │ ├── cache │ │ │ │ ├── EasyCacheTime.java │ │ │ │ ├── EasyCacheType.java │ │ │ │ └── EasyCacheDir.java │ │ │ │ ├── callback │ │ │ │ ├── EasyCallback.java │ │ │ │ ├── EasyStringCallback.java │ │ │ │ ├── EasyJsonCallback.java │ │ │ │ └── EasyCustomCallback.java │ │ │ │ ├── Interceptor │ │ │ │ ├── EasyUserAgentInterceptor.java │ │ │ │ ├── EasyLoggingInterceptor.java │ │ │ │ ├── EasyHeaderInterceptor.java │ │ │ │ └── EasyCacheInterceptor.java │ │ │ │ ├── download │ │ │ │ ├── EasyTaskStatus.java │ │ │ │ ├── EasyDownloadTaskListener.java │ │ │ │ ├── EasySimpleDownloadTaskListener.java │ │ │ │ ├── EasyTaskEntity.java │ │ │ │ ├── EasySimpleDownloadManager.java │ │ │ │ ├── EasyDownloadManager.java │ │ │ │ ├── EasySimpleDownloadTask.java │ │ │ │ └── EasyDownloadTask.java │ │ │ │ ├── request │ │ │ │ └── EasyRequestParams.java │ │ │ │ ├── db │ │ │ │ └── EasyDaoManager.java │ │ │ │ ├── config │ │ │ │ └── EasyHttpConfig.java │ │ │ │ ├── EasyHttpClient.java │ │ │ │ └── manager │ │ │ │ └── EasyHttpClientManager.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── yang │ │ │ └── easyhttp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── yang │ │ └── easyhttp │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /assert/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /easy-http-library-rx/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /easy-http-library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /assert/GIF.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/GIF.gif -------------------------------------------------------------------------------- /assert/get.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/get.png -------------------------------------------------------------------------------- /assert/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/main.png -------------------------------------------------------------------------------- /assert/post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/post.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':easy-http-library', ':easy-http-library-rx' 2 | -------------------------------------------------------------------------------- /assert/download1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/download1.png -------------------------------------------------------------------------------- /assert/Android技术交流群群二维码.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/Android技术交流群群二维码.png -------------------------------------------------------------------------------- /assert/mainanddownload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/assert/mainanddownload.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /easy-http-library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | easy-http-library 3 | 4 | -------------------------------------------------------------------------------- /easy-http-library-rx/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | easy-http-library-rx 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaurenceYang/EasyHttp/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/utils/EasyConstants.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.utils; 2 | 3 | /** 4 | * Created by yangy on 2017/2/16. 5 | */ 6 | public class EasyConstants { 7 | public static final int MAX_THREAD_COUNT = 16; 8 | } 9 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/converter/EasyResponseConverter.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.converter; 2 | 3 | /** 4 | * Created by yangy on 2017/2/15. 5 | */ 6 | public interface EasyResponseConverter { 7 | T convert(String body); 8 | } 9 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/java/com/yang/demo/activity/UploadActivity.java: -------------------------------------------------------------------------------- 1 | package com.yang.demo.activity; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | 5 | /** 6 | * Created by yangyang on 2017/2/17. 7 | */ 8 | public class UploadActivity extends AppCompatActivity { 9 | } 10 | -------------------------------------------------------------------------------- /easy-http-library-rx/src/main/java/com/yang/easyhttprx/converter/RxEasyConverter.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttprx.converter; 2 | 3 | /** 4 | * Created by yangyang on 2017/3/15. 5 | */ 6 | public interface RxEasyConverter { 7 | T convert(String body) throws Exception; 8 | 9 | void doNothing(); 10 | } 11 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/utils/Exceptions.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.utils; 2 | 3 | public class Exceptions 4 | { 5 | public static void illegalArgument(String msg, Object... params) 6 | { 7 | throw new IllegalArgumentException(String.format(msg, params)); 8 | } 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /easy-http-library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/cache/EasyCacheTime.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.cache; 2 | 3 | /** 4 | * Created by yangy on 2017/2/15. 5 | */ 6 | public class EasyCacheTime { 7 | public static final int CACHE_TIME_SHORT = 30;//s 8 | public static final int CACHE_TIME_MID = 3600;//s 9 | public static final int CACHE_TIME_LONG = 21600;//s 10 | } 11 | -------------------------------------------------------------------------------- /easy-http-library-rx/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /sample/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /easy-http-library/src/test/java/com/yang/easyhttp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /easy-http-library-rx/src/main/java/com/yang/easyhttprx/converter/RxEasyStringConverter.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttprx.converter; 2 | 3 | /** 4 | * Created by yangyang on 2017/3/15. 5 | */ 6 | public class RxEasyStringConverter implements RxEasyConverter { 7 | @Override 8 | public String convert(String body) throws Exception { 9 | return body; 10 | } 11 | 12 | @Override 13 | public void doNothing() { 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/cache/EasyCacheType.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.cache; 2 | 3 | /** 4 | * Created by yangy on 2017/2/15. 5 | */ 6 | public class EasyCacheType { 7 | public static final int CACHE_TYPE_NO_SETTING = -1; 8 | public static final int CACHE_TYPE_DEFAULT = 0; 9 | public static final int CACHE_TYPE_SHORT = 1; 10 | public static final int CACHE_TYPE_MID = 2; 11 | public static final int CACHE_TYPE_LONG = 3; 12 | } 13 | -------------------------------------------------------------------------------- /easy-http-library/src/androidTest/java/com/yang/easyhttp/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/callback/EasyCallback.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.callback; 2 | 3 | /** 4 | * Created by yangy on 2016/10/14. 5 | */ 6 | 7 | public interface EasyCallback { 8 | // UI线程. 9 | void onStart(); 10 | 11 | // UI线程. 12 | void onFinish(); 13 | 14 | // UI线程. 15 | void onSuccess(T content); 16 | 17 | // UI线程. 18 | void onFailure(Throwable error, String content); 19 | 20 | // 子线程. 21 | T convert(String body) throws Exception; 22 | } 23 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/callback/EasyStringCallback.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.callback; 2 | 3 | /** 4 | * Created by yangyang on 2017/2/20. 5 | */ 6 | public abstract class EasyStringCallback implements EasyCallback { 7 | @Override 8 | public void onStart() { 9 | 10 | } 11 | 12 | @Override 13 | public void onFinish() { 14 | 15 | } 16 | 17 | @Override 18 | public String convert(String body) { 19 | return body; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /easy-http-library-rx/src/test/java/com/yang/easyhttprx/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttprx; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /easy-http-library-rx/src/main/java/com/yang/easyhttprx/converter/RxEasyJsonConverter.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttprx.converter; 2 | 3 | import org.json.JSONObject; 4 | 5 | /** 6 | * Created by yangyang on 2017/3/15. 7 | */ 8 | public class RxEasyJsonConverter implements RxEasyConverter { 9 | @Override 10 | public JSONObject convert(String body) throws Exception { 11 | return new JSONObject(body); 12 | } 13 | 14 | @Override 15 | public void doNothing() { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/cache/EasyCacheDir.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.cache; 2 | 3 | import android.os.Environment; 4 | 5 | /** 6 | * Created by yangy on 2017/2/16. 7 | */ 8 | public class EasyCacheDir { 9 | public static final String SD_PATH = Environment.getExternalStorageDirectory().getPath() + "/"; 10 | public static final String CACHE_SHORT_DIR = "/cache/http.cache.1"; 11 | public static final String CACHE_MID_DIR = "/cache/http.cache.2"; 12 | public static final String CACHE_LONG_DIR = "/cache/http.cache.3"; 13 | } 14 | -------------------------------------------------------------------------------- /sample/src/main/java/com/yang/demo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.yang.demo; 2 | 3 | import android.app.Application; 4 | 5 | import com.yang.easyhttp.EasyHttpClient; 6 | 7 | /** 8 | * Created by yangyang on 2017/2/17. 9 | */ 10 | public class MainApplication extends Application { 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | 16 | // 初始化HttpClient. 17 | EasyHttpClient.init(this); 18 | 19 | // 初始化下载环境. 20 | EasyHttpClient.initDownloadEnvironment(2); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /sample/src/main/java/com/yang/demo/entity/PostEntity.java: -------------------------------------------------------------------------------- 1 | package com.yang.demo.entity; 2 | 3 | /** 4 | * Created by yangyang on 2017/3/15. 5 | */ 6 | public class PostEntity { 7 | int status; 8 | String message; 9 | 10 | public int getStatus() { 11 | return status; 12 | } 13 | 14 | public void setStatus(int status) { 15 | this.status = status; 16 | } 17 | 18 | public String getMessage() { 19 | return message; 20 | } 21 | 22 | public void setMessage(String message) { 23 | this.message = message; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/callback/EasyJsonCallback.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.callback; 2 | 3 | import org.json.JSONException; 4 | import org.json.JSONObject; 5 | 6 | /** 7 | * Created by yangy on 2017/2/22. 8 | */ 9 | public abstract class EasyJsonCallback implements EasyCallback { 10 | @Override 11 | public void onStart() { 12 | 13 | } 14 | 15 | @Override 16 | public void onFinish() { 17 | 18 | } 19 | 20 | @Override 21 | public JSONObject convert(String body) throws JSONException { 22 | return new JSONObject(body); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EasyHttp 3 | 开始 4 | 暂停 5 | 等待 6 | 取消 7 | 继续 8 | 删除 9 | 失败 10 | 重试 11 | 连接中 12 | 等待中 13 | 请求异常 14 | 存储异常 15 | 16 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/layout_download.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/converter/EasyResponseJsonConverter.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.converter; 2 | 3 | import com.google.gson.Gson; 4 | 5 | import java.lang.reflect.ParameterizedType; 6 | import java.lang.reflect.Type; 7 | 8 | /** 9 | * Created by yangy on 2017/2/15. 10 | */ 11 | public class EasyResponseJsonConverter implements EasyResponseConverter { 12 | 13 | @Override 14 | public T convert(String body) { 15 | Gson gson = new Gson(); //TODO: 16 | Type t = getClass().getGenericSuperclass(); 17 | Type targ = ((ParameterizedType) t).getActualTypeArguments()[0]; 18 | return gson.fromJson(body, targ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea 38 | 39 | # Keystore files 40 | *.jks 41 | 42 | # OSX files 43 | .DS_Store -------------------------------------------------------------------------------- /easy-http-library/src/main/java/com/yang/easyhttp/utils/EasyIOUtils.java: -------------------------------------------------------------------------------- 1 | package com.yang.easyhttp.utils; 2 | 3 | import java.io.Closeable; 4 | import java.io.IOException; 5 | 6 | /** 7 | * Created by yuan on 07/12/2016. 8 | */ 9 | 10 | public class EasyIOUtils { 11 | 12 | /** 13 | * 关闭流 14 | * @param closeables io 15 | */ 16 | public static void close(Closeable... closeables) { 17 | for (Closeable io : closeables) { 18 | if (io != null) { 19 | try { 20 | io.close(); 21 | } catch (IOException e) { 22 | e.printStackTrace(); 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/yangyang/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /easy-http-library/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/yangyang/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /sample/src/main/java/com/yang/demo/entity/MainEntity.java: -------------------------------------------------------------------------------- 1 | package com.yang.demo.entity; 2 | 3 | /** 4 | * Created by yangyang on 2017/2/17. 5 | */ 6 | public class MainEntity { 7 | private String title; 8 | private String desc; 9 | private int type; 10 | 11 | public String getTitle() { 12 | return title; 13 | } 14 | 15 | public void setTitle(String title) { 16 | this.title = title; 17 | } 18 | 19 | public String getDesc() { 20 | return desc; 21 | } 22 | 23 | public void setDesc(String desc) { 24 | this.desc = desc; 25 | } 26 | 27 | public int getType() { 28 | return type; 29 | } 30 | 31 | public void setType(int type) { 32 | this.type = type; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sample/src/main/java/com/yang/demo/entity/DownloadEntity.java: -------------------------------------------------------------------------------- 1 | package com.yang.demo.entity; 2 | 3 | /** 4 | * Created by yangyang on 2017/2/17. 5 | */ 6 | public class DownloadEntity { 7 | private String title; 8 | private String url; 9 | private String hashCode; 10 | 11 | public String getTitle() { 12 | return title; 13 | } 14 | 15 | public void setTitle(String title) { 16 | this.title = title; 17 | } 18 | 19 | public String getUrl() { 20 | return url; 21 | } 22 | 23 | public void setUrl(String url) { 24 | this.url = url; 25 | } 26 | 27 | public String getHashCode() { 28 | return hashCode; 29 | } 30 | 31 | public void setHashCode(String hashCode) { 32 | this.hashCode = hashCode; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/main_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 15 | 21 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/post_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 12 |