package androidx.leanback.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes.dex */
public class NonOverlappingLinearLayout extends LinearLayout {

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

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

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final ArrayList<ArrayList<View>> f735;

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

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

    public NonOverlappingLinearLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f733 = false;
        this.f735 = new ArrayList<>();
    }

    @Override // android.view.ViewGroup, android.view.ViewParent
    public void focusableViewAvailable(View view) {
        int iIndexOfChild;
        if (!this.f734) {
            super.focusableViewAvailable(view);
            return;
        }
        for (View view2 = view; view2 != this && view2 != null; view2 = (View) view2.getParent()) {
            if (view2.getParent() == this) {
                iIndexOfChild = indexOfChild(view2);
                break;
            }
        }
        iIndexOfChild = -1;
        if (iIndexOfChild != -1) {
            this.f735.get(iIndexOfChild).add(view);
        }
    }

    @Override // android.view.View
    public boolean hasOverlappingRendering() {
        return false;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v0, types: [boolean] */
    /* JADX WARN: Type inference failed for: r0v1, types: [int] */
    /* JADX WARN: Type inference failed for: r0v6 */
    @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View
    public void onLayout(boolean z, int i, int i2, int i3, int i4) {
        boolean z2;
        int size;
        ?? r0 = 0;
        int i5 = 0;
        try {
            boolean z3 = this.f733 && getOrientation() == 0 && getLayoutDirection() == 1;
            this.f734 = z3;
            if (z3) {
                while (this.f735.size() > getChildCount()) {
                    this.f735.remove(this.f735.size() - 1);
                }
                while (this.f735.size() < getChildCount()) {
                    this.f735.add(new ArrayList<>());
                }
            }
            super.onLayout(z, i, i2, i3, i4);
            if (this.f734) {
                for (int i6 = 0; i6 < this.f735.size(); i6++) {
                    for (int i7 = 0; i7 < this.f735.get(i6).size(); i7++) {
                        super.focusableViewAvailable(this.f735.get(i6).get(i7));
                    }
                }
            }
            if (z2) {
                while (true) {
                    if (i5 >= size) {
                        return;
                    }
                }
            }
        } finally {
            if (this.f734) {
                this.f734 = false;
                while (r0 < this.f735.size()) {
                    this.f735.get(r0).clear();
                    r0++;
                }
            }
        }
    }

    public void setFocusableViewAvailableFixEnabled(boolean z) {
        this.f733 = z;
    }
}
