當前位置: 首頁>>代碼示例>>Java>>正文


Java RecyclerView.removeOnScrollListener方法代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.removeOnScrollListener方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.removeOnScrollListener方法的具體用法?Java RecyclerView.removeOnScrollListener怎麽用?Java RecyclerView.removeOnScrollListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.RecyclerView的用法示例。


在下文中一共展示了RecyclerView.removeOnScrollListener方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerScrollListener

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void registerScrollListener(RecyclerView recyclerView)
{
    if (null != mWeakRecyclerView && mWeakRecyclerView.get() == recyclerView)
    {
        return;
    }
    
    if (null == mRecyclerViewScrollListener)
    {
        mRecyclerViewScrollListener = new RecyclerViewScrollListener(this);
    }
    
    if (null != mWeakRecyclerView && null != mWeakRecyclerView.get())
    {
        mWeakRecyclerView.get().removeOnScrollListener(mRecyclerViewScrollListener);
        mWeakRecyclerView.clear();
    }
    
    recyclerView.removeOnScrollListener(mRecyclerViewScrollListener);
    recyclerView.addOnScrollListener(mRecyclerViewScrollListener);
    mWeakRecyclerView = new WeakReference<>(recyclerView);
}
 
開發者ID:Dreamxiaoxuan,項目名稱:AndroidTvDemo,代碼行數:23,代碼來源:AbsFocusBorder.java

示例2: onScrollStateChanged

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);

    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
        recyclerView.removeOnScrollListener(this);
        m_bMoved = false;

        if (recyclerView == m_jCellRecyclerView) {
            Log.d(LOG_TAG, "m_jCellRecyclerView scroll listener removed from " +
                    "onScrollStateChanged");
        } else if (recyclerView == m_jRowHeaderRecyclerView) {
            Log.d(LOG_TAG, "m_jRowHeaderRecyclerView scroll listener removed from " +
                    "onScrollStateChanged");
        }
    }
}
 
開發者ID:evrencoskun,項目名稱:TableView,代碼行數:18,代碼來源:VerticalRecyclerViewListener.java

示例3: onScrollStateChanged

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);

    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
        // Renew the scroll position and its offset
        renewScrollPosition(recyclerView);

        recyclerView.removeOnScrollListener(this);
        Log.d(LOG_TAG, "Scroll listener has been removed to " + recyclerView.getId() + " at "
                + "onScrollStateChanged");
        m_bMoved = false;

        // When a user scrolls horizontally, VerticalRecyclerView add vertical scroll
        // listener because of touching process.However, m_iVerticalRecyclerViewListener
        // doesn't know anything about it. So, it is necessary to remove the last touched
        // recyclerView which uses the m_iVerticalRecyclerViewListener.
        boolean bNeeded = m_jLastTouchedRecyclerView != m_jColumnHeaderRecyclerView;
        m_iVerticalRecyclerViewListener.removeLastTouchedRecyclerViewScrollListener(bNeeded);
    }
}
 
開發者ID:evrencoskun,項目名稱:TableView,代碼行數:22,代碼來源:HorizontalRecyclerViewListener.java

示例4: unregisterView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * unregister RecyclerView suggested to call in onStop.
 * @param view RecyclerView instance
 */
public void unregisterView(@NonNull RecyclerView view){
    if (mScrollListener != null){
        view.removeOnScrollListener(mScrollListener);
    }

    if (mOnTouсhEventListener != null) {
        view.removeOnItemTouchListener(mOnTouсhEventListener);
    }

    clearPendingEvents();

    //send all items
    send();
    mDelayHandler = null;
    mOnTouсhEventListener = null;
    mScrollListener = null;
}
 
開發者ID:Webtrekk,項目名稱:webtrekk-android-sdk,代碼行數:22,代碼來源:ProductListTracker.java

示例5: onScrollStateChanged

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    if (newState == recyclerView.SCROLL_STATE_IDLE) {
        recyclerView.removeOnScrollListener(this);
    }
}
 
開發者ID:GitLqr,項目名稱:TopsalesSellControlTableDemo,代碼行數:8,代碼來源:MyOnScrollListener.java

示例6: detach

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected boolean detach(RecyclerView recyclerView) {
    if (recyclerView != null) {
        recyclerView.removeOnScrollListener(this);
        clearStickyView();
    }

    return true;
}
 
開發者ID:wayfair,項目名稱:brickkit-android,代碼行數:10,代碼來源:StickyViewBehavior.java

示例7: onDetachedFromRecyclerView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
    if (moreLoader != null) {
        recyclerView.removeOnScrollListener(moreLoader);
    }
    super.onDetachedFromRecyclerView(recyclerView);
}
 
開發者ID:MEiDIK,項目名稱:SlimAdapter,代碼行數:8,代碼來源:SlimAdapter.java

示例8: setRecyclerViewScrollListener

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
private void setRecyclerViewScrollListener() {
        layoutManagerType = null;
        final RecyclerView recyclerView = (RecyclerView) child;
        if (recyclerView.getAdapter() == null) {
            return;
        }
        if (!(recyclerView.getAdapter() instanceof BaseRecyclerAdapter)) {
//            throw new RuntimeException("Recylerview的adapter請繼承 BaseRecyclerAdapter");
            LogUtils.w(RECYCLERVIEW_ADAPTER_WARIN);
            return;
        }
        final BaseRecyclerAdapter adapter = (BaseRecyclerAdapter) recyclerView.getAdapter();
        adapter.insideEnableFooter(mParent.getPullLoadEnable());
        recyclerView.removeOnScrollListener(mOnScrollListener);
        mOnScrollListener = new RecyclerView.OnScrollListener() {

            @Override
            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                super.onScrollStateChanged(recyclerView, newState);
                if (mRecyclerViewScrollListener != null) {
                    mRecyclerViewScrollListener.onScrollStateChanged(recyclerView, newState);
                }
            }

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                onRecyclerViewScrolled(recyclerView, adapter, dx, dy, false);
            }
        };
        recyclerView.addOnScrollListener(mOnScrollListener);

        RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
        if (layoutManager != null && layoutManager instanceof GridLayoutManager) {
            GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
            gridLayoutManager.setSpanSizeLookup(new XSpanSizeLookup(adapter, gridLayoutManager.getSpanCount()));
        }
        initFooterCallBack(adapter, mParent);
    }
 
開發者ID:LonelyMushroom,項目名稱:aarLibrary,代碼行數:39,代碼來源:XRefreshContentView.java

示例9: attachToRecyclerView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void attachToRecyclerView(@Nullable RecyclerView recyclerView) throws IllegalStateException {
    super.attachToRecyclerView(recyclerView);
    if (recyclerView != null) {
        recyclerView.removeOnScrollListener(mScrollListener);
        recyclerView.addOnScrollListener(mScrollListener);

        RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
        if (layoutManager instanceof LinearLayoutManager) {
            mOrientation = ((LinearLayoutManager) layoutManager).getOrientation();
        }
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:14,代碼來源:RPagerSnapHelper.java

示例10: dettach

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void dettach(RecyclerView pRecyclerView) {
    pRecyclerView.removeOnScrollListener(mScrollListener);
}
 
開發者ID:aliumujib,項目名稱:Orin,代碼行數:4,代碼來源:IndexLayoutManager.java

示例11: unRegisterListener

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void unRegisterListener(RecyclerView recyclerView) {
    recyclerView.removeOnScrollListener(this);
    this.listener = null;
}
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:5,代碼來源:OnLoadMore.java

示例12: onInterceptTouchEvent

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
    if (e.getAction() == MotionEvent.ACTION_DOWN) {
        if (rv.getScrollState() == RecyclerView.SCROLL_STATE_IDLE) {

            if (m_jLastTouchedRecyclerView != null && rv != m_jLastTouchedRecyclerView) {
                removeLastTouchedRecyclerViewScrollListener(false);
            }
            m_nYPosition = ((CellRecyclerView) rv).getScrolledY();
            rv.addOnScrollListener(this);

            if (rv == m_jCellRecyclerView) {
                Log.d(LOG_TAG, "m_jCellRecyclerView scroll listener added");
            } else if (rv == m_jRowHeaderRecyclerView) {
                Log.d(LOG_TAG, "m_jRowHeaderRecyclerView scroll listener added");
            }

            // Refresh the value;
            m_bMoved = false;
        }
    } else if (e.getAction() == MotionEvent.ACTION_MOVE) {
        // Why does it matter ?
        // user scroll any recyclerView like brushing, at that time, ACTION_UP will be
        // triggered
        // before scrolling. So, we need to store whether it moved or not.
        m_bMoved = true;
    } else if (e.getAction() == MotionEvent.ACTION_UP) {
        int nScrollY = ((CellRecyclerView) rv).getScrolledY();

        // TODO: Even if moved value is true and it may not scroll. This should be fixed.
        // TODO: The scenario is scroll lightly center RecyclerView vertically.
        // TODO: Below if condition may be changed later.

        // Is it just touched without scrolling then remove the listener
        if (m_nYPosition == nScrollY && !m_bMoved && rv.getScrollState() == RecyclerView
                .SCROLL_STATE_IDLE) {
            rv.removeOnScrollListener(this);

            if (rv == m_jCellRecyclerView) {
                Log.d(LOG_TAG, "m_jCellRecyclerView scroll listener removed from up ");
            } else if (rv == m_jRowHeaderRecyclerView) {
                Log.d(LOG_TAG, "m_jRowHeaderRecyclerView scroll listener removed from up");
            }
        }

        m_jLastTouchedRecyclerView = rv;

    }
    return false;
}
 
開發者ID:evrencoskun,項目名稱:TableView,代碼行數:51,代碼來源:VerticalRecyclerViewListener.java

示例13: onDetachedFromRecyclerView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
    mDelegateAdapter.onDetachedFromRecyclerView(recyclerView);
    recyclerView.removeOnScrollListener(mScrollListener);
    unregisterAdapterDataObserver(mAdapterDataObserver);
}
 
開發者ID:Sunzxyong,項目名稱:PullToLoad,代碼行數:7,代碼來源:RecyclerViewAdapterWrapper.java


注:本文中的android.support.v7.widget.RecyclerView.removeOnScrollListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。