@Override public void run() { if (!mProgressIncreasing && !mIsRefreshing) { if (mProgressCount >= 0) { mProgressCount -= 4; mProgressBarLeft.setProgress(mProgressCount); mProgressBarRight.setProgress(mProgressCount); if (mRecyclerView.getTranslationY() != 0) { mRecyclerView.setTranslationY(dpToPx((mProgressCount / 2))); } handler.postDelayed(mProgressUpdater, 5); } else { mProgressCount = 0; mProgressBarLeft.setVisibility(GONE); mProgressBarRight.setVisibility(GONE); } } } };
@Override public void run() { float translation = (isVertical() ? mRecyclerView.getTranslationY() : mRecyclerView.getTranslationX()); float fraction = MathUtils.clamp(Math.abs((translation / getDragThreshold())), 0f, 1f); int scroll = (int) (0f - translation * Math.pow(fraction, SCROLL_EXPONENT)); if (Math.abs(scroll) > 0 && (isVertical() && mRecyclerView.canScrollVertically(scroll) || !isVertical() && mRecyclerView.canScrollHorizontally(scroll))) { if (mScrollCallbacks != null) mScrollCallbacks.onScrolled((translation > 0 ? 1f : -1) * fraction); mRecyclerView.scrollBy(isVertical() ? 0 : scroll, isVertical() ? scroll : 0); } mRecyclerView.post(mScrollByRunnable); } };
&& !canScrollUp() && mRecyclerView.getTranslationY() != 0) { mShouldAnimateCard = true; mPreviousY = mDeltaY = 0;
else mRecyclerView.setTranslationX(interpolatedProgress); int direction = (int) (-translation + mRecyclerView.getTranslationY()); if (isVertical() && mRecyclerView.canScrollVertically(direction) || !isVertical() && mRecyclerView.canScrollHorizontally(direction)) mRecyclerView.post(mScrollByRunnable); if (Math.abs(isVertical() ? mRecyclerView.getTranslationY() : mRecyclerView.getTranslationX()) < getDragThreshold() / 2f) mRecyclerView.animate().setInterpolator(LogDecelerateInterpolator.LOG_DECELERATE_INTERPOLATOR).translationX(0).translationY(0).start(); else {