diff --git a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/interfaces/net_about/I_HttpResultHandler.java b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/interfaces/net_about/I_HttpResultHandler.java index 9d50fcb..be6794c 100644 --- a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/interfaces/net_about/I_HttpResultHandler.java +++ b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/interfaces/net_about/I_HttpResultHandler.java @@ -11,5 +11,6 @@ */ public interface I_HttpResultHandler{ void onSuccess(int requestCode, BaseHttpResponseBean codeInfoBean,T successBean); + void onFailure(int requestCode,Throwable e); void setState(View v, boolean b); //设置发起http的view是否可以点击 } diff --git a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseAppCompatActivity.java b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseAppCompatActivity.java index 512062b..a54efe6 100644 --- a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseAppCompatActivity.java +++ b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseAppCompatActivity.java @@ -318,4 +318,9 @@ public void readyGoForResult(Class clazz, int requestCode) { public void readyGoForResult(Class clazz, int requestCode, Bundle bundle) { navigateMaster.readyGoForResult(clazz, requestCode, bundle); } + + @Override + public void onFailure(int requestCode, Throwable e) { + + } } diff --git a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseFragment.java b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseFragment.java index 29b83fe..5a87b40 100644 --- a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseFragment.java +++ b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/main/BaseFragment.java @@ -284,4 +284,9 @@ public void readyGoForResult(Class clazz, int requestCode) { public void readyGoForResult(Class clazz, int requestCode, Bundle bundle) { navigateMaster.readyGoForResult(clazz, requestCode, bundle); } + + @Override + public void onFailure(int requestCode, Throwable e) { + + } } diff --git a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/net_about/HttpMaster.java b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/net_about/HttpMaster.java index 7470a62..33bbc0b 100644 --- a/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/net_about/HttpMaster.java +++ b/CZBaseDevTool/src/main/java/com/xinyi/czbasedevtool/base/manager/net_about/HttpMaster.java @@ -365,6 +365,7 @@ public void onError(Throwable e) { hideProgressView(); ToastUtil.shortT(mContext,"解析数据异常!"); e.printStackTrace(); + httpResultHandler.onFailure(getRequestCode(), e); } @Override @@ -428,6 +429,7 @@ public void onError(Throwable e) { hideProgressView(); ToastUtil.shortT(mContext,"解析数据异常!"); e.printStackTrace(); + httpResultHandler.onFailure(getRequestCode(), e); } @Override diff --git a/app/src/main/java/xinyi/com/czdevmodule/net_test/retrofit/service/UserService.java b/app/src/main/java/xinyi/com/czdevmodule/net_test/retrofit/service/UserService.java index 40c1453..28df811 100644 --- a/app/src/main/java/xinyi/com/czdevmodule/net_test/retrofit/service/UserService.java +++ b/app/src/main/java/xinyi/com/czdevmodule/net_test/retrofit/service/UserService.java @@ -53,6 +53,11 @@ public void onSuccess(int requestCode, BaseHttpResponseBean codeInfoBean, T } } + @Override + public void onFailure(int requestCode, Throwable e) { + + } + //注册回调成功处理站 public void onRegistSuccess(BaseHttpResponseBean codeInfoBean, UserBean user) {