Search in sources :

Example 1 with OnStateChangedListener

use of com.scwang.smartrefresh.layout.listener.OnStateChangedListener in project SmartRefreshLayout by scwang90.

the class SmartRefreshLayout method notifyStateChanged.

// /*
// * 这段代码来自谷歌官方的 SwipeRefreshLayout
// * 应用场景已经在英文注释中解释清楚
// * 大部分第三方下拉刷新库都保留了这段代码,本库也不例外
// */
// @Override
// public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
// // if this is a List < L or another view that doesn't support nested
// // scrolling, ignore this request so that the vertical scroll event
// // isn't stolen
// View target = mRefreshContent.getScrollableView();
// if ((android.os.Build.VERSION.SDK_INT >= 21 || !(target instanceof AbsListView))
// && (target == null || ViewCompat.isNestedScrollingEnabled(target))) {
// super.requestDisallowInterceptTouchEvent(disallowIntercept);
// //} else {
// // Nope.
// }
// }
// </editor-fold>
// <editor-fold desc="状态更改 state changes">
protected void notifyStateChanged(RefreshState state) {
    final RefreshState oldState = mState;
    if (oldState != state) {
        mState = state;
        mViceState = state;
        final OnStateChangedListener refreshHeader = mRefreshHeader;
        final OnStateChangedListener refreshFooter = mRefreshFooter;
        final OnStateChangedListener refreshListener = mOnMultiPurposeListener;
        if (refreshHeader != null) {
            refreshHeader.onStateChanged(this, oldState, state);
        }
        if (refreshFooter != null) {
            refreshFooter.onStateChanged(this, oldState, state);
        }
        if (refreshListener != null) {
            refreshListener.onStateChanged(this, oldState, state);
        }
    }
}
Also used : OnStateChangedListener(com.scwang.smartrefresh.layout.listener.OnStateChangedListener) RefreshState(com.scwang.smartrefresh.layout.constant.RefreshState)

Aggregations

RefreshState (com.scwang.smartrefresh.layout.constant.RefreshState)1 OnStateChangedListener (com.scwang.smartrefresh.layout.listener.OnStateChangedListener)1