package androidx.slidingpanelayout.widget;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.core.view.f3;
import androidx.core.view.s1;
import androidx.window.layout.k;
import androidx.window.layout.m;
import com.google.android.gms.measurement.internal.u1;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.WeakHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import kotlinx.coroutines.n1;
import kotlinx.coroutines.y;
import okhttp3.internal.http2.Http2Connection;

/* JADX INFO: loaded from: classes.dex */
public class SlidingPaneLayout extends ViewGroup {

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public static final boolean f4238d0;
    public final CopyOnWriteArrayList Q;
    public final y0.h R;
    public boolean S;
    public boolean T;
    public final Rect U;
    public final ArrayList V;
    public int W;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f4239a;

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public androidx.window.layout.f f4240a0;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f4241b;

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public final e f4242b0;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Drawable f4243c;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public d f4244c0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Drawable f4245d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f4246e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public View f4247f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public float f4248g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public float f4249h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public int f4250i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public boolean f4251j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f4252k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public float f4253l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public float f4254m;

    @Nullable
    private h mPanelSlideListener;

    static {
        f4238d0 = Build.VERSION.SDK_INT >= 29;
    }

    public SlidingPaneLayout(@NonNull Context context) {
        this(context, null);
    }

    @Nullable
    private static Activity getActivityOrNull(Context context) {
        while (context instanceof ContextWrapper) {
            if (context instanceof Activity) {
                return (Activity) context;
            }
            context = ((ContextWrapper) context).getBaseContext();
        }
        return null;
    }

    private j0.d getSystemGestureInsets() {
        f3 rootWindowInsets;
        if (!f4238d0 || (rootWindowInsets = s1.getRootWindowInsets(this)) == null) {
            return null;
        }
        return rootWindowInsets.f1747a.i();
    }

    private void setFoldingFeatureObserver(d dVar) {
        this.f4244c0 = dVar;
        dVar.getClass();
        e eVar = this.f4242b0;
        nb.g.i(eVar, "onFoldingFeatureChangeListener");
        dVar.f4264d = eVar;
    }

    public final boolean a(View view) {
        if (view == null) {
            return false;
        }
        return this.f4246e && ((g) view.getLayoutParams()).f4271c && this.f4248g > 0.0f;
    }

    @Override // android.view.ViewGroup
    public void addView(@NonNull View view, int i10, @Nullable ViewGroup.LayoutParams layoutParams) {
        if (getChildCount() != 1) {
            super.addView(view, i10, layoutParams);
            return;
        }
        j jVar = new j(view.getContext());
        jVar.addView(view);
        super.addView(jVar, i10, layoutParams);
    }

    public final boolean b() {
        WeakHashMap weakHashMap = s1.f1815a;
        return getLayoutDirection() == 1;
    }

    public final boolean c() {
        return !this.f4246e || this.f4248g == 0.0f;
    }

    @Override // android.view.ViewGroup
    public final boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
        return (layoutParams instanceof g) && super.checkLayoutParams(layoutParams);
    }

    @Override // android.view.View
    public final void computeScroll() {
        y0.h hVar = this.R;
        if (hVar.h()) {
            if (!this.f4246e) {
                hVar.a();
            } else {
                WeakHashMap weakHashMap = s1.f1815a;
                postInvalidateOnAnimation();
            }
        }
    }

    public final void d(float f10) {
        boolean zB = b();
        int childCount = getChildCount();
        for (int i10 = 0; i10 < childCount; i10++) {
            View childAt = getChildAt(i10);
            if (childAt != this.f4247f) {
                float f11 = 1.0f - this.f4249h;
                int i11 = this.f4252k;
                this.f4249h = f10;
                int i12 = ((int) (f11 * i11)) - ((int) ((1.0f - f10) * i11));
                if (zB) {
                    i12 = -i12;
                }
                childAt.offsetLeftAndRight(i12);
            }
        }
    }

    @Override // android.view.View
    public final void draw(Canvas canvas) {
        int i10;
        int right;
        super.draw(canvas);
        Drawable drawable = b() ? this.f4245d : this.f4243c;
        View childAt = getChildCount() > 1 ? getChildAt(1) : null;
        if (childAt == null || drawable == null) {
            return;
        }
        int top = childAt.getTop();
        int bottom = childAt.getBottom();
        int intrinsicWidth = drawable.getIntrinsicWidth();
        if (b()) {
            right = childAt.getRight();
            i10 = intrinsicWidth + right;
        } else {
            int left = childAt.getLeft();
            int i11 = left - intrinsicWidth;
            i10 = left;
            right = i11;
        }
        drawable.setBounds(right, top, i10, bottom);
        drawable.draw(canvas);
    }

    @Override // android.view.ViewGroup
    public final boolean drawChild(Canvas canvas, View view, long j10) {
        boolean zB = b() ^ c();
        y0.h hVar = this.R;
        if (zB) {
            hVar.f36694q = 1;
            j0.d systemGestureInsets = getSystemGestureInsets();
            if (systemGestureInsets != null) {
                hVar.f36692o = Math.max(hVar.f36693p, systemGestureInsets.f28502a);
            }
        } else {
            hVar.f36694q = 2;
            j0.d systemGestureInsets2 = getSystemGestureInsets();
            if (systemGestureInsets2 != null) {
                hVar.f36692o = Math.max(hVar.f36693p, systemGestureInsets2.f28504c);
            }
        }
        g gVar = (g) view.getLayoutParams();
        int iSave = canvas.save();
        if (this.f4246e && !gVar.f4270b && this.f4247f != null) {
            Rect rect = this.U;
            canvas.getClipBounds(rect);
            if (b()) {
                rect.left = Math.max(rect.left, this.f4247f.getRight());
            } else {
                rect.right = Math.min(rect.right, this.f4247f.getLeft());
            }
            canvas.clipRect(rect);
        }
        boolean zDrawChild = super.drawChild(canvas, view, j10);
        canvas.restoreToCount(iSave);
        return zDrawChild;
    }

    public final boolean e(float f10) {
        int paddingLeft;
        if (!this.f4246e) {
            return false;
        }
        boolean zB = b();
        g gVar = (g) this.f4247f.getLayoutParams();
        if (zB) {
            int paddingRight = getPaddingRight() + ((ViewGroup.MarginLayoutParams) gVar).rightMargin;
            paddingLeft = (int) (getWidth() - (((f10 * this.f4250i) + paddingRight) + this.f4247f.getWidth()));
        } else {
            paddingLeft = (int) ((f10 * this.f4250i) + getPaddingLeft() + ((ViewGroup.MarginLayoutParams) gVar).leftMargin);
        }
        View view = this.f4247f;
        if (!this.R.s(view, paddingLeft, view.getTop())) {
            return false;
        }
        int childCount = getChildCount();
        for (int i10 = 0; i10 < childCount; i10++) {
            View childAt = getChildAt(i10);
            if (childAt.getVisibility() == 4) {
                childAt.setVisibility(0);
            }
        }
        WeakHashMap weakHashMap = s1.f1815a;
        postInvalidateOnAnimation();
        return true;
    }

    public final void f(View view) {
        int left;
        int right;
        int top;
        int bottom;
        View childAt;
        boolean z10;
        View view2 = view;
        boolean zB = b();
        int width = zB ? getWidth() - getPaddingRight() : getPaddingLeft();
        int paddingLeft = zB ? getPaddingLeft() : getWidth() - getPaddingRight();
        int paddingTop = getPaddingTop();
        int height = getHeight() - getPaddingBottom();
        if (view2 == null || !view.isOpaque()) {
            left = 0;
            right = 0;
            top = 0;
            bottom = 0;
        } else {
            left = view.getLeft();
            right = view.getRight();
            top = view.getTop();
            bottom = view.getBottom();
        }
        int childCount = getChildCount();
        int i10 = 0;
        while (i10 < childCount && (childAt = getChildAt(i10)) != view2) {
            if (childAt.getVisibility() == 8) {
                z10 = zB;
            } else {
                z10 = zB;
                childAt.setVisibility((Math.max(zB ? paddingLeft : width, childAt.getLeft()) < left || Math.max(paddingTop, childAt.getTop()) < top || Math.min(zB ? width : paddingLeft, childAt.getRight()) > right || Math.min(height, childAt.getBottom()) > bottom) ? 0 : 4);
            }
            i10++;
            view2 = view;
            zB = z10;
        }
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateDefaultLayoutParams() {
        g gVar = new g(-1, -1);
        gVar.f4269a = 0.0f;
        return gVar;
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
        if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
            g gVar = new g((ViewGroup.MarginLayoutParams) layoutParams);
            gVar.f4269a = 0.0f;
            return gVar;
        }
        g gVar2 = new g(layoutParams);
        gVar2.f4269a = 0.0f;
        return gVar2;
    }

    @ColorInt
    @Deprecated
    public int getCoveredFadeColor() {
        return this.f4241b;
    }

    public final int getLockMode() {
        return this.W;
    }

    @Px
    public int getParallaxDistance() {
        return this.f4252k;
    }

    @ColorInt
    @Deprecated
    public int getSliderFadeColor() {
        return this.f4239a;
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onAttachedToWindow() {
        Activity activityOrNull;
        super.onAttachedToWindow();
        this.T = true;
        if (this.f4244c0 == null || (activityOrNull = getActivityOrNull(getContext())) == null) {
            return;
        }
        d dVar = this.f4244c0;
        dVar.getClass();
        n1 n1Var = dVar.f4263c;
        if (n1Var != null) {
            n1Var.e(null);
        }
        dVar.f4263c = hb.a.k0(y.b(y.o(dVar.f4262b)), null, new FoldingFeatureObserver$registerLayoutStateChangeCallback$1(dVar, activityOrNull, null), 3);
    }

    @Override // android.view.ViewGroup, android.view.View
    public final void onDetachedFromWindow() {
        n1 n1Var;
        super.onDetachedFromWindow();
        this.T = true;
        d dVar = this.f4244c0;
        if (dVar != null && (n1Var = dVar.f4263c) != null) {
            n1Var.e(null);
        }
        ArrayList arrayList = this.V;
        if (arrayList.size() <= 0) {
            arrayList.clear();
        } else {
            u1.x(arrayList.get(0));
            throw null;
        }
    }

    @Override // android.view.ViewGroup
    public final boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        boolean z10;
        View childAt;
        int actionMasked = motionEvent.getActionMasked();
        boolean z11 = this.f4246e;
        y0.h hVar = this.R;
        if (!z11 && actionMasked == 0 && getChildCount() > 1 && (childAt = getChildAt(1)) != null) {
            this.S = hVar.isViewUnder(childAt, (int) motionEvent.getX(), (int) motionEvent.getY());
        }
        if (!this.f4246e || (this.f4251j && actionMasked != 0)) {
            hVar.b();
            return super.onInterceptTouchEvent(motionEvent);
        }
        if (actionMasked == 3 || actionMasked == 1) {
            hVar.b();
            return false;
        }
        if (actionMasked == 0) {
            this.f4251j = false;
            float x10 = motionEvent.getX();
            float y10 = motionEvent.getY();
            this.f4253l = x10;
            this.f4254m = y10;
            if (hVar.isViewUnder(this.f4247f, (int) x10, (int) y10) && a(this.f4247f)) {
                z10 = true;
            }
            return hVar.r(motionEvent) || z10;
        }
        if (actionMasked == 2) {
            float x11 = motionEvent.getX();
            float y11 = motionEvent.getY();
            float fAbs = Math.abs(x11 - this.f4253l);
            float fAbs2 = Math.abs(y11 - this.f4254m);
            if (fAbs > hVar.f36679b && fAbs2 > fAbs) {
                hVar.b();
                this.f4251j = true;
                return false;
            }
        }
        z10 = false;
        if (hVar.r(motionEvent)) {
            return true;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:53:0x00f1  */
    @Override // android.view.ViewGroup, android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void onLayout(boolean z10, int i10, int i11, int i12, int i13) {
        int i14;
        int i15;
        int i16;
        int i17;
        int i18;
        boolean zB = b();
        int i19 = i12 - i10;
        int paddingRight = zB ? getPaddingRight() : getPaddingLeft();
        int paddingLeft = zB ? getPaddingLeft() : getPaddingRight();
        int paddingTop = getPaddingTop();
        int childCount = getChildCount();
        if (this.T) {
            this.f4248g = (this.f4246e && this.S) ? 0.0f : 1.0f;
        }
        int i20 = paddingRight;
        int i21 = 0;
        while (i21 < childCount) {
            View childAt = getChildAt(i21);
            if (childAt.getVisibility() == 8) {
                i14 = i20;
            } else {
                g gVar = (g) childAt.getLayoutParams();
                int measuredWidth = childAt.getMeasuredWidth();
                if (gVar.f4270b) {
                    int i22 = i19 - paddingLeft;
                    int iMin = (Math.min(paddingRight, i22) - i20) - (((ViewGroup.MarginLayoutParams) gVar).leftMargin + ((ViewGroup.MarginLayoutParams) gVar).rightMargin);
                    this.f4250i = iMin;
                    int i23 = zB ? ((ViewGroup.MarginLayoutParams) gVar).rightMargin : ((ViewGroup.MarginLayoutParams) gVar).leftMargin;
                    gVar.f4271c = (measuredWidth / 2) + ((i20 + i23) + iMin) > i22;
                    int i24 = (int) (iMin * this.f4248g);
                    i14 = i23 + i24 + i20;
                    this.f4248g = i24 / iMin;
                    i15 = 0;
                } else if (!this.f4246e || (i16 = this.f4252k) == 0) {
                    i14 = paddingRight;
                    i15 = 0;
                } else {
                    i15 = (int) ((1.0f - this.f4248g) * i16);
                    i14 = paddingRight;
                }
                if (zB) {
                    i18 = (i19 - i14) + i15;
                    i17 = i18 - measuredWidth;
                } else {
                    i17 = i14 - i15;
                    i18 = i17 + measuredWidth;
                }
                childAt.layout(i17, paddingTop, i18, childAt.getMeasuredHeight() + paddingTop);
                androidx.window.layout.f fVar = this.f4240a0;
                if (fVar != null) {
                    androidx.window.core.b bVar = ((androidx.window.layout.h) fVar).f4475a;
                    int iB = bVar.b();
                    int iA = bVar.a();
                    androidx.window.layout.d dVar = androidx.window.layout.d.f4466b;
                    int iWidth = ((iB > iA ? androidx.window.layout.d.f4467c : dVar) == dVar && ((androidx.window.layout.h) this.f4240a0).a()) ? ((androidx.window.layout.h) this.f4240a0).f4475a.c().width() : 0;
                    paddingRight = Math.abs(iWidth) + childAt.getWidth() + paddingRight;
                }
            }
            i21++;
            i20 = i14;
        }
        if (this.T) {
            if (this.f4246e && this.f4252k != 0) {
                d(this.f4248g);
            }
            f(this.f4247f);
        }
        this.T = false;
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x007d A[PHI: r16
      0x007d: PHI (r16v2 float) = (r16v1 float), (r16v3 float) binds: [B:16:0x0073, B:18:0x0079] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:92:0x01b0  */
    /* JADX WARN: Type inference failed for: r6v0 */
    /* JADX WARN: Type inference failed for: r6v1, types: [boolean, int] */
    /* JADX WARN: Type inference failed for: r6v37 */
    @Override // android.view.View
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void onMeasure(int i10, int i11) {
        int paddingTop;
        int iMin;
        int i12;
        int iMax;
        int iMakeMeasureSpec;
        int i13;
        ArrayList arrayList;
        int i14;
        int minimumWidth;
        int mode = View.MeasureSpec.getMode(i10);
        int size = View.MeasureSpec.getSize(i10);
        int mode2 = View.MeasureSpec.getMode(i11);
        int size2 = View.MeasureSpec.getSize(i11);
        ?? r62 = 0;
        if (mode2 != Integer.MIN_VALUE) {
            iMin = mode2 != 1073741824 ? 0 : (size2 - getPaddingTop()) - getPaddingBottom();
            paddingTop = iMin;
        } else {
            paddingTop = (size2 - getPaddingTop()) - getPaddingBottom();
            iMin = 0;
        }
        int iMax2 = Math.max((size - getPaddingLeft()) - getPaddingRight(), 0);
        int childCount = getChildCount();
        this.f4247f = null;
        int i15 = 0;
        boolean z10 = false;
        int i16 = iMax2;
        float f10 = 0.0f;
        while (true) {
            i12 = 8;
            if (i15 >= childCount) {
                break;
            }
            View childAt = getChildAt(i15);
            g gVar = (g) childAt.getLayoutParams();
            int i17 = size;
            if (childAt.getVisibility() == 8) {
                gVar.f4271c = r62;
            } else {
                float f11 = gVar.f4269a;
                if (f11 > 0.0f) {
                    f10 += f11;
                    if (((ViewGroup.MarginLayoutParams) gVar).width != 0) {
                        int iMax3 = Math.max(iMax2 - (((ViewGroup.MarginLayoutParams) gVar).leftMargin + ((ViewGroup.MarginLayoutParams) gVar).rightMargin), (int) r62);
                        int i18 = ((ViewGroup.MarginLayoutParams) gVar).width;
                        childAt.measure(i18 == -2 ? View.MeasureSpec.makeMeasureSpec(iMax3, mode == 0 ? mode : Integer.MIN_VALUE) : i18 == -1 ? View.MeasureSpec.makeMeasureSpec(iMax3, mode) : View.MeasureSpec.makeMeasureSpec(i18, 1073741824), ViewGroup.getChildMeasureSpec(i11, getPaddingBottom() + getPaddingTop(), ((ViewGroup.MarginLayoutParams) gVar).height));
                        int measuredWidth = childAt.getMeasuredWidth();
                        int measuredHeight = childAt.getMeasuredHeight();
                        if (measuredHeight > iMin) {
                            if (mode2 == Integer.MIN_VALUE) {
                                iMin = Math.min(measuredHeight, paddingTop);
                            } else if (mode2 == 0) {
                                iMin = measuredHeight;
                            }
                        }
                        i16 -= measuredWidth;
                        if (i15 != 0) {
                            boolean z11 = i16 < 0;
                            gVar.f4270b = z11;
                            z10 |= z11;
                            if (z11) {
                                this.f4247f = childAt;
                            }
                        }
                    }
                }
            }
            i15++;
            size = i17;
            r62 = 0;
        }
        int i19 = size;
        if (z10 || f10 > 0.0f) {
            int i20 = 0;
            while (i20 < childCount) {
                View childAt2 = getChildAt(i20);
                if (childAt2.getVisibility() == i12) {
                    i13 = i16;
                } else {
                    g gVar2 = (g) childAt2.getLayoutParams();
                    int i21 = ((ViewGroup.MarginLayoutParams) gVar2).width;
                    float f12 = gVar2.f4269a;
                    int measuredWidth2 = (i21 != 0 || f12 <= 0.0f) ? childAt2.getMeasuredWidth() : 0;
                    if (z10) {
                        iMax = iMax2 - (((ViewGroup.MarginLayoutParams) gVar2).leftMargin + ((ViewGroup.MarginLayoutParams) gVar2).rightMargin);
                        iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(iMax, 1073741824);
                    } else if (f12 > 0.0f) {
                        iMax = ((int) ((f12 * Math.max(0, i16)) / f10)) + measuredWidth2;
                        iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(iMax, 1073741824);
                    } else {
                        iMax = measuredWidth2;
                        iMakeMeasureSpec = 0;
                    }
                    int paddingBottom = getPaddingBottom() + getPaddingTop();
                    g gVar3 = (g) childAt2.getLayoutParams();
                    i13 = i16;
                    int iMakeMeasureSpec2 = (((ViewGroup.MarginLayoutParams) gVar3).width != 0 || gVar3.f4269a <= 0.0f) ? View.MeasureSpec.makeMeasureSpec(childAt2.getMeasuredHeight(), 1073741824) : ViewGroup.getChildMeasureSpec(i11, paddingBottom, ((ViewGroup.MarginLayoutParams) gVar3).height);
                    if (measuredWidth2 != iMax) {
                        childAt2.measure(iMakeMeasureSpec, iMakeMeasureSpec2);
                        int measuredHeight2 = childAt2.getMeasuredHeight();
                        if (measuredHeight2 > iMin) {
                            if (mode2 == Integer.MIN_VALUE) {
                                measuredHeight2 = Math.min(measuredHeight2, paddingTop);
                            } else if (mode2 == 0) {
                            }
                            iMin = measuredHeight2;
                        }
                    }
                }
                i20++;
                i16 = i13;
                i12 = 8;
            }
        }
        androidx.window.layout.f fVar = this.f4240a0;
        if (fVar == null || !((androidx.window.layout.h) fVar).a() || ((androidx.window.layout.h) this.f4240a0).f4475a.c().left == 0 || ((androidx.window.layout.h) this.f4240a0).f4475a.c().top != 0) {
            arrayList = null;
        } else {
            androidx.window.layout.f fVar2 = this.f4240a0;
            int[] iArr = new int[2];
            getLocationInWindow(iArr);
            int i22 = iArr[0];
            Rect rect = new Rect(i22, iArr[1], getWidth() + i22, getWidth() + iArr[1]);
            Rect rect2 = new Rect(((androidx.window.layout.h) fVar2).f4475a.c());
            boolean zIntersect = rect2.intersect(rect);
            if (!(rect2.width() == 0 && rect2.height() == 0) && zIntersect) {
                rect2.offset(-iArr[0], -iArr[1]);
            } else {
                rect2 = null;
            }
            if (rect2 != null) {
                Rect rect3 = new Rect(getPaddingLeft(), getPaddingTop(), Math.max(getPaddingLeft(), rect2.left), getHeight() - getPaddingBottom());
                int width = getWidth() - getPaddingRight();
                arrayList = new ArrayList(Arrays.asList(rect3, new Rect(Math.min(width, rect2.right), getPaddingTop(), width, getHeight() - getPaddingBottom())));
            }
        }
        if (arrayList != null && !z10) {
            for (int i23 = 0; i23 < childCount; i23++) {
                View childAt3 = getChildAt(i23);
                if (childAt3.getVisibility() != 8) {
                    Rect rect4 = (Rect) arrayList.get(i23);
                    g gVar4 = (g) childAt3.getLayoutParams();
                    int i24 = ((ViewGroup.MarginLayoutParams) gVar4).leftMargin + ((ViewGroup.MarginLayoutParams) gVar4).rightMargin;
                    int iMakeMeasureSpec3 = View.MeasureSpec.makeMeasureSpec(childAt3.getMeasuredHeight(), 1073741824);
                    childAt3.measure(View.MeasureSpec.makeMeasureSpec(rect4.width(), Integer.MIN_VALUE), iMakeMeasureSpec3);
                    if ((childAt3.getMeasuredWidthAndState() & Http2Connection.OKHTTP_CLIENT_WINDOW_SIZE) != 1) {
                        boolean z12 = childAt3 instanceof j;
                        if (z12) {
                            View childAt4 = ((j) childAt3).getChildAt(0);
                            WeakHashMap weakHashMap = s1.f1815a;
                            minimumWidth = childAt4.getMinimumWidth();
                        } else {
                            WeakHashMap weakHashMap2 = s1.f1815a;
                            minimumWidth = childAt3.getMinimumWidth();
                        }
                        if (minimumWidth != 0) {
                            i14 = rect4.width() < (z12 ? ((j) childAt3).getChildAt(0).getMinimumWidth() : childAt3.getMinimumWidth()) ? 1073741824 : 1073741824;
                        }
                        childAt3.measure(View.MeasureSpec.makeMeasureSpec(rect4.width(), 1073741824), iMakeMeasureSpec3);
                    }
                    childAt3.measure(View.MeasureSpec.makeMeasureSpec(iMax2 - i24, i14), iMakeMeasureSpec3);
                    if (i23 != 0) {
                        gVar4.f4270b = true;
                        this.f4247f = childAt3;
                        z10 = true;
                    }
                }
            }
        }
        setMeasuredDimension(i19, getPaddingBottom() + getPaddingTop() + iMin);
        this.f4246e = z10;
        y0.h hVar = this.R;
        if (hVar.f36678a == 0 || z10) {
            return;
        }
        hVar.a();
    }

    @Override // android.view.View
    public final void onRestoreInstanceState(Parcelable parcelable) {
        if (!(parcelable instanceof i)) {
            super.onRestoreInstanceState(parcelable);
            return;
        }
        i iVar = (i) parcelable;
        super.onRestoreInstanceState(iVar.getSuperState());
        if (iVar.f4272c) {
            if (!this.f4246e) {
                this.S = true;
            }
            if (this.T || e(0.0f)) {
                this.S = true;
            }
        } else {
            if (!this.f4246e) {
                this.S = false;
            }
            if (this.T || e(1.0f)) {
                this.S = false;
            }
        }
        this.S = iVar.f4272c;
        setLockMode(iVar.f4273d);
    }

    @Override // android.view.View
    public final Parcelable onSaveInstanceState() {
        i iVar = new i(super.onSaveInstanceState());
        iVar.f4272c = this.f4246e ? c() : this.S;
        iVar.f4273d = this.W;
        return iVar;
    }

    @Override // android.view.View
    public final void onSizeChanged(int i10, int i11, int i12, int i13) {
        super.onSizeChanged(i10, i11, i12, i13);
        if (i10 != i12) {
            this.T = true;
        }
    }

    @Override // android.view.View
    public final boolean onTouchEvent(MotionEvent motionEvent) {
        if (!this.f4246e) {
            return super.onTouchEvent(motionEvent);
        }
        y0.h hVar = this.R;
        hVar.k(motionEvent);
        int actionMasked = motionEvent.getActionMasked();
        if (actionMasked == 0) {
            float x10 = motionEvent.getX();
            float y10 = motionEvent.getY();
            this.f4253l = x10;
            this.f4254m = y10;
        } else if (actionMasked == 1 && a(this.f4247f)) {
            float x11 = motionEvent.getX();
            float y11 = motionEvent.getY();
            float f10 = x11 - this.f4253l;
            float f11 = y11 - this.f4254m;
            int i10 = hVar.f36679b;
            if ((f11 * f11) + (f10 * f10) < i10 * i10 && hVar.isViewUnder(this.f4247f, (int) x11, (int) y11)) {
                if (!this.f4246e) {
                    this.S = false;
                }
                if (this.T || e(1.0f)) {
                    this.S = false;
                }
            }
        }
        return true;
    }

    @Override // android.view.ViewGroup, android.view.ViewManager
    public final void removeView(View view) {
        if (view.getParent() instanceof j) {
            super.removeView((View) view.getParent());
        } else {
            super.removeView(view);
        }
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public final void requestChildFocus(View view, View view2) {
        super.requestChildFocus(view, view2);
        if (isInTouchMode() || this.f4246e) {
            return;
        }
        this.S = view == this.f4247f;
    }

    @Deprecated
    public void setCoveredFadeColor(@ColorInt int i10) {
        this.f4241b = i10;
    }

    public final void setLockMode(int i10) {
        this.W = i10;
    }

    @Deprecated
    public void setPanelSlideListener(@Nullable h hVar) {
        if (hVar != null) {
            this.Q.add(hVar);
        }
    }

    public void setParallaxDistance(@Px int i10) {
        this.f4252k = i10;
        requestLayout();
    }

    @Deprecated
    public void setShadowDrawable(Drawable drawable) {
        setShadowDrawableLeft(drawable);
    }

    public void setShadowDrawableLeft(@Nullable Drawable drawable) {
        this.f4243c = drawable;
    }

    public void setShadowDrawableRight(@Nullable Drawable drawable) {
        this.f4245d = drawable;
    }

    @Deprecated
    public void setShadowResource(@DrawableRes int i10) {
        setShadowDrawableLeft(getResources().getDrawable(i10));
    }

    public void setShadowResourceLeft(int i10) {
        setShadowDrawableLeft(g0.d.getDrawable(getContext(), i10));
    }

    public void setShadowResourceRight(int i10) {
        setShadowDrawableRight(g0.d.getDrawable(getContext(), i10));
    }

    @Deprecated
    public void setSliderFadeColor(@ColorInt int i10) {
        this.f4239a = i10;
    }

    public SlidingPaneLayout(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public SlidingPaneLayout(@NonNull Context context, @Nullable AttributeSet attributeSet, int i10) {
        Executor fVar;
        super(context, attributeSet, i10);
        this.f4239a = 0;
        this.f4248g = 1.0f;
        this.Q = new CopyOnWriteArrayList();
        this.T = true;
        this.U = new Rect();
        this.V = new ArrayList();
        this.f4242b0 = new e(this);
        float f10 = context.getResources().getDisplayMetrics().density;
        setWillNotDraw(false);
        s1.setAccessibilityDelegate(this, new d1.c(this));
        setImportantForAccessibility(1);
        y0.h hVarI = y0.h.i(this, 0.5f, new f(this, 0));
        this.R = hVarI;
        hVarI.f36691n = f10 * 400.0f;
        k.f4484a.getClass();
        m mVarA = androidx.window.layout.j.a(context);
        Object obj = g0.d.f26125a;
        if (Build.VERSION.SDK_INT >= 28) {
            fVar = m.d.h(context);
        } else {
            fVar = new m0.f(0, new Handler(context.getMainLooper()));
        }
        setFoldingFeatureObserver(new d(mVarA, fVar));
    }

    @Override // android.view.ViewGroup
    public final ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        return new g(getContext(), attributeSet);
    }
}
