本文整理匯總了Java中android.support.v4.widget.ScrollerCompat.getFinalY方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollerCompat.getFinalY方法的具體用法?Java ScrollerCompat.getFinalY怎麽用?Java ScrollerCompat.getFinalY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v4.widget.ScrollerCompat
的用法示例。
在下文中一共展示了ScrollerCompat.getFinalY方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import android.support.v4.widget.ScrollerCompat; //導入方法依賴的package包/類
@Override
public void run() {
disableRunOnAnimationRequests();
consumePendingUpdateOperations();
// keep a local reference so that if it is changed during onAnimation method, it wont cause
// unexpected behaviors
final ScrollerCompat scroller = mScroller;
final SmoothScroller smoothScroller = mLayout.mSmoothScroller;
if (scroller.computeScrollOffset()) {
final int x = scroller.getCurrX();
final int y = scroller.getCurrY();
final int dx = x - mLastFlingX;
final int dy = y - mLastFlingY;
mLastFlingX = x;
mLastFlingY = y;
int overscrollX = 0, overscrollY = 0;
if (mAdapter != null) {
eatRequestLayout();
if (dx != 0) {
final int hresult = mLayout.scrollHorizontallyBy(dx, mRecycler, mState);
overscrollX = dx - hresult;
}
if (dy != 0) {
final int vresult = mLayout.scrollVerticallyBy(dy, mRecycler, mState);
overscrollY = dy - vresult;
}
if (smoothScroller != null && !smoothScroller.isPendingInitialRun() &&
smoothScroller.isRunning()) {
smoothScroller.onAnimation(dx - overscrollX, dy - overscrollY);
}
resumeRequestLayout(false);
}
if (!mItemDecorations.isEmpty()) {
invalidate();
}
if (overscrollX != 0 || overscrollY != 0) {
final int vel = (int) scroller.getCurrVelocity();
int velX = 0;
if (overscrollX != x) {
velX = overscrollX < 0 ? -vel : overscrollX > 0 ? vel : 0;
}
int velY = 0;
if (overscrollY != y) {
velY = overscrollY < 0 ? -vel : overscrollY > 0 ? vel : 0;
}
if (ViewCompat.getOverScrollMode(RecyclerView.this) !=
ViewCompat.OVER_SCROLL_NEVER) {
absorbGlows(velX, velY);
}
if ((velX != 0 || overscrollX == x || scroller.getFinalX() == 0) &&
(velY != 0 || overscrollY == y || scroller.getFinalY() == 0)) {
scroller.abortAnimation();
}
}
if (mScrollListener != null && (x != 0 || y != 0)) {
mScrollListener.onScrolled(dx, dy);
}
if (!awakenScrollBars()) {
invalidate();
}
if (scroller.isFinished()) {
setScrollState(SCROLL_STATE_IDLE);
} else {
postOnAnimation();
}
}
// call this after the onAnimation is complete not to have inconsistent callbacks etc.
if (smoothScroller != null && smoothScroller.isPendingInitialRun()) {
smoothScroller.onAnimation(0, 0);
}
enableRunOnAnimationRequests();
}