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.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.appcompat.app.AlertController;
import java.util.ArrayList;
import p037.p041.p042.C1482;
import p037.p065.p078.C1905;
import p037.p065.p078.C1914;
import p037.p065.p078.C1917;
import p037.p065.p078.C1920;
import p037.p065.p078.InterfaceC1913;
import p037.p065.p078.InterfaceC1916;
import p037.p065.p078.p079.C1947;
import p138.p139.p143.p144.C2803;

/* JADX INFO: loaded from: classes.dex */
public class NestedScrollView extends FrameLayout implements InterfaceC1916, InterfaceC1913 {

    /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
    public static final C0081 f602 = new C0081();

    /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
    public static final int[] f603 = {R.attr.fillViewport};

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public long f604;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final Rect f605;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public OverScroller f606;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public EdgeEffect f607;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public EdgeEffect f608;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public int f609;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public boolean f610;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public boolean f611;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public View f612;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public boolean f613;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public VelocityTracker f614;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public boolean f615;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public boolean f616;

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public int f617;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public int f618;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public int f619;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public int f620;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public final int[] f621;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public final int[] f622;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public int f623;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public int f624;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public C0083 f625;

    /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
    public final C1917 f626;

    /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
    public final C1914 f627;

    /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
    public float f628;

    /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
    public InterfaceC0082 f629;

    /* JADX INFO: renamed from: androidx.core.widget.NestedScrollView$֏, reason: contains not printable characters */
    public static class C0081 extends C1905 {
        @Override // p037.p065.p078.C1905
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo255(View view, C1947 c1947) {
            int scrollRange;
            this.f6348.onInitializeAccessibilityNodeInfo(view, c1947.f6407);
            NestedScrollView nestedScrollView = (NestedScrollView) view;
            c1947.f6407.setClassName(ScrollView.class.getName());
            if (!nestedScrollView.isEnabled() || (scrollRange = nestedScrollView.getScrollRange()) <= 0) {
                return;
            }
            c1947.f6407.setScrollable(true);
            if (nestedScrollView.getScrollY() > 0) {
                c1947.m3819(C1947.C1948.f6411);
                c1947.m3819(C1947.C1948.f6412);
            }
            if (nestedScrollView.getScrollY() < scrollRange) {
                c1947.m3819(C1947.C1948.f6410);
                c1947.m3819(C1947.C1948.f6414);
            }
        }

        @Override // p037.p065.p078.C1905
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public boolean mo256(View view, int i, Bundle bundle) {
            if (super.mo256(view, i, bundle)) {
                return true;
            }
            NestedScrollView nestedScrollView = (NestedScrollView) view;
            if (!nestedScrollView.isEnabled()) {
                return false;
            }
            if (i != 4096) {
                if (i == 8192 || i == 16908344) {
                    int iMax = Math.max(nestedScrollView.getScrollY() - ((nestedScrollView.getHeight() - nestedScrollView.getPaddingBottom()) - nestedScrollView.getPaddingTop()), 0);
                    if (iMax == nestedScrollView.getScrollY()) {
                        return false;
                    }
                    nestedScrollView.m236(0 - nestedScrollView.getScrollX(), iMax - nestedScrollView.getScrollY(), 250, true);
                    return true;
                }
                if (i != 16908346) {
                    return false;
                }
            }
            int iMin = Math.min(nestedScrollView.getScrollY() + ((nestedScrollView.getHeight() - nestedScrollView.getPaddingBottom()) - nestedScrollView.getPaddingTop()), nestedScrollView.getScrollRange());
            if (iMin == nestedScrollView.getScrollY()) {
                return false;
            }
            nestedScrollView.m236(0 - nestedScrollView.getScrollX(), iMin - nestedScrollView.getScrollY(), 250, true);
            return true;
        }

        @Override // p037.p065.p078.C1905
        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public void mo257(View view, AccessibilityEvent accessibilityEvent) {
            this.f6348.onInitializeAccessibilityEvent(view, accessibilityEvent);
            NestedScrollView nestedScrollView = (NestedScrollView) view;
            accessibilityEvent.setClassName(ScrollView.class.getName());
            accessibilityEvent.setScrollable(nestedScrollView.getScrollRange() > 0);
            accessibilityEvent.setScrollX(nestedScrollView.getScrollX());
            accessibilityEvent.setScrollY(nestedScrollView.getScrollY());
            accessibilityEvent.setMaxScrollX(nestedScrollView.getScrollX());
            accessibilityEvent.setMaxScrollY(nestedScrollView.getScrollRange());
        }
    }

    /* JADX INFO: renamed from: androidx.core.widget.NestedScrollView$ؠ, reason: contains not printable characters */
    public interface InterfaceC0082 {
    }

    /* JADX INFO: renamed from: androidx.core.widget.NestedScrollView$ހ, reason: contains not printable characters */
    public static class C0083 extends View.BaseSavedState {
        public static final Parcelable.Creator<C0083> CREATOR = new C0084();

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public int f630;

        /* JADX INFO: renamed from: androidx.core.widget.NestedScrollView$ހ$֏, reason: contains not printable characters */
        public class C0084 implements Parcelable.Creator<C0083> {
            @Override // android.os.Parcelable.Creator
            public C0083 createFromParcel(Parcel parcel) {
                return new C0083(parcel);
            }

            @Override // android.os.Parcelable.Creator
            public C0083[] newArray(int i) {
                return new C0083[i];
            }
        }

        public C0083(Parcel parcel) {
            super(parcel);
            this.f630 = parcel.readInt();
        }

        public C0083(Parcelable parcelable) {
            super(parcelable);
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("HorizontalScrollView.SavedState{");
            sbM4889.append(Integer.toHexString(System.identityHashCode(this)));
            sbM4889.append(" scrollPosition=");
            return C2803.m4882(sbM4889, this.f630, "}");
        }

        @Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
        public void writeToParcel(Parcel parcel, int i) {
            super.writeToParcel(parcel, i);
            parcel.writeInt(this.f630);
        }
    }

    public NestedScrollView(Context context) {
        this(context, null);
    }

    public NestedScrollView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public NestedScrollView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f605 = new Rect();
        this.f610 = true;
        this.f611 = false;
        this.f612 = null;
        this.f613 = false;
        this.f616 = true;
        this.f620 = -1;
        this.f621 = new int[2];
        this.f622 = new int[2];
        this.f606 = new OverScroller(getContext());
        setFocusable(true);
        setDescendantFocusability(262144);
        setWillNotDraw(false);
        ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
        this.f617 = viewConfiguration.getScaledTouchSlop();
        this.f618 = viewConfiguration.getScaledMinimumFlingVelocity();
        this.f619 = viewConfiguration.getScaledMaximumFlingVelocity();
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, f603, i, 0);
        setFillViewport(typedArrayObtainStyledAttributes.getBoolean(0, false));
        typedArrayObtainStyledAttributes.recycle();
        this.f626 = new C1917();
        this.f627 = new C1914(this);
        setNestedScrollingEnabled(true);
        C1920.m3748(this, f602);
    }

    private float getVerticalScrollFactorCompat() {
        if (this.f628 == 0.0f) {
            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.f628 = typedValue.getDimension(context.getResources().getDisplayMetrics());
        }
        return this.f628;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static boolean m232(View view, View view2) {
        if (view == view2) {
            return true;
        }
        Object parent = view.getParent();
        return (parent instanceof ViewGroup) && m232((View) parent, view2);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static int m233(int i, int i2, int i3) {
        if (i2 >= i3 || i < 0) {
            return 0;
        }
        return i2 + i > i3 ? i3 - i2 : i;
    }

    @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
    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);
    }

    @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.View
    public int computeHorizontalScrollExtent() {
        return super.computeHorizontalScrollExtent();
    }

    @Override // android.view.View
    public int computeHorizontalScrollOffset() {
        return super.computeHorizontalScrollOffset();
    }

    @Override // android.view.View
    public int computeHorizontalScrollRange() {
        return super.computeHorizontalScrollRange();
    }

    @Override // android.view.View
    public void computeScroll() {
        if (this.f606.isFinished()) {
            return;
        }
        this.f606.computeScrollOffset();
        int currY = this.f606.getCurrY();
        int i = currY - this.f624;
        this.f624 = currY;
        int[] iArr = this.f622;
        boolean z = false;
        iArr[1] = 0;
        m245(0, i, iArr, (int[]) null, 1);
        int i2 = i - this.f622[1];
        int scrollRange = getScrollRange();
        if (i2 != 0) {
            int scrollY = getScrollY();
            m244(0, i2, getScrollX(), scrollY, 0, scrollRange, 0, 0);
            int scrollY2 = getScrollY() - scrollY;
            int i3 = i2 - scrollY2;
            int[] iArr2 = this.f622;
            iArr2[1] = 0;
            this.f627.m3732(0, scrollY2, 0, i3, this.f621, 1, iArr2);
            i2 = i3 - this.f622[1];
        }
        if (i2 != 0) {
            int overScrollMode = getOverScrollMode();
            if (overScrollMode == 0 || (overScrollMode == 1 && scrollRange > 0)) {
                z = true;
            }
            if (z) {
                m250();
                if (i2 < 0) {
                    if (this.f607.isFinished()) {
                        this.f607.onAbsorb((int) this.f606.getCurrVelocity());
                    }
                } else if (this.f608.isFinished()) {
                    this.f608.onAbsorb((int) this.f606.getCurrVelocity());
                }
            }
            m235();
        }
        if (this.f606.isFinished()) {
            this.f627.m3733(1);
        } else {
            C1920.m3772(this);
        }
    }

    @Override // android.view.View
    public int computeVerticalScrollExtent() {
        return super.computeVerticalScrollExtent();
    }

    @Override // android.view.View
    public int computeVerticalScrollOffset() {
        return Math.max(0, super.computeVerticalScrollOffset());
    }

    @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() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin;
        int scrollY = getScrollY();
        int iMax = Math.max(0, bottom - height);
        return scrollY < 0 ? bottom - scrollY : scrollY > iMax ? bottom + (scrollY - iMax) : bottom;
    }

    @Override // android.view.ViewGroup, android.view.View
    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        return super.dispatchKeyEvent(keyEvent) || m246(keyEvent);
    }

    @Override // android.view.View
    public boolean dispatchNestedFling(float f, float f2, boolean z) {
        return this.f627.m3727(f, f2, z);
    }

    @Override // android.view.View
    public boolean dispatchNestedPreFling(float f, float f2) {
        return this.f627.m3726(f, f2);
    }

    @Override // android.view.View
    public boolean dispatchNestedPreScroll(int i, int i2, int[] iArr, int[] iArr2) {
        return m245(i, i2, iArr, iArr2, 0);
    }

    @Override // android.view.View
    public boolean dispatchNestedScroll(int i, int i2, int i3, int i4, int[] iArr) {
        return this.f627.m3729(i, i2, i3, i4, iArr);
    }

    @Override // android.view.View
    public void draw(Canvas canvas) {
        int paddingLeft;
        super.draw(canvas);
        if (this.f607 != null) {
            int scrollY = getScrollY();
            int paddingLeft2 = 0;
            if (!this.f607.isFinished()) {
                int iSave = canvas.save();
                int width = getWidth();
                int height = getHeight();
                int iMin = Math.min(0, scrollY);
                if (getClipToPadding()) {
                    width -= getPaddingRight() + getPaddingLeft();
                    paddingLeft = getPaddingLeft() + 0;
                } else {
                    paddingLeft = 0;
                }
                if (getClipToPadding()) {
                    height -= getPaddingBottom() + getPaddingTop();
                    iMin += getPaddingTop();
                }
                canvas.translate(paddingLeft, iMin);
                this.f607.setSize(width, height);
                if (this.f607.draw(canvas)) {
                    C1920.m3772(this);
                }
                canvas.restoreToCount(iSave);
            }
            if (this.f608.isFinished()) {
                return;
            }
            int iSave2 = canvas.save();
            int width2 = getWidth();
            int height2 = getHeight();
            int iMax = Math.max(getScrollRange(), scrollY) + height2;
            if (getClipToPadding()) {
                width2 -= getPaddingRight() + getPaddingLeft();
                paddingLeft2 = 0 + getPaddingLeft();
            }
            if (getClipToPadding()) {
                height2 -= getPaddingBottom() + getPaddingTop();
                iMax -= getPaddingBottom();
            }
            canvas.translate(paddingLeft2 - width2, iMax);
            canvas.rotate(180.0f, width2, 0.0f);
            this.f608.setSize(width2, height2);
            if (this.f608.draw(canvas)) {
                C1920.m3772(this);
            }
            canvas.restoreToCount(iSave2);
        }
    }

    @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() {
        C1917 c1917 = this.f626;
        return c1917.f6363 | c1917.f6362;
    }

    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;
    }

    @Override // android.view.View
    public boolean hasNestedScrollingParent() {
        return m254(0);
    }

    @Override // android.view.View
    public boolean isNestedScrollingEnabled() {
        return this.f627.f6360;
    }

    @Override // android.view.ViewGroup
    public void measureChild(View view, int i, int i2) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        view.measure(FrameLayout.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft(), layoutParams.width), View.MeasureSpec.makeMeasureSpec(0, 0));
    }

    @Override // android.view.ViewGroup
    public void measureChildWithMargins(View view, int i, int i2, int i3, int i4) {
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
        view.measure(FrameLayout.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft() + marginLayoutParams.leftMargin + marginLayoutParams.rightMargin + i2, marginLayoutParams.width), View.MeasureSpec.makeMeasureSpec(marginLayoutParams.topMargin + marginLayoutParams.bottomMargin, 0));
    }

    @Override // android.view.ViewGroup, android.view.View
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        this.f611 = false;
    }

    @Override // android.view.View
    public boolean onGenericMotionEvent(MotionEvent motionEvent) {
        if ((motionEvent.getSource() & 2) != 0 && motionEvent.getAction() == 8 && !this.f613) {
            float axisValue = motionEvent.getAxisValue(9);
            if (axisValue != 0.0f) {
                int verticalScrollFactorCompat = (int) (axisValue * getVerticalScrollFactorCompat());
                int scrollRange = getScrollRange();
                int scrollY = getScrollY();
                int i = scrollY - verticalScrollFactorCompat;
                if (i < 0) {
                    scrollRange = 0;
                } else if (i <= scrollRange) {
                    scrollRange = i;
                }
                if (scrollRange != scrollY) {
                    super.scrollTo(getScrollX(), scrollRange);
                    return true;
                }
            }
        }
        return false;
    }

    /* JADX WARN: Removed duplicated region for block: B:34:0x0085  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00e0  */
    @Override // android.view.ViewGroup
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        int action = motionEvent.getAction();
        if (action == 2 && this.f613) {
            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);
                boolean z = y >= childAt.getTop() - scrollY && y < childAt.getBottom() - scrollY && x >= childAt.getLeft() && x < childAt.getRight();
                if (z) {
                    this.f609 = y;
                    this.f620 = motionEvent.getPointerId(0);
                    VelocityTracker velocityTracker = this.f614;
                    if (velocityTracker == null) {
                        this.f614 = VelocityTracker.obtain();
                    } else {
                        velocityTracker.clear();
                    }
                    this.f614.addMovement(motionEvent);
                    this.f606.computeScrollOffset();
                    this.f613 = !this.f606.isFinished();
                    m242(2, 0);
                } else {
                    this.f613 = false;
                    m252();
                }
            }
        } else if (i == 1) {
            this.f613 = false;
            this.f620 = -1;
            m252();
            if (this.f606.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                C1920.m3772(this);
            }
            this.f627.m3733(0);
        } else if (i == 2) {
            int i2 = this.f620;
            if (i2 != -1) {
                int iFindPointerIndex = motionEvent.findPointerIndex(i2);
                if (iFindPointerIndex == -1) {
                    Log.e("NestedScrollView", "Invalid pointerId=" + i2 + " in onInterceptTouchEvent");
                } else {
                    int y2 = (int) motionEvent.getY(iFindPointerIndex);
                    if (Math.abs(y2 - this.f609) > this.f617 && (2 & getNestedScrollAxes()) == 0) {
                        this.f613 = true;
                        this.f609 = y2;
                        if (this.f614 == null) {
                            this.f614 = VelocityTracker.obtain();
                        }
                        this.f614.addMovement(motionEvent);
                        this.f623 = 0;
                        ViewParent parent = getParent();
                        if (parent != null) {
                            parent.requestDisallowInterceptTouchEvent(true);
                        }
                    }
                }
            }
        } else if (i != 3) {
            if (i == 6) {
                m238(motionEvent);
            }
        }
        return this.f613;
    }

    @Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        super.onLayout(z, i, i2, i3, i4);
        int measuredHeight = 0;
        this.f610 = false;
        View view = this.f612;
        if (view != null && m232(view, this)) {
            m239(this.f612);
        }
        this.f612 = null;
        if (!this.f611) {
            if (this.f625 != null) {
                scrollTo(getScrollX(), this.f625.f630);
                this.f625 = null;
            }
            if (getChildCount() > 0) {
                View childAt = getChildAt(0);
                FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
                measuredHeight = childAt.getMeasuredHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
            }
            int paddingTop = ((i4 - i2) - getPaddingTop()) - getPaddingBottom();
            int scrollY = getScrollY();
            int iM233 = m233(scrollY, paddingTop, measuredHeight);
            if (iM233 != scrollY) {
                scrollTo(getScrollX(), iM233);
            }
        }
        scrollTo(getScrollX(), getScrollY());
        this.f611 = true;
    }

    @Override // android.widget.FrameLayout, android.view.View
    public void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        if (this.f615 && 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(FrameLayout.getChildMeasureSpec(i, getPaddingRight() + getPaddingLeft() + layoutParams.leftMargin + layoutParams.rightMargin, layoutParams.width), View.MeasureSpec.makeMeasureSpec(measuredHeight2, 1073741824));
            }
        }
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public boolean onNestedFling(View view, float f, float f2, boolean z) {
        if (z) {
            return false;
        }
        dispatchNestedFling(0.0f, f2, true);
        m251((int) f2);
        return true;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public boolean onNestedPreFling(View view, float f, float f2) {
        return this.f627.m3726(f, f2);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void onNestedPreScroll(View view, int i, int i2, int[] iArr) {
        m245(i, i2, iArr, (int[]) null, 0);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void onNestedScroll(View view, int i, int i2, int i3, int i4) {
        m237(i4, 0, (int[]) null);
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void onNestedScrollAccepted(View view, View view2, int i) {
        this.f626.f6362 = i;
        m242(2, 0);
    }

    @Override // android.view.View
    public void onOverScrolled(int i, int i2, boolean z, boolean z2) {
        super.scrollTo(i, i2);
    }

    @Override // android.view.ViewGroup
    public boolean onRequestFocusInDescendants(int i, Rect rect) {
        if (i == 2) {
            i = 130;
        } else if (i == 1) {
            i = 33;
        }
        View viewFindNextFocus = rect == null ? FocusFinder.getInstance().findNextFocus(this, null, i) : FocusFinder.getInstance().findNextFocusFromRect(this, rect, i);
        if (viewFindNextFocus == null || (true ^ m247(viewFindNextFocus, 0, getHeight()))) {
            return false;
        }
        return viewFindNextFocus.requestFocus(i, rect);
    }

    @Override // android.view.View
    public void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof C0083)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        C0083 c0083 = (C0083) parcelable;
        super.onRestoreInstanceState(c0083.getSuperState());
        this.f625 = c0083;
        requestLayout();
    }

    @Override // android.view.View
    public Parcelable onSaveInstanceState() {
        C0083 c0083 = new C0083(super.onSaveInstanceState());
        c0083.f630 = getScrollY();
        return c0083;
    }

    @Override // android.view.View
    public void onScrollChanged(int i, int i2, int i3, int i4) {
        super.onScrollChanged(i, i2, i3, i4);
        InterfaceC0082 interfaceC0082 = this.f629;
        if (interfaceC0082 != null) {
            C1482 c1482 = (C1482) interfaceC0082;
            AlertController.m97(this, c1482.f4654, c1482.f4655);
        }
    }

    @Override // android.view.View
    public void onSizeChanged(int i, int i2, int i3, int i4) {
        super.onSizeChanged(i, i2, i3, i4);
        View viewFindFocus = findFocus();
        if (viewFindFocus == null || this == viewFindFocus || !m247(viewFindFocus, 0, i4)) {
            return;
        }
        viewFindFocus.getDrawingRect(this.f605);
        offsetDescendantRectToMyCoords(viewFindFocus, this.f605);
        m249(m234(this.f605));
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public boolean onStartNestedScroll(View view, View view2, int i) {
        return (i & 2) != 0;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void onStopNestedScroll(View view) {
        this.f626.f6362 = 0;
        this.f627.m3733(0);
    }

    @Override // android.view.View
    public boolean onTouchEvent(MotionEvent motionEvent) {
        ViewParent parent;
        if (this.f614 == null) {
            this.f614 = VelocityTracker.obtain();
        }
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 0) {
            this.f623 = 0;
        }
        MotionEvent motionEventObtain = MotionEvent.obtain(motionEvent);
        motionEventObtain.offsetLocation(0.0f, this.f623);
        if (actionMasked != 0) {
            if (actionMasked == 1) {
                VelocityTracker velocityTracker = this.f614;
                velocityTracker.computeCurrentVelocity(1000, this.f619);
                int yVelocity = (int) velocityTracker.getYVelocity(this.f620);
                if (Math.abs(yVelocity) >= this.f618) {
                    int i = -yVelocity;
                    float f = i;
                    if (!dispatchNestedPreFling(0.0f, f)) {
                        dispatchNestedFling(0.0f, f, true);
                        m251(i);
                    }
                } else if (this.f606.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                    C1920.m3772(this);
                }
                this.f620 = -1;
                m248();
            } else if (actionMasked == 2) {
                int iFindPointerIndex = motionEvent.findPointerIndex(this.f620);
                if (iFindPointerIndex == -1) {
                    StringBuilder sbM4889 = C2803.m4889("Invalid pointerId=");
                    sbM4889.append(this.f620);
                    sbM4889.append(" in onTouchEvent");
                    Log.e("NestedScrollView", sbM4889.toString());
                } else {
                    int y = (int) motionEvent.getY(iFindPointerIndex);
                    int i2 = this.f609 - y;
                    if (!this.f613 && Math.abs(i2) > this.f617) {
                        ViewParent parent2 = getParent();
                        if (parent2 != null) {
                            parent2.requestDisallowInterceptTouchEvent(true);
                        }
                        this.f613 = true;
                        i2 = i2 > 0 ? i2 - this.f617 : i2 + this.f617;
                    }
                    int i3 = i2;
                    if (this.f613) {
                        if (m245(0, i3, this.f622, this.f621, 0)) {
                            i3 -= this.f622[1];
                            this.f623 += this.f621[1];
                        }
                        int i4 = i3;
                        this.f609 = y - this.f621[1];
                        int scrollY = getScrollY();
                        int scrollRange = getScrollRange();
                        int overScrollMode = getOverScrollMode();
                        boolean z = overScrollMode == 0 || (overScrollMode == 1 && scrollRange > 0);
                        if (m244(0, i4, 0, getScrollY(), 0, scrollRange, 0, 0) && !m254(0)) {
                            this.f614.clear();
                        }
                        int scrollY2 = getScrollY() - scrollY;
                        int[] iArr = this.f622;
                        iArr[1] = 0;
                        this.f627.m3732(0, scrollY2, 0, i4 - scrollY2, this.f621, 0, iArr);
                        int i5 = this.f609;
                        int[] iArr2 = this.f621;
                        this.f609 = i5 - iArr2[1];
                        this.f623 += iArr2[1];
                        if (z) {
                            int i6 = i4 - this.f622[1];
                            m250();
                            int i7 = scrollY + i6;
                            if (i7 < 0) {
                                this.f607.onPull(i6 / getHeight(), motionEvent.getX(iFindPointerIndex) / getWidth());
                                if (!this.f608.isFinished()) {
                                    this.f608.onRelease();
                                }
                            } else if (i7 > scrollRange) {
                                this.f608.onPull(i6 / getHeight(), 1.0f - (motionEvent.getX(iFindPointerIndex) / getWidth()));
                                if (!this.f607.isFinished()) {
                                    this.f607.onRelease();
                                }
                            }
                            EdgeEffect edgeEffect = this.f607;
                            if (edgeEffect != null && (!edgeEffect.isFinished() || !this.f608.isFinished())) {
                                C1920.m3772(this);
                            }
                        }
                    }
                }
            } else if (actionMasked == 3) {
                if (this.f613 && getChildCount() > 0 && this.f606.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                    C1920.m3772(this);
                }
                this.f620 = -1;
                m248();
            } else if (actionMasked == 5) {
                int actionIndex = motionEvent.getActionIndex();
                this.f609 = (int) motionEvent.getY(actionIndex);
                this.f620 = motionEvent.getPointerId(actionIndex);
            } else if (actionMasked == 6) {
                m238(motionEvent);
                this.f609 = (int) motionEvent.getY(motionEvent.findPointerIndex(this.f620));
            }
        } else {
            if (getChildCount() == 0) {
                return false;
            }
            boolean z2 = !this.f606.isFinished();
            this.f613 = z2;
            if (z2 && (parent = getParent()) != null) {
                parent.requestDisallowInterceptTouchEvent(true);
            }
            if (!this.f606.isFinished()) {
                m235();
            }
            this.f609 = (int) motionEvent.getY();
            this.f620 = motionEvent.getPointerId(0);
            m242(2, 0);
        }
        VelocityTracker velocityTracker2 = this.f614;
        if (velocityTracker2 != null) {
            velocityTracker2.addMovement(motionEventObtain);
        }
        motionEventObtain.recycle();
        return true;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void requestChildFocus(View view, View view2) {
        if (this.f610) {
            this.f612 = view2;
        } else {
            m239(view2);
        }
        super.requestChildFocus(view, view2);
    }

    @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 iM234 = m234(rect);
        boolean z2 = iM234 != 0;
        if (z2) {
            if (z) {
                scrollBy(0, iM234);
            } else {
                m236(0, iM234, 250, false);
            }
        }
        return z2;
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void requestDisallowInterceptTouchEvent(boolean z) {
        if (z) {
            m252();
        }
        super.requestDisallowInterceptTouchEvent(z);
    }

    @Override // android.view.View, android.view.ViewParent
    public void requestLayout() {
        this.f610 = true;
        super.requestLayout();
    }

    @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() - getPaddingLeft()) - getPaddingRight();
            int width2 = childAt.getWidth() + layoutParams.leftMargin + layoutParams.rightMargin;
            int height = (getHeight() - getPaddingTop()) - getPaddingBottom();
            int height2 = childAt.getHeight() + layoutParams.topMargin + layoutParams.bottomMargin;
            int iM233 = m233(i, width, width2);
            int iM2332 = m233(i2, height, height2);
            if (iM233 == getScrollX() && iM2332 == getScrollY()) {
                return;
            }
            super.scrollTo(iM233, iM2332);
        }
    }

    public void setFillViewport(boolean z) {
        if (z != this.f615) {
            this.f615 = z;
            requestLayout();
        }
    }

    @Override // android.view.View
    public void setNestedScrollingEnabled(boolean z) {
        C1914 c1914 = this.f627;
        if (c1914.f6360) {
            C1920.m3774(c1914.f6359);
        }
        c1914.f6360 = z;
    }

    public void setOnScrollChangeListener(InterfaceC0082 interfaceC0082) {
        this.f629 = interfaceC0082;
    }

    public void setSmoothScrollingEnabled(boolean z) {
        this.f616 = z;
    }

    @Override // android.widget.FrameLayout, android.view.ViewGroup
    public boolean shouldDelayChildPressedState() {
        return true;
    }

    @Override // android.view.View
    public boolean startNestedScroll(int i) {
        return this.f627.m3728(i, 0);
    }

    @Override // android.view.View
    public void stopNestedScroll() {
        this.f627.m3733(0);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public int m234(Rect rect) {
        if (getChildCount() == 0) {
            return 0;
        }
        int height = getHeight();
        int scrollY = getScrollY();
        int i = scrollY + height;
        int verticalFadingEdgeLength = getVerticalFadingEdgeLength();
        if (rect.top > 0) {
            scrollY += verticalFadingEdgeLength;
        }
        View childAt = getChildAt(0);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
        int i2 = rect.bottom < (childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin ? i - verticalFadingEdgeLength : i;
        if (rect.bottom > i2 && rect.top > scrollY) {
            return Math.min((rect.height() > height ? rect.top - scrollY : rect.bottom - i2) + 0, (childAt.getBottom() + layoutParams.bottomMargin) - i);
        }
        if (rect.top >= scrollY || rect.bottom >= i2) {
            return 0;
        }
        return Math.max(rect.height() > height ? 0 - (i2 - rect.bottom) : 0 - (scrollY - rect.top), -getScrollY());
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m235() {
        this.f606.abortAnimation();
        this.f627.m3733(1);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m236(int i, int i2, int i3, boolean z) {
        if (getChildCount() == 0) {
            return;
        }
        if (AnimationUtils.currentAnimationTimeMillis() - this.f604 > 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();
            this.f606.startScroll(getScrollX(), scrollY, 0, Math.max(0, Math.min(i2 + scrollY, Math.max(0, height - height2))) - scrollY, i3);
            m240(z);
        } else {
            if (!this.f606.isFinished()) {
                m235();
            }
            scrollBy(i, i2);
        }
        this.f604 = AnimationUtils.currentAnimationTimeMillis();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m237(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.f627.m3725(0, scrollY2, 0, i - scrollY2, null, i2, iArr);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m238(MotionEvent motionEvent) {
        int actionIndex = motionEvent.getActionIndex();
        if (motionEvent.getPointerId(actionIndex) == this.f620) {
            int i = actionIndex == 0 ? 1 : 0;
            this.f609 = (int) motionEvent.getY(i);
            this.f620 = motionEvent.getPointerId(i);
            VelocityTracker velocityTracker = this.f614;
            if (velocityTracker != null) {
                velocityTracker.clear();
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m239(View view) {
        view.getDrawingRect(this.f605);
        offsetDescendantRectToMyCoords(view, this.f605);
        int iM234 = m234(this.f605);
        if (iM234 != 0) {
            scrollBy(0, iM234);
        }
    }

    @Override // p037.p065.p078.InterfaceC1915
    /* JADX INFO: renamed from: ֏ */
    public void mo125(View view, int i) {
        C1917 c1917 = this.f626;
        if (i == 1) {
            c1917.f6363 = 0;
        } else {
            c1917.f6362 = 0;
        }
        this.f627.m3733(i);
    }

    @Override // p037.p065.p078.InterfaceC1915
    /* JADX INFO: renamed from: ֏ */
    public void mo126(View view, int i, int i2, int i3, int i4, int i5) {
        m237(i4, i5, (int[]) null);
    }

    @Override // p037.p065.p078.InterfaceC1916
    /* JADX INFO: renamed from: ֏ */
    public void mo127(View view, int i, int i2, int i3, int i4, int i5, int[] iArr) {
        m237(i4, i5, iArr);
    }

    @Override // p037.p065.p078.InterfaceC1915
    /* JADX INFO: renamed from: ֏ */
    public void mo128(View view, int i, int i2, int[] iArr, int i3) {
        m245(i, i2, iArr, (int[]) null, i3);
    }

    @Override // p037.p065.p078.InterfaceC1915
    /* JADX INFO: renamed from: ֏ */
    public void mo129(View view, View view2, int i, int i2) {
        C1917 c1917 = this.f626;
        if (i2 == 1) {
            c1917.f6363 = i;
        } else {
            c1917.f6362 = i;
        }
        m242(2, i2);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m240(boolean z) {
        if (z) {
            m242(2, 1);
        } else {
            this.f627.m3733(1);
        }
        this.f624 = getScrollY();
        C1920.m3772(this);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m241(int i) {
        View viewFindFocus = findFocus();
        if (viewFindFocus == this) {
            viewFindFocus = null;
        }
        View viewFindNextFocus = FocusFinder.getInstance().findNextFocus(this, viewFindFocus, i);
        int maxScrollAmount = getMaxScrollAmount();
        if (viewFindNextFocus == null || !m247(viewFindNextFocus, maxScrollAmount, getHeight())) {
            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;
            }
            m249(maxScrollAmount);
        } else {
            viewFindNextFocus.getDrawingRect(this.f605);
            offsetDescendantRectToMyCoords(viewFindNextFocus, this.f605);
            m249(m234(this.f605));
            viewFindNextFocus.requestFocus(i);
        }
        if (viewFindFocus != null && viewFindFocus.isFocused() && (!m247(viewFindFocus, 0, getHeight()))) {
            int descendantFocusability = getDescendantFocusability();
            setDescendantFocusability(131072);
            requestFocus();
            setDescendantFocusability(descendantFocusability);
        }
        return true;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m242(int i, int i2) {
        return this.f627.m3728(i, i2);
    }

    /* JADX WARN: Removed duplicated region for block: B:32:0x0068  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean m243(int i, int i2, int i3) {
        boolean z;
        int height = getHeight();
        int scrollY = getScrollY();
        int i4 = height + scrollY;
        boolean z2 = i == 33;
        ArrayList focusables = getFocusables(2);
        int size = focusables.size();
        View view = null;
        boolean z3 = false;
        for (int i5 = 0; i5 < size; i5++) {
            View view2 = (View) 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 && z5) {
                            view = view2;
                        }
                    } else if (z4) {
                        view = view2;
                        z3 = true;
                    } else if (z5) {
                    }
                }
            }
        }
        if (view == null) {
            view = this;
        }
        if (i2 < scrollY || i3 > i4) {
            m249(z2 ? i2 - scrollY : i3 - i4);
            z = true;
        } else {
            z = false;
        }
        if (view != findFocus()) {
            view.requestFocus(i);
        }
        return z;
    }

    /* JADX WARN: Removed duplicated region for block: B:38:0x0057  */
    /* JADX WARN: Removed duplicated region for block: B:40:0x005a  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x0061  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x0083 A[ADDED_TO_REGION] */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean m244(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
        boolean z;
        boolean z2;
        int overScrollMode = getOverScrollMode();
        boolean z3 = super.computeHorizontalScrollRange() > super.computeHorizontalScrollExtent();
        boolean z4 = computeVerticalScrollRange() > super.computeVerticalScrollExtent();
        boolean z5 = overScrollMode == 0 || (overScrollMode == 1 && z3);
        boolean z6 = overScrollMode == 0 || (overScrollMode == 1 && z4);
        int i9 = i3 + i;
        int i10 = !z5 ? 0 : i7;
        int i11 = i4 + i2;
        int i12 = !z6 ? 0 : i8;
        int i13 = -i10;
        int i14 = i10 + i5;
        int i15 = -i12;
        int i16 = i12 + i6;
        if (i9 > i14) {
            i9 = i14;
        } else {
            if (i9 >= i13) {
                z = false;
                if (i11 <= i16) {
                    i11 = i16;
                } else {
                    if (i11 >= i15) {
                        z2 = false;
                        if (z2 && !m254(1)) {
                            this.f606.springBack(i9, i11, 0, 0, 0, getScrollRange());
                        }
                        super.scrollTo(i9, i11);
                        return !z || z2;
                    }
                    i11 = i15;
                }
                z2 = true;
                if (z2) {
                    this.f606.springBack(i9, i11, 0, 0, 0, getScrollRange());
                }
                super.scrollTo(i9, i11);
                if (z) {
                }
            }
            i9 = i13;
        }
        z = true;
        if (i11 <= i16) {
        }
        z2 = true;
        if (z2) {
        }
        super.scrollTo(i9, i11);
        if (z) {
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m245(int i, int i2, int[] iArr, int[] iArr2, int i3) {
        return this.f627.m3730(i, i2, iArr, iArr2, i3);
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0033  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean m246(KeyEvent keyEvent) {
        boolean z;
        this.f605.setEmpty();
        if (getChildCount() > 0) {
            View childAt = getChildAt(0);
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) childAt.getLayoutParams();
            z = (childAt.getHeight() + layoutParams.topMargin) + layoutParams.bottomMargin > (getHeight() - getPaddingTop()) - getPaddingBottom();
        }
        if (!z) {
            if (!isFocused() || keyEvent.getKeyCode() == 4) {
                return false;
            }
            View viewFindFocus = findFocus();
            if (viewFindFocus == this) {
                viewFindFocus = null;
            }
            View viewFindNextFocus = FocusFinder.getInstance().findNextFocus(this, viewFindFocus, 130);
            return (viewFindNextFocus == null || viewFindNextFocus == this || !viewFindNextFocus.requestFocus(130)) ? false : true;
        }
        if (keyEvent.getAction() != 0) {
            return false;
        }
        int keyCode = keyEvent.getKeyCode();
        if (keyCode == 19) {
            return !keyEvent.isAltPressed() ? m241(33) : m253(33);
        }
        if (keyCode == 20) {
            return !keyEvent.isAltPressed() ? m241(130) : m253(130);
        }
        if (keyCode != 62) {
            return false;
        }
        int i = keyEvent.isShiftPressed() ? 33 : 130;
        boolean z2 = i == 130;
        int height = getHeight();
        if (z2) {
            this.f605.top = getScrollY() + height;
            int childCount = getChildCount();
            if (childCount > 0) {
                View childAt2 = getChildAt(childCount - 1);
                int paddingBottom = getPaddingBottom() + childAt2.getBottom() + ((FrameLayout.LayoutParams) childAt2.getLayoutParams()).bottomMargin;
                Rect rect = this.f605;
                if (rect.top + height > paddingBottom) {
                    rect.top = paddingBottom - height;
                }
            }
        } else {
            this.f605.top = getScrollY() - height;
            Rect rect2 = this.f605;
            if (rect2.top < 0) {
                rect2.top = 0;
            }
        }
        Rect rect3 = this.f605;
        int i2 = rect3.top;
        int i3 = height + i2;
        rect3.bottom = i3;
        m243(i, i2, i3);
        return false;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final boolean m247(View view, int i, int i2) {
        view.getDrawingRect(this.f605);
        offsetDescendantRectToMyCoords(view, this.f605);
        return this.f605.bottom + i >= getScrollY() && this.f605.top - i <= getScrollY() + i2;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m248() {
        this.f613 = false;
        m252();
        this.f627.m3733(0);
        EdgeEffect edgeEffect = this.f607;
        if (edgeEffect != null) {
            edgeEffect.onRelease();
            this.f608.onRelease();
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m249(int i) {
        if (i != 0) {
            if (this.f616) {
                m236(0, i, 250, false);
            } else {
                scrollBy(0, i);
            }
        }
    }

    @Override // p037.p065.p078.InterfaceC1915
    /* JADX INFO: renamed from: ؠ */
    public boolean mo132(View view, View view2, int i, int i2) {
        return (i & 2) != 0;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final void m250() {
        if (getOverScrollMode() == 2) {
            this.f607 = null;
            this.f608 = null;
        } else if (this.f607 == null) {
            Context context = getContext();
            this.f607 = new EdgeEffect(context);
            this.f608 = new EdgeEffect(context);
        }
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public void m251(int i) {
        if (getChildCount() > 0) {
            this.f606.fling(getScrollX(), getScrollY(), 0, i, 0, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0);
            m240(true);
        }
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final void m252() {
        VelocityTracker velocityTracker = this.f614;
        if (velocityTracker != null) {
            velocityTracker.recycle();
            this.f614 = null;
        }
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public boolean m253(int i) {
        int childCount;
        boolean z = i == 130;
        int height = getHeight();
        Rect rect = this.f605;
        rect.top = 0;
        rect.bottom = height;
        if (z && (childCount = getChildCount()) > 0) {
            View childAt = getChildAt(childCount - 1);
            this.f605.bottom = getPaddingBottom() + childAt.getBottom() + ((FrameLayout.LayoutParams) childAt.getLayoutParams()).bottomMargin;
            Rect rect2 = this.f605;
            rect2.top = rect2.bottom - height;
        }
        Rect rect3 = this.f605;
        return m243(i, rect3.top, rect3.bottom);
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public boolean m254(int i) {
        return this.f627.m3724(i) != null;
    }
}
