soul-browser/sources/java/androidx/core/widget/NestedScrollView.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* Decompile and recreate Soul Browser v1.4.85 with APK CI builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix CI build: include bundled google.jks and remove PR trigger

The apktool build failed in CI because app/unknown/.../google.jks was
excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files
and commit the missing resource.

Also remove the redundant pull_request workflow trigger.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Change package ID to com.github.kaki87.soulbrowser

Rename the application ID so the rebuilt APK can be installed
alongside the original Soul Browser from Google Play.

- Update AndroidManifest package, permissions, providers, and actions
- Update R class references in smali (com/github/kaki87/soulbrowser/R)
- Update shortcuts.xml targetPackage
- Rename app label to "Soul Rebuild" for easy identification

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install compatibility: remove split APK metadata and bundle native libs

The rebuilt APK still declared requiredSplitTypes and Play Store split
metadata, causing Android to reject standalone installs as incompatible.

- Remove requiredSplitTypes and split-related manifest meta-data
- Merge native libs from all ABI splits with uncompressed storage
- Page-align before signing for extractNativeLibs=false
- Add .so to apktool doNotCompress list

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install failure: use apksigner v2/v3 and bundle arm64 native libs

Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only
produces v1 signatures, causing Android to reject the install.

- Sign with apksigner (v1+v2+v3) instead of jarsigner
- Add arm64-v8a native libraries from universal Soul Browser 1.4.79
- Set extractNativeLibs=true for reliable sideload installs
- Commit stable debug keystore for consistent signatures across builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Add committed debug keystore for consistent APK signatures

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix startup crash: use original classes2.dex desugar libraries

Apktool recompiles smali_classes2 into a broken classes2.dex, causing
ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init.

Inject the original classes2.dex (Java 8+ desugar libs) after apktool
build instead of using the recompiled version.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix missing drawable resources from density split APKs

The base APK is an app bundle module; density-specific drawables like
seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild,
causing Resources$NotFoundException at runtime.

- Merge non-9-patch resources from split APKs before apktool build
- Sync public.xml IDs from R smali only when backing files exist
- Add 713 density-specific resource IDs to public.xml

Co-authored-by: KaKi87 <KaKi87@pm.me>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-10 16:07:14 +02:00

1634 lines
59 KiB
Java

package androidx.core.widget;
import android.R;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.media.a;
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.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.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.core.os.BuildCompat;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.DifferentialMotionFlingController;
import androidx.core.view.DifferentialMotionFlingTarget;
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.accessibility.AccessibilityNodeInfoCompat;
import java.util.ArrayList;
import kotlin.KotlinVersion;
import kotlin.jvm.internal.IntCompanionObject;
/* loaded from: classes.dex */
public class NestedScrollView extends FrameLayout implements NestedScrollingParent3, NestedScrollingChild3, ScrollingView {
public static final float G = (float) (Math.log(0.78d) / Math.log(0.9d));
public static final AccessibilityDelegate H = new AccessibilityDelegateCompat();
public static final int[] I = {R.attr.fillViewport};
public SavedState A;
public final NestedScrollingParentHelper B;
public final NestedScrollingChildHelper C;
public float D;
public OnScrollChangeListener E;
public final DifferentialMotionFlingController F;
/* renamed from: c, reason: collision with root package name */
public final float f858c;
public long f;
public final Rect g;
public final OverScroller h;
public final EdgeEffect i;
public final EdgeEffect j;
public int k;
public boolean l;
public boolean m;
public View n;
public boolean o;
public VelocityTracker p;
public boolean q;
public boolean r;
public final int s;
public final int t;
public final int u;
public int v;
public final int[] w;
public final int[] x;
public int y;
public int z;
/* loaded from: classes.dex */
public static class AccessibilityDelegate extends AccessibilityDelegateCompat {
@Override // androidx.core.view.AccessibilityDelegateCompat
public final void c(View view, AccessibilityEvent accessibilityEvent) {
boolean z;
super.c(view, accessibilityEvent);
NestedScrollView nestedScrollView = (NestedScrollView) view;
accessibilityEvent.setClassName(ScrollView.class.getName());
if (nestedScrollView.getScrollRange() > 0) {
z = true;
} else {
z = false;
}
accessibilityEvent.setScrollable(z);
accessibilityEvent.setScrollX(nestedScrollView.getScrollX());
accessibilityEvent.setScrollY(nestedScrollView.getScrollY());
accessibilityEvent.setMaxScrollX(nestedScrollView.getScrollX());
accessibilityEvent.setMaxScrollY(nestedScrollView.getScrollRange());
}
@Override // androidx.core.view.AccessibilityDelegateCompat
public final void d(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) {
int scrollRange;
this.f760a.onInitializeAccessibilityNodeInfo(view, accessibilityNodeInfoCompat.f834a);
NestedScrollView nestedScrollView = (NestedScrollView) view;
accessibilityNodeInfoCompat.k(ScrollView.class.getName());
if (nestedScrollView.isEnabled() && (scrollRange = nestedScrollView.getScrollRange()) > 0) {
accessibilityNodeInfoCompat.t(true);
if (nestedScrollView.getScrollY() > 0) {
accessibilityNodeInfoCompat.b(AccessibilityNodeInfoCompat.AccessibilityActionCompat.i);
accessibilityNodeInfoCompat.b(AccessibilityNodeInfoCompat.AccessibilityActionCompat.m);
}
if (nestedScrollView.getScrollY() < scrollRange) {
accessibilityNodeInfoCompat.b(AccessibilityNodeInfoCompat.AccessibilityActionCompat.h);
accessibilityNodeInfoCompat.b(AccessibilityNodeInfoCompat.AccessibilityActionCompat.n);
}
}
}
/* JADX WARN: Code restructure failed: missing block: B:19:0x0040, code lost:
if (r6 != 16908346) goto L30;
*/
@Override // androidx.core.view.AccessibilityDelegateCompat
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final boolean g(android.view.View r5, int r6, android.os.Bundle r7) {
/*
r4 = this;
boolean r7 = super.g(r5, r6, r7)
r0 = 1
if (r7 == 0) goto L8
return r0
L8:
androidx.core.widget.NestedScrollView r5 = (androidx.core.widget.NestedScrollView) r5
boolean r7 = r5.isEnabled()
r1 = 0
if (r7 != 0) goto L13
goto L95
L13:
int r7 = r5.getHeight()
android.graphics.Rect r2 = new android.graphics.Rect
r2.<init>()
android.graphics.Matrix r3 = r5.getMatrix()
boolean r3 = r3.isIdentity()
if (r3 == 0) goto L30
boolean r3 = r5.getGlobalVisibleRect(r2)
if (r3 == 0) goto L30
int r7 = r2.height()
L30:
r2 = 4096(0x1000, float:5.74E-42)
if (r6 == r2) goto L6a
r2 = 8192(0x2000, float:1.148E-41)
if (r6 == r2) goto L43
r2 = 16908344(0x1020038, float:2.3877386E-38)
if (r6 == r2) goto L43
r2 = 16908346(0x102003a, float:2.3877392E-38)
if (r6 == r2) goto L6a
goto L95
L43:
int r6 = r5.getPaddingBottom()
int r7 = r7 - r6
int r6 = r5.getPaddingTop()
int r7 = r7 - r6
int r6 = r5.getScrollY()
int r6 = r6 - r7
int r6 = java.lang.Math.max(r6, r1)
int r7 = r5.getScrollY()
if (r6 == r7) goto L95
int r7 = r5.getScrollX()
int r1 = r1 - r7
int r7 = r5.getScrollY()
int r6 = r6 - r7
r5.u(r1, r6, r0)
return r0
L6a:
int r6 = r5.getPaddingBottom()
int r7 = r7 - r6
int r6 = r5.getPaddingTop()
int r7 = r7 - r6
int r6 = r5.getScrollY()
int r6 = r6 + r7
int r7 = r5.getScrollRange()
int r6 = java.lang.Math.min(r6, r7)
int r7 = r5.getScrollY()
if (r6 == r7) goto L95
int r7 = r5.getScrollX()
int r1 = r1 - r7
int r7 = r5.getScrollY()
int r6 = r6 - r7
r5.u(r1, r6, r0)
return r0
L95:
return r1
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.AccessibilityDelegate.g(android.view.View, int, android.os.Bundle):boolean");
}
}
@RequiresApi
/* loaded from: classes.dex */
public static class Api21Impl {
}
@RequiresApi
/* loaded from: classes.dex */
public static final class Api35Impl {
public static void a(NestedScrollView nestedScrollView, float f) {
try {
nestedScrollView.setFrameContentVelocity(f);
} catch (LinkageError unused) {
}
}
}
/* loaded from: classes.dex */
public class DifferentialMotionFlingTargetImpl implements DifferentialMotionFlingTarget {
public DifferentialMotionFlingTargetImpl() {
}
@Override // androidx.core.view.DifferentialMotionFlingTarget
public final boolean a(float f) {
if (f == 0.0f) {
return false;
}
c();
NestedScrollView.this.d((int) f);
return true;
}
@Override // androidx.core.view.DifferentialMotionFlingTarget
public final float b() {
return -NestedScrollView.this.getVerticalScrollFactorCompat();
}
@Override // androidx.core.view.DifferentialMotionFlingTarget
public final void c() {
NestedScrollView.this.h.abortAnimation();
}
}
/* loaded from: classes.dex */
public interface OnScrollChangeListener {
void a(NestedScrollView nestedScrollView, int i);
}
/* loaded from: classes.dex */
public static class SavedState extends View.BaseSavedState {
public static final Parcelable.Creator<SavedState> CREATOR = new Object();
/* renamed from: c, reason: collision with root package name */
public int f860c;
/* renamed from: androidx.core.widget.NestedScrollView$SavedState$1, reason: invalid class name */
/* loaded from: classes.dex */
public class AnonymousClass1 implements Parcelable.Creator<SavedState> {
/* JADX WARN: Type inference failed for: r0v0, types: [android.view.View$BaseSavedState, androidx.core.widget.NestedScrollView$SavedState] */
@Override // android.os.Parcelable.Creator
public final SavedState createFromParcel(Parcel parcel) {
?? baseSavedState = new View.BaseSavedState(parcel);
baseSavedState.f860c = parcel.readInt();
return baseSavedState;
}
@Override // android.os.Parcelable.Creator
public final SavedState[] newArray(int i) {
return new SavedState[i];
}
}
public final String toString() {
StringBuilder sb = new StringBuilder("HorizontalScrollView.SavedState{");
sb.append(Integer.toHexString(System.identityHashCode(this)));
sb.append(" scrollPosition=");
return a.g(this.f860c, "}", sb);
}
@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.f860c);
}
}
/* JADX WARN: Illegal instructions before constructor call */
/* JADX WARN: Type inference failed for: r7v2, types: [androidx.core.view.NestedScrollingParentHelper, java.lang.Object] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public NestedScrollView(@androidx.annotation.NonNull android.content.Context r7, @androidx.annotation.Nullable android.util.AttributeSet r8) {
/*
r6 = this;
int r0 = androidx.core.R.attr.nestedScrollViewStyle
r6.<init>(r7, r8, r0)
android.graphics.Rect r1 = new android.graphics.Rect
r1.<init>()
r6.g = r1
r1 = 1
r6.l = r1
r2 = 0
r6.m = r2
r3 = 0
r6.n = r3
r6.o = r2
r6.r = r1
r3 = -1
r6.v = r3
r3 = 2
int[] r4 = new int[r3]
r6.w = r4
int[] r3 = new int[r3]
r6.x = r3
androidx.core.widget.NestedScrollView$DifferentialMotionFlingTargetImpl r3 = new androidx.core.widget.NestedScrollView$DifferentialMotionFlingTargetImpl
r3.<init>()
androidx.core.view.DifferentialMotionFlingController r4 = new androidx.core.view.DifferentialMotionFlingController
android.content.Context r5 = r6.getContext()
r4.<init>(r5, r3)
r6.F = r4
int r3 = android.os.Build.VERSION.SDK_INT
r4 = 31
if (r3 < r4) goto L40
android.widget.EdgeEffect r5 = androidx.core.widget.EdgeEffectCompat.Api31Impl.a(r7, r8)
goto L45
L40:
android.widget.EdgeEffect r5 = new android.widget.EdgeEffect
r5.<init>(r7)
L45:
r6.i = r5
if (r3 < r4) goto L4e
android.widget.EdgeEffect r3 = androidx.core.widget.EdgeEffectCompat.Api31Impl.a(r7, r8)
goto L53
L4e:
android.widget.EdgeEffect r3 = new android.widget.EdgeEffect
r3.<init>(r7)
L53:
r6.j = r3
android.content.res.Resources r3 = r7.getResources()
android.util.DisplayMetrics r3 = r3.getDisplayMetrics()
float r3 = r3.density
r4 = 1126170624(0x43200000, float:160.0)
float r3 = r3 * r4
r4 = 1136724797(0x43c10b3d, float:386.0878)
float r3 = r3 * r4
r4 = 1062668861(0x3f570a3d, float:0.84)
float r3 = r3 * r4
r6.f858c = r3
android.widget.OverScroller r3 = new android.widget.OverScroller
android.content.Context r4 = r6.getContext()
r3.<init>(r4)
r6.h = r3
r6.setFocusable(r1)
r3 = 262144(0x40000, float:3.67342E-40)
r6.setDescendantFocusability(r3)
r6.setWillNotDraw(r2)
android.content.Context r3 = r6.getContext()
android.view.ViewConfiguration r3 = android.view.ViewConfiguration.get(r3)
int r4 = r3.getScaledTouchSlop()
r6.s = r4
int r4 = r3.getScaledMinimumFlingVelocity()
r6.t = r4
int r3 = r3.getScaledMaximumFlingVelocity()
r6.u = r3
int[] r3 = androidx.core.widget.NestedScrollView.I
android.content.res.TypedArray r7 = r7.obtainStyledAttributes(r8, r3, r0, r2)
boolean r8 = r7.getBoolean(r2, r2)
r6.setFillViewport(r8)
r7.recycle()
androidx.core.view.NestedScrollingParentHelper r7 = new androidx.core.view.NestedScrollingParentHelper
r7.<init>()
r6.B = r7
androidx.core.view.NestedScrollingChildHelper r7 = new androidx.core.view.NestedScrollingChildHelper
r7.<init>(r6)
r6.C = r7
r6.setNestedScrollingEnabled(r1)
androidx.core.widget.NestedScrollView$AccessibilityDelegate r7 = androidx.core.widget.NestedScrollView.H
androidx.core.view.ViewCompat.z(r6, r7)
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.<init>(android.content.Context, android.util.AttributeSet):void");
}
public static boolean f(View view, NestedScrollView nestedScrollView) {
if (view != nestedScrollView) {
Object parent = view.getParent();
if ((parent instanceof ViewGroup) && f((View) parent, nestedScrollView)) {
return true;
}
return false;
}
return true;
}
public final boolean a(int i) {
View findFocus = findFocus();
if (findFocus == this) {
findFocus = null;
}
View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, i);
int maxScrollAmount = getMaxScrollAmount();
if (findNextFocus != null && g(findNextFocus, maxScrollAmount, getHeight())) {
Rect rect = this.g;
findNextFocus.getDrawingRect(rect);
offsetDescendantRectToMyCoords(findNextFocus, rect);
s(b(rect), 0, 1, true);
findNextFocus.requestFocus(i);
} else {
if (i == 33 && getScrollY() < maxScrollAmount) {
maxScrollAmount = getScrollY();
} else if (i == 130 && getChildCount() > 0) {
View childAt = getChildAt(0);
maxScrollAmount = Math.min((childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin) - ((getHeight() + getScrollY()) - getPaddingBottom()), maxScrollAmount);
}
if (maxScrollAmount == 0) {
return false;
}
if (i != 130) {
maxScrollAmount = -maxScrollAmount;
}
s(maxScrollAmount, 0, 1, true);
}
if (findFocus != null && findFocus.isFocused() && !g(findFocus, 0, getHeight())) {
int descendantFocusability = getDescendantFocusability();
setDescendantFocusability(131072);
requestFocus();
setDescendantFocusability(descendantFocusability);
}
return true;
}
@Override // android.view.ViewGroup
public final void addView(View view) {
if (getChildCount() <= 0) {
super.addView(view);
return;
}
throw new IllegalStateException("ScrollView can host only one direct child");
}
public final int b(Rect rect) {
int i;
int i2;
int i3;
if (getChildCount() == 0) {
return 0;
}
int height = getHeight();
int scrollY = getScrollY();
int i4 = scrollY + height;
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 = i4 - verticalFadingEdgeLength;
} else {
i = i4;
}
int i5 = rect.bottom;
if (i5 > i && rect.top > scrollY) {
if (rect.height() > height) {
i3 = rect.top - scrollY;
} else {
i3 = rect.bottom - i;
}
return Math.min(i3, (childAt.getBottom() + layoutParams.bottomMargin) - i4);
}
if (rect.top >= scrollY || i5 >= i) {
return 0;
}
if (rect.height() > height) {
i2 = 0 - (i - rect.bottom);
} else {
i2 = 0 - (scrollY - rect.top);
}
return Math.max(i2, -getScrollY());
}
public final boolean c(KeyEvent keyEvent) {
this.g.setEmpty();
int i = 130;
if (getChildCount() > 0) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
if (childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin > (getHeight() - getPaddingTop()) - getPaddingBottom()) {
if (keyEvent.getAction() == 0) {
int keyCode = keyEvent.getKeyCode();
if (keyCode != 19) {
if (keyCode != 20) {
if (keyCode != 62) {
if (keyCode != 92) {
if (keyCode != 93) {
if (keyCode != 122) {
if (keyCode == 123) {
q(130);
return false;
}
} else {
q(33);
return false;
}
} else {
return e(130);
}
} else {
return e(33);
}
} else {
if (keyEvent.isShiftPressed()) {
i = 33;
}
q(i);
return false;
}
} else {
if (keyEvent.isAltPressed()) {
return e(130);
}
return a(130);
}
} else {
if (keyEvent.isAltPressed()) {
return e(33);
}
return a(33);
}
}
return false;
}
}
if (isFocused() && keyEvent.getKeyCode() != 4) {
View findFocus = findFocus();
if (findFocus == this) {
findFocus = null;
}
View findNextFocus = FocusFinder.getInstance().findNextFocus(this, findFocus, 130);
if (findNextFocus != null && findNextFocus != this && findNextFocus.requestFocus(130)) {
return true;
}
}
return false;
}
@Override // android.view.View
public final int computeHorizontalScrollExtent() {
return super.computeHorizontalScrollExtent();
}
@Override // android.view.View
public final int computeHorizontalScrollOffset() {
return super.computeHorizontalScrollOffset();
}
@Override // android.view.View
public final int computeHorizontalScrollRange() {
return super.computeHorizontalScrollRange();
}
/* JADX WARN: Removed duplicated region for block: B:16:0x0087 */
/* JADX WARN: Removed duplicated region for block: B:18:0x0096 */
/* JADX WARN: Removed duplicated region for block: B:20:0x00be */
/* JADX WARN: Removed duplicated region for block: B:34:0x00fb */
/* JADX WARN: Removed duplicated region for block: B:36:0x00ff */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void computeScroll() {
/*
Method dump skipped, instructions count: 259
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.computeScroll():void");
}
@Override // android.view.View
public final int computeVerticalScrollExtent() {
return super.computeVerticalScrollExtent();
}
@Override // android.view.View
public final int computeVerticalScrollOffset() {
return Math.max(0, super.computeVerticalScrollOffset());
}
@Override // android.view.View
public final 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);
if (scrollY < 0) {
return bottom - scrollY;
}
if (scrollY > max) {
return (scrollY - max) + bottom;
}
return bottom;
}
public final void d(int i) {
if (getChildCount() > 0) {
this.h.fling(getScrollX(), getScrollY(), 0, i, 0, 0, IntCompanionObject.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
v(2, 1);
this.z = getScrollY();
postInvalidateOnAnimation();
if (BuildCompat.c()) {
Api35Impl.a(this, Math.abs(this.h.getCurrVelocity()));
}
}
}
@Override // android.view.ViewGroup, android.view.View
public final boolean dispatchKeyEvent(KeyEvent keyEvent) {
if (!super.dispatchKeyEvent(keyEvent) && !c(keyEvent)) {
return false;
}
return true;
}
@Override // android.view.View
public final boolean dispatchNestedFling(float f, float f2, boolean z) {
return this.C.a(f, f2, z);
}
@Override // android.view.View
public final boolean dispatchNestedPreFling(float f, float f2) {
return this.C.b(f, f2);
}
@Override // android.view.View
public final boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
return this.C.c(iArr, iArr2, i, i2, 0);
}
@Override // android.view.View
public final boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
return this.C.d(i, i2, i3, i4, iArr, 0, null);
}
@Override // android.view.View
public final void draw(Canvas canvas) {
int i;
super.draw(canvas);
int scrollY = getScrollY();
EdgeEffect edgeEffect = this.i;
int i2 = 0;
if (!edgeEffect.isFinished()) {
int save = canvas.save();
int width = getWidth();
int height = getHeight();
int min = Math.min(0, scrollY);
if (getClipToPadding()) {
width -= getPaddingRight() + getPaddingLeft();
i = getPaddingLeft();
} else {
i = 0;
}
if (getClipToPadding()) {
height -= getPaddingBottom() + getPaddingTop();
min += getPaddingTop();
}
canvas.translate(i, min);
edgeEffect.setSize(width, height);
if (edgeEffect.draw(canvas)) {
postInvalidateOnAnimation();
}
canvas.restoreToCount(save);
}
EdgeEffect edgeEffect2 = this.j;
if (!edgeEffect2.isFinished()) {
int save2 = canvas.save();
int width2 = getWidth();
int height2 = getHeight();
int max = Math.max(getScrollRange(), scrollY) + height2;
if (getClipToPadding()) {
width2 -= getPaddingRight() + getPaddingLeft();
i2 = getPaddingLeft();
}
if (getClipToPadding()) {
height2 -= getPaddingBottom() + getPaddingTop();
max -= getPaddingBottom();
}
canvas.translate(i2 - width2, max);
canvas.rotate(180.0f, width2, 0.0f);
edgeEffect2.setSize(width2, height2);
if (edgeEffect2.draw(canvas)) {
postInvalidateOnAnimation();
}
canvas.restoreToCount(save2);
}
}
public final boolean e(int i) {
boolean z;
int childCount;
if (i == 130) {
z = true;
} else {
z = false;
}
int height = getHeight();
Rect rect = this.g;
rect.top = 0;
rect.bottom = height;
if (z && (childCount = getChildCount()) > 0) {
View childAt = getChildAt(childCount - 1);
rect.bottom = getPaddingBottom() + childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin;
rect.top = rect.bottom - height;
}
return r(i, rect.top, rect.bottom);
}
public final boolean g(View view, int i, int i2) {
Rect rect = this.g;
view.getDrawingRect(rect);
offsetDescendantRectToMyCoords(view, rect);
if (rect.bottom + i >= getScrollY() && rect.top - i <= getScrollY() + i2) {
return true;
}
return false;
}
@Override // android.view.View
public float getBottomFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
int bottom = ((childAt.getBottom() + layoutParams.bottomMargin) - getScrollY()) - (getHeight() - getPaddingBottom());
if (bottom < verticalFadingEdgeLength) {
return bottom / verticalFadingEdgeLength;
}
return 1.0f;
}
public int getMaxScrollAmount() {
return (int) (getHeight() * 0.5f);
}
@Override // android.view.ViewGroup
public int getNestedScrollAxes() {
NestedScrollingParentHelper nestedScrollingParentHelper = this.B;
return nestedScrollingParentHelper.b | nestedScrollingParentHelper.f783a;
}
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()));
}
@Override // android.view.View
public float getTopFadingEdgeStrength() {
if (getChildCount() == 0) {
return 0.0f;
}
int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
int scrollY = getScrollY();
if (scrollY < verticalFadingEdgeLength) {
return scrollY / verticalFadingEdgeLength;
}
return 1.0f;
}
@VisibleForTesting
public float getVerticalScrollFactorCompat() {
if (this.D == 0.0f) {
TypedValue typedValue = new TypedValue();
Context context = getContext();
if (context.getTheme().resolveAttribute(R.attr.listPreferredItemHeight, typedValue, true)) {
this.D = typedValue.getDimension(context.getResources().getDisplayMetrics());
} else {
throw new IllegalStateException("Expected theme to define listPreferredItemHeight.");
}
}
return this.D;
}
public final void h(int[] iArr, int i, int i2) {
int scrollY = getScrollY();
scrollBy(0, i);
int scrollY2 = getScrollY() - scrollY;
if (iArr != null) {
iArr[1] = iArr[1] + scrollY2;
}
this.C.d(0, scrollY2, 0, i - scrollY2, null, i2, iArr);
}
@Override // android.view.View
public final boolean hasNestedScrollingParent() {
return this.C.f(0);
}
public final void i(MotionEvent motionEvent) {
int i;
int actionIndex = motionEvent.getActionIndex();
if (motionEvent.getPointerId(actionIndex) == this.v) {
if (actionIndex == 0) {
i = 1;
} else {
i = 0;
}
this.k = (int) motionEvent.getY(i);
this.v = motionEvent.getPointerId(i);
VelocityTracker velocityTracker = this.p;
if (velocityTracker != null) {
velocityTracker.clear();
}
}
}
@Override // android.view.View
public final boolean isNestedScrollingEnabled() {
return this.C.d;
}
@Override // androidx.core.view.NestedScrollingParent3
public final void j(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
h(iArr, i4, i5);
}
@Override // androidx.core.view.NestedScrollingParent2
public final void k(View view, int i, int i2, int i3, int i4, int i5) {
h(null, i4, i5);
}
@Override // androidx.core.view.NestedScrollingParent2
public final boolean l(View view, View view2, int i, int i2) {
return (i & 2) != 0;
}
@Override // androidx.core.view.NestedScrollingParent2
public final void m(View view, View view2, int i, int i2) {
NestedScrollingParentHelper nestedScrollingParentHelper = this.B;
if (i2 == 1) {
nestedScrollingParentHelper.b = i;
} else {
nestedScrollingParentHelper.f783a = i;
}
v(2, i2);
}
@Override // android.view.ViewGroup
public final void measureChild(View view, int i, int i2) {
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
view.measure(ViewGroup.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft(), layoutParams.width), View.MeasureSpec.makeMeasureSpec(0, 0));
}
@Override // android.view.ViewGroup
public final void measureChildWithMargins(View view, int i, int i2, int i3, int i4) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
view.measure(ViewGroup.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin + i2, marginLayoutParams.width), View.MeasureSpec.makeMeasureSpec(marginLayoutParams.topMargin + marginLayoutParams.bottomMargin, 0));
}
@Override // androidx.core.view.NestedScrollingParent2
public final void n(View view, int i) {
NestedScrollingParentHelper nestedScrollingParentHelper = this.B;
if (i == 1) {
nestedScrollingParentHelper.b = 0;
} else {
nestedScrollingParentHelper.f783a = 0;
}
x(i);
}
@Override // androidx.core.view.NestedScrollingParent2
public final void o(View view, int i, int i2, int[] iArr, int i3) {
this.C.c(iArr, null, i, i2, i3);
}
@Override // android.view.ViewGroup, android.view.View
public final void onAttachedToWindow() {
super.onAttachedToWindow();
this.m = false;
}
@Override // android.view.View
public final boolean onGenericMotionEvent(MotionEvent motionEvent) {
int i;
int i2;
float f;
boolean z = false;
if (motionEvent.getAction() == 8 && !this.o) {
if ((motionEvent.getSource() & 2) == 2) {
i = 9;
f = motionEvent.getAxisValue(9);
i2 = (int) motionEvent.getX();
} else if ((motionEvent.getSource() & 4194304) == 4194304) {
i = 26;
float axisValue = motionEvent.getAxisValue(26);
i2 = getWidth() / 2;
f = axisValue;
} else {
i = 0;
i2 = 0;
f = 0.0f;
}
if (f != 0.0f) {
int verticalScrollFactorCompat = (int) (getVerticalScrollFactorCompat() * f);
if ((motionEvent.getSource() & 8194) == 8194) {
z = true;
}
s(-verticalScrollFactorCompat, i2, 1, z);
if (i != 0) {
this.F.a(motionEvent, i);
}
return true;
}
}
return false;
}
@Override // android.view.ViewGroup
public final boolean onInterceptTouchEvent(MotionEvent motionEvent) {
int action = motionEvent.getAction();
boolean z = true;
if (action == 2 && this.o) {
return true;
}
int i = action & KotlinVersion.MAX_COMPONENT_VALUE;
if (i != 0) {
if (i != 1) {
if (i != 2) {
if (i != 3) {
if (i == 6) {
i(motionEvent);
}
}
} else {
int i2 = this.v;
if (i2 != -1) {
int findPointerIndex = motionEvent.findPointerIndex(i2);
if (findPointerIndex == -1) {
Log.e("NestedScrollView", "Invalid pointerId=" + i2 + " in onInterceptTouchEvent");
} else {
int y = (int) motionEvent.getY(findPointerIndex);
if (Math.abs(y - this.k) > this.s && (2 & getNestedScrollAxes()) == 0) {
this.o = true;
this.k = y;
if (this.p == null) {
this.p = VelocityTracker.obtain();
}
this.p.addMovement(motionEvent);
this.y = 0;
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
}
}
}
}
}
this.o = false;
this.v = -1;
VelocityTracker velocityTracker = this.p;
if (velocityTracker != null) {
velocityTracker.recycle();
this.p = null;
}
if (this.h.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
postInvalidateOnAnimation();
}
x(0);
} else {
int y2 = (int) motionEvent.getY();
int x = (int) motionEvent.getX();
if (getChildCount() > 0) {
int scrollY = getScrollY();
View childAt = getChildAt(0);
if (y2 >= childAt.getTop() - scrollY && y2 < childAt.getBottom() - scrollY && x >= childAt.getLeft() && x < childAt.getRight()) {
this.k = y2;
this.v = motionEvent.getPointerId(0);
VelocityTracker velocityTracker2 = this.p;
if (velocityTracker2 == null) {
this.p = VelocityTracker.obtain();
} else {
velocityTracker2.clear();
}
this.p.addMovement(motionEvent);
this.h.computeScrollOffset();
if (!w(motionEvent) && this.h.isFinished()) {
z = false;
}
this.o = z;
v(2, 0);
}
}
if (!w(motionEvent) && this.h.isFinished()) {
z = false;
}
this.o = z;
VelocityTracker velocityTracker3 = this.p;
if (velocityTracker3 != null) {
velocityTracker3.recycle();
this.p = null;
}
}
return this.o;
}
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
public final 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.l = false;
View view = this.n;
if (view != null && f(view, this)) {
View view2 = this.n;
Rect rect = this.g;
view2.getDrawingRect(rect);
offsetDescendantRectToMyCoords(view2, rect);
int b = b(rect);
if (b != 0) {
scrollBy(0, b);
}
}
this.n = null;
if (!this.m) {
if (this.A != null) {
scrollTo(getScrollX(), this.A.f860c);
this.A = null;
}
if (getChildCount() > 0) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
i5 = childAt.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
} else {
i5 = 0;
}
int paddingTop = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
int scrollY = getScrollY();
if (paddingTop < i5 && scrollY >= 0) {
i6 = paddingTop + scrollY > i5 ? i5 - paddingTop : scrollY;
}
if (i6 != scrollY) {
scrollTo(getScrollX(), i6);
}
}
scrollTo(getScrollX(), getScrollY());
this.m = true;
}
@Override // android.widget.FrameLayout, android.view.View
public final void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
if (this.q && 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()) - layoutParams.topMargin) - layoutParams.bottomMargin;
if (measuredHeight < measuredHeight2) {
childAt.measure(ViewGroup.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft() + layoutParams.leftMargin + layoutParams.rightMargin, layoutParams.width), View.MeasureSpec.makeMeasureSpec(measuredHeight2, 1073741824));
}
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final boolean onNestedFling(View view, float f, float f2, boolean z) {
if (!z) {
dispatchNestedFling(0.0f, f2, true);
d((int) f2);
return true;
}
return false;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final boolean onNestedPreFling(View view, float f, float f2) {
return this.C.b(f, f2);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
this.C.c(iArr, null, i, i2, 0);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void onNestedScroll(View view, int i, int i2, int i3, int i4) {
h(null, i4, 0);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void onNestedScrollAccepted(View view, View view2, int i) {
m(view, view2, i, 0);
}
@Override // android.view.View
public final void onOverScrolled(int i, int i2, boolean z, boolean z2) {
super.scrollTo(i, i2);
}
@Override // android.view.ViewGroup
public final boolean onRequestFocusInDescendants(int i, Rect rect) {
View findNextFocusFromRect;
if (i == 2) {
i = 130;
} 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 || !g(findNextFocusFromRect, 0, getHeight())) {
return false;
}
return findNextFocusFromRect.requestFocus(i, rect);
}
@Override // android.view.View
public final void onRestoreInstanceState(Parcelable parcelable) {
if (!(parcelable instanceof SavedState)) {
super.onRestoreInstanceState(parcelable);
return;
}
SavedState savedState = (SavedState) parcelable;
super.onRestoreInstanceState(savedState.getSuperState());
this.A = savedState;
requestLayout();
}
/* JADX WARN: Type inference failed for: r1v0, types: [android.view.View$BaseSavedState, androidx.core.widget.NestedScrollView$SavedState, android.os.Parcelable] */
@Override // android.view.View
public final Parcelable onSaveInstanceState() {
?? baseSavedState = new View.BaseSavedState(super.onSaveInstanceState());
baseSavedState.f860c = getScrollY();
return baseSavedState;
}
@Override // android.view.View
public final void onScrollChanged(int i, int i2, int i3, int i4) {
super.onScrollChanged(i, i2, i3, i4);
OnScrollChangeListener onScrollChangeListener = this.E;
if (onScrollChangeListener != null) {
onScrollChangeListener.a(this, i2);
}
}
@Override // android.view.View
public void onSizeChanged(int i, int i2, int i3, int i4) {
super.onSizeChanged(i, i2, i3, i4);
View findFocus = findFocus();
if (findFocus != null && this != findFocus && g(findFocus, 0, i4)) {
Rect rect = this.g;
findFocus.getDrawingRect(rect);
offsetDescendantRectToMyCoords(findFocus, rect);
int b = b(rect);
if (b != 0) {
if (this.r) {
u(0, b, false);
} else {
scrollBy(0, b);
}
}
}
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final boolean onStartNestedScroll(View view, View view2, int i) {
return l(view, view2, i, 0);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void onStopNestedScroll(View view) {
n(view, 0);
}
/* JADX WARN: Removed duplicated region for block: B:48:0x011d */
/* JADX WARN: Removed duplicated region for block: B:55:0x0133 */
/* JADX WARN: Removed duplicated region for block: B:58:0x013a */
/* JADX WARN: Removed duplicated region for block: B:59:0x013e */
/* JADX WARN: Removed duplicated region for block: B:62:0x0145 */
@Override // android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final boolean onTouchEvent(android.view.MotionEvent r20) {
/*
Method dump skipped, instructions count: 546
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.widget.NestedScrollView.onTouchEvent(android.view.MotionEvent):boolean");
}
public final boolean p(int i, int i2, int i3, int i4) {
int i5;
boolean z;
int i6;
boolean z2;
getOverScrollMode();
super.computeHorizontalScrollRange();
super.computeHorizontalScrollExtent();
computeVerticalScrollRange();
super.computeVerticalScrollExtent();
int i7 = i3 + i;
if (i2 > 0 || i2 < 0) {
i5 = 0;
z = true;
} else {
i5 = i2;
z = false;
}
if (i7 > i4) {
i6 = i4;
} else if (i7 < 0) {
i6 = 0;
} else {
i6 = i7;
z2 = false;
if (z2 && !this.C.f(1)) {
this.h.springBack(i5, i6, 0, 0, 0, getScrollRange());
}
super.scrollTo(i5, i6);
if (!z || z2) {
return true;
}
return false;
}
z2 = true;
if (z2) {
this.h.springBack(i5, i6, 0, 0, 0, getScrollRange());
}
super.scrollTo(i5, i6);
if (!z) {
}
return true;
}
public final void q(int i) {
boolean z;
if (i == 130) {
z = true;
} else {
z = false;
}
int height = getHeight();
Rect rect = this.g;
if (z) {
rect.top = getScrollY() + height;
int childCount = getChildCount();
if (childCount > 0) {
View childAt = getChildAt(childCount - 1);
int paddingBottom = getPaddingBottom() + childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin;
if (rect.top + height > paddingBottom) {
rect.top = paddingBottom - height;
}
}
} else {
int scrollY = getScrollY() - height;
rect.top = scrollY;
if (scrollY < 0) {
rect.top = 0;
}
}
int i2 = rect.top;
int i3 = height + i2;
rect.bottom = i3;
r(i, i2, i3);
}
public final boolean r(int i, int i2, int i3) {
boolean z;
int i4;
boolean z2;
boolean z3;
boolean z4;
int height = getHeight();
int scrollY = getScrollY();
int i5 = height + scrollY;
if (i == 33) {
z = true;
} else {
z = false;
}
ArrayList<View> focusables = getFocusables(2);
int size = focusables.size();
View view = null;
boolean z5 = false;
for (int i6 = 0; i6 < size; i6++) {
View view2 = focusables.get(i6);
int top = view2.getTop();
int bottom = view2.getBottom();
if (i2 < bottom && top < i3) {
if (i2 < top && bottom < i3) {
z3 = true;
} else {
z3 = false;
}
if (view == null) {
view = view2;
z5 = z3;
} else {
if ((z && top < view.getTop()) || (!z && bottom > view.getBottom())) {
z4 = true;
} else {
z4 = false;
}
if (z5) {
if (z3) {
if (!z4) {
}
view = view2;
}
} else if (z3) {
view = view2;
z5 = true;
} else {
if (!z4) {
}
view = view2;
}
}
}
}
if (view == null) {
view = this;
}
if (i2 >= scrollY && i3 <= i5) {
z2 = false;
} else {
if (z) {
i4 = i2 - scrollY;
} else {
i4 = i3 - i5;
}
s(i4, 0, 1, true);
z2 = true;
}
if (view != findFocus()) {
view.requestFocus(i);
}
return z2;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void requestChildFocus(View view, View view2) {
if (!this.l) {
Rect rect = this.g;
view2.getDrawingRect(rect);
offsetDescendantRectToMyCoords(view2, rect);
int b = b(rect);
if (b != 0) {
scrollBy(0, b);
}
} else {
this.n = view2;
}
super.requestChildFocus(view, view2);
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
boolean z2;
rect.offset(view.getLeft() - view.getScrollX(), view.getTop() - view.getScrollY());
int b = b(rect);
if (b != 0) {
z2 = true;
} else {
z2 = false;
}
if (z2) {
if (z) {
scrollBy(0, b);
return z2;
}
u(0, b, false);
}
return z2;
}
@Override // android.view.ViewGroup, android.view.ViewParent
public final void requestDisallowInterceptTouchEvent(boolean z) {
VelocityTracker velocityTracker;
if (z && (velocityTracker = this.p) != null) {
velocityTracker.recycle();
this.p = null;
}
super.requestDisallowInterceptTouchEvent(z);
}
@Override // android.view.View, android.view.ViewParent
public final void requestLayout() {
this.l = true;
super.requestLayout();
}
public final int s(int i, int i2, int i3, boolean z) {
int i4;
int i5;
boolean z2;
boolean z3;
boolean z4;
VelocityTracker velocityTracker;
if (i3 == 1) {
v(2, i3);
}
boolean c2 = this.C.c(this.x, this.w, 0, i, i3);
int[] iArr = this.w;
int[] iArr2 = this.x;
if (c2) {
i4 = i - iArr2[1];
i5 = iArr[1];
} else {
i4 = i;
i5 = 0;
}
int scrollY = getScrollY();
int scrollRange = getScrollRange();
int overScrollMode = getOverScrollMode();
if ((overScrollMode == 0 || (overScrollMode == 1 && getScrollRange() > 0)) && !z) {
z2 = true;
} else {
z2 = false;
}
if (p(i4, 0, scrollY, scrollRange) && !this.C.f(i3)) {
z3 = true;
} else {
z3 = false;
}
int scrollY2 = getScrollY() - scrollY;
iArr2[1] = 0;
this.C.d(0, scrollY2, 0, i4 - scrollY2, this.w, i3, iArr2);
int i6 = i5 + iArr[1];
int i7 = i4 - iArr2[1];
int i8 = scrollY + i7;
EdgeEffect edgeEffect = this.j;
EdgeEffect edgeEffect2 = this.i;
if (i8 < 0) {
if (z2) {
EdgeEffectCompat.b(edgeEffect2, (-i7) / getHeight(), i2 / getWidth());
if (!edgeEffect.isFinished()) {
edgeEffect.onRelease();
}
}
} else if (i8 > scrollRange && z2) {
EdgeEffectCompat.b(edgeEffect, i7 / getHeight(), 1.0f - (i2 / getWidth()));
if (!edgeEffect2.isFinished()) {
edgeEffect2.onRelease();
}
}
if (edgeEffect2.isFinished() && edgeEffect.isFinished()) {
z4 = z3;
} else {
postInvalidateOnAnimation();
z4 = false;
}
if (z4 && i3 == 0 && (velocityTracker = this.p) != null) {
velocityTracker.clear();
}
if (i3 == 1) {
x(i3);
edgeEffect2.onRelease();
edgeEffect.onRelease();
}
return i6;
}
@Override // android.view.View
public final void scrollTo(int i, int i2) {
if (getChildCount() > 0) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int width = (getWidth() - getPaddingLeft()) - getPaddingRight();
int width2 = childAt.getWidth() + layoutParams.leftMargin + layoutParams.rightMargin;
int height = (getHeight() - getPaddingTop()) - getPaddingBottom();
int height2 = childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
if (width < width2 && i >= 0) {
if (width + i > width2) {
i = width2 - width;
}
} else {
i = 0;
}
if (height < height2 && i2 >= 0) {
if (height + i2 > height2) {
i2 = height2 - height;
}
} else {
i2 = 0;
}
if (i != getScrollX() || i2 != getScrollY()) {
super.scrollTo(i, i2);
}
}
}
public void setFillViewport(boolean z) {
if (z != this.q) {
this.q = z;
requestLayout();
}
}
@Override // android.view.View
public void setNestedScrollingEnabled(boolean z) {
this.C.g(z);
}
public void setOnScrollChangeListener(@Nullable OnScrollChangeListener onScrollChangeListener) {
this.E = onScrollChangeListener;
}
public void setSmoothScrollingEnabled(boolean z) {
this.r = z;
}
@Override // android.widget.FrameLayout, android.view.ViewGroup
public final boolean shouldDelayChildPressedState() {
return true;
}
@Override // android.view.View
public final boolean startNestedScroll(int i) {
return this.C.h(i, 0);
}
@Override // android.view.View
public final void stopNestedScroll() {
x(0);
}
public final boolean t(EdgeEffect edgeEffect, int i) {
if (i > 0) {
return true;
}
float a2 = EdgeEffectCompat.a(edgeEffect) * getHeight();
float abs = Math.abs(-i) * 0.35f;
float f = this.f858c * 0.015f;
double log = Math.log(abs / f);
double d = G;
if (((float) (Math.exp((d / (d - 1.0d)) * log) * f)) < a2) {
return true;
}
return false;
}
public final void u(int i, int i2, boolean z) {
if (getChildCount() == 0) {
return;
}
if (AnimationUtils.currentAnimationTimeMillis() - this.f > 250) {
View childAt = getChildAt(0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
int height = childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
int height2 = (getHeight() - getPaddingTop()) - getPaddingBottom();
int scrollY = getScrollY();
int max = Math.max(0, Math.min(i2 + scrollY, Math.max(0, height - height2))) - scrollY;
this.h.startScroll(getScrollX(), scrollY, 0, max, 250);
if (z) {
v(2, 1);
} else {
x(1);
}
this.z = getScrollY();
postInvalidateOnAnimation();
} else {
if (!this.h.isFinished()) {
this.h.abortAnimation();
x(1);
}
scrollBy(i, i2);
}
this.f = AnimationUtils.currentAnimationTimeMillis();
}
public final void v(int i, int i2) {
this.C.h(2, i2);
}
public final boolean w(MotionEvent motionEvent) {
boolean z;
EdgeEffect edgeEffect = this.i;
if (EdgeEffectCompat.a(edgeEffect) != 0.0f) {
EdgeEffectCompat.b(edgeEffect, 0.0f, motionEvent.getX() / getWidth());
z = true;
} else {
z = false;
}
EdgeEffect edgeEffect2 = this.j;
if (EdgeEffectCompat.a(edgeEffect2) != 0.0f) {
EdgeEffectCompat.b(edgeEffect2, 0.0f, 1.0f - (motionEvent.getX() / getWidth()));
return true;
}
return z;
}
public final void x(int i) {
this.C.i(i);
}
@Override // android.view.ViewGroup
public final void addView(View view, int i) {
if (getChildCount() <= 0) {
super.addView(view, i);
return;
}
throw new IllegalStateException("ScrollView can host only one direct child");
}
@Override // android.view.ViewGroup, android.view.ViewManager
public final void addView(View view, ViewGroup.LayoutParams layoutParams) {
if (getChildCount() <= 0) {
super.addView(view, layoutParams);
return;
}
throw new IllegalStateException("ScrollView can host only one direct child");
}
@Override // android.view.ViewGroup
public final void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (getChildCount() <= 0) {
super.addView(view, i, layoutParams);
return;
}
throw new IllegalStateException("ScrollView can host only one direct child");
}
}