本文整理匯總了Java中android.support.v7.widget.RecyclerView.SCROLL_STATE_DRAGGING屬性的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.SCROLL_STATE_DRAGGING屬性的具體用法?Java RecyclerView.SCROLL_STATE_DRAGGING怎麽用?Java RecyclerView.SCROLL_STATE_DRAGGING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.SCROLL_STATE_DRAGGING屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onScrollStateChanged
@Override
public void onScrollStateChanged(int state) {
if (currentScrollState == RecyclerView.SCROLL_STATE_IDLE && currentScrollState != state) {
scrollStateListener.onScrollStart();
}
if (state == RecyclerView.SCROLL_STATE_IDLE) {
//Scroll is not finished until current view is centered
boolean isScrollEnded = onScrollEnd();
if (isScrollEnded) {
scrollStateListener.onScrollEnd();
} else {
//Scroll continues and we don't want to set currentScrollState to STATE_IDLE,
//because this will then trigger .scrollStateListener.onScrollStart()
return;
}
} else if (state == RecyclerView.SCROLL_STATE_DRAGGING) {
onDragStart();
}
currentScrollState = state;
}
示例2: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
int listViewState;
switch (newState) {
case RecyclerView.SCROLL_STATE_DRAGGING:
listViewState = ListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL;
break;
case RecyclerView.SCROLL_STATE_IDLE:
listViewState = ListView.OnScrollListener.SCROLL_STATE_IDLE;
break;
case RecyclerView.SCROLL_STATE_SETTLING:
listViewState = ListView.OnScrollListener.SCROLL_STATE_FLING;
break;
default:
listViewState = UNKNOWN_SCROLL_STATE;
}
scrollListener.onScrollStateChanged(null /*view*/, listViewState);
}
示例3: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if(!(layoutManager instanceof CustomLayoutManager)){
mAutoSet = true;
return;
}
if(!mAutoSet){
if(newState == RecyclerView.SCROLL_STATE_IDLE){
final int dx;
dx = ((CustomLayoutManager)layoutManager).getOffsetCenterView();
//Log.e(TAG, "getOffsetCenterView: " + String.valueOf(dx));
recyclerView.smoothScrollBy(dx,0);
}
mAutoSet = true;
}
if(newState == RecyclerView.SCROLL_STATE_DRAGGING || newState == RecyclerView.SCROLL_STATE_SETTLING){
mAutoSet = false;
}
}
示例4: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
//Fix for bug with bottom selection bar and different month item height in horizontal mode (different count of weeks)
View view = rvMonths.getLayoutManager().findViewByPosition(getFirstVisiblePosition(rvMonths.getLayoutManager()));
if (view != null) {
view.requestLayout();
}
if (getCalendarOrientation() == OrientationHelper.HORIZONTAL) {
multipleSelectionBarAdapter.notifyDataSetChanged();
//Hide navigation buttons
boolean show = newState != RecyclerView.SCROLL_STATE_DRAGGING;
ivPrevious.setVisibility(show ? View.VISIBLE : View.GONE);
ivNext.setVisibility(show ? View.VISIBLE : View.GONE);
}
super.onScrollStateChanged(recyclerView, newState);
}
示例5: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
int listViewState;
switch (newState) {
case RecyclerView.SCROLL_STATE_DRAGGING:
listViewState = ListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL;
break;
case RecyclerView.SCROLL_STATE_IDLE:
listViewState = ListView.OnScrollListener.SCROLL_STATE_IDLE;
break;
case RecyclerView.SCROLL_STATE_SETTLING:
listViewState = ListView.OnScrollListener.SCROLL_STATE_FLING;
break;
default:
listViewState = UNKNOWN_SCROLL_STATE;
}
scrollListener.onScrollStateChanged(null /*view*/, listViewState);
}
示例6: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (!disable) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
if (isAutoDetectIdle) {
((Application) recyclerView.getContext().getApplicationContext())
.registerActivityLifecycleCallbacks(mLifecycleCallbacks);
startDetectPage();
}
isDetectingFastScroll = true;
disable = true;
}
}
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
onScrollStateIdle();
}
}
示例7: onScrollStateChanged
@Override
public void onScrollStateChanged(int state) {
super.onScrollStateChanged(state);
switch (state){
case RecyclerView.SCROLL_STATE_IDLE:
//滾動停止時
fixOffsetWhenFinishScroll();
break;
case RecyclerView.SCROLL_STATE_DRAGGING:
//拖拽滾動時
break;
case RecyclerView.SCROLL_STATE_SETTLING:
//動畫滾動時
break;
}
}
示例8: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_IDLE || newState == RecyclerView.SCROLL_STATE_DRAGGING) {
PicassoInstance.with().resumeTag(tag);
} else {
PicassoInstance.with().pauseTag(tag);
}
}
示例9: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
conversationDateHeader.show();
} else if (newState == RecyclerView.SCROLL_STATE_IDLE) {
conversationDateHeader.hide();
}
}
示例10: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE)
{
mPullLoadMoreRecyclerView.onScroll(0);
}else if(newState == RecyclerView.SCROLL_STATE_DRAGGING)
{
mPullLoadMoreRecyclerView.onScroll(1);
}
}
示例11: onScrollStateChanged
@Override
public void onScrollStateChanged(int state) {
if (state == RecyclerView.SCROLL_STATE_DRAGGING) {
needSnap = true;
}
super.onScrollStateChanged(state);
}
示例12: onScrollStateChanged
/**
* Hadle recyclerView scroll status
* just to show FAB
*
* @param newState the new state of the recyclerView
*/
@Override
public void onScrollStateChanged(int newState) {
if (newState != RecyclerView.SCROLL_STATE_IDLE &&
newState != RecyclerView.SCROLL_STATE_DRAGGING) {
view.setFABVisibility(false);
} else {
view.setFABVisibility(true);
}
}
示例13: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
//開始滾動
} else if (newState == RecyclerView.SCROLL_STATE_IDLE) {
//結束滾動
} else if (newState == RecyclerView.SCROLL_STATE_SETTLING) {
//滑行中
}
}
示例14: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
scrollState = newState;
L.w("scroll state : " + newState);
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
onScrollEnd();
} else if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
isFling = false;
} else if (newState == RecyclerView.SCROLL_STATE_SETTLING) {
}
}
示例15: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch (newState) {
case RecyclerView.SCROLL_STATE_DRAGGING:
// distinct drag to improve accuracy, init mDraggingStart and mDraggingEnd here
mDragging = true;
final int[] range = AbstractLayoutManagerUtils.getVisibleRange(recyclerView);
mDraggingStart = range[0];
mDraggingEnd = range[1];
break;
case RecyclerView.SCROLL_STATE_SETTLING:
mDragging = false;
break;
case RecyclerView.SCROLL_STATE_IDLE:
mDragging = false;
// perform final update on the range we have ever visited
updateVisibleRange(recyclerView);
AbstractLogUtils.e(this, "==> visible range: [" + mDraggingStart + ", " + mDraggingEnd + "]");
MeasurableRecyclerViewHelper.notifyMeasurableViewHolderDataRangeChanged(recyclerView, mDraggingStart, mDraggingEnd);
// reset mDraggingStart and mDraggingEnd here
mDraggingStart = RecyclerView.NO_POSITION;
mDraggingEnd = RecyclerView.NO_POSITION;
final boolean rtl = AbstractUIUtils.isRightToLeft(getRef());
if (mRtl ^ rtl) {
/*
* [ANDROID-1778]
*
* immediately flush the statistics if user change between a ltr and rtl language
* on the fly; do the check in here for better performance
*/
final List<IMeasurableViewHolder> holders =
MeasurableRecyclerViewHelper.getViewHolders(recyclerView, IMeasurableViewHolder.class);
for (IMeasurableViewHolder holder : holders) {
holder.flush();
}
if (AbstractLayoutManagerUtils.getOrientation(recyclerView.getLayoutManager())
== OrientationHelper.HORIZONTAL) {
AbstractLayoutManagerUtils.setReverseLayout(recyclerView.getLayoutManager(), mRtl);
}
}
break;
default:
break;
}
}