public void setRefreshing(boolean refreshing) { if (mSwipeRefreshLayout == null) { return; } if (!refreshing) { mIsRequestDataRefresh = false; // 防止刷新消失太快,让子弹飞一会儿 mSwipeRefreshLayout.postDelayed(() -> mSwipeRefreshLayout.setRefreshing(false), 1000); } else { requestDataRefresh(); } }
private void requestDataRefresh() { mIsRequestDataRefresh = true; mSwipeRefreshLayout.setRefreshing(true); loadData(); };