package d.p.b;

import android.view.View;

/* JADX INFO: loaded from: classes.dex */
public class a0 {
    public final b a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public a f3232b = new a();

    public static class a {
        public int a = 0;

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

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

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

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

        public boolean a() {
            int i2 = this.a;
            if ((i2 & 7) != 0 && (i2 & (b(this.f3235d, this.f3233b) << 0)) == 0) {
                return false;
            }
            int i3 = this.a;
            if ((i3 & 112) != 0 && (i3 & (b(this.f3235d, this.f3234c) << 4)) == 0) {
                return false;
            }
            int i4 = this.a;
            if ((i4 & 1792) != 0 && (i4 & (b(this.f3236e, this.f3233b) << 8)) == 0) {
                return false;
            }
            int i5 = this.a;
            return (i5 & 28672) == 0 || (i5 & (b(this.f3236e, this.f3234c) << 12)) != 0;
        }

        public int b(int i2, int i3) {
            if (i2 > i3) {
                return 1;
            }
            return i2 == i3 ? 2 : 4;
        }
    }

    public interface b {
        int a(View view);

        int b();

        int c();

        View d(int i2);

        int e(View view);
    }

    public a0(b bVar) {
        this.a = bVar;
    }

    public View a(int i2, int i3, int i4, int i5) {
        int iB = this.a.b();
        int iC = this.a.c();
        int i6 = i3 > i2 ? 1 : -1;
        View view = null;
        while (i2 != i3) {
            View viewD = this.a.d(i2);
            int iA = this.a.a(viewD);
            int iE = this.a.e(viewD);
            a aVar = this.f3232b;
            aVar.f3233b = iB;
            aVar.f3234c = iC;
            aVar.f3235d = iA;
            aVar.f3236e = iE;
            if (i4 != 0) {
                aVar.a = 0;
                aVar.a = i4 | 0;
                if (aVar.a()) {
                    return viewD;
                }
            }
            if (i5 != 0) {
                a aVar2 = this.f3232b;
                aVar2.a = 0;
                aVar2.a = i5 | 0;
                if (aVar2.a()) {
                    view = viewD;
                }
            }
            i2 += i6;
        }
        return view;
    }

    public boolean b(View view, int i2) {
        a aVar = this.f3232b;
        int iB = this.a.b();
        int iC = this.a.c();
        int iA = this.a.a(view);
        int iE = this.a.e(view);
        aVar.f3233b = iB;
        aVar.f3234c = iC;
        aVar.f3235d = iA;
        aVar.f3236e = iE;
        if (i2 == 0) {
            return false;
        }
        a aVar2 = this.f3232b;
        aVar2.a = 0;
        aVar2.a = 0 | i2;
        return aVar2.a();
    }
}
