Skip to content

Commit

Permalink
opt
Browse files Browse the repository at this point in the history
  • Loading branch information
heaven7 committed Jul 20, 2020
1 parent 5130a1d commit 04cf1eb
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ public void showContent(boolean refresh, List<?> listData) {

@Override
public void onThrowable(String url, boolean refresh, Throwable e) {
setRefreshing(false);
mComponent.showPlaceholderView(AppLoadingComponent.CODE_EXCEPTION);

AppLoadingComponent.ViewDelegate d = mCallback.shouldShowError(e) ? getAppLoadingComponent().getErrorDelegate()
: getAppLoadingComponent().getEmptyDelegate();

d.show(AppLoadingComponent.CODE_EXCEPTION, null, e);

mAdapterDelegate.clearItems();
Expand All @@ -253,6 +255,18 @@ public void onClickLoadingView(AppLoadingComponent component, View view, int sta

}

protected void setRefreshing(boolean refreshing){
mCallback.getPullToRefreshLayout().getSwipeRefreshLayout().setRefreshing(refreshing);
View refreshView = mComponent.getEmptyDelegate().getRefreshView();
if(refreshView != null){
mRefresh.setRefreshing(refreshView, refreshing);
}
refreshView = mComponent.getErrorDelegate().getRefreshView();
if(refreshView != null){
mRefresh.setRefreshing(refreshView, refreshing);
}
}

private static boolean hasConnectedNetwork(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm != null) {
Expand Down

0 comments on commit 04cf1eb

Please sign in to comment.