content: package androidx.recyclerview.widget;
  
  import android.graphics.Rect;
  import android.view.View;
  import androidx.recyclerview.widget.RecyclerView;
  
  public abstract class OrientationHelper {
      public static final int HORIZONTAL = 0;
      private static final int INVALID_SIZE = Integer.MIN_VALUE;
      public static final int VERTICAL = 1;
      private int mLastTotalSpace;
      protected final RecyclerView.LayoutManager mLayoutManager;
      final Rect mTmpRect;
  
      private OrientationHelper(RecyclerView.LayoutManager layoutManager) {
          this.mLastTotalSpace = Integer.MIN_VALUE;
          this.mTmpRect = new Rect();
          this.mLayoutManager = layoutManager;
      }
  
      public static OrientationHelper createHorizontalHelper(RecyclerView.LayoutManager layoutManager) {
          return new OrientationHelper(layoutManager) {
              public int getDecoratedEnd(View view) {
                  return this.mLayoutManager.getDecoratedRight(view) + ((RecyclerView.LayoutParams) view.getLayoutParams()).rightMargin;
              }
  
              public int getDecoratedMeasurement(View view) {
                  RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
                  return this.mLayoutManager.getDecoratedMeasuredWidth(view) + layoutParams.leftMargin + layoutParams.rightMargin;
              }
  
              public int getDecoratedMeasurementInOther(View view) {
                  RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
                  return this.mLayoutManager.getDecoratedMeasuredHeight(view) + layoutParams.topMargin + layoutParams.bottomMargin;
              }
  
              public int getDecoratedStart(View view) {
                  return this.mLayoutManager.getDecoratedLeft(view) - ((RecyclerView.LayoutParams) view.getLayoutParams()).leftMargin;
              }
  
              public int getEnd() {
                  return this.mLayoutManager.getWidth();
              }
  
              public int getEndAfterPadding() {
                  return this.mLayoutManager.getWidth() - this.mLayoutManager.getPaddingRight();
              }
  
              public int getEndPadding() {
                  return this.mLayoutManager.getPaddingRight();
              }
  
              public int getMode() {
                  return this.mLayoutManager.getWidthMode();
              }
  
              public int getModeInOther() {
                  return this.mLayoutManager.getHeightMode();
              }
  
              public int getStartAfterPadding() {
                  return this.mLayoutManager.getPaddingLeft();
              }
  
              public int getTotalSpace() {
                  return (this.mLayoutManager.getWidth() - this.mLayoutManager.getPaddingLeft()) - this.mLayoutManager.getPaddingRight();
              }
  
              public int getTransformedEndWithDecoration(View view) {
                  this.mLayoutManager.getTransformedBoundingBox(view, true, this.mTmpRect);
                  return this.mTmpRect.right;
              }
  
              public int getTransformedStartWithDecoration(View view) {
                  this.mLayoutManager.getTransformedBoundingBox(view, true, this.mTmpRect);
                  return this.mTmpRect.left;
              }
  
              public void offsetChild(View view, int offset) {
                  view.offsetLeftAndRight(offset);
              }
  
              public void offsetChildren(int amount) {
                  this.mLayoutManager.offsetChildrenHorizontal(amount);
              }
          };
      }
  
      public static OrientationHelper createOrientationHelper(RecyclerView.LayoutManager layoutManager, int orientation) {
          switch (orientation) {
              case 0:
                  return createHorizontalHelper(layoutManager);
              case 1:
                  return createVerticalHelper(layoutManager);
              default:
                  throw new IllegalArgumentException("invalid orientation");
          }
      }
  
      public static OrientationHelper createVerticalHelper(RecyclerView.LayoutManager layoutManager) {
          return new OrientationHelper(layoutManager) {
              public int getDecoratedEnd(View view) {
                  return this.mLayoutManager.getDecoratedBottom(view) + ((RecyclerView.LayoutParams) view.getLayoutParams()).bottomMargin;
              }
  
              public int getDecoratedMeasurement(View view) {
                  RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
                  return this.mLayoutManager.getDecoratedMeasuredHeight(view) + layoutParams.topMargin + layoutParams.bottomMargin;
              }
  
              public int getDecoratedMeasurementInOther(View view) {
                  RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) view.getLayoutParams();
                  return this.mLayoutManager.getDecoratedMeasuredWidth(view) + layoutParams.leftMargin + layoutParams.rightMargin;
              }
  
              public int getDecoratedStart(View view) {
                  return this.mLayoutManager.getDecoratedTop(view) - ((RecyclerView.LayoutParams) view.getLayoutParams()).topMargin;
              }
  
              public int getEnd() {
                  return this.mLayoutManager.getHeight();
              }
  
              public int getEndAfterPadding() {
                  return this.mLayoutManager.getHeight() - this.mLayoutManager.getPaddingBottom();
              }
  
              public int getEndPadding() {
                  return this.mLayoutManager.getPaddingBottom();
              }
  
              public int getMode() {
                  return this.mLayoutManager.getHeightMode();
              }
  
              public int getModeInOther() {
                  return this.mLayoutManager.getWidthMode();
              }
  
              public int getStartAfterPadding() {
                  return this.mLayoutManager.getPaddingTop();
              }
  
              public int getTotalSpace() {
                  return (this.mLayoutManager.getHeight() - this.mLayoutManager.getPaddingTop()) - this.mLayoutManager.getPaddingBottom();
              }
  
              public int getTransformedEndWithDecoration(View view) {
                  this.mLayoutManager.getTransformedBoundingBox(view, true, this.mTmpRect);
                  return this.mTmpRect.bottom;
              }
  
              public int getTransformedStartWithDecoration(View view) {
                  this.mLayoutManager.getTransformedBoundingBox(view, true, this.mTmpRect);
                  return this.mTmpRect.top;
              }
  
              public void offsetChild(View view, int offset) {
                  view.offsetTopAndBottom(offset);
              }
  
              public void offsetChildren(int amount) {
                  this.mLayoutManager.offsetChildrenVertical(amount);
              }
          };
      }
  
      public abstract int getDecoratedEnd(View view);
  
      public abstract int getDecoratedMeasurement(View view);
  
      public abstract int getDecoratedMeasurementInOther(View view);
  
      public abstract int getDecoratedStart(View view);
  
      public abstract int getEnd();
  
      public abstract int getEndAfterPadding();
  
      public abstract int getEndPadding();
  
      public RecyclerView.LayoutManager getLayoutManager() {
          return this.mLayoutManager;
      }
  
      public abstract int getMode();
  
      public abstract int getModeInOther();
  
      public abstract int getStartAfterPadding();
  
      public abstract int getTotalSpace();
  
      public int getTotalSpaceChange() {
          if (Integer.MIN_VALUE == this.mLastTotalSpace) {
              return 0;
          }
          return getTotalSpace() - this.mLastTotalSpace;
      }
  
      public abstract int getTransformedEndWithDecoration(View view);
  
      public abstract int getTransformedStartWithDecoration(View view);
  
      public abstract void offsetChild(View view, int i);
  
      public abstract void offsetChildren(int i);
  
      public void onLayoutComplete() {
          this.mLastTotalSpace = getTotalSpace();
      }
  }
  