content: package androidx.core.widget;
  
  import android.content.Context;
  import android.content.res.TypedArray;
  import android.graphics.Canvas;
  import android.graphics.Rect;
  import android.os.Build;
  import android.os.Bundle;
  import android.os.Parcel;
  import android.os.Parcelable;
  import android.util.AttributeSet;
  import android.util.Log;
  import android.util.TypedValue;
  import android.view.FocusFinder;
  import android.view.KeyEvent;
  import android.view.MotionEvent;
  import android.view.VelocityTracker;
  import android.view.View;
  import android.view.ViewConfiguration;
  import android.view.ViewGroup;
  import android.view.ViewParent;
  import android.view.accessibility.AccessibilityEvent;
  import android.view.animation.AnimationUtils;
  import android.widget.EdgeEffect;
  import android.widget.FrameLayout;
  import android.widget.OverScroller;
  import android.widget.ScrollView;
  import androidx.constraintlayout.core.widgets.analyzer.BasicMeasure;
  import androidx.core.R;
  import androidx.core.view.AccessibilityDelegateCompat;
  import androidx.core.view.MotionEventCompat;
  import androidx.core.view.NestedScrollingChild3;
  import androidx.core.view.NestedScrollingChildHelper;
  import androidx.core.view.NestedScrollingParent3;
  import androidx.core.view.NestedScrollingParentHelper;
  import androidx.core.view.ScrollingView;
  import androidx.core.view.ViewCompat;
  import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
  import androidx.core.view.accessibility.AccessibilityRecordCompat;
  import androidx.recyclerview.widget.ItemTouchHelper;
  import java.util.ArrayList;
  import mt.Log1F380D;
  
  public class NestedScrollView extends FrameLayout implements NestedScrollingParent3, NestedScrollingChild3, ScrollingView {
      private static final AccessibilityDelegate ACCESSIBILITY_DELEGATE = new AccessibilityDelegate();
      static final int ANIMATED_SCROLL_GAP = 250;
      private static final int DEFAULT_SMOOTH_SCROLL_DURATION = 250;
      private static final int INVALID_POINTER = -1;
      static final float MAX_SCROLL_FACTOR = 0.5f;
      private static final int[] SCROLLVIEW_STYLEABLE = {16843130};
      private static final String TAG = "NestedScrollView";
      private int mActivePointerId;
      private final NestedScrollingChildHelper mChildHelper;
      private View mChildToScrollTo;
      public EdgeEffect mEdgeGlowBottom;
      public EdgeEffect mEdgeGlowTop;
      private boolean mFillViewport;
      private boolean mIsBeingDragged;
      private boolean mIsLaidOut;
      private boolean mIsLayoutDirty;
      private int mLastMotionY;
      private long mLastScroll;
      private int mLastScrollerY;
      private int mMaximumVelocity;
      private int mMinimumVelocity;
      private int mNestedYOffset;
      private OnScrollChangeListener mOnScrollChangeListener;
      private final NestedScrollingParentHelper mParentHelper;
      private SavedState mSavedState;
      private final int[] mScrollConsumed;
      private final int[] mScrollOffset;
      private OverScroller mScroller;
      private boolean mSmoothScrollingEnabled;
      private final Rect mTempRect;
      private int mTouchSlop;
      private VelocityTracker mVelocityTracker;
      private float mVerticalScrollFactor;
  
      static class AccessibilityDelegate extends AccessibilityDelegateCompat {
          AccessibilityDelegate() {
          }
  
          public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
              super.onInitializeAccessibilityEvent(host, event);
              NestedScrollView nestedScrollView = (NestedScrollView) host;
              event.setClassName(ScrollView.class.getName());
              event.setScrollable(nestedScrollView.getScrollRange() > 0);
              event.setScrollX(nestedScrollView.getScrollX());
              event.setScrollY(nestedScrollView.getScrollY());
              AccessibilityRecordCompat.setMaxScrollX(event, nestedScrollView.getScrollX());
              AccessibilityRecordCompat.setMaxScrollY(event, nestedScrollView.getScrollRange());
          }
  
          public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) {
              int scrollRange;
              super.onInitializeAccessibilityNodeInfo(host, info);
              NestedScrollView nestedScrollView = (NestedScrollView) host;
              info.setClassName(ScrollView.class.getName());
              if (nestedScrollView.isEnabled() && (scrollRange = nestedScrollView.getScrollRange()) > 0) {
                  info.setScrollable(true);
                  if (nestedScrollView.getScrollY() > 0) {
                      info.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_BACKWARD);
                      info.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_UP);
                  }
                  if (nestedScrollView.getScrollY() < scrollRange) {
                      info.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_FORWARD);
                      info.addAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_SCROLL_DOWN);
                  }
              }
          }
  
          public boolean performAccessibilityAction(View host, int action, Bundle arguments) {
              if (super.performAccessibilityAction(host, action, arguments)) {
                  return true;
              }
              NestedScrollView nestedScrollView = (NestedScrollView) host;
              if (!nestedScrollView.isEnabled()) {
                  return false;
              }
              int height = nestedScrollView.getHeight();
              Rect rect = new Rect();
              if (nestedScrollView.getMatrix().isIdentity() && nestedScrollView.getGlobalVisibleRect(rect)) {
                  height = rect.height();
              }
              switch (action) {
                  case 4096:
                  case 16908346:
                      int min = Math.min(nestedScrollView.getScrollY() + ((height - nestedScrollView.getPaddingBottom()) - nestedScrollView.getPaddingTop()), nestedScrollView.getScrollRange());
                      if (min == nestedScrollView.getScrollY()) {
                          return false;
                      }
                      nestedScrollView.smoothScrollTo(0, min, true);
                      return true;
                  case 8192:
                  case 16908344:
                      int max = Math.max(nestedScrollView.getScrollY() - ((height - nestedScrollView.getPaddingBottom()) - nestedScrollView.getPaddingTop()), 0);
                      if (max == nestedScrollView.getScrollY()) {
                          return false;
                      }
                      nestedScrollView.smoothScrollTo(0, max, true);
                      return true;
                  default:
                      return false;
              }
          }
      }
  
      static class Api21Impl {
          private Api21Impl() {
          }
  
          static boolean getClipToPadding(ViewGroup viewGroup) {
              return viewGroup.getClipToPadding();
          }
      }
  
      public interface OnScrollChangeListener {
          void onScrollChange(NestedScrollView nestedScrollView, int i, int i2, int i3, int i4);
      }
  
      /* compiled from: 0067 */
      static class SavedState extends View.BaseSavedState {
          public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() {
              public SavedState createFromParcel(Parcel in) {
                  return new SavedState(in);
              }
  
              public SavedState[] newArray(int size) {
                  return new SavedState[size];
              }
          };
          public int scrollPosition;
  
          SavedState(Parcel source) {
              super(source);
              this.scrollPosition = source.readInt();
          }
  
          SavedState(Parcelable superState) {
              super(superState);
          }
  
          public String toString() {
              StringBuilder append = new StringBuilder().append("HorizontalScrollView.SavedState{");
              String hexString = Integer.toHexString(System.identityHashCode(this));
              Log1F380D.a((Object) hexString);
              return append.append(hexString).append(" scrollPosition=").append(this.scrollPosition).append("}").toString();
          }
  
          public void writeToParcel(Parcel dest, int flags) {
              super.writeToParcel(dest, flags);
              dest.writeInt(this.scrollPosition);
          }
      }
  
      public NestedScrollView(Context context) {
          this(context, (AttributeSet) null);
      }
  
      public NestedScrollView(Context context, AttributeSet attrs) {
          this(context, attrs, R.attr.nestedScrollViewStyle);
      }
  
      public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
          super(context, attrs, defStyleAttr);
          this.mTempRect = new Rect();
          this.mIsLayoutDirty = true;
          this.mIsLaidOut = false;
          this.mChildToScrollTo = null;
          this.mIsBeingDragged = false;
          this.mSmoothScrollingEnabled = true;
          this.mActivePointerId = -1;
          this.mScrollOffset = new int[2];
          this.mScrollConsumed = new int[2];
          this.mEdgeGlowTop = EdgeEffectCompat.create(context, attrs);
          this.mEdgeGlowBottom = EdgeEffectCompat.create(context, attrs);
          initScrollView();
          TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0);
          setFillViewport(obtainStyledAttributes.getBoolean(0, false));
          obtainStyledAttributes.recycle();
          this.mParentHelper = new NestedScrollingParentHelper(this);
          this.mChildHelper = new NestedScrollingChildHelper(this);
          setNestedScrollingEnabled(true);
          ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
      }
  
      private void abortAnimatedScroll() {
          this.mScroller.abortAnimation();
          stopNestedScroll(1);
      }
  
      private boolean canOverScroll() {
          int overScrollMode = getOverScrollMode();
          if (overScrollMode != 0) {
              return overScrollMode == 1 && getScrollRange() > 0;
          }
          return true;
      }
  
      private boolean canScroll() {
          if (getChildCount() <= 0) {
              return false;
          }
          View childAt = getChildAt(0);
          FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
          return (childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin > (getHeight() - getPaddingTop()) - getPaddingBottom();
      }
  
      private static int clamp(int n, int my, int child) {
          if (my >= child || n < 0) {
              return 0;
          }
          return my + n > child ? child - my : n;
      }
  
      private void doScrollY(int delta) {
          if (delta == 0) {
              return;
          }
          if (this.mSmoothScrollingEnabled) {
              smoothScrollBy(0, delta);
          } else {
              scrollBy(0, delta);
          }
      }
  
      private boolean edgeEffectFling(int velocityY) {
          if (EdgeEffectCompat.getDistance(this.mEdgeGlowTop) != 0.0f) {
              this.mEdgeGlowTop.onAbsorb(velocityY);
              return true;
          } else if (EdgeEffectCompat.getDistance(this.mEdgeGlowBottom) == 0.0f) {
              return false;
          } else {
              this.mEdgeGlowBottom.onAbsorb(-velocityY);
              return true;
          }
      }
  
      private void endDrag() {
          this.mIsBeingDragged = false;
          recycleVelocityTracker();
          stopNestedScroll(0);
          this.mEdgeGlowTop.onRelease();
          this.mEdgeGlowBottom.onRelease();
      }
  
      private View findFocusableViewInBounds(boolean topFocus, int top, int bottom) {
          ArrayList focusables = getFocusables(2);
          View view = null;
          boolean z = false;
          int size = focusables.size();
          for (int i = 0; i < size; i++) {
              View view2 = (View) focusables.get(i);
              int top2 = view2.getTop();
              int bottom2 = view2.getBottom();
              if (top < bottom2 && top2 < bottom) {
                  boolean z2 = false;
                  boolean z3 = top < top2 && bottom2 < bottom;
                  if (view == null) {
                      view = view2;
                      z = z3;
                  } else {
                      if ((topFocus && top2 < view.getTop()) || (!topFocus && bottom2 > view.getBottom())) {
                          z2 = true;
                      }
                      if (z) {
                          if (z3 && z2) {
                              view = view2;
                          }
                      } else if (z3) {
                          view = view2;
                          z = true;
                      } else if (z2) {
                          view = view2;
                      }
                  }
              }
          }
          return view;
      }
  
      private float getVerticalScrollFactorCompat() {
          if (this.mVerticalScrollFactor == 0.0f) {
              TypedValue typedValue = new TypedValue();
              Context context = getContext();
              if (context.getTheme().resolveAttribute(16842829, typedValue, true)) {
                  this.mVerticalScrollFactor = typedValue.getDimension(context.getResources().getDisplayMetrics());
              } else {
                  throw new IllegalStateException("Expected theme to define listPreferredItemHeight.");
              }
          }
          return this.mVerticalScrollFactor;
      }
  
      private boolean inChild(int x, int y) {
          if (getChildCount() <= 0) {
              return false;
          }
          int scrollY = getScrollY();
          View childAt = getChildAt(0);
          return y >= childAt.getTop() - scrollY && y < childAt.getBottom() - scrollY && x >= childAt.getLeft() && x < childAt.getRight();
      }
  
      private void initOrResetVelocityTracker() {
          VelocityTracker velocityTracker = this.mVelocityTracker;
          if (velocityTracker == null) {
              this.mVelocityTracker = VelocityTracker.obtain();
          } else {
              velocityTracker.clear();
          }
      }
  
      private void initScrollView() {
          this.mScroller = new OverScroller(getContext());
          setFocusable(true);
          setDescendantFocusability(262144);
          setWillNotDraw(false);
          ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
          this.mTouchSlop = viewConfiguration.getScaledTouchSlop();
          this.mMinimumVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
          this.mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
      }
  
      private void initVelocityTrackerIfNotExists() {
          if (this.mVelocityTracker == null) {
              this.mVelocityTracker = VelocityTracker.obtain();
          }
      }
  
      private boolean isOffScreen(View descendant) {
          return !isWithinDeltaOfScreen(descendant, 0, getHeight());
      }
  
      private static boolean isViewDescendantOf(View child, View parent) {
          if (child == parent) {
              return true;
          }
          ViewParent parent2 = child.getParent();
          return (parent2 instanceof ViewGroup) && isViewDescendantOf((View) parent2, parent);
      }
  
      private boolean isWithinDeltaOfScreen(View descendant, int delta, int height) {
          descendant.getDrawingRect(this.mTempRect);
          offsetDescendantRectToMyCoords(descendant, this.mTempRect);
          return this.mTempRect.bottom + delta >= getScrollY() && this.mTempRect.top - delta <= getScrollY() + height;
      }
  
      private void onNestedScrollInternal(int dyUnconsumed, int type, int[] consumed) {
          int scrollY = getScrollY();
          scrollBy(0, dyUnconsumed);
          int scrollY2 = getScrollY() - scrollY;
          if (consumed != null) {
              consumed[1] = consumed[1] + scrollY2;
          }
          this.mChildHelper.dispatchNestedScroll(0, scrollY2, 0, dyUnconsumed - scrollY2, (int[]) null, type, consumed);
      }
  
      private void onSecondaryPointerUp(MotionEvent ev) {
          int actionIndex = ev.getActionIndex();
          if (ev.getPointerId(actionIndex) == this.mActivePointerId) {
              int i = actionIndex == 0 ? 1 : 0;
              this.mLastMotionY = (int) ev.getY(i);
              this.mActivePointerId = ev.getPointerId(i);
              VelocityTracker velocityTracker = this.mVelocityTracker;
              if (velocityTracker != null) {
                  velocityTracker.clear();
              }
          }
      }
  
      private void recycleVelocityTracker() {
          VelocityTracker velocityTracker = this.mVelocityTracker;
          if (velocityTracker != null) {
              velocityTracker.recycle();
              this.mVelocityTracker = null;
          }
      }
  
      private int releaseVerticalGlow(int deltaY, float x) {
          float f = 0.0f;
          float width = x / ((float) getWidth());
          float height = ((float) deltaY) / ((float) getHeight());
          if (EdgeEffectCompat.getDistance(this.mEdgeGlowTop) != 0.0f) {
              f = -EdgeEffectCompat.onPullDistance(this.mEdgeGlowTop, -height, width);
              if (EdgeEffectCompat.getDistance(this.mEdgeGlowTop) == 0.0f) {
                  this.mEdgeGlowTop.onRelease();
              }
          } else if (EdgeEffectCompat.getDistance(this.mEdgeGlowBottom) != 0.0f) {
              f = EdgeEffectCompat.onPullDistance(this.mEdgeGlowBottom, height, 1.0f - width);
              if (EdgeEffectCompat.getDistance(this.mEdgeGlowBottom) == 0.0f) {
                  this.mEdgeGlowBottom.onRelease();
              }
          }
          int round = Math.round(((float) getHeight()) * f);
          if (round != 0) {
              invalidate();
          }
          return round;
      }
  
      private void runAnimatedScroll(boolean participateInNestedScrolling) {
          if (participateInNestedScrolling) {
              startNestedScroll(2, 1);
          } else {
              stopNestedScroll(1);
          }
          this.mLastScrollerY = getScrollY();
          ViewCompat.postInvalidateOnAnimation(this);
      }
  
      private boolean scrollAndFocus(int direction, int top, int bottom) {
          boolean z = true;
          int height = getHeight();
          int scrollY = getScrollY();
          int i = scrollY + height;
          boolean z2 = direction == 33;
          View findFocusableViewInBounds = findFocusableViewInBounds(z2, top, bottom);
          if (findFocusableViewInBounds == null) {
              findFocusableViewInBounds = this;
          }
          if (top < scrollY || bottom > i) {
              doScrollY(z2 ? top - scrollY : bottom - i);
          } else {
              z = false;
          }
          if (findFocusableViewInBounds != findFocus()) {
              findFocusableViewInBounds.requestFocus(direction);
          }
          return z;
      }
  
      private void scrollToChild(View child) {
          child.getDrawingRect(this.mTempRect);
          offsetDescendantRectToMyCoords(child, this.mTempRect);
          int computeScrollDeltaToGetChildRectOnScreen = computeScrollDeltaToGetChildRectOnScreen(this.mTempRect);
          if (computeScrollDeltaToGetChildRectOnScreen != 0) {
              scrollBy(0, computeScrollDeltaToGetChildRectOnScreen);
          }
      }
  
      private boolean scrollToChildRect(Rect rect, boolean immediate) {
          int computeScrollDeltaToGetChildRectOnScreen = computeScrollDeltaToGetChildRectOnScreen(rect);
          boolean z = computeScrollDeltaToGetChildRectOnScreen != 0;
          if (z) {
              if (immediate) {
                  scrollBy(0, computeScrollDeltaToGetChildRectOnScreen);
              } else {
                  smoothScrollBy(0, computeScrollDeltaToGetChildRectOnScreen);
              }
          }
          return z;
      }
  
      private void smoothScrollBy(int dx, int dy, int scrollDurationMs, boolean withNestedScrolling) {
          if (getChildCount() != 0) {
              if (AnimationUtils.currentAnimationTimeMillis() - this.mLastScroll > 250) {
                  View childAt = getChildAt(0);
                  FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
                  int scrollY = getScrollY();
                  this.mScroller.startScroll(getScrollX(), scrollY, 0, Math.max(0, Math.min(scrollY + dy, Math.max(0, ((childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin) - ((getHeight() - getPaddingTop()) - getPaddingBottom())))) - scrollY, scrollDurationMs);
                  runAnimatedScroll(withNestedScrolling);
              } else {
                  boolean z = withNestedScrolling;
                  if (!this.mScroller.isFinished()) {
                      abortAnimatedScroll();
                  }
                  scrollBy(dx, dy);
                  int i = dy;
              }
              this.mLastScroll = AnimationUtils.currentAnimationTimeMillis();
          }
      }
  
      private boolean stopGlowAnimations(MotionEvent e) {
          boolean z = false;
          if (EdgeEffectCompat.getDistance(this.mEdgeGlowTop) != 0.0f) {
              EdgeEffectCompat.onPullDistance(this.mEdgeGlowTop, 0.0f, e.getX() / ((float) getWidth()));
              z = true;
          }
          if (EdgeEffectCompat.getDistance(this.mEdgeGlowBottom) == 0.0f) {
              return z;
          }
          EdgeEffectCompat.onPullDistance(this.mEdgeGlowBottom, 0.0f, 1.0f - (e.getX() / ((float) getWidth())));
          return true;
      }
  
      public void addView(View child) {
          if (getChildCount() <= 0) {
              super.addView(child);
              return;
          }
          throw new IllegalStateException("ScrollView can host only one direct child");
      }
  
      public void addView(View child, int index) {
          if (getChildCount() <= 0) {
              super.addView(child, index);
              return;
          }
          throw new IllegalStateException("ScrollView can host only one direct child");
      }
  
      public void addView(View child, int index, ViewGroup.LayoutParams params) {
          if (getChildCount() <= 0) {
              super.addView(child, index, params);
              return;
          }
          throw new IllegalStateException("ScrollView can host only one direct child");
      }
  
      public void addView(View child, ViewGroup.LayoutParams params) {
          if (getChildCount() <= 0) {
              super.addView(child, params);
              return;
          }
          throw new IllegalStateException("ScrollView can host only one direct child");
      }
  
      public boolean arrowScroll(int direction) {
          View findFocus = findFocus();
          if (findFocus == this) {
              findFocus = null;
          }
          View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, direction);
          int maxScrollAmount = getMaxScrollAmount();
          if (findNextFocus == null || !isWithinDeltaOfScreen(findNextFocus, maxScrollAmount, getHeight())) {
              int i = maxScrollAmount;
              if (direction == 33 && getScrollY() < i) {
                  i = getScrollY();
              } else if (direction == 130 && getChildCount() > 0) {
                  View childAt = getChildAt(0);
                  i = Math.min((childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin) - ((getScrollY() + getHeight()) - getPaddingBottom()), maxScrollAmount);
              }
              if (i == 0) {
                  return false;
              }
              doScrollY(direction == 130 ? i : -i);
          } else {
              findNextFocus.getDrawingRect(this.mTempRect);
              offsetDescendantRectToMyCoords(findNextFocus, this.mTempRect);
              doScrollY(computeScrollDeltaToGetChildRectOnScreen(this.mTempRect));
              findNextFocus.requestFocus(direction);
          }
          if (findFocus == null || !findFocus.isFocused() || !isOffScreen(findFocus)) {
              return true;
          }
          int descendantFocusability = getDescendantFocusability();
          setDescendantFocusability(131072);
          requestFocus();
          setDescendantFocusability(descendantFocusability);
          return true;
      }
  
      public int computeHorizontalScrollExtent() {
          return super.computeHorizontalScrollExtent();
      }
  
      public int computeHorizontalScrollOffset() {
          return super.computeHorizontalScrollOffset();
      }
  
      public int computeHorizontalScrollRange() {
          return super.computeHorizontalScrollRange();
      }
  
      public void computeScroll() {
          if (!this.mScroller.isFinished()) {
              this.mScroller.computeScrollOffset();
              int currY = this.mScroller.getCurrY();
              int i = currY - this.mLastScrollerY;
              this.mLastScrollerY = currY;
              int[] iArr = this.mScrollConsumed;
              boolean z = false;
              iArr[1] = 0;
              dispatchNestedPreScroll(0, i, iArr, (int[]) null, 1);
              int i2 = i - this.mScrollConsumed[1];
              int scrollRange = getScrollRange();
              if (i2 != 0) {
                  int scrollY = getScrollY();
                  overScrollByCompat(0, i2, getScrollX(), scrollY, 0, scrollRange, 0, 0, false);
                  int scrollY2 = getScrollY() - scrollY;
                  int i3 = i2 - scrollY2;
                  int[] iArr2 = this.mScrollConsumed;
                  iArr2[1] = 0;
                  dispatchNestedScroll(0, scrollY2, 0, i3, this.mScrollOffset, 1, iArr2);
                  i2 = i3 - this.mScrollConsumed[1];
              }
              if (i2 != 0) {
                  int overScrollMode = getOverScrollMode();
                  if (overScrollMode == 0 || (overScrollMode == 1 && scrollRange > 0)) {
                      z = true;
                  }
                  if (z) {
                      if (i2 < 0) {
                          if (this.mEdgeGlowTop.isFinished()) {
                              this.mEdgeGlowTop.onAbsorb((int) this.mScroller.getCurrVelocity());
                          }
                      } else if (this.mEdgeGlowBottom.isFinished()) {
                          this.mEdgeGlowBottom.onAbsorb((int) this.mScroller.getCurrVelocity());
                      }
                  }
                  abortAnimatedScroll();
              }
              if (!this.mScroller.isFinished()) {
                  ViewCompat.postInvalidateOnAnimation(this);
              } else {
                  stopNestedScroll(1);
              }
          }
      }
  
      /* access modifiers changed from: protected */
      public int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
          if (getChildCount() == 0) {
              return 0;
          }
          int height = getHeight();
          int scrollY = getScrollY();
          int i = scrollY + height;
          int i2 = i;
          int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
          if (rect.top > 0) {
              scrollY += verticalFadingEdgeLength;
          }
          View childAt = getChildAt(0);
          FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
          if (rect.bottom < childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin) {
              i -= verticalFadingEdgeLength;
          }
          if (rect.bottom > i && rect.top > scrollY) {
              return Math.min(rect.height() > height ? 0 + (rect.top - scrollY) : 0 + (rect.bottom - i), (childAt.getBottom() + layoutParams.bottomMargin) - i2);
          } else if (rect.top >= scrollY || rect.bottom >= i) {
              return 0;
          } else {
              return Math.max(rect.height() > height ? 0 - (i - rect.bottom) : 0 - (scrollY - rect.top), -getScrollY());
          }
      }
  
      public int computeVerticalScrollExtent() {
          return super.computeVerticalScrollExtent();
      }
  
      public int computeVerticalScrollOffset() {
          return Math.max(0, super.computeVerticalScrollOffset());
      }
  
      public int computeVerticalScrollRange() {
          int childCount = getChildCount();
          int height = (getHeight() - getPaddingBottom()) - getPaddingTop();
          if (childCount == 0) {
              return height;
          }
          View childAt = getChildAt(0);
          int bottom = childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin;
          int scrollY = getScrollY();
          int max = Math.max(0, bottom - height);
          return scrollY < 0 ? bottom - scrollY : scrollY > max ? bottom + (scrollY - max) : bottom;
      }
  
      public boolean dispatchKeyEvent(KeyEvent event) {
          return super.dispatchKeyEvent(event) || executeKeyEvent(event);
      }
  
      public boolean dispatchNestedFling(float velocityX, float velocityY, boolean consumed) {
          return this.mChildHelper.dispatchNestedFling(velocityX, velocityY, consumed);
      }
  
      public boolean dispatchNestedPreFling(float velocityX, float velocityY) {
          return this.mChildHelper.dispatchNestedPreFling(velocityX, velocityY);
      }
  
      public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow) {
          return dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow, 0);
      }
  
      public boolean dispatchNestedPreScroll(int dx, int dy, int[] consumed, int[] offsetInWindow, int type) {
          return this.mChildHelper.dispatchNestedPreScroll(dx, dy, consumed, offsetInWindow, type);
      }
  
      public void dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow, int type, int[] consumed) {
          this.mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow, type, consumed);
      }
  
      public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow) {
          return this.mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow);
      }
  
      public boolean dispatchNestedScroll(int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int[] offsetInWindow, int type) {
          return this.mChildHelper.dispatchNestedScroll(dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, offsetInWindow, type);
      }
  
      public void draw(Canvas canvas) {
          super.draw(canvas);
          int scrollY = getScrollY();
          if (!this.mEdgeGlowTop.isFinished()) {
              int save = canvas.save();
              int width = getWidth();
              int height = getHeight();
              int i = 0;
              int min = Math.min(0, scrollY);
              if (Build.VERSION.SDK_INT < 21 || Api21Impl.getClipToPadding(this)) {
                  width -= getPaddingLeft() + getPaddingRight();
                  i = 0 + getPaddingLeft();
              }
              if (Build.VERSION.SDK_INT >= 21 && Api21Impl.getClipToPadding(this)) {
                  height -= getPaddingTop() + getPaddingBottom();
                  min += getPaddingTop();
              }
              canvas.translate((float) i, (float) min);
              this.mEdgeGlowTop.setSize(width, height);
              if (this.mEdgeGlowTop.draw(canvas)) {
                  ViewCompat.postInvalidateOnAnimation(this);
              }
              canvas.restoreToCount(save);
          }
          if (!this.mEdgeGlowBottom.isFinished()) {
              int save2 = canvas.save();
              int width2 = getWidth();
              int height2 = getHeight();
              int i2 = 0;
              int max = Math.max(getScrollRange(), scrollY) + height2;
              if (Build.VERSION.SDK_INT < 21 || Api21Impl.getClipToPadding(this)) {
                  width2 -= getPaddingLeft() + getPaddingRight();
                  i2 = 0 + getPaddingLeft();
              }
              if (Build.VERSION.SDK_INT >= 21 && Api21Impl.getClipToPadding(this)) {
                  height2 -= getPaddingTop() + getPaddingBottom();
                  max -= getPaddingBottom();
              }
              canvas.translate((float) (i2 - width2), (float) max);
              canvas.rotate(180.0f, (float) width2, 0.0f);
              this.mEdgeGlowBottom.setSize(width2, height2);
              if (this.mEdgeGlowBottom.draw(canvas)) {
                  ViewCompat.postInvalidateOnAnimation(this);
              }
              canvas.restoreToCount(save2);
          }
      }
  
      public boolean executeKeyEvent(KeyEvent event) {
          this.mTempRect.setEmpty();
          int i = 130;
          if (!canScroll()) {
              if (!isFocused() || event.getKeyCode() == 4) {
                  return false;
              }
              View findFocus = findFocus();
              if (findFocus == this) {
                  findFocus = null;
              }
              View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, 130);
              return (findNextFocus == null || findNextFocus == this || !findNextFocus.requestFocus(130)) ? false : true;
          } else if (event.getAction() != 0) {
              return false;
          } else {
              switch (event.getKeyCode()) {
                  case 19:
                      return !event.isAltPressed() ? arrowScroll(33) : fullScroll(33);
                  case 20:
                      return !event.isAltPressed() ? arrowScroll(130) : fullScroll(130);
                  case 62:
                      if (event.isShiftPressed()) {
                          i = 33;
                      }
                      pageScroll(i);
                      return false;
                  default:
                      return false;
              }
          }
      }
  
      public void fling(int velocityY) {
          if (getChildCount() > 0) {
              this.mScroller.fling(getScrollX(), getScrollY(), 0, velocityY, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
              runAnimatedScroll(true);
          }
      }
  
      public boolean fullScroll(int direction) {
          int childCount;
          boolean z = direction == 130;
          int height = getHeight();
          this.mTempRect.top = 0;
          this.mTempRect.bottom = height;
          if (z && (childCount = getChildCount()) > 0) {
              View childAt = getChildAt(childCount - 1);
              this.mTempRect.bottom = childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin + getPaddingBottom();
              Rect rect = this.mTempRect;
              rect.top = rect.bottom - height;
          }
          return scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom);
      }
  
      /* access modifiers changed from: protected */
      public float getBottomFadingEdgeStrength() {
          if (getChildCount() == 0) {
              return 0.0f;
          }
          View childAt = getChildAt(0);
          int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
          int bottom = ((childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin) - getScrollY()) - (getHeight() - getPaddingBottom());
          if (bottom < verticalFadingEdgeLength) {
              return ((float) bottom) / ((float) verticalFadingEdgeLength);
          }
          return 1.0f;
      }
  
      public int getMaxScrollAmount() {
          return (int) (((float) getHeight()) * 0.5f);
      }
  
      public int getNestedScrollAxes() {
          return this.mParentHelper.getNestedScrollAxes();
      }
  
      /* access modifiers changed from: package-private */
      public int getScrollRange() {
          if (getChildCount() <= 0) {
              return 0;
          }
          View childAt = getChildAt(0);
          FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
          return Math.max(0, ((childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin) - ((getHeight() - getPaddingTop()) - getPaddingBottom()));
      }
  
      /* access modifiers changed from: protected */
      public float getTopFadingEdgeStrength() {
          if (getChildCount() == 0) {
              return 0.0f;
          }
          int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
          int scrollY = getScrollY();
          if (scrollY < verticalFadingEdgeLength) {
              return ((float) scrollY) / ((float) verticalFadingEdgeLength);
          }
          return 1.0f;
      }
  
      public boolean hasNestedScrollingParent() {
          return hasNestedScrollingParent(0);
      }
  
      public boolean hasNestedScrollingParent(int type) {
          return this.mChildHelper.hasNestedScrollingParent(type);
      }
  
      public boolean isFillViewport() {
          return this.mFillViewport;
      }
  
      public boolean isNestedScrollingEnabled() {
          return this.mChildHelper.isNestedScrollingEnabled();
      }
  
      public boolean isSmoothScrollingEnabled() {
          return this.mSmoothScrollingEnabled;
      }
  
      /* access modifiers changed from: protected */
      public void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) {
          child.measure(getChildMeasureSpec(parentWidthMeasureSpec, getPaddingLeft() + getPaddingRight(), child.getLayoutParams().width), View.MeasureSpec.makeMeasureSpec(0, 0));
      }
  
      /* access modifiers changed from: protected */
      public void measureChildWithMargins(View child, int parentWidthMeasureSpec, int widthUsed, int parentHeightMeasureSpec, int heightUsed) {
          ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
          child.measure(getChildMeasureSpec(parentWidthMeasureSpec, getPaddingLeft() + getPaddingRight() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin + widthUsed, marginLayoutParams.width), View.MeasureSpec.makeMeasureSpec(marginLayoutParams.topMargin + marginLayoutParams.bottomMargin, 0));
      }
  
      public void onAttachedToWindow() {
          super.onAttachedToWindow();
          this.mIsLaidOut = false;
      }
  
      public boolean onGenericMotionEvent(MotionEvent event) {
          boolean z = false;
          if (event.getAction() == 8 && !this.mIsBeingDragged) {
              float axisValue = MotionEventCompat.isFromSource(event, 2) ? event.getAxisValue(9) : MotionEventCompat.isFromSource(event, 4194304) ? event.getAxisValue(26) : 0.0f;
              if (axisValue != 0.0f) {
                  int scrollRange = getScrollRange();
                  int scrollY = getScrollY();
                  int verticalScrollFactorCompat = scrollY - ((int) (getVerticalScrollFactorCompat() * axisValue));
                  boolean z2 = false;
                  if (verticalScrollFactorCompat < 0) {
                      if (canOverScroll() && !MotionEventCompat.isFromSource(event, 8194)) {
                          z = true;
                      }
                      if (z) {
                          EdgeEffectCompat.onPullDistance(this.mEdgeGlowTop, (-((float) verticalScrollFactorCompat)) / ((float) getHeight()), 0.5f);
                          this.mEdgeGlowTop.onRelease();
                          invalidate();
                          z2 = true;
                      }
                      verticalScrollFactorCompat = 0;
                  } else if (verticalScrollFactorCompat > scrollRange) {
                      if (canOverScroll() && !MotionEventCompat.isFromSource(event, 8194)) {
                          z = true;
                      }
                      if (z) {
                          EdgeEffectCompat.onPullDistance(this.mEdgeGlowBottom, ((float) (verticalScrollFactorCompat - scrollRange)) / ((float) getHeight()), 0.5f);
                          this.mEdgeGlowBottom.onRelease();
                          invalidate();
                          z2 = true;
                      }
                      verticalScrollFactorCompat = scrollRange;
                  }
                  if (verticalScrollFactorCompat == scrollY) {
                      return z2;
                  }
                  super.scrollTo(getScrollX(), verticalScrollFactorCompat);
                  return true;
              }
          }
          return false;
      }
  
      public boolean onInterceptTouchEvent(MotionEvent ev) {
          MotionEvent motionEvent = ev;
          int action = ev.getAction();
          boolean z = true;
          if (action == 2 && this.mIsBeingDragged) {
              return true;
          }
          switch (action & 255) {
              case 0:
                  int y = (int) ev.getY();
                  if (inChild((int) ev.getX(), y)) {
                      this.mLastMotionY = y;
                      this.mActivePointerId = motionEvent.getPointerId(0);
                      initOrResetVelocityTracker();
                      this.mVelocityTracker.addMovement(motionEvent);
                      this.mScroller.computeScrollOffset();
                      if (!stopGlowAnimations(ev) && this.mScroller.isFinished()) {
                          z = false;
                      }
                      this.mIsBeingDragged = z;
                      startNestedScroll(2, 0);
                      break;
                  } else {
                      if (!stopGlowAnimations(ev) && this.mScroller.isFinished()) {
                          z = false;
                      }
                      this.mIsBeingDragged = z;
                      recycleVelocityTracker();
                      break;
                  }
              case 1:
              case 3:
                  this.mIsBeingDragged = false;
                  this.mActivePointerId = -1;
                  recycleVelocityTracker();
                  if (this.mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                      ViewCompat.postInvalidateOnAnimation(this);
                  }
                  stopNestedScroll(0);
                  break;
              case 2:
                  int i = this.mActivePointerId;
                  if (i != -1) {
                      int findPointerIndex = motionEvent.findPointerIndex(i);
                      if (findPointerIndex != -1) {
                          int y2 = (int) motionEvent.getY(findPointerIndex);
                          if (Math.abs(y2 - this.mLastMotionY) > this.mTouchSlop && (2 & getNestedScrollAxes()) == 0) {
                              this.mIsBeingDragged = true;
                              this.mLastMotionY = y2;
                              initVelocityTrackerIfNotExists();
                              this.mVelocityTracker.addMovement(motionEvent);
                              this.mNestedYOffset = 0;
                              ViewParent parent = getParent();
                              if (parent != null) {
                                  parent.requestDisallowInterceptTouchEvent(true);
                                  break;
                              }
                          }
                      } else {
                          Log.e(TAG, "Invalid pointerId=" + i + " in onInterceptTouchEvent");
                          break;
                      }
                  }
                  break;
              case 6:
                  onSecondaryPointerUp(ev);
                  break;
          }
          return this.mIsBeingDragged;
      }
  
      /* access modifiers changed from: protected */
      public void onLayout(boolean changed, int l, int t, int r, int b) {
          super.onLayout(changed, l, t, r, b);
          this.mIsLayoutDirty = false;
          View view = this.mChildToScrollTo;
          if (view != null && isViewDescendantOf(view, this)) {
              scrollToChild(this.mChildToScrollTo);
          }
          this.mChildToScrollTo = null;
          if (!this.mIsLaidOut) {
              if (this.mSavedState != null) {
                  scrollTo(getScrollX(), this.mSavedState.scrollPosition);
                  this.mSavedState = null;
              }
              int i = 0;
              if (getChildCount() > 0) {
                  View childAt = getChildAt(0);
                  FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
                  i = childAt.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
              }
              int paddingTop = ((b - t) - getPaddingTop()) - getPaddingBottom();
              int scrollY = getScrollY();
              int clamp = clamp(scrollY, paddingTop, i);
              if (clamp != scrollY) {
                  scrollTo(getScrollX(), clamp);
              }
          }
          scrollTo(getScrollX(), getScrollY());
          this.mIsLaidOut = true;
      }
  
      /* access modifiers changed from: protected */
      public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
          super.onMeasure(widthMeasureSpec, heightMeasureSpec);
          if (this.mFillViewport && View.MeasureSpec.getMode(heightMeasureSpec) != 0 && getChildCount() > 0) {
              View childAt = getChildAt(0);
              FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
              int measuredHeight = childAt.getMeasuredHeight();
              int measuredHeight2 = (((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom()) - layoutParams.topMargin) - layoutParams.bottomMargin;
              if (measuredHeight < measuredHeight2) {
                  childAt.measure(getChildMeasureSpec(widthMeasureSpec, getPaddingLeft() + getPaddingRight() + layoutParams.leftMargin + layoutParams.rightMargin, layoutParams.width), View.MeasureSpec.makeMeasureSpec(measuredHeight2, BasicMeasure.EXACTLY));
              }
          }
      }
  
      public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) {
          if (consumed) {
              return false;
          }
          dispatchNestedFling(0.0f, velocityY, true);
          fling((int) velocityY);
          return true;
      }
  
      public boolean onNestedPreFling(View target, float velocityX, float velocityY) {
          return dispatchNestedPreFling(velocityX, velocityY);
      }
  
      public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) {
          onNestedPreScroll(target, dx, dy, consumed, 0);
      }
  
      public void onNestedPreScroll(View target, int dx, int dy, int[] consumed, int type) {
          dispatchNestedPreScroll(dx, dy, consumed, (int[]) null, type);
      }
  
      public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
          onNestedScrollInternal(dyUnconsumed, 0, (int[]) null);
      }
  
      public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
          onNestedScrollInternal(dyUnconsumed, type, (int[]) null);
      }
  
      public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type, int[] consumed) {
          onNestedScrollInternal(dyUnconsumed, type, consumed);
      }
  
      public void onNestedScrollAccepted(View child, View target, int axes) {
          onNestedScrollAccepted(child, target, axes, 0);
      }
  
      public void onNestedScrollAccepted(View child, View target, int axes, int type) {
          this.mParentHelper.onNestedScrollAccepted(child, target, axes, type);
          startNestedScroll(2, type);
      }
  
      /* access modifiers changed from: protected */
      public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
          super.scrollTo(scrollX, scrollY);
      }
  
      /* access modifiers changed from: protected */
      public boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
          if (direction == 2) {
              direction = 130;
          } else if (direction == 1) {
              direction = 33;
          }
          View findNextFocus = previouslyFocusedRect == null ? FocusFinder.getInstance().findNextFocus(this, (View) null, direction) : FocusFinder.getInstance().findNextFocusFromRect(this, previouslyFocusedRect, direction);
          if (findNextFocus != null && !isOffScreen(findNextFocus)) {
              return findNextFocus.requestFocus(direction, previouslyFocusedRect);
          }
          return false;
      }
  
      /* access modifiers changed from: protected */
      public void onRestoreInstanceState(Parcelable state) {
          if (!(state instanceof SavedState)) {
              super.onRestoreInstanceState(state);
              return;
          }
          SavedState savedState = (SavedState) state;
          super.onRestoreInstanceState(savedState.getSuperState());
          this.mSavedState = savedState;
          requestLayout();
      }
  
      /* access modifiers changed from: protected */
      public Parcelable onSaveInstanceState() {
          SavedState savedState = new SavedState(super.onSaveInstanceState());
          savedState.scrollPosition = getScrollY();
          return savedState;
      }
  
      /* access modifiers changed from: protected */
      public void onScrollChanged(int l, int t, int oldl, int oldt) {
          super.onScrollChanged(l, t, oldl, oldt);
          OnScrollChangeListener onScrollChangeListener = this.mOnScrollChangeListener;
          if (onScrollChangeListener != null) {
              onScrollChangeListener.onScrollChange(this, l, t, oldl, oldt);
          }
      }
  
      /* access modifiers changed from: protected */
      public void onSizeChanged(int w, int h, int oldw, int oldh) {
          super.onSizeChanged(w, h, oldw, oldh);
          View findFocus = findFocus();
          if (findFocus != null && this != findFocus && isWithinDeltaOfScreen(findFocus, 0, oldh)) {
              findFocus.getDrawingRect(this.mTempRect);
              offsetDescendantRectToMyCoords(findFocus, this.mTempRect);
              doScrollY(computeScrollDeltaToGetChildRectOnScreen(this.mTempRect));
          }
      }
  
      public boolean onStartNestedScroll(View child, View target, int axes) {
          return onStartNestedScroll(child, target, axes, 0);
      }
  
      public boolean onStartNestedScroll(View child, View target, int axes, int type) {
          return (axes & 2) != 0;
      }
  
      public void onStopNestedScroll(View target) {
          onStopNestedScroll(target, 0);
      }
  
      public void onStopNestedScroll(View target, int type) {
          this.mParentHelper.onStopNestedScroll(target, type);
          stopNestedScroll(type);
      }
  
      public boolean onTouchEvent(MotionEvent ev) {
          ViewParent parent;
          int i;
          int i2;
          MotionEvent motionEvent = ev;
          initVelocityTrackerIfNotExists();
          int actionMasked = ev.getActionMasked();
          if (actionMasked == 0) {
              this.mNestedYOffset = 0;
          }
          MotionEvent obtain = MotionEvent.obtain(ev);
          obtain.offsetLocation(0.0f, (float) this.mNestedYOffset);
          switch (actionMasked) {
              case 0:
                  if (getChildCount() != 0) {
                      if (this.mIsBeingDragged && (parent = getParent()) != null) {
                          parent.requestDisallowInterceptTouchEvent(true);
                      }
                      if (!this.mScroller.isFinished()) {
                          abortAnimatedScroll();
                      }
                      this.mLastMotionY = (int) ev.getY();
                      this.mActivePointerId = motionEvent.getPointerId(0);
                      startNestedScroll(2, 0);
                      break;
                  } else {
                      return false;
                  }
              case 1:
                  VelocityTracker velocityTracker = this.mVelocityTracker;
                  velocityTracker.computeCurrentVelocity(1000, (float) this.mMaximumVelocity);
                  int yVelocity = (int) velocityTracker.getYVelocity(this.mActivePointerId);
                  if (Math.abs(yVelocity) < this.mMinimumVelocity) {
                      if (this.mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                          ViewCompat.postInvalidateOnAnimation(this);
                      }
                  } else if (!edgeEffectFling(yVelocity) && !dispatchNestedPreFling(0.0f, (float) (-yVelocity))) {
                      dispatchNestedFling(0.0f, (float) (-yVelocity), true);
                      fling(-yVelocity);
                  }
                  this.mActivePointerId = -1;
                  endDrag();
                  break;
              case 2:
                  int findPointerIndex = motionEvent.findPointerIndex(this.mActivePointerId);
                  if (findPointerIndex != -1) {
                      int y = (int) motionEvent.getY(findPointerIndex);
                      int i3 = this.mLastMotionY - y;
                      int releaseVerticalGlow = i3 - releaseVerticalGlow(i3, motionEvent.getX(findPointerIndex));
                      if (this.mIsBeingDragged || Math.abs(releaseVerticalGlow) <= this.mTouchSlop) {
                          i = releaseVerticalGlow;
                      } else {
                          ViewParent parent2 = getParent();
                          if (parent2 != null) {
                              parent2.requestDisallowInterceptTouchEvent(true);
                          }
                          this.mIsBeingDragged = true;
                          i = releaseVerticalGlow > 0 ? releaseVerticalGlow - this.mTouchSlop : releaseVerticalGlow + this.mTouchSlop;
                      }
                      if (!this.mIsBeingDragged) {
                          int i4 = y;
                          int i5 = findPointerIndex;
                          break;
                      } else {
                          if (dispatchNestedPreScroll(0, i, this.mScrollConsumed, this.mScrollOffset, 0)) {
                              int i6 = i - this.mScrollConsumed[1];
                              this.mNestedYOffset += this.mScrollOffset[1];
                              i2 = i6;
                          } else {
                              i2 = i;
                          }
                          this.mLastMotionY = y - this.mScrollOffset[1];
                          int scrollY = getScrollY();
                          int scrollRange = getScrollRange();
                          int overScrollMode = getOverScrollMode();
                          boolean z = overScrollMode == 0 || (overScrollMode == 1 && scrollRange > 0);
                          int i7 = overScrollMode;
                          int i8 = scrollRange;
                          int i9 = y;
                          int i10 = findPointerIndex;
                          boolean z2 = overScrollByCompat(0, i2, 0, getScrollY(), 0, scrollRange, 0, 0, true) && !hasNestedScrollingParent(0);
                          int scrollY2 = getScrollY() - scrollY;
                          int[] iArr = this.mScrollConsumed;
                          iArr[1] = 0;
                          dispatchNestedScroll(0, scrollY2, 0, i2 - scrollY2, this.mScrollOffset, 0, iArr);
                          int i11 = this.mLastMotionY;
                          int i12 = this.mScrollOffset[1];
                          this.mLastMotionY = i11 - i12;
                          this.mNestedYOffset += i12;
                          if (z) {
                              int i13 = i2 - this.mScrollConsumed[1];
                              int i14 = scrollY + i13;
                              if (i14 < 0) {
                                  EdgeEffectCompat.onPullDistance(this.mEdgeGlowTop, ((float) (-i13)) / ((float) getHeight()), motionEvent.getX(i10) / ((float) getWidth()));
                                  if (!this.mEdgeGlowBottom.isFinished()) {
                                      this.mEdgeGlowBottom.onRelease();
                                      int i15 = i8;
                                  } else {
                                      int i16 = i8;
                                  }
                              } else {
                                  int i17 = i10;
                                  if (i14 > i8) {
                                      EdgeEffectCompat.onPullDistance(this.mEdgeGlowBottom, ((float) i13) / ((float) getHeight()), 1.0f - (motionEvent.getX(i17) / ((float) getWidth())));
                                      if (!this.mEdgeGlowTop.isFinished()) {
                                          this.mEdgeGlowTop.onRelease();
                                      }
                                  }
                              }
                              if (!this.mEdgeGlowTop.isFinished() || !this.mEdgeGlowBottom.isFinished()) {
                                  ViewCompat.postInvalidateOnAnimation(this);
                                  z2 = false;
                                  int i18 = i13;
                              } else {
                                  int i19 = i13;
                              }
                          } else {
                              int i20 = i8;
                              int i21 = i10;
                          }
                          if (z2) {
                              this.mVelocityTracker.clear();
                              break;
                          }
                      }
                  } else {
                      Log.e(TAG, "Invalid pointerId=" + this.mActivePointerId + " in onTouchEvent");
                      break;
                  }
                  break;
              case 3:
                  if (this.mIsBeingDragged && getChildCount() > 0 && this.mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                      ViewCompat.postInvalidateOnAnimation(this);
                  }
                  this.mActivePointerId = -1;
                  endDrag();
                  break;
              case 5:
                  int actionIndex = ev.getActionIndex();
                  this.mLastMotionY = (int) motionEvent.getY(actionIndex);
                  this.mActivePointerId = motionEvent.getPointerId(actionIndex);
                  break;
              case 6:
                  onSecondaryPointerUp(ev);
                  this.mLastMotionY = (int) motionEvent.getY(motionEvent.findPointerIndex(this.mActivePointerId));
                  break;
          }
          VelocityTracker velocityTracker2 = this.mVelocityTracker;
          if (velocityTracker2 != null) {
              velocityTracker2.addMovement(obtain);
          }
          obtain.recycle();
          return true;
      }
  
      /* access modifiers changed from: package-private */
      public boolean overScrollByCompat(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
          boolean z;
          boolean z2;
          int overScrollMode = getOverScrollMode();
          boolean z3 = computeHorizontalScrollRange() > computeHorizontalScrollExtent();
          boolean z4 = computeVerticalScrollRange() > computeVerticalScrollExtent();
          boolean z5 = overScrollMode == 0 || (overScrollMode == 1 && z3);
          boolean z6 = overScrollMode == 0 || (overScrollMode == 1 && z4);
          int i = scrollX + deltaX;
          int i2 = !z5 ? 0 : maxOverScrollX;
          int i3 = scrollY + deltaY;
          int i4 = !z6 ? 0 : maxOverScrollY;
          int i5 = -i2;
          int i6 = i2 + scrollRangeX;
          int i7 = -i4;
          int i8 = i4 + scrollRangeY;
          if (i > i6) {
              i = i6;
              z = true;
          } else if (i < i5) {
              i = i5;
              z = true;
          } else {
              z = false;
          }
          if (i3 > i8) {
              i3 = i8;
              z2 = true;
          } else if (i3 < i7) {
              i3 = i7;
              z2 = true;
          } else {
              z2 = false;
          }
          if (z2) {
              int i9 = overScrollMode;
              if (!hasNestedScrollingParent(1)) {
                  this.mScroller.springBack(i, i3, 0, 0, 0, getScrollRange());
              }
          } else {
              int i10 = overScrollMode;
          }
          onOverScrolled(i, i3, z, z2);
          return z || z2;
      }
  
      public boolean pageScroll(int direction) {
          boolean z = direction == 130;
          int height = getHeight();
          if (z) {
              this.mTempRect.top = getScrollY() + height;
              int childCount = getChildCount();
              if (childCount > 0) {
                  View childAt = getChildAt(childCount - 1);
                  int bottom = childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin + getPaddingBottom();
                  if (this.mTempRect.top + height > bottom) {
                      this.mTempRect.top = bottom - height;
                  }
              }
          } else {
              this.mTempRect.top = getScrollY() - height;
              if (this.mTempRect.top < 0) {
                  this.mTempRect.top = 0;
              }
          }
          Rect rect = this.mTempRect;
          rect.bottom = rect.top + height;
          return scrollAndFocus(direction, this.mTempRect.top, this.mTempRect.bottom);
      }
  
      public void requestChildFocus(View child, View focused) {
          if (!this.mIsLayoutDirty) {
              scrollToChild(focused);
          } else {
              this.mChildToScrollTo = focused;
          }
          super.requestChildFocus(child, focused);
      }
  
      public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
          rectangle.offset(child.getLeft() - child.getScrollX(), child.getTop() - child.getScrollY());
          return scrollToChildRect(rectangle, immediate);
      }
  
      public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
          if (disallowIntercept) {
              recycleVelocityTracker();
          }
          super.requestDisallowInterceptTouchEvent(disallowIntercept);
      }
  
      public void requestLayout() {
          this.mIsLayoutDirty = true;
          super.requestLayout();
      }
  
      public void scrollTo(int x, int y) {
          if (getChildCount() > 0) {
              View childAt = getChildAt(0);
              FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
              int x2 = clamp(x, (getWidth() - getPaddingLeft()) - getPaddingRight(), childAt.getWidth() + layoutParams.leftMargin + layoutParams.rightMargin);
              int y2 = clamp(y, (getHeight() - getPaddingTop()) - getPaddingBottom(), childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin);
              if (x2 != getScrollX() || y2 != getScrollY()) {
                  super.scrollTo(x2, y2);
              }
          }
      }
  
      public void setFillViewport(boolean fillViewport) {
          if (fillViewport != this.mFillViewport) {
              this.mFillViewport = fillViewport;
              requestLayout();
          }
      }
  
      public void setNestedScrollingEnabled(boolean enabled) {
          this.mChildHelper.setNestedScrollingEnabled(enabled);
      }
  
      public void setOnScrollChangeListener(OnScrollChangeListener l) {
          this.mOnScrollChangeListener = l;
      }
  
      public void setSmoothScrollingEnabled(boolean smoothScrollingEnabled) {
          this.mSmoothScrollingEnabled = smoothScrollingEnabled;
      }
  
      public boolean shouldDelayChildPressedState() {
          return true;
      }
  
      public final void smoothScrollBy(int dx, int dy) {
          smoothScrollBy(dx, dy, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, false);
      }
  
      public final void smoothScrollBy(int dx, int dy, int scrollDurationMs) {
          smoothScrollBy(dx, dy, scrollDurationMs, false);
      }
  
      public final void smoothScrollTo(int x, int y) {
          smoothScrollTo(x, y, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, false);
      }
  
      public final void smoothScrollTo(int x, int y, int scrollDurationMs) {
          smoothScrollTo(x, y, scrollDurationMs, false);
      }
  
      /* access modifiers changed from: package-private */
      public void smoothScrollTo(int x, int y, int scrollDurationMs, boolean withNestedScrolling) {
          smoothScrollBy(x - getScrollX(), y - getScrollY(), scrollDurationMs, withNestedScrolling);
      }
  
      /* access modifiers changed from: package-private */
      public void smoothScrollTo(int x, int y, boolean withNestedScrolling) {
          smoothScrollTo(x, y, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, withNestedScrolling);
      }
  
      public boolean startNestedScroll(int axes) {
          return startNestedScroll(axes, 0);
      }
  
      public boolean startNestedScroll(int axes, int type) {
          return this.mChildHelper.startNestedScroll(axes, type);
      }
  
      public void stopNestedScroll() {
          stopNestedScroll(0);
      }
  
      public void stopNestedScroll(int type) {
          this.mChildHelper.stopNestedScroll(type);
      }
  }
  