本文整理匯總了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);
}
示例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");
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例6: detach
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected boolean detach(RecyclerView recyclerView) {
if (recyclerView != null) {
recyclerView.removeOnScrollListener(this);
clearStickyView();
}
return true;
}
示例7: onDetachedFromRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
if (moreLoader != null) {
recyclerView.removeOnScrollListener(moreLoader);
}
super.onDetachedFromRecyclerView(recyclerView);
}
示例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);
}
示例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();
}
}
}
示例10: dettach
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void dettach(RecyclerView pRecyclerView) {
pRecyclerView.removeOnScrollListener(mScrollListener);
}
示例11: unRegisterListener
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void unRegisterListener(RecyclerView recyclerView) {
recyclerView.removeOnScrollListener(this);
this.listener = null;
}
示例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;
}
示例13: onDetachedFromRecyclerView
import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
mDelegateAdapter.onDetachedFromRecyclerView(recyclerView);
recyclerView.removeOnScrollListener(mScrollListener);
unregisterAdapterDataObserver(mAdapterDataObserver);
}