Пример #1
0
 @Override
 public int getRedrawOffset(
     final ScrollDirectionManager scrollDirectionManager,
     final View incomingView,
     final View outgoingView) {
   final int outgoingViewStart = scrollDirectionManager.getViewStart(outgoingView);
   return outgoingViewStart;
 }
Пример #2
0
  @Override
  public int getSnapToPixelDistance(
      LayoutManager<Cell> layoutManager,
      ScrollDirectionManager scrollDirectionManager,
      int size,
      View view) {
    final int startSizePadding = layoutManager.getStartSizePadding();
    final int endSizePadding = layoutManager.getEndSizePadding();
    final int startPixel = scrollDirectionManager.getViewStart(view);
    final int endPixel = scrollDirectionManager.getViewEnd(view);
    final int viewSize = endPixel - startPixel;

    final int actualSize = size - startSizePadding - endSizePadding;
    final boolean viewIsLargerThanViewGroup = actualSize <= viewSize;
    if (startPixel < startSizePadding || viewIsLargerThanViewGroup) {
      return -startPixel + startSizePadding;
    } else if (endPixel > startSizePadding + size) {
      return startSizePadding + size - endPixel;
    }

    return 0;
  }