what-the-bank/sources/androidx/core/widget/NestedScrollView.java

1366 lines
49 KiB
Java

package androidx.core.widget;
import android.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
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.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import com.airbnb.deeplinkdispatch.UrlTreeKt;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.ArrayList;
import o.C15996kMa;
import o.FBj;
import o.FgG;
import o.InterfaceC10263dzV;
import o.JXX;
import o.Klw;
import o.KtR;
import o.htg;
import o.yZt;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
import org.jmrtd.cbeff.ISO781611;
/* loaded from: classes.dex */
public class NestedScrollView extends FrameLayout implements htg, InterfaceC10263dzV {
private VelocityTracker A;
private float B;
private int C;
private final Rect D;
private int d;
private final FgG e;
private EdgeEffect f;
private boolean g;
private boolean h;
private View i;
private EdgeEffect j;
private boolean k;
private long l;
private int m;
private int n;
/* renamed from: o, reason: collision with root package name */
private boolean f6388o;
private RVV p;
private int q;
private final JXX r;
private int s;
private int t;
private final int[] u;
private Sts v;
private final float w;
private OverScroller x;
private final int[] y;
private boolean z;
private static final float c = (float) (Math.log(0.78d) / Math.log(0.9d));
private static final HBt b = new HBt();
private static final int[] a = {R.attr.fillViewport};
/* loaded from: classes.dex */
public interface RVV {
void e(NestedScrollView nestedScrollView, int i, int i2);
}
@Override // o.FEJ
public final boolean c(View view, View view2, int i, int i2) {
return (i & 2) != 0;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public boolean onStartNestedScroll(View view, View view2, int i) {
return (i & 2) != 0;
}
@Override // android.widget.FrameLayout, android.view.ViewGroup
public boolean shouldDelayChildPressedState() {
return true;
}
public NestedScrollView(Context context) {
this(context, null);
}
public NestedScrollView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, KtR.HBt.nestedScrollViewStyle);
}
public NestedScrollView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.D = new Rect();
this.f6388o = true;
this.k = false;
this.i = null;
this.h = false;
this.z = true;
this.d = -1;
this.y = new int[2];
this.u = new int[2];
this.j = FBj.vi_(context, attributeSet);
this.f = FBj.vi_(context, attributeSet);
this.w = context.getResources().getDisplayMetrics().density * 160.0f * 386.0878f * 0.84f;
this.x = new OverScroller(getContext());
setFocusable(true);
setDescendantFocusability(262144);
setWillNotDraw(false);
ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
this.C = viewConfiguration.getScaledTouchSlop();
this.q = viewConfiguration.getScaledMinimumFlingVelocity();
this.t = viewConfiguration.getScaledMaximumFlingVelocity();
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, a, i, 0);
setFillViewport(obtainStyledAttributes.getBoolean(0, false));
obtainStyledAttributes.recycle();
this.r = new JXX();
this.e = new FgG(this);
setNestedScrollingEnabled(true);
ViewCompat.e(this, b);
}
@Override // android.view.View
public void setNestedScrollingEnabled(boolean z) {
FgG fgG = this.e;
if (fgG.c) {
ViewCompat.K(fgG.d);
}
fgG.c = z;
}
@Override // android.view.View
public boolean startNestedScroll(int i) {
return this.e.a(i, 0);
}
@Override // android.view.View
public void stopNestedScroll() {
this.e.a(0);
}
@Override // android.view.View
public boolean hasNestedScrollingParent() {
return this.e.e(0);
}
@Override // android.view.View
public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
return this.e.a(i, i2, iArr, iArr2, 0);
}
@Override // android.view.View
public boolean dispatchNestedFling(float f, float f2, boolean z) {
return this.e.d(f, f2, z);
}
@Override // android.view.View
public boolean dispatchNestedPreFling(float f, float f2) {
return this.e.b(f, f2);
}
@Override // o.htg
public final void a(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
b(i4, i5, iArr);
}
private void b(int i, int i2, int[] iArr) {
int scrollY = getScrollY();
scrollBy(0, i);
int scrollY2 = getScrollY() - scrollY;
if (iArr != null) {
iArr[1] = iArr[1] + scrollY2;
}
this.e.c(0, scrollY2, 0, i - scrollY2, null, i2, iArr);
}
@Override // o.FEJ
public final void c(View view, int i, int i2, int i3, int i4, int i5) {
b(i4, i5, null);
}
@Override // o.FEJ
public final void a(View view, int i, int i2, int[] iArr, int i3) {
this.e.a(i, i2, iArr, null, i3);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void onNestedScrollAccepted(View view, View view2, int i) {
this.r.c = i;
this.e.a(2, 0);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void onStopNestedScroll(View view) {
this.r.c = 0;
this.e.a(0);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
b(i4, 0, null);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public boolean onNestedFling(View view, float f, float f2, boolean z) {
if (z) {
return false;
}
dispatchNestedFling(BitmapDescriptorFactory.HUE_RED, f2, true);
e((int) f2);
return true;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public boolean onNestedPreFling(View view, float f, float f2) {
return dispatchNestedPreFling(f, f2);
}
@Override // android.view.View
protected float getTopFadingEdgeStrength() {
if (getChildCount() == 0) {
return BitmapDescriptorFactory.HUE_RED;
}
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
int scrollY = getScrollY();
if (scrollY < verticalFadingEdgeLength) {
return scrollY / verticalFadingEdgeLength;
}
return 1.0f;
}
@Override // android.view.View
protected float getBottomFadingEdgeStrength() {
if (getChildCount() == 0) {
return BitmapDescriptorFactory.HUE_RED;
}
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
int bottom = ((childAt.getBottom() + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin) - getScrollY()) - (getHeight() - getPaddingBottom());
if (bottom < verticalFadingEdgeLength) {
return bottom / verticalFadingEdgeLength;
}
return 1.0f;
}
@Override // android.view.ViewGroup
public void addView(View view) {
if (getChildCount() > 0) {
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(view);
}
@Override // android.view.ViewGroup
public void addView(View view, int i) {
if (getChildCount() > 0) {
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(view, i);
}
@Override // android.view.ViewGroup, android.view.ViewManager
public void addView(View view, ViewGroup.LayoutParams layoutParams) {
if (getChildCount() > 0) {
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(view, layoutParams);
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (getChildCount() > 0) {
throw new IllegalStateException("ScrollView can host only one direct child");
}
super.addView(view, i, layoutParams);
}
private boolean c() {
if (getChildCount() <= 0) {
return false;
}
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
return (childAt.getHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin > (getHeight() - getPaddingTop()) - getPaddingBottom();
}
public void setFillViewport(boolean z) {
if (z != this.g) {
this.g = z;
requestLayout();
}
}
@Override // android.view.View
protected void onScrollChanged(int i, int i2, int i3, int i4) {
super.onScrollChanged(i, i2, i3, i4);
RVV rvv = this.p;
if (rvv != null) {
rvv.e(this, i2, i4);
}
}
@Override // android.widget.FrameLayout, android.view.View
protected void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
if (this.g && View.MeasureSpec.getMode(i2) != 0 && getChildCount() > 0) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int measuredHeight = childAt.getMeasuredHeight();
int measuredHeight2 = (((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom()) - ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) - ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
if (measuredHeight < measuredHeight2) {
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int i3 = ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
childAt.measure(getChildMeasureSpec(i, paddingLeft + paddingRight + i3 + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, ((ViewGroup.LayoutParams) layoutParams).width), View.MeasureSpec.makeMeasureSpec(measuredHeight2, 1073741824));
}
}
}
@Override // android.view.ViewGroup, android.view.View
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
return super.dispatchKeyEvent(keyEvent) || vG_(keyEvent);
}
public final boolean vG_(KeyEvent keyEvent) {
this.D.setEmpty();
boolean c2 = c();
int i = ISO781611.BIOMETRIC_SUBTYPE_TAG;
if (!c2) {
if (!isFocused() || keyEvent.getKeyCode() == 4) {
return false;
}
View findFocus = findFocus();
if (findFocus == this) {
findFocus = null;
}
View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, ISO781611.BIOMETRIC_SUBTYPE_TAG);
return (findNextFocus == null || findNextFocus == this || !findNextFocus.requestFocus(ISO781611.BIOMETRIC_SUBTYPE_TAG)) ? false : true;
}
if (keyEvent.getAction() != 0) {
return false;
}
int keyCode = keyEvent.getKeyCode();
if (keyCode == 19) {
if (!keyEvent.isAltPressed()) {
return b(33);
}
return a(33);
}
if (keyCode == 20) {
if (!keyEvent.isAltPressed()) {
return b(ISO781611.BIOMETRIC_SUBTYPE_TAG);
}
return a(ISO781611.BIOMETRIC_SUBTYPE_TAG);
}
if (keyCode != 62) {
return false;
}
if (keyEvent.isShiftPressed()) {
i = 33;
}
d(i);
return false;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestDisallowInterceptTouchEvent(boolean z) {
VelocityTracker velocityTracker;
if (z && (velocityTracker = this.A) != null) {
velocityTracker.recycle();
this.A = null;
}
super.requestDisallowInterceptTouchEvent(z);
}
@Override // android.view.ViewGroup
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
int findPointerIndex;
int action = motionEvent.getAction();
boolean z = true;
if (action == 2 && this.h) {
return true;
}
int i = action & 255;
if (i == 0) {
int y = (int) motionEvent.getY();
int x = (int) motionEvent.getX();
if (getChildCount() > 0) {
int scrollY = getScrollY();
View childAt = getChildAt(0);
if (y >= childAt.getTop() - scrollY && y < childAt.getBottom() - scrollY && x >= childAt.getLeft() && x < childAt.getRight()) {
this.n = y;
this.d = motionEvent.getPointerId(0);
VelocityTracker velocityTracker = this.A;
if (velocityTracker == null) {
this.A = VelocityTracker.obtain();
} else {
velocityTracker.clear();
}
this.A.addMovement(motionEvent);
this.x.computeScrollOffset();
if (!vE_(motionEvent) && this.x.isFinished()) {
z = false;
}
this.h = z;
this.e.a(2, 0);
}
}
if (!vE_(motionEvent) && this.x.isFinished()) {
z = false;
}
this.h = z;
VelocityTracker velocityTracker2 = this.A;
if (velocityTracker2 != null) {
velocityTracker2.recycle();
this.A = null;
}
} else {
if (i != 1) {
if (i == 2) {
int i2 = this.d;
if (i2 != -1 && (findPointerIndex = motionEvent.findPointerIndex(i2)) != -1) {
int y2 = (int) motionEvent.getY(findPointerIndex);
if (Math.abs(y2 - this.n) > this.C && (2 & getNestedScrollAxes()) == 0) {
this.h = true;
this.n = y2;
if (this.A == null) {
this.A = VelocityTracker.obtain();
}
this.A.addMovement(motionEvent);
this.s = 0;
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
}
}
} else if (i != 3) {
if (i == 6) {
vC_(motionEvent);
}
}
}
this.h = false;
this.d = -1;
VelocityTracker velocityTracker3 = this.A;
if (velocityTracker3 != null) {
velocityTracker3.recycle();
this.A = null;
}
if (this.x.springBack(getScrollX(), getScrollY(), 0, 0, 0, b())) {
ViewCompat.N(this);
}
this.e.a(0);
}
return this.h;
}
/* JADX WARN: Removed duplicated region for block: B:44:0x00f9 */
/* JADX WARN: Removed duplicated region for block: B:51:0x010f */
/* JADX WARN: Removed duplicated region for block: B:54:0x0118 */
/* JADX WARN: Removed duplicated region for block: B:55:0x011a */
/* JADX WARN: Removed duplicated region for block: B:58:0x011f */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean onTouchEvent(android.view.MotionEvent r22) {
/*
Method dump skipped, instructions count: 721
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.onTouchEvent(android.view.MotionEvent):boolean");
}
private boolean vD_(EdgeEffect edgeEffect, int i) {
if (i > 0) {
return true;
}
float vj_ = FBj.vj_(edgeEffect);
float height = getHeight();
double log = Math.log((Math.abs(-i) * 0.35f) / (this.w * 0.015f));
double d = c;
return ((float) (((double) (this.w * 0.015f)) * Math.exp((d / (d - 1.0d)) * log))) < vj_ * height;
}
private boolean vE_(MotionEvent motionEvent) {
boolean z;
if (FBj.vj_(this.j) != BitmapDescriptorFactory.HUE_RED) {
FBj.vl_(this.j, BitmapDescriptorFactory.HUE_RED, motionEvent.getX() / getWidth());
z = true;
} else {
z = false;
}
if (FBj.vj_(this.f) == BitmapDescriptorFactory.HUE_RED) {
return z;
}
FBj.vl_(this.f, BitmapDescriptorFactory.HUE_RED, 1.0f - (motionEvent.getX() / getWidth()));
return true;
}
private void vC_(MotionEvent motionEvent) {
int actionIndex = motionEvent.getActionIndex();
if (motionEvent.getPointerId(actionIndex) == this.d) {
int i = actionIndex == 0 ? 1 : 0;
this.n = (int) motionEvent.getY(i);
this.d = motionEvent.getPointerId(i);
VelocityTracker velocityTracker = this.A;
if (velocityTracker != null) {
velocityTracker.clear();
}
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // android.view.View
public boolean onGenericMotionEvent(MotionEvent motionEvent) {
float axisValue;
boolean z;
int i = 0;
if (motionEvent.getAction() == 8 && !this.h) {
if (Klw.sa_(motionEvent, 2)) {
axisValue = motionEvent.getAxisValue(9);
} else {
axisValue = Klw.sa_(motionEvent, 4194304) ? motionEvent.getAxisValue(26) : 0.0f;
}
if (axisValue != BitmapDescriptorFactory.HUE_RED) {
if (this.B == BitmapDescriptorFactory.HUE_RED) {
TypedValue typedValue = new TypedValue();
Context context = getContext();
if (!context.getTheme().resolveAttribute(R.attr.listPreferredItemHeight, typedValue, true)) {
throw new IllegalStateException("Expected theme to define listPreferredItemHeight.");
}
this.B = typedValue.getDimension(context.getResources().getDisplayMetrics());
}
int i2 = (int) (axisValue * this.B);
int b2 = b();
int scrollY = getScrollY();
int i3 = scrollY - i2;
if (i3 < 0) {
int overScrollMode = getOverScrollMode();
if ((overScrollMode == 0 || (overScrollMode == 1 && b() > 0)) && !Klw.sa_(motionEvent, 8194)) {
FBj.vl_(this.j, (-i3) / getHeight(), 0.5f);
this.j.onRelease();
invalidate();
z = 1;
} else {
z = 0;
}
} else if (i3 > b2) {
int overScrollMode2 = getOverScrollMode();
if ((overScrollMode2 == 0 || (overScrollMode2 == 1 && b() > 0)) && !Klw.sa_(motionEvent, 8194)) {
FBj.vl_(this.f, (i3 - b2) / getHeight(), 0.5f);
this.f.onRelease();
invalidate();
i = 1;
}
z = i;
i = b2;
} else {
z = 0;
i = i3;
}
if (i == scrollY) {
return z;
}
super.scrollTo(getScrollX(), i);
return true;
}
}
return false;
}
@Override // android.view.View
protected void onOverScrolled(int i, int i2, boolean z, boolean z2) {
super.scrollTo(i, i2);
}
private boolean d(int i, int i2, int i3, int i4) {
boolean z;
boolean z2;
getOverScrollMode();
computeHorizontalScrollRange();
computeHorizontalScrollExtent();
computeVerticalScrollRange();
computeVerticalScrollExtent();
int i5 = i3 + i;
if (i2 <= 0 && i2 >= 0) {
z = false;
} else {
z = true;
i2 = 0;
}
if (i5 > i4) {
z2 = true;
} else if (i5 < 0) {
z2 = true;
i4 = 0;
} else {
i4 = i5;
z2 = false;
}
if (z2 && !this.e.e(1)) {
this.x.springBack(i2, i4, 0, 0, 0, b());
}
onOverScrolled(i2, i4, z, z2);
return z || z2;
}
final int b() {
if (getChildCount() <= 0) {
return 0;
}
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int height = childAt.getHeight();
int i = ((ViewGroup.MarginLayoutParams) layoutParams).topMargin;
return Math.max(0, ((height + i) + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin) - ((getHeight() - getPaddingTop()) - getPaddingBottom()));
}
private boolean d(int i) {
boolean z = i == 130;
int height = getHeight();
if (z) {
this.D.top = getScrollY() + height;
int childCount = getChildCount();
if (childCount > 0) {
View childAt = getChildAt(childCount - 1);
int bottom = childAt.getBottom() + ((ViewGroup.MarginLayoutParams) ((FrameLayout.LayoutParams) childAt.getLayoutParams())).bottomMargin + getPaddingBottom();
if (this.D.top + height > bottom) {
this.D.top = bottom - height;
}
}
} else {
this.D.top = getScrollY() - height;
if (this.D.top < 0) {
this.D.top = 0;
}
}
Rect rect = this.D;
rect.bottom = rect.top + height;
return d(i, this.D.top, this.D.bottom);
}
public final boolean a(int i) {
int childCount;
boolean z = i == 130;
int height = getHeight();
this.D.top = 0;
this.D.bottom = height;
if (z && (childCount = getChildCount()) > 0) {
View childAt = getChildAt(childCount - 1);
this.D.bottom = childAt.getBottom() + ((ViewGroup.MarginLayoutParams) ((FrameLayout.LayoutParams) childAt.getLayoutParams())).bottomMargin + getPaddingBottom();
Rect rect = this.D;
rect.top = rect.bottom - height;
}
return d(i, this.D.top, this.D.bottom);
}
private boolean d(int i, int i2, int i3) {
boolean z;
int height = getHeight();
int scrollY = getScrollY();
int i4 = height + scrollY;
boolean z2 = i == 33;
ArrayList<View> focusables = getFocusables(2);
int size = focusables.size();
View view = null;
boolean z3 = false;
for (int i5 = 0; i5 < size; i5++) {
View view2 = focusables.get(i5);
int top = view2.getTop();
int bottom = view2.getBottom();
if (i2 < bottom && top < i3) {
boolean z4 = i2 < top && bottom < i3;
if (view == null) {
view = view2;
z3 = z4;
} else {
boolean z5 = (z2 && top < view.getTop()) || (!z2 && bottom > view.getBottom());
if (z3) {
if (z4) {
if (!z5) {
}
view = view2;
}
} else if (z4) {
view = view2;
z3 = true;
} else {
if (!z5) {
}
view = view2;
}
}
}
}
if (view == null) {
view = this;
}
if (i2 < scrollY || i3 > i4) {
int i6 = z2 ? i2 - scrollY : i3 - i4;
if (i6 != 0) {
if (!this.z) {
scrollBy(0, i6);
} else {
e(0, i6, false);
}
}
z = true;
} else {
z = false;
}
if (view != findFocus()) {
view.requestFocus(i);
}
return z;
}
private boolean b(int i) {
View findFocus = findFocus();
if (findFocus == this) {
findFocus = null;
}
View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, i);
int height = (int) (getHeight() * 0.5f);
if (findNextFocus != null && c(findNextFocus, height, getHeight())) {
findNextFocus.getDrawingRect(this.D);
offsetDescendantRectToMyCoords(findNextFocus, this.D);
int vF_ = vF_(this.D);
if (vF_ != 0) {
if (!this.z) {
scrollBy(0, vF_);
} else {
e(0, vF_, false);
}
}
findNextFocus.requestFocus(i);
} else {
if (i == 33 && getScrollY() < height) {
height = getScrollY();
} else if (i == 130 && getChildCount() > 0) {
View childAt = getChildAt(0);
height = Math.min((childAt.getBottom() + ((ViewGroup.MarginLayoutParams) ((FrameLayout.LayoutParams) childAt.getLayoutParams())).bottomMargin) - ((getScrollY() + getHeight()) - getPaddingBottom()), height);
}
if (height == 0) {
return false;
}
if (i != 130) {
height = -height;
}
if (height != 0) {
if (!this.z) {
scrollBy(0, height);
} else {
e(0, height, false);
}
}
}
if (findFocus != null && findFocus.isFocused() && (!c(findFocus, 0, getHeight()))) {
int descendantFocusability = getDescendantFocusability();
setDescendantFocusability(131072);
requestFocus();
setDescendantFocusability(descendantFocusability);
}
return true;
}
private boolean c(View view, int i, int i2) {
view.getDrawingRect(this.D);
offsetDescendantRectToMyCoords(view, this.D);
return this.D.bottom + i >= getScrollY() && this.D.top - i <= getScrollY() + i2;
}
public final void e(int i, int i2, boolean z) {
if (getChildCount() == 0) {
return;
}
if (AnimationUtils.currentAnimationTimeMillis() - this.l > 250) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int height = childAt.getHeight();
int i3 = ((ViewGroup.MarginLayoutParams) layoutParams).topMargin;
int i4 = ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
int height2 = getHeight();
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int scrollY = getScrollY();
this.x.startScroll(getScrollX(), scrollY, 0, Math.max(0, Math.min(i2 + scrollY, Math.max(0, ((height + i3) + i4) - ((height2 - paddingTop) - paddingBottom)))) - scrollY, 250);
c(z);
} else {
if (!this.x.isFinished()) {
this.x.abortAnimation();
this.e.a(1);
}
scrollBy(i, i2);
}
this.l = AnimationUtils.currentAnimationTimeMillis();
}
@Override // android.view.View
public int computeVerticalScrollRange() {
int childCount = getChildCount();
int height = (getHeight() - getPaddingBottom()) - getPaddingTop();
if (childCount == 0) {
return height;
}
View childAt = getChildAt(0);
int bottom = childAt.getBottom() + ((ViewGroup.MarginLayoutParams) ((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;
}
@Override // android.view.View
public int computeVerticalScrollOffset() {
return Math.max(0, super.computeVerticalScrollOffset());
}
@Override // android.view.View
public int computeVerticalScrollExtent() {
return super.computeVerticalScrollExtent();
}
@Override // android.view.View
public int computeHorizontalScrollRange() {
return super.computeHorizontalScrollRange();
}
@Override // android.view.View
public int computeHorizontalScrollOffset() {
return super.computeHorizontalScrollOffset();
}
@Override // android.view.View
public int computeHorizontalScrollExtent() {
return super.computeHorizontalScrollExtent();
}
@Override // android.view.ViewGroup
protected void measureChild(View view, int i, int i2) {
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
view.measure(getChildMeasureSpec(i, getPaddingLeft() + getPaddingRight(), layoutParams.width), View.MeasureSpec.makeMeasureSpec(0, 0));
}
@Override // android.view.ViewGroup
protected void measureChildWithMargins(View view, int i, int i2, int i3, int i4) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int i5 = marginLayoutParams.leftMargin;
view.measure(getChildMeasureSpec(i, paddingLeft + paddingRight + i5 + marginLayoutParams.rightMargin + i2, ((ViewGroup.LayoutParams) marginLayoutParams).width), View.MeasureSpec.makeMeasureSpec(marginLayoutParams.topMargin + marginLayoutParams.bottomMargin, 0));
}
/* JADX WARN: Removed duplicated region for block: B:15:0x008b */
/* JADX WARN: Removed duplicated region for block: B:17:0x00b6 */
/* JADX WARN: Removed duplicated region for block: B:31:0x00fd */
/* JADX WARN: Removed duplicated region for block: B:33:0x0101 */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void computeScroll() {
/*
Method dump skipped, instructions count: 263
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.computeScroll():void");
}
private void c(boolean z) {
if (z) {
this.e.a(2, 1);
} else {
this.e.a(1);
}
this.m = getScrollY();
ViewCompat.N(this);
}
private void d(View view) {
view.getDrawingRect(this.D);
offsetDescendantRectToMyCoords(view, this.D);
int vF_ = vF_(this.D);
if (vF_ != 0) {
scrollBy(0, vF_);
}
}
private int vF_(Rect rect) {
int i;
int i2;
if (getChildCount() == 0) {
return 0;
}
int height = getHeight();
int scrollY = getScrollY();
int i3 = scrollY + height;
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
if (rect.top > 0) {
scrollY += verticalFadingEdgeLength;
}
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int i4 = rect.bottom < (childAt.getHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin) + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin ? i3 - verticalFadingEdgeLength : i3;
if (rect.bottom > i4 && rect.top > scrollY) {
if (rect.height() > height) {
i2 = rect.top - scrollY;
} else {
i2 = rect.bottom - i4;
}
return Math.min(i2, (childAt.getBottom() + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin) - i3);
}
if (rect.top >= scrollY || rect.bottom >= i4) {
return 0;
}
if (rect.height() > height) {
i = 0 - (i4 - rect.bottom);
} else {
i = 0 - (scrollY - rect.top);
}
return Math.max(i, -getScrollY());
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void requestChildFocus(View view, View view2) {
if (this.f6388o) {
this.i = view2;
} else {
d(view2);
}
super.requestChildFocus(view, view2);
}
@Override // android.view.ViewGroup
protected boolean onRequestFocusInDescendants(int i, Rect rect) {
View findNextFocusFromRect;
if (i == 2) {
i = ISO781611.BIOMETRIC_SUBTYPE_TAG;
} else if (i == 1) {
i = 33;
}
if (rect == null) {
findNextFocusFromRect = FocusFinder.getInstance().findNextFocus(this, null, i);
} else {
findNextFocusFromRect = FocusFinder.getInstance().findNextFocusFromRect(this, rect, i);
}
if (findNextFocusFromRect == null || (true ^ c(findNextFocusFromRect, 0, getHeight()))) {
return false;
}
return findNextFocusFromRect.requestFocus(i, rect);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
rect.offset(view.getLeft() - view.getScrollX(), view.getTop() - view.getScrollY());
int vF_ = vF_(rect);
boolean z2 = vF_ != 0;
if (z2) {
if (!z) {
e(0, vF_, false);
} else {
scrollBy(0, vF_);
}
}
return z2;
}
@Override // android.view.View, android.view.ViewParent
public void requestLayout() {
this.f6388o = true;
super.requestLayout();
}
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
int i5;
super.onLayout(z, i, i2, i3, i4);
int i6 = 0;
this.f6388o = false;
View view = this.i;
if (view != null && a(view, this)) {
d(this.i);
}
this.i = null;
if (!this.k) {
if (this.v != null) {
scrollTo(getScrollX(), this.v.b);
this.v = null;
}
if (getChildCount() > 0) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
i5 = childAt.getMeasuredHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
} else {
i5 = 0;
}
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int scrollY = getScrollY();
int i7 = ((i4 - i2) - paddingTop) - paddingBottom;
if (i7 < i5 && scrollY >= 0) {
i6 = i7 + scrollY > i5 ? i5 - i7 : scrollY;
}
if (i6 != scrollY) {
scrollTo(getScrollX(), i6);
}
}
scrollTo(getScrollX(), getScrollY());
this.k = true;
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.k = false;
}
@Override // android.view.View
protected void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
View findFocus = findFocus();
if (findFocus == null || this == findFocus || !c(findFocus, 0, i4)) {
return;
}
findFocus.getDrawingRect(this.D);
offsetDescendantRectToMyCoords(findFocus, this.D);
int vF_ = vF_(this.D);
if (vF_ != 0) {
if (!this.z) {
scrollBy(0, vF_);
} else {
e(0, vF_, false);
}
}
}
private static boolean a(View view, View view2) {
if (view == view2) {
return true;
}
Object parent = view.getParent();
return (parent instanceof ViewGroup) && a((View) parent, view2);
}
public final void e(int i) {
if (getChildCount() > 0) {
this.x.fling(getScrollX(), getScrollY(), 0, i, 0, 0, PKIFailureInfo.systemUnavail, Integer.MAX_VALUE, 0, 0);
c(true);
}
}
private void e() {
this.h = false;
VelocityTracker velocityTracker = this.A;
if (velocityTracker != null) {
velocityTracker.recycle();
this.A = null;
}
this.e.a(0);
this.j.onRelease();
this.f.onRelease();
}
@Override // android.view.View
public void scrollTo(int i, int i2) {
if (getChildCount() > 0) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int width = getWidth();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int width2 = childAt.getWidth();
int i3 = ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
int i4 = ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
int height = getHeight();
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int height2 = childAt.getHeight();
int i5 = ((ViewGroup.MarginLayoutParams) layoutParams).topMargin;
int i6 = ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
int i7 = (width - paddingLeft) - paddingRight;
int i8 = width2 + i3 + i4;
if (i7 >= i8 || i < 0) {
i = 0;
} else if (i7 + i > i8) {
i = i8 - i7;
}
int i9 = (height - paddingTop) - paddingBottom;
int i10 = height2 + i5 + i6;
if (i9 >= i10 || i2 < 0) {
i2 = 0;
} else if (i9 + i2 > i10) {
i2 = i10 - i9;
}
if (i == getScrollX() && i2 == getScrollY()) {
return;
}
super.scrollTo(i, i2);
}
}
@Override // android.view.View
public void draw(Canvas canvas) {
int i;
super.draw(canvas);
int scrollY = getScrollY();
int i2 = 0;
if (!this.j.isFinished()) {
int save = canvas.save();
int width = getWidth();
int height = getHeight();
int min = Math.min(0, scrollY);
if (LWm.vH_(this)) {
width -= getPaddingLeft() + getPaddingRight();
i = getPaddingLeft();
} else {
i = 0;
}
if (LWm.vH_(this)) {
height -= getPaddingTop() + getPaddingBottom();
min += getPaddingTop();
}
canvas.translate(i, min);
this.j.setSize(width, height);
if (this.j.draw(canvas)) {
ViewCompat.N(this);
}
canvas.restoreToCount(save);
}
if (this.f.isFinished()) {
return;
}
int save2 = canvas.save();
int width2 = getWidth();
int height2 = getHeight();
int max = Math.max(b(), scrollY) + height2;
if (LWm.vH_(this)) {
width2 -= getPaddingLeft() + getPaddingRight();
i2 = getPaddingLeft();
}
if (LWm.vH_(this)) {
height2 -= getPaddingTop() + getPaddingBottom();
max -= getPaddingBottom();
}
canvas.translate(i2 - width2, max);
canvas.rotate(180.0f, width2, BitmapDescriptorFactory.HUE_RED);
this.f.setSize(width2, height2);
if (this.f.draw(canvas)) {
ViewCompat.N(this);
}
canvas.restoreToCount(save2);
}
@Override // android.view.View
protected void onRestoreInstanceState(Parcelable parcelable) {
if (!(parcelable instanceof Sts)) {
super.onRestoreInstanceState(parcelable);
return;
}
Sts sts = (Sts) parcelable;
super.onRestoreInstanceState(sts.getSuperState());
this.v = sts;
requestLayout();
}
@Override // android.view.View
protected Parcelable onSaveInstanceState() {
Sts sts = new Sts(super.onSaveInstanceState());
sts.b = getScrollY();
return sts;
}
/* loaded from: classes.dex */
static class Sts extends View.BaseSavedState {
public static final Parcelable.Creator<Sts> CREATOR = new Parcelable.Creator<Sts>() { // from class: androidx.core.widget.NestedScrollView.Sts.5
@Override // android.os.Parcelable.Creator
public final /* synthetic */ Sts createFromParcel(Parcel parcel) {
return new Sts(parcel);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ Sts[] newArray(int i) {
return new Sts[i];
}
};
public int b;
Sts(Parcelable parcelable) {
super(parcelable);
}
Sts(Parcel parcel) {
super(parcel);
this.b = parcel.readInt();
}
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
public final void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.b);
}
public final String toString() {
StringBuilder sb = new StringBuilder("HorizontalScrollView.SavedState{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(" scrollPosition=");
sb.append(this.b);
sb.append(UrlTreeKt.componentParamSuffix);
return sb.toString();
}
}
/* loaded from: classes.dex */
static class HBt extends yZt {
HBt() {
}
@Override // o.yZt
public final boolean performAccessibilityAction(View view, int i, Bundle bundle) {
if (super.performAccessibilityAction(view, i, bundle)) {
return true;
}
NestedScrollView nestedScrollView = (NestedScrollView) view;
if (!nestedScrollView.isEnabled()) {
return false;
}
int height = nestedScrollView.getHeight();
Rect rect = new Rect();
if (nestedScrollView.getMatrix().isIdentity() && nestedScrollView.getGlobalVisibleRect(rect)) {
height = rect.height();
}
if (i != 4096) {
if (i == 8192 || i == 16908344) {
int paddingBottom = nestedScrollView.getPaddingBottom();
int max = Math.max(nestedScrollView.getScrollY() - ((height - paddingBottom) - nestedScrollView.getPaddingTop()), 0);
if (max == nestedScrollView.getScrollY()) {
return false;
}
nestedScrollView.e(0 - nestedScrollView.getScrollX(), max - nestedScrollView.getScrollY(), true);
return true;
}
if (i != 16908346) {
return false;
}
}
int paddingBottom2 = nestedScrollView.getPaddingBottom();
int paddingTop = nestedScrollView.getPaddingTop();
int min = Math.min(nestedScrollView.getScrollY() + ((height - paddingBottom2) - paddingTop), nestedScrollView.b());
if (min == nestedScrollView.getScrollY()) {
return false;
}
nestedScrollView.e(0 - nestedScrollView.getScrollX(), min - nestedScrollView.getScrollY(), true);
return true;
}
@Override // o.yZt
public final void onInitializeAccessibilityNodeInfo(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
int b;
super.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat);
NestedScrollView nestedScrollView = (NestedScrollView) view;
accessibilityNodeInfoCompat.e((CharSequence) ScrollView.class.getName());
if (!nestedScrollView.isEnabled() || (b = nestedScrollView.b()) <= 0) {
return;
}
accessibilityNodeInfoCompat.n(true);
if (nestedScrollView.getScrollY() > 0) {
accessibilityNodeInfoCompat.e(AccessibilityNodeInfoCompat.AccessibilityActionCompat.C);
accessibilityNodeInfoCompat.e(AccessibilityNodeInfoCompat.AccessibilityActionCompat.L);
}
if (nestedScrollView.getScrollY() < b) {
accessibilityNodeInfoCompat.e(AccessibilityNodeInfoCompat.AccessibilityActionCompat.I);
accessibilityNodeInfoCompat.e(AccessibilityNodeInfoCompat.AccessibilityActionCompat.F);
}
}
@Override // o.yZt
public final void onInitializeAccessibilityEvent(View view, AccessibilityEvent accessibilityEvent) {
super.onInitializeAccessibilityEvent(view, accessibilityEvent);
NestedScrollView nestedScrollView = (NestedScrollView) view;
accessibilityEvent.setClassName(ScrollView.class.getName());
accessibilityEvent.setScrollable(nestedScrollView.b() > 0);
accessibilityEvent.setScrollX(nestedScrollView.getScrollX());
accessibilityEvent.setScrollY(nestedScrollView.getScrollY());
C15996kMa.uf_(accessibilityEvent, nestedScrollView.getScrollX());
C15996kMa.ug_(accessibilityEvent, nestedScrollView.b());
}
}
/* loaded from: classes.dex */
static class LWm {
static boolean vH_(ViewGroup viewGroup) {
return viewGroup.getClipToPadding();
}
}
@Override // android.view.View
public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
return this.e.c(i, i2, i3, i4, iArr, 0, null);
}
@Override // android.view.ViewGroup
public int getNestedScrollAxes() {
JXX jxx = this.r;
return jxx.d | jxx.c;
}
@Override // android.view.View
public boolean isNestedScrollingEnabled() {
return this.e.c;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
this.e.a(i, i2, iArr, null, 0);
}
@Override // o.FEJ
public final void e(View view, View view2, int i, int i2) {
JXX jxx = this.r;
if (i2 == 1) {
jxx.d = i;
} else {
jxx.c = i;
}
this.e.a(2, i2);
}
@Override // o.FEJ
public final void a(View view, int i) {
JXX jxx = this.r;
if (i == 1) {
jxx.d = 0;
} else {
jxx.c = 0;
}
this.e.a(i);
}
public void setSmoothScrollingEnabled(boolean z) {
this.z = z;
}
public void setOnScrollChangeListener(RVV rvv) {
this.p = rvv;
}
}