Java 类android.support.v7.widget.RecyclerView.SmoothScroller.Action 实例源码

项目:letv    文件:LinearSmoothScroller.java   
protected void onTargetFound(View targetView, State state, Action action) {
    int dx = calculateDxToMakeVisible(targetView, getHorizontalSnapPreference());
    int dy = calculateDyToMakeVisible(targetView, getVerticalSnapPreference());
    int time = calculateTimeForDeceleration((int) Math.sqrt((double) ((dx * dx) + (dy * dy))));
    if (time > 0) {
        action.update(-dx, -dy, time, this.mDecelerateInterpolator);
    }
}
项目:letv    文件:LinearSmoothScroller.java   
protected void onSeekTargetStep(int dx, int dy, State state, Action action) {
    if (getChildCount() == 0) {
        stop();
        return;
    }
    this.mInterimTargetDx = clampApplyScroll(this.mInterimTargetDx, dx);
    this.mInterimTargetDy = clampApplyScroll(this.mInterimTargetDy, dy);
    if (this.mInterimTargetDx == 0 && this.mInterimTargetDy == 0) {
        updateActionForInterimTarget(action);
    }
}
项目:letv    文件:LinearSmoothScroller.java   
protected void updateActionForInterimTarget(Action action) {
    PointF scrollVector = computeScrollVectorForPosition(getTargetPosition());
    if (scrollVector == null || (scrollVector.x == 0.0f && scrollVector.y == 0.0f)) {
        Log.e(TAG, "To support smooth scrolling, you should override \nLayoutManager#computeScrollVectorForPosition.\nFalling back to instant scroll");
        action.jumpTo(getTargetPosition());
        stop();
        return;
    }
    normalize(scrollVector);
    this.mTargetVector = scrollVector;
    this.mInterimTargetDx = (int) (scrollVector.x * 10000.0f);
    this.mInterimTargetDy = (int) (scrollVector.y * 10000.0f);
    action.update((int) (((float) this.mInterimTargetDx) * TARGET_SEEK_EXTRA_SCROLL_RATIO), (int) (((float) this.mInterimTargetDy) * TARGET_SEEK_EXTRA_SCROLL_RATIO), (int) (((float) calculateTimeForScrolling(10000)) * TARGET_SEEK_EXTRA_SCROLL_RATIO), this.mLinearInterpolator);
}
项目:boohee_v5.6    文件:LinearSmoothScroller.java   
protected void onTargetFound(View targetView, State state, Action action) {
    int dx = calculateDxToMakeVisible(targetView, getHorizontalSnapPreference());
    int dy = calculateDyToMakeVisible(targetView, getVerticalSnapPreference());
    int time = calculateTimeForDeceleration((int) Math.sqrt((double) ((dx * dx) + (dy * dy))));
    if (time > 0) {
        action.update(-dx, -dy, time, this.mDecelerateInterpolator);
    }
}
项目:boohee_v5.6    文件:LinearSmoothScroller.java   
protected void onSeekTargetStep(int dx, int dy, State state, Action action) {
    if (getChildCount() == 0) {
        stop();
        return;
    }
    this.mInterimTargetDx = clampApplyScroll(this.mInterimTargetDx, dx);
    this.mInterimTargetDy = clampApplyScroll(this.mInterimTargetDy, dy);
    if (this.mInterimTargetDx == 0 && this.mInterimTargetDy == 0) {
        updateActionForInterimTarget(action);
    }
}
项目:boohee_v5.6    文件:LinearSmoothScroller.java   
protected void updateActionForInterimTarget(Action action) {
    PointF scrollVector = computeScrollVectorForPosition(getTargetPosition());
    if (scrollVector == null || (scrollVector.x == 0.0f && scrollVector.y == 0.0f)) {
        Log.e(TAG, "To support smooth scrolling, you should override \nLayoutManager#computeScrollVectorForPosition.\nFalling back to instant scroll");
        action.jumpTo(getTargetPosition());
        stop();
        return;
    }
    normalize(scrollVector);
    this.mTargetVector = scrollVector;
    this.mInterimTargetDx = (int) (scrollVector.x * 10000.0f);
    this.mInterimTargetDy = (int) (scrollVector.y * 10000.0f);
    action.update((int) (((float) this.mInterimTargetDx) * TARGET_SEEK_EXTRA_SCROLL_RATIO), (int) (((float) this.mInterimTargetDy) * TARGET_SEEK_EXTRA_SCROLL_RATIO), (int) (((float) calculateTimeForScrolling(10000)) * TARGET_SEEK_EXTRA_SCROLL_RATIO), this.mLinearInterpolator);
}