package g.d.a.j;

import g.d.a.j.e;
import g.d.a.j.f;
import java.util.ArrayList;

/* JADX INFO: compiled from: Guideline.java */
/* JADX INFO: loaded from: classes.dex */
public class i extends f {
    protected float k0 = -1.0f;
    protected int l0 = -1;
    protected int m0 = -1;
    private e n0 = this.t;
    private int o0 = 0;
    private boolean p0 = false;

    /* JADX INFO: compiled from: Guideline.java */
    static /* synthetic */ class a {
        static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[e.d.values().length];
            a = iArr;
            try {
                iArr[e.d.LEFT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[e.d.RIGHT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[e.d.TOP.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[e.d.BOTTOM.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[e.d.BASELINE.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[e.d.CENTER.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[e.d.CENTER_X.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[e.d.CENTER_Y.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[e.d.NONE.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
        }
    }

    public i() {
        this.B.clear();
        this.B.add(this.n0);
        int length = this.A.length;
        for (int i2 = 0; i2 < length; i2++) {
            this.A[i2] = this.n0;
        }
    }

    @Override // g.d.a.j.f
    public void G0(g.d.a.e eVar) {
        if (u() == null) {
            return;
        }
        int iY = eVar.y(this.n0);
        if (this.o0 == 1) {
            C0(iY);
            D0(0);
            b0(u().r());
            y0(0);
            return;
        }
        C0(0);
        D0(iY);
        y0(u().D());
        b0(0);
    }

    public int I0() {
        return this.o0;
    }

    public void J0(int i2) {
        if (i2 > -1) {
            this.k0 = -1.0f;
            this.l0 = i2;
            this.m0 = -1;
        }
    }

    public void K0(int i2) {
        if (i2 > -1) {
            this.k0 = -1.0f;
            this.l0 = -1;
            this.m0 = i2;
        }
    }

    public void L0(float f) {
        if (f > -1.0f) {
            this.k0 = f;
            this.l0 = -1;
            this.m0 = -1;
        }
    }

    public void M0(int i2) {
        if (this.o0 == i2) {
            return;
        }
        this.o0 = i2;
        this.B.clear();
        if (this.o0 == 1) {
            this.n0 = this.s;
        } else {
            this.n0 = this.t;
        }
        this.B.add(this.n0);
        int length = this.A.length;
        for (int i3 = 0; i3 < length; i3++) {
            this.A[i3] = this.n0;
        }
    }

    @Override // g.d.a.j.f
    public void b(g.d.a.e eVar) {
        g gVar = (g) u();
        if (gVar == null) {
            return;
        }
        e eVarH = gVar.h(e.d.LEFT);
        e eVarH2 = gVar.h(e.d.RIGHT);
        f fVar = this.D;
        boolean z = fVar != null && fVar.C[0] == f.b.WRAP_CONTENT;
        if (this.o0 == 0) {
            eVarH = gVar.h(e.d.TOP);
            eVarH2 = gVar.h(e.d.BOTTOM);
            f fVar2 = this.D;
            z = fVar2 != null && fVar2.C[1] == f.b.WRAP_CONTENT;
        }
        if (this.l0 != -1) {
            g.d.a.i iVarR = eVar.r(this.n0);
            eVar.e(iVarR, eVar.r(eVarH), this.l0, 6);
            if (z) {
                eVar.i(eVar.r(eVarH2), iVarR, 0, 5);
                return;
            }
            return;
        }
        if (this.m0 == -1) {
            if (this.k0 != -1.0f) {
                eVar.d(g.d.a.e.t(eVar, eVar.r(this.n0), eVar.r(eVarH), eVar.r(eVarH2), this.k0, this.p0));
                return;
            }
            return;
        }
        g.d.a.i iVarR2 = eVar.r(this.n0);
        g.d.a.i iVarR3 = eVar.r(eVarH2);
        eVar.e(iVarR2, iVarR3, -this.m0, 6);
        if (z) {
            eVar.i(iVarR2, eVar.r(eVarH), 0, 5);
            eVar.i(iVarR3, iVarR2, 0, 5);
        }
    }

    @Override // g.d.a.j.f
    public boolean c() {
        return true;
    }

    @Override // g.d.a.j.f
    public void d(int i2) {
        f fVarU = u();
        if (fVarU == null) {
            return;
        }
        if (I0() == 1) {
            this.t.f().h(1, fVarU.t.f(), 0);
            this.v.f().h(1, fVarU.t.f(), 0);
            if (this.l0 != -1) {
                this.s.f().h(1, fVarU.s.f(), this.l0);
                this.u.f().h(1, fVarU.s.f(), this.l0);
                return;
            } else if (this.m0 != -1) {
                this.s.f().h(1, fVarU.u.f(), -this.m0);
                this.u.f().h(1, fVarU.u.f(), -this.m0);
                return;
            } else {
                if (this.k0 == -1.0f || fVarU.s() != f.b.FIXED) {
                    return;
                }
                int i3 = (int) (fVarU.E * this.k0);
                this.s.f().h(1, fVarU.s.f(), i3);
                this.u.f().h(1, fVarU.s.f(), i3);
                return;
            }
        }
        this.s.f().h(1, fVarU.s.f(), 0);
        this.u.f().h(1, fVarU.s.f(), 0);
        if (this.l0 != -1) {
            this.t.f().h(1, fVarU.t.f(), this.l0);
            this.v.f().h(1, fVarU.t.f(), this.l0);
        } else if (this.m0 != -1) {
            this.t.f().h(1, fVarU.v.f(), -this.m0);
            this.v.f().h(1, fVarU.v.f(), -this.m0);
        } else {
            if (this.k0 == -1.0f || fVarU.B() != f.b.FIXED) {
                return;
            }
            int i4 = (int) (fVarU.F * this.k0);
            this.t.f().h(1, fVarU.t.f(), i4);
            this.v.f().h(1, fVarU.t.f(), i4);
        }
    }

    @Override // g.d.a.j.f
    public e h(e.d dVar) {
        switch (a.a[dVar.ordinal()]) {
            case 1:
            case 2:
                if (this.o0 == 1) {
                    return this.n0;
                }
                break;
            case 3:
            case 4:
                if (this.o0 == 0) {
                    return this.n0;
                }
                break;
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
                return null;
        }
        throw new AssertionError(dVar.name());
    }

    @Override // g.d.a.j.f
    public ArrayList<e> i() {
        return this.B;
    }
}
