本文整理匯總了Java中android.support.v7.widget.RecyclerView.SCROLL_STATE_SETTLING屬性的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.SCROLL_STATE_SETTLING屬性的具體用法?Java RecyclerView.SCROLL_STATE_SETTLING怎麽用?Java RecyclerView.SCROLL_STATE_SETTLING使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.support.v7.widget.RecyclerView
的用法示例。
在下文中一共展示了RecyclerView.SCROLL_STATE_SETTLING屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例2: 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;
}
}
示例3: 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);
}
示例4: 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;
}
}
示例5: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_SETTLING) {
snapping = false;
}
if (newState == RecyclerView.SCROLL_STATE_IDLE && snapping && listener != null) {
int position = getSnappedPosition(recyclerView);
if (position != RecyclerView.NO_POSITION) {
listener.onSnap(position);
}
snapping = false;
}
}
示例6: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, final int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (RecyclerView.SCROLL_STATE_IDLE == newState || RecyclerView.SCROLL_STATE_SETTLING == newState) {
if (Math.abs(offsetY) >= LIMIT) {
if (expandableButton.getState() == ExpandableButtonView.State.FINISHED) {
expandableButton.removeBottomToolbar();
expandableButton.setState(State.IDLE);
hasStopped = false;
} else if (hasStopped && expandableButton.getState() == State.IDLE) {
if (expandableButton.getScaleX() > 0f) {
expandableButton.setClickable(false);
expandableButton.animate().setInterpolator(new AccelerateInterpolator())
.scaleY(0.f).scaleX(0.f).setDuration(FADE_IN_OUT_DURATION).start();
}
}
if (!hasStopped) {
hasStopped = (newState == RecyclerView.SCROLL_STATE_IDLE)
|| (Math.abs(offsetY) >= 8 * LIMIT);
}
offsetY = 0;
}
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
if (expandableButton.getScaleX() < 1.f) {
expandableButton.setClickable(true);
expandableButton.animate().scaleX(1.f).setListener(null).
setInterpolator(new DecelerateInterpolator()).scaleY(1.f).
setDuration(FADE_IN_OUT_DURATION / 2).start();
}
}
}
}
示例7: onScrollStateChanged
@Override
public void onScrollStateChanged(int state) {
super.onScrollStateChanged(state);
currentScrollState = state;
if (mLScrollListener != null) {
mLScrollListener.onScrollStateChanged(state);
}
if (mLoadMoreListener != null && mLoadMoreEnabled) {
if (currentScrollState == RecyclerView.SCROLL_STATE_IDLE || currentScrollState == RecyclerView.SCROLL_STATE_SETTLING) {
RecyclerView.LayoutManager layoutManager = getLayoutManager();
int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount();
if (visibleItemCount > 0
&& lastVisibleItemPosition >= totalItemCount - 1
&& totalItemCount > visibleItemCount
&& !isNoMore
&& !mRefreshing ) {
mFootView.setVisibility(View.VISIBLE);
if (mLoadingData) {
return;
} else {
mLoadingData = true;
mLoadMoreFooter.onLoading();
mLoadMoreListener.onLoadMore();
}
}
}
}
}
示例8: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (newState == RecyclerView.SCROLL_STATE_SETTLING) {
mSnapping = false;
}
if (newState == RecyclerView.SCROLL_STATE_IDLE && mSnapping && mSnapListener != null) {
int position = getSnappedPosition(recyclerView);
if (position != RecyclerView.NO_POSITION) {
mSnapListener.onSnap(position);
}
mSnapping = false;
}
}
示例9: onTouchEvent
@Override
public boolean onTouchEvent(MotionEvent e) {
if (getLayoutManager() == null) {
return super.onTouchEvent(e);
}
return getLayoutManager().getScrollState() != RecyclerView.SCROLL_STATE_SETTLING && super.onTouchEvent(e);
}
示例10: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (swallowNextScroll) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
swallowNextScroll = false;
}
return;
}
if ((newState == RecyclerView.SCROLL_STATE_IDLE || newState == RecyclerView.SCROLL_STATE_SETTLING)) {
tryLoadingMore();
}
}
示例11: 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) {
//滑行中
}
}
示例12: 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) {
}
}
示例13: onScrollStateChanged
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if ((newState == RecyclerView.SCROLL_STATE_IDLE || newState == RecyclerView.SCROLL_STATE_SETTLING) && mRefreshLayout != null && mRefreshLayout.shouldHandleRecyclerViewLoadingMore(recyclerView)) {
mRefreshLayout.beginLoadingMore();
}
}
示例14: 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;
}
}