├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── app ├── .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 │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── activity_download.xml │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ljd │ │ │ │ └── retrofit │ │ │ │ ├── download │ │ │ │ ├── DownloadApi.java │ │ │ │ └── DownloadActivity.java │ │ │ │ ├── pojo │ │ │ │ ├── User.java │ │ │ │ ├── Owner.java │ │ │ │ ├── Contributor.java │ │ │ │ ├── Item.java │ │ │ │ ├── RetrofitBean.java │ │ │ │ └── Example.java │ │ │ │ ├── RxUtils.java │ │ │ │ ├── GithubService.java │ │ │ │ ├── GithubApi.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── ljd │ │ │ └── retrofit │ │ │ └── exampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── ljd │ │ └── retrofit │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── library ├── .gitignore ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── ljd │ │ └── retrofit │ │ └── progress │ │ ├── ProgressListener.java │ │ ├── ProgressBean.java │ │ ├── UploadProgressHandler.java │ │ ├── ProgressHandler.java │ │ ├── DownloadProgressHandler.java │ │ ├── ProgressResponseBody.java │ │ ├── ProgressRequestBody.java │ │ └── ProgressHelper.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── libs └── android-async-http-1.4.9.jar ├── .gitignore ├── README.md ├── gradle.properties ├── gradlew.bat └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | retrofit-example -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':library' 2 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /library/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Library 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /libs/android-async-http-1.4.9.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/libs/android-async-http-1.4.9.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lijiangdong/retrofit-example/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # retrofit-example 2 | retrofit基本用法:http://blog.csdn.net/ljd2038/article/details/51046512 3 | 4 | 解决retrofit文件下载的进度显示问题:http://blog.csdn.net/ljd2038/article/details/51189334 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /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.10-all.zip 7 | -------------------------------------------------------------------------------- /library/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /library/src/main/java/com/ljd/retrofit/progress/ProgressListener.java: -------------------------------------------------------------------------------- 1 | package com.ljd.retrofit.progress; 2 | 3 | /** 4 | * Created by ljd on 3/29/16. 5 | */ 6 | public interface ProgressListener { 7 | /** 8 | * @param progress 已经下载或上传字节数 9 | * @param total 总字节数 10 | * @param done 是否完成 11 | */ 12 | void onProgress(long progress, long total, boolean done); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/ljd/retrofit/download/DownloadApi.java: -------------------------------------------------------------------------------- 1 | package com.example.ljd.retrofit.download; 2 | 3 | import okhttp3.ResponseBody; 4 | import retrofit2.Call; 5 | import retrofit2.http.GET; 6 | 7 | /** 8 | * Created by ljd on 3/29/16. 9 | */ 10 | public interface DownloadApi { 11 | 12 | @GET("/mobilesafe/shouji360/360safesis/360MobileSafe_6.2.3.1060.apk") 13 | Call retrofitDownload(); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/test/java/com/example/ljd/retrofit/exampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.ljd.retrofit; 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 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/ljd/retrofit/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.ljd.retrofit; 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 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | retrofit-example 3 | 9d43774b1ce07bc1abb84310252bc87b2f036a50 4 | 清空 5 | square 6 | retrofit 7 | 8 | Hello blank fragment 9 | 10 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/ljd/retrofit/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.example.ljd.retrofit.pojo; 2 | 3 | 4 | public class User { 5 | 6 | private String name; 7 | private String email; 8 | 9 | public String getName() { 10 | return name; 11 | } 12 | 13 | public void setLogin(String login) { 14 | this.name = login; 15 | } 16 | 17 | public String getEmail() { 18 | return email; 19 | } 20 | 21 | public void setEmail(String email) { 22 | this.email = email; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/ljd/retrofit/pojo/Owner.java: -------------------------------------------------------------------------------- 1 | package com.example.ljd.retrofit.pojo; 2 | 3 | 4 | /** 5 | * Created by ljd on 3/29/16. 6 | */ 7 | public class Owner { 8 | 9 | private String login; 10 | private String type; 11 | 12 | public String getLogin() { 13 | return login; 14 | } 15 | 16 | public void setLogin(String login) { 17 | this.login = login; 18 | } 19 | 20 | public String getType() { 21 | return type; 22 | } 23 | 24 | public void setType(String type) { 25 | this.type = type; 26 | } 27 | } -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/ljd/retrofit/pojo/Contributor.java: -------------------------------------------------------------------------------- 1 | package com.example.ljd.retrofit.pojo; 2 | 3 | 4 | /** 5 | * Created by ljd on 3/25/16. 6 | */ 7 | public class Contributor { 8 | private String login; 9 | private Integer contributions; 10 | 11 | public String getLogin() { 12 | return login; 13 | } 14 | 15 | public void setLogin(String login) { 16 | this.login = login; 17 | } 18 | 19 | public Integer getContributions() { 20 | return contributions; 21 | } 22 | 23 | public void setContributions(Integer contributions) { 24 | this.contributions = contributions; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_download.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 |