private boolean slideToSpecifiedPositionInternal(
      final RecyclerView.ViewHolder holder,
      float amount,
      boolean proportional,
      boolean horizontal,
      boolean shouldAnimate,
      Interpolator interpolator,
      long duration,
      SwipeFinishInfo swipeFinish) {
    final View containerView = ((SwipeableItemViewHolder) holder).getSwipeableContainerView();

    if (shouldAnimate) {
      shouldAnimate =
          ViewCompat.isAttachedToWindow(containerView)
              && (containerView.getVisibility() == View.VISIBLE);
    }

    duration = (shouldAnimate) ? duration : 0;

    if (amount != 0.0f) {
      final int width = containerView.getWidth();
      final int height = containerView.getHeight();

      if (horizontal && (proportional || width != 0)) {
        final int translationX;
        translationX = (int) ((proportional ? width * amount : amount) + 0.5f);
        return animateSlideInternalCompat(
            holder, horizontal, translationX, 0, duration, interpolator, swipeFinish);
      } else if (!horizontal && (proportional || height != 0)) {
        final int translationY;
        translationY = (int) ((proportional ? height * amount : amount) + 0.5f);
        return animateSlideInternalCompat(
            holder, horizontal, 0, translationY, duration, interpolator, swipeFinish);
      } else {
        if (swipeFinish != null) {
          throw new IllegalStateException(
              "Unexpected state in slideToSpecifiedPositionInternal (swipeFinish == null)");
        }

        scheduleViewHolderDeferredSlideProcess(
            holder, new DeferredSlideProcess(holder, amount, horizontal));

        return false;
      }
    } else {
      return animateSlideInternalCompat(
          holder, horizontal, 0, 0, duration, interpolator, swipeFinish);
    }
  }
  private boolean slideToOutsideOfWindowInternal(
      RecyclerView.ViewHolder holder,
      int dir,
      boolean shouldAnimate,
      long duration,
      SwipeFinishInfo swipeFinish) {

    if (!(holder instanceof SwipeableItemViewHolder)) {
      return false;
    }

    final View containerView = ((SwipeableItemViewHolder) holder).getSwipeableContainerView();
    final ViewGroup parent = (ViewGroup) containerView.getParent();

    if (parent == null) {
      return false;
    }

    final int left = containerView.getLeft();
    final int right = containerView.getRight();
    final int top = containerView.getTop();
    final int bottom = containerView.getBottom();
    final int width = right - left;
    final int height = bottom - top;

    parent.getWindowVisibleDisplayFrame(mTmpRect);
    final int windowWidth = mTmpRect.width();
    final int windowHeight = mTmpRect.height();

    int translateX = 0;
    int translateY = 0;

    if ((width == 0) || (height == 0)) {
      // not measured yet or not shown
      switch (dir) {
        case DIR_LEFT:
          translateX = -windowWidth;
          break;
        case DIR_UP:
          translateY = -windowHeight;
          break;
        case DIR_RIGHT:
          translateX = windowWidth;
          break;
        case DIR_DOWN:
          translateY = windowHeight;
          break;
        default:
          break;
      }
      shouldAnimate = false;
    } else {
      parent.getLocationInWindow(mTmpLocation);
      final int x = mTmpLocation[0];
      final int y = mTmpLocation[1];

      switch (dir) {
        case DIR_LEFT:
          translateX = -(x + width);
          break;
        case DIR_UP:
          translateY = -(y + height);
          break;
        case DIR_RIGHT:
          translateX = windowWidth - (x - left);
          break;
        case DIR_DOWN:
          translateY = windowHeight - (y - top);
          break;
        default:
          break;
      }
    }

    if (shouldAnimate) {
      shouldAnimate =
          ViewCompat.isAttachedToWindow(containerView)
              && (containerView.getVisibility() == View.VISIBLE);
    }

    duration = (shouldAnimate) ? duration : 0;

    boolean horizontal = (dir == DIR_LEFT || dir == DIR_RIGHT);
    return animateSlideInternalCompat(
        holder,
        horizontal,
        translateX,
        translateY,
        duration,
        mSlideToOutsideOfWindowAnimationInterpolator,
        swipeFinish);
  }