├── README.md ├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── java │ │ └── com │ │ │ └── cicinnus │ │ │ └── retrofitmvprxjava2 │ │ │ ├── MainFragment.java │ │ │ ├── MainContract.java │ │ │ ├── BaseApplication.java │ │ │ ├── Api.java │ │ │ ├── BaseActivity.java │ │ │ ├── MainModel.java │ │ │ ├── OkHttpManager.java │ │ │ ├── MainPresenter.java │ │ │ ├── ResultBean.java │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml ├── build.gradle └── proguard-rules.pro ├── rrmlib ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── cicinnus │ │ │ │ └── retrofitlib │ │ │ │ ├── hybrid │ │ │ │ ├── jsbridge │ │ │ │ │ ├── CallBackFunction.java │ │ │ │ │ ├── BridgeHandler.java │ │ │ │ │ ├── WebViewJavascriptBridge.java │ │ │ │ │ ├── DefaultHandler.java │ │ │ │ │ ├── BridgeWebViewClient.java │ │ │ │ │ ├── BridgeUtil.java │ │ │ │ │ ├── Message.java │ │ │ │ │ └── BridgeWebView.java │ │ │ │ └── wrapper │ │ │ │ │ ├── JavaCallBack.java │ │ │ │ │ ├── JsCallBack.java │ │ │ │ │ ├── WebViewTools.java │ │ │ │ │ ├── WebViewSettingUtil.java │ │ │ │ │ └── WebViewClientWrapper.java │ │ │ │ ├── base │ │ │ │ ├── ICorePresenter.java │ │ │ │ ├── ICoreLoadingView.java │ │ │ │ ├── BaseMVPActivity.java │ │ │ │ ├── BaseMVPFragment.java │ │ │ │ └── BaseMVPPresenter.java │ │ │ │ ├── net │ │ │ │ ├── BaseObserver.java │ │ │ │ ├── BASE_API.java │ │ │ │ ├── file_upload │ │ │ │ │ ├── FileUploadObserver.java │ │ │ │ │ └── UploadFileRequestBody.java │ │ │ │ ├── JsonRequestBody.java │ │ │ │ ├── error │ │ │ │ │ └── ExceptionHandle.java │ │ │ │ ├── file_download │ │ │ │ │ └── FileDownLoadObserver.java │ │ │ │ ├── RxApiManager.java │ │ │ │ └── RetrofitClient.java │ │ │ │ ├── rx │ │ │ │ └── SchedulersCompact.java │ │ │ │ └── utils │ │ │ │ ├── UIUtils.java │ │ │ │ ├── NetWorkUtil.java │ │ │ │ ├── SPUtils.java │ │ │ │ ├── ServicesUtils.java │ │ │ │ └── BarUtils.java │ │ ├── AndroidManifest.xml │ │ └── assets │ │ │ └── WebViewJavascriptBridge.js │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── cicinnus │ │ │ └── retrofitlib │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── cicinnus │ │ └── retrofitlib │ │ └── ExampleInstrumentedTest.java ├── libs │ └── tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat └── gradlew /README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rrmlib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':rrmlib' 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /rrmlib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | RetrofitLib 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Retrofit+MVP+RxJava2 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /rrmlib/libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cicinnus0407/RRMLib/HEAD/rrmlib/libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/hybrid/jsbridge/CallBackFunction.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.hybrid.jsbridge; 2 | 3 | public interface CallBackFunction { 4 | 5 | public void onCallBack(String data); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/hybrid/jsbridge/BridgeHandler.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.hybrid.jsbridge; 2 | 3 | public interface BridgeHandler { 4 | 5 | void handler(String data, CallBackFunction function); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/base/ICorePresenter.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.base; 2 | 3 | /** 4 | * Presenter接口用于解除订阅回调 5 | */ 6 | 7 | public interface ICorePresenter { 8 | void onViewStop(); 9 | void onViewDestroy(); 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Mar 28 16:43:25 CST 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/hybrid/wrapper/JavaCallBack.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.hybrid.wrapper; 2 | 3 | /** 4 | * Java调用Js的回调接口 5 | */ 6 | 7 | public interface JavaCallBack { 8 | //JS给Java的回调数据 9 | void onJsResponse(String data); 10 | } 11 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/base/ICoreLoadingView.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.base; 2 | 3 | /** 4 | * Created by Cicinnus on 2017/3/28. 5 | */ 6 | 7 | public interface ICoreLoadingView { 8 | void showLoading(); 9 | void showContent(); 10 | void showError(String errorMsg); 11 | } 12 | -------------------------------------------------------------------------------- /rrmlib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/hybrid/jsbridge/WebViewJavascriptBridge.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.hybrid.jsbridge; 2 | 3 | 4 | public interface WebViewJavascriptBridge { 5 | 6 | public void send(String data); 7 | public void send(String data, CallBackFunction responseCallback); 8 | 9 | 10 | 11 | } 12 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/hybrid/jsbridge/DefaultHandler.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.hybrid.jsbridge; 2 | 3 | public class DefaultHandler implements BridgeHandler{ 4 | 5 | String TAG = "DefaultHandler"; 6 | 7 | @Override 8 | public void handler(String data, CallBackFunction function) { 9 | if(function != null){ 10 | function.onCallBack("DefaultHandler response data"); 11 | } 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/cicinnus/retrofitmvprxjava2/MainFragment.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitmvprxjava2; 2 | 3 | import com.cicinnus.retrofitlib.base.BaseMVPFragment; 4 | 5 | /** 6 | * Created by Cicinnus on 2017/3/29. 7 | */ 8 | 9 | public class MainFragment extends BaseMVPFragment { 10 | @Override 11 | protected int getLayoutId() { 12 | return 0; 13 | } 14 | 15 | @Override 16 | protected void initEventAndData() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/cicinnus/retrofitmvprxjava2/MainContract.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitmvprxjava2; 2 | 3 | import com.cicinnus.retrofitlib.base.ICoreLoadingView; 4 | 5 | /** 6 | * Created by Cicinnus on 2017/3/28. 7 | */ 8 | 9 | public class MainContract { 10 | public interface IMainView extends ICoreLoadingView{ 11 | void addMainData(String string); 12 | } 13 | public interface IMainPresenter{ 14 | void getMainData(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/hybrid/wrapper/JsCallBack.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.hybrid.wrapper; 2 | 3 | 4 | import com.cicinnus.retrofitlib.hybrid.jsbridge.CallBackFunction; 5 | 6 | /** 7 | * Js调用本地方法的回调接口 8 | */ 9 | 10 | public interface JsCallBack { 11 | //Js调用本地唤起本地的方法 12 | void notifyNativeMethod(); 13 | //Js传过来的数据 14 | void JsData(String data); 15 | //回调给Js的参数 16 | void CallBack(CallBackFunction function); 17 | } 18 | -------------------------------------------------------------------------------- /rrmlib/src/test/java/com/cicinnus/retrofitlib/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib; 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 | } 18 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/net/BaseObserver.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.net; 2 | 3 | /** 4 | * 基础回调 5 | */ 6 | 7 | public abstract class BaseObserver { 8 | 9 | 10 | /** 11 | * 请求成功回调 12 | * @param t bean 13 | */ 14 | public abstract void onSuccess(T t); 15 | 16 | /** 17 | * 请求失败的回调 18 | * @param t 异常 19 | */ 20 | public abstract void onFail(Throwable t); 21 | 22 | /** 23 | * 整个Rx流结束,可用于隐藏Loading 24 | */ 25 | protected void onSubscribeComplete(){ 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/cicinnus/retrofitmvprxjava2/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitmvprxjava2; 2 | 3 | import android.app.Application; 4 | 5 | import com.cicinnus.retrofitlib.net.RetrofitClient; 6 | 7 | /** 8 | * Created by Cicinnus on 2017/3/29. 9 | */ 10 | 11 | public class BaseApplication extends Application { 12 | 13 | private static BaseApplication instance; 14 | 15 | public static BaseApplication getInstance() { 16 | return instance; 17 | } 18 | 19 | @Override 20 | public void onCreate() { 21 | super.onCreate(); 22 | instance = this; 23 | RetrofitClient.initClient_BaseUrl(null, Api.BASE_URL); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/cicinnus/retrofitmvprxjava2/Api.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitmvprxjava2; 2 | 3 | import io.reactivex.Observable; 4 | import okhttp3.ResponseBody; 5 | import retrofit2.http.GET; 6 | import retrofit2.http.Query; 7 | import retrofit2.http.Url; 8 | 9 | /** 10 | * Created by Cicinnus on 2017/3/28. 11 | */ 12 | 13 | public interface Api { 14 | 15 | String BASE_URL = "http://news-at.zhihu.com/api/"; 16 | 17 | @GET("4/news/latest") 18 | Observable load(); 19 | 20 | @GET 21 | Observable get(@Url String url); 22 | 23 | @GET("http://192.168.191.1:8080/api/app/checkUser.do") 24 | Observable login(@Query("userName")String userName, @Query("password")String password); 25 | 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/net/BASE_API.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.net; 2 | 3 | import io.reactivex.Observable; 4 | import io.reactivex.annotations.NonNull; 5 | import okhttp3.MultipartBody; 6 | import okhttp3.ResponseBody; 7 | import retrofit2.http.GET; 8 | import retrofit2.http.Multipart; 9 | import retrofit2.http.POST; 10 | import retrofit2.http.Part; 11 | import retrofit2.http.Streaming; 12 | import retrofit2.http.Url; 13 | 14 | /** 15 | * 文件上传与下载接口定义 16 | */ 17 | 18 | interface BASE_API { 19 | 20 | @Multipart 21 | @POST 22 | Observable uploadFile(@NonNull @Url String url, @Part MultipartBody.Part file); 23 | 24 | @Streaming 25 | @GET 26 | Observable downLoadFile(@NonNull @Url String url); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/cicinnus/retrofitmvprxjava2/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitmvprxjava2; 2 | 3 | import com.cicinnus.retrofitlib.base.BaseMVPActivity; 4 | import com.cicinnus.retrofitlib.base.ICorePresenter; 5 | 6 | /** 7 | * Created by Cicinnus on 2017/3/29. 8 | */ 9 | 10 | public class BaseActivity extends BaseMVPActivity { 11 | protected T mPresenter; 12 | 13 | @Override 14 | public int getLayout() { 15 | return 0; 16 | } 17 | 18 | @Override 19 | protected ICorePresenter getCorePresenter() { 20 | return getPresenter(); 21 | } 22 | 23 | protected ICorePresenter getPresenter() { 24 | return mPresenter; 25 | } 26 | 27 | @Override 28 | protected void initEventAndData() { 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/rx/SchedulersCompact.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.rx; 2 | 3 | import io.reactivex.Observable; 4 | import io.reactivex.ObservableSource; 5 | import io.reactivex.ObservableTransformer; 6 | import io.reactivex.android.schedulers.AndroidSchedulers; 7 | import io.reactivex.schedulers.Schedulers; 8 | 9 | /** 10 | * 用于Rx工作流的整体线程切换 11 | */ 12 | 13 | public class SchedulersCompact { 14 | public static ObservableTransformer applyIoSchedulers() { 15 | return new ObservableTransformer() { 16 | @Override 17 | public ObservableSource apply(Observable upstream) { 18 | return upstream.subscribeOn(Schedulers.io()) 19 | .observeOn(AndroidSchedulers.mainThread()); 20 | } 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /rrmlib/src/androidTest/java/com/cicinnus/retrofitlib/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.cicinnus.retrofitlib.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rrmlib/src/main/java/com/cicinnus/retrofitlib/net/file_upload/FileUploadObserver.java: -------------------------------------------------------------------------------- 1 | package com.cicinnus.retrofitlib.net.file_upload; 2 | 3 | /** 4 | * 上传文件的回调 5 | */ 6 | 7 | public abstract class FileUploadObserver{ 8 | 9 | 10 | 11 | // @Override 12 | // public void onNext(T t) { 13 | // onUpLoadSuccess(t); 14 | // } 15 | // 16 | // @Override 17 | // public void onError(Throwable e) { 18 | // onUpLoadFail(e); 19 | // } 20 | // 21 | //可以重写,具体可由子类实现 22 | public void onComplete() { 23 | 24 | } 25 | 26 | public void onProgressChange(long bytesWritten, long contentLength) { 27 | onProgress((int) (bytesWritten*100 / contentLength)); 28 | } 29 | 30 | //上传成功的回调 31 | public abstract void onUpLoadSuccess(T t); 32 | 33 | //上传你失败回调 34 | public abstract void onUpLoadFail(Throwable e); 35 | 36 | //上传进度回调 37 | public abstract void onProgress(int progress); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 |