package com.lynx.tasm.behavior.ui.swiper;

import X.0HH;
import X.C3890QeN;
import X.C4398QmZ;
import X.C4502QoF;
import X.C5120QyD;
import X.C5121QyE;
import X.C5123QyG;
import X.C5125QyI;
import X.C5126QyJ;
import X.C5127QyK;
import X.LC0;
import X.LC5;
import X.QNL;
import X.QNX;
import X.QNZ;
import X.QWT;
import android.content.Context;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.LinearLayout;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.lynx.react.bridge.ReadableMap;
import com.lynx.react.bridge.ReadableMapKeySetIterator;
import com.lynx.react.bridge.ReadableType;
import com.lynx.tasm.behavior.ui.LynxBaseUI;
import com.lynx.tasm.behavior.ui.LynxUI;
import com.lynx.tasm.behavior.ui.view.UISimpleView;
import com.lynx.tasm.utils.ColorUtils;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class XSwiperUI extends UISimpleView<C5120QyD> {
    public static final int LIZ = Color.argb(255, 255, 255, 255);
    public static final int LIZIZ = Color.argb(89, 255, 255, 255);
    public boolean LIZJ;
    public boolean LIZLLL;
    public int LJ = 5000;
    public boolean LJFF = true;
    public boolean LJI;
    public boolean LJII;
    public boolean LJIIIIZZ;
    public boolean LJIIIZ;
    public boolean LJIIJ;
    public final Handler LJIIJJI = new Handler(Looper.getMainLooper());
    public final List<View> LJIIL = new ArrayList();
    public float LJIILIIL = 0.6f;
    public float LJIILJJIL = 1.0f;
    public float LJIILL = 0.6f;
    public float LJIILLIIL = 1.0f;
    public float LJIIZILJ = 0.0f;
    public Runnable LJIJ = new Runnable() {
        static {
            Covode.recordClassIndex(46762);
        }

        public final void run() {
            if (XSwiperUI.this.LJII && XSwiperUI.this.LIZJ) {
                C5121QyE qyE = ((C5120QyD) XSwiperUI.this.mView).LIZ;
                int i = qyE.LIZ + 1;
                if (XSwiperUI.this.LIZLLL && i == XSwiperUI.this.LJIIL.size()) {
                    i = 0;
                }
                qyE.LIZ(i, XSwiperUI.this.LJFF);
                XSwiperUI.this.LJIIJJI.postDelayed(this, (long) XSwiperUI.this.LJ);
            }
        }
    };
    public String LJIJI = "normal";
    public int LJIJJ;
    public int LJIJJLI;
    public int LJIL = -1;
    public int LJJ = -1;
    public int LJJI = -1;
    public C5125QyI LJJIFFI = new C5125QyI() {
        static {
            Covode.recordClassIndex(46760);
        }

        public final void LIZ(View view) {
            view.setRotationX(0.0f);
            view.setRotationY(0.0f);
        }

        public final void LIZ(View view, int i) {
            float f;
            C5121QyE qyE = ((C5120QyD) XSwiperUI.this.mView).LIZ;
            int LIZ2 = qyE.LIZ();
            if (LIZ2 != 0) {
                f = ((float) i) / ((float) LIZ2);
            } else {
                f = 0.0f;
            }
            float LIZ3 = XSwiperUI.this.LIZ(f * 9.0f, -9.0f, 9.0f);
            view.setCameraDistance(1280.0f);
            if (qyE.LIZLLL()) {
                view.setRotationX(LIZ3);
            } else {
                view.setRotationY(-LIZ3);
            }
        }
    };
    public C5125QyI LJJII = new C5125QyI() {
        static {
            Covode.recordClassIndex(46761);
        }

        public final void LIZ(View view) {
            view.setScaleX(1.0f);
            view.setScaleY(1.0f);
            view.setTranslationX(0.0f);
            view.setTranslationY(0.0f);
        }

        public final void LIZ(View view, int i) {
            float f;
            float f2;
            float f3;
            float f4;
            float f5;
            float f6;
            float abs = (float) Math.abs(i);
            int LIZ2 = ((C5120QyD) XSwiperUI.this.mView).LIZ.LIZ();
            if (LIZ2 != 0) {
                float f7 = (float) LIZ2;
                f = XSwiperUI.this.LJIILJJIL - (((XSwiperUI.this.LJIILJJIL - XSwiperUI.this.LJIILIIL) * abs) / f7);
                f2 = XSwiperUI.this.LJIILLIIL - ((abs * (XSwiperUI.this.LJIILLIIL - XSwiperUI.this.LJIILL)) / f7);
            } else {
                f = 1.0f;
                f2 = 1.0f;
            }
            XSwiperUI xSwiperUI = XSwiperUI.this;
            float LIZ3 = xSwiperUI.LIZ(f, xSwiperUI.LJIILIIL, XSwiperUI.this.LJIILJJIL);
            XSwiperUI xSwiperUI2 = XSwiperUI.this;
            float LIZ4 = xSwiperUI2.LIZ(f2, xSwiperUI2.LJIILL, XSwiperUI.this.LJIILLIIL);
            view.setScaleX(LIZ3);
            view.setScaleY(LIZ4);
            if (XSwiperUI.this.LJIIZILJ <= 0.0f) {
                return;
            }
            if (((C5120QyD) XSwiperUI.this.mView).LIZ.LIZLLL()) {
                float f8 = XSwiperUI.this.LJIILL + ((XSwiperUI.this.LJIILLIIL - XSwiperUI.this.LJIILL) / 2.0f);
                float abs2 = 1.0f - (Math.abs(LIZ4 - f8) / (XSwiperUI.this.LJIILLIIL - f8));
                float f9 = ((XSwiperUI.this.LJIIZILJ * ((float) LIZ2)) * (XSwiperUI.this.LJIILLIIL - XSwiperUI.this.LJIILL)) / 2.0f;
                if (i > 0) {
                    if (LIZ4 <= f8) {
                        f6 = (-f9) + (abs2 * 0.5f * f9);
                    } else {
                        f5 = abs2 * -0.5f;
                        f6 = f5 * f9;
                    }
                } else if (LIZ4 >= f8) {
                    f5 = abs2 * 0.5f;
                    f6 = f5 * f9;
                } else {
                    f6 = f9 - ((abs2 * 0.5f) * f9);
                }
                view.setTranslationY(f6);
                return;
            }
            float f10 = XSwiperUI.this.LJIILIIL + ((XSwiperUI.this.LJIILJJIL - XSwiperUI.this.LJIILIIL) / 2.0f);
            float abs3 = 1.0f - (Math.abs(LIZ3 - f10) / (XSwiperUI.this.LJIILJJIL - f10));
            float f11 = ((XSwiperUI.this.LJIIZILJ * ((float) LIZ2)) * (XSwiperUI.this.LJIILJJIL - XSwiperUI.this.LJIILIIL)) / 2.0f;
            if (i > 0) {
                if (LIZ3 <= f10) {
                    f4 = (-f11) + (abs3 * 0.5f * f11);
                } else {
                    f3 = abs3 * -0.5f;
                    f4 = f3 * f11;
                }
            } else if (LIZ3 >= f10) {
                f3 = abs3 * 0.5f;
                f4 = f3 * f11;
            } else {
                f4 = f11 - ((abs3 * 0.5f) * f11);
            }
            view.setTranslationX(f4);
        }
    };

    public boolean isScrollContainer() {
        return true;
    }

    public boolean isScrollable() {
        return true;
    }

    public boolean needCustomLayout() {
        return true;
    }

    public void destroy() {
        super.destroy();
    }

    public void onDetach() {
        super.onDetach();
    }

    private void LIZ() {
        ((C5120QyD) this.mView).LIZ.LIZ((C5126QyJ) new C5126QyJ() {
            static {
                Covode.recordClassIndex(46759);
            }

            public final int LIZ() {
                return XSwiperUI.this.LJIIL.size();
            }

            public final View LIZ(int i) {
                return XSwiperUI.this.LJIIL.get(i);
            }
        });
    }

    static {
        Covode.recordClassIndex(46753);
    }

    public void onLayoutUpdated() {
        super.onLayoutUpdated();
        this.LJIIL.clear();
        Iterator<LynxBaseUI> it = this.mChildren.iterator();
        while (it.hasNext()) {
            this.LJIIL.add(((LynxUI) it.next()).mView);
        }
        LIZ();
        setMode(this.LJIJI);
        ((C5120QyD) this.mView).LIZ(isRtl());
        int i = ((C5120QyD) this.mView).LIZ.LIZ;
        if (i != -1) {
            int i2 = this.LJJI;
            if (i2 != -1) {
                i = i2;
            }
            setCurrentIndex(i);
        }
        if (getOverflow() != 0) {
            ((C5120QyD) this.mView).setClipChildren(false);
        }
    }

    @QNL(LIZ = "finish-reset", LJFF = false)
    public void setFinishReset(boolean z) {
        this.LIZLLL = z;
    }

    @QNL(LIZ = "interval", LJ = 5000)
    public void setInterval(int i) {
        this.LJ = i;
    }

    @QNL(LIZ = "max-x-scale")
    public void setMaxXScale(double d) {
        this.LJIILJJIL = (float) d;
    }

    @QNL(LIZ = "max-y-scale")
    public void setMaxYScale(double d) {
        this.LJIILLIIL = (float) d;
    }

    @QNL(LIZ = "min-x-scale")
    public void setMinXScale(double d) {
        this.LJIILIIL = (float) d;
    }

    @QNL(LIZ = "min-y-scale")
    public void setMinYScale(double d) {
        this.LJIILL = (float) d;
    }

    @QNL(LIZ = "circular", LJFF = false)
    public void setCircular(boolean z) {
        ((C5120QyD) this.mView).LIZ.LJ = z;
    }

    @QNL(LIZ = "continuous-switch", LJFF = false)
    public void setContinuousSwitch(boolean z) {
        ((C5120QyD) this.mView).LIZ.LJIJJ = z;
    }

    @QNL(LIZ = "force-can-scroll", LJFF = false)
    public void setForceCanScroll(boolean z) {
        ((C5120QyD) this.mView).LIZ.LJJII = z;
    }

    @QNL(LIZ = "indicator-dots", LJFF = false)
    public void setIndicator(boolean z) {
        int i;
        LinearLayout linearLayout = ((C5120QyD) this.mView).LIZIZ;
        if (z) {
            i = 0;
        } else {
            i = 8;
        }
        linearLayout.setVisibility(i);
    }

    @QNL(LIZ = "touchable", LJFF = false)
    public void setTouchable(boolean z) {
        ((C5120QyD) this.mView).LIZ.LJIILL = z;
    }

    @QNL(LIZ = "autoplay", LJFF = false)
    public void setAutoPlay(boolean z) {
        this.LIZJ = z;
        ((C5120QyD) this.mView).LIZ.LJIJJLI = z;
        this.LJIIJJI.removeCallbacks(this.LJIJ);
        if (this.LIZJ) {
            this.LJIIJJI.postDelayed(this.LJIJ, (long) this.LJ);
        }
    }

    @QNL(LIZ = "current", LJ = 0)
    public void setCurrentIndex(final int i) {
        C5121QyE qyE = ((C5120QyD) this.mView).LIZ;
        if (qyE.getChildCount() <= 0) {
            qyE.post(new Runnable() {
                static {
                    Covode.recordClassIndex(46763);
                }

                public final void run() {
                    XSwiperUI xSwiperUI = XSwiperUI.this;
                    xSwiperUI.LIZ(i, xSwiperUI.LJFF);
                }
            });
        } else {
            LIZ(i, this.LJFF);
        }
    }

    @QNL(LIZ = "current-item-id")
    public void setCurrentItemId(final String str) {
        if (str != null) {
            final C5121QyE qyE = ((C5120QyD) this.mView).LIZ;
            if (qyE.getChildCount() <= 0) {
                qyE.post(new Runnable() {
                    static {
                        Covode.recordClassIndex(46764);
                    }

                    public final void run() {
                        XSwiperUI.this.LIZ(str);
                    }
                });
            } else {
                LIZ(str);
            }
        }
    }

    @QNL(LIZ = "duration", LJ = 500)
    public void setDuration(int i) {
        this.LJIJJ = i;
        if (this.LJFF) {
            ((C5120QyD) this.mView).LIZ.LIZJ = i;
        } else {
            ((C5120QyD) this.mView).LIZ.LIZJ = 0;
        }
    }

    public void setLynxDirection(int i) {
        super.setLynxDirection(i);
        if (i == 2 || i == 2) {
            ((C5120QyD) this.mView).LIZ(true);
        } else {
            ((C5120QyD) this.mView).LIZ(false);
        }
        setMode(this.LJIJI);
    }

    @QNL(LIZ = "norm-translation-factor", LIZLLL = 0.0f)
    public void setNormalTranslationFactor(double d) {
        if (d <= 1.0d && d >= -1.0d) {
            this.LJIIZILJ = (float) d;
            setMode(this.LJIJI);
        }
    }

    @QNL(LIZ = "smooth-scroll", LJFF = true)
    public void setSmoothScroll(boolean z) {
        this.LJFF = z;
        if (z) {
            ((C5120QyD) this.mView).LIZ.LIZJ = this.LJIJJ;
            return;
        }
        ((C5120QyD) this.mView).LIZ.LIZJ = 0;
    }

    private boolean LIZ(C5121QyE qyE) {
        int width;
        if (qyE.LIZLLL()) {
            width = getHeight();
        } else {
            width = getWidth();
        }
        int i = this.LJIL;
        int i2 = this.LJJ;
        int i3 = this.LJIJJLI;
        int i4 = (((width - i) - i2) - i3) - i3;
        if (i < 0 || i2 < 0 || i4 <= 0) {
            return true;
        }
        int i5 = i + i3;
        if (isRtl()) {
            qyE.LIZIZ(-i5);
        } else {
            qyE.LIZIZ(i5);
        }
        qyE.LIZ(i4);
        return false;
    }

    public /* synthetic */ View createView(Context context) {
        final C5120QyD qyD = new C5120QyD(context);
        qyD.LIZ.LJIIJ = new C5127QyK() {
            static {
                Covode.recordClassIndex(46756);
            }

            public final void LIZ(int i) {
                ((C5120QyD) XSwiperUI.this.mView).LIZIZ(i);
                if (XSwiperUI.this.LJI && !qyD.LIZ.LIZIZ) {
                    QWT qwt = new QWT(XSwiperUI.this.getSign(), "change");
                    qwt.LIZ("current", Integer.valueOf(i));
                    XSwiperUI.this.mContext.LJFF.LIZ((C4502QoF) qwt);
                }
            }
        };
        C5121QyE qyE = qyD.LIZ;
        qyE.LJIIL.add(new C5123QyG() {
            public boolean LIZIZ;

            static {
                Covode.recordClassIndex(46757);
            }

            public final void LIZ() {
                this.LIZIZ = false;
                if (XSwiperUI.this.LJIIIZ && !qyD.LIZ.LIZIZ) {
                    QWT qwt = new QWT(XSwiperUI.this.getSign(), "scrollend");
                    qwt.LIZ("current", Integer.valueOf(qyD.LIZ.LIZ));
                    XSwiperUI.this.mContext.LJFF.LIZ((C4502QoF) qwt);
                }
            }

            public final void LIZIZ(float f, float f2) {
                this.LIZIZ = true;
                if (XSwiperUI.this.LJIIIIZZ && !qyD.LIZ.LIZIZ) {
                    QWT qwt = new QWT(XSwiperUI.this.getSign(), "scrollstart");
                    qwt.LIZ("current", Integer.valueOf(qyD.LIZ.LIZ));
                    qwt.LIZ("dx", Float.valueOf(C3890QeN.LIZJ(f)));
                    qwt.LIZ("dy", Float.valueOf(C3890QeN.LIZJ(f2)));
                    XSwiperUI.this.mContext.LJFF.LIZ((C4502QoF) qwt);
                }
            }

            public final void LIZJ(float f, float f2) {
                if (this.LIZIZ) {
                    XSwiperUI.this.recognizeGesturere();
                    if (XSwiperUI.this.LJIIJ && !qyD.LIZ.LIZIZ) {
                        QWT qwt = new QWT(XSwiperUI.this.getSign(), "transition");
                        qwt.LIZ("current", Integer.valueOf(qyD.LIZ.LIZ));
                        qwt.LIZ("dx", Float.valueOf(C3890QeN.LIZJ(f)));
                        qwt.LIZ("dy", Float.valueOf(C3890QeN.LIZJ(f2)));
                        XSwiperUI.this.mContext.LJFF.LIZ((C4502QoF) qwt);
                    }
                }
            }
        });
        qyD.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
            static {
                Covode.recordClassIndex(46758);
            }

            public final void onViewDetachedFromWindow(View view) {
                XSwiperUI.this.LJII = false;
                XSwiperUI.this.LJIIJJI.removeCallbacks(XSwiperUI.this.LJIJ);
            }

            public final void onViewAttachedToWindow(View view) {
                XSwiperUI.this.LJII = true;
                if (XSwiperUI.this.LIZJ) {
                    XSwiperUI.this.LJIIJJI.removeCallbacks(XSwiperUI.this.LJIJ);
                    XSwiperUI.this.LJIIJJI.postDelayed(XSwiperUI.this.LJIJ, (long) XSwiperUI.this.LJ);
                }
            }
        });
        return qyD;
    }

    public void removeChild(LynxBaseUI lynxBaseUI) {
        MethodCollector.i(2622);
        if (lynxBaseUI instanceof LynxUI) {
            this.mChildren.remove(lynxBaseUI);
            this.LJIIL.remove(((LynxUI) lynxBaseUI).mView);
            LIZ();
            C5120QyD qyD = (C5120QyD) this.mView;
            qyD.LIZIZ.removeViewAt(0);
            qyD.LIZIZ(qyD.LJFF);
        }
        MethodCollector.o(2622);
    }

    public void setEvents(Map<String, LC0> map) {
        super.setEvents(map);
        if (map != null) {
            this.LJI = map.containsKey("change");
            this.LJIIIIZZ = map.containsKey("scrollstart");
            this.LJIIIZ = map.containsKey("scrollend");
            this.LJIIJ = map.containsKey("transition");
        }
    }

    @QNL(LIZ = "indicator-active-color")
    public void setIndicatorActiveColor(String str) {
        int i;
        try {
            i = ColorUtils.LIZ(str);
        } catch (Exception unused) {
            i = LIZ;
        }
        C5120QyD qyD = (C5120QyD) this.mView;
        qyD.LIZLLL = i;
        for (int childCount = qyD.LIZIZ.getChildCount() - 1; childCount >= 0; childCount--) {
            if (childCount == qyD.LJFF) {
                qyD.LIZIZ.getChildAt(childCount).setBackground(qyD.LIZ(qyD.LIZLLL));
                return;
            }
        }
    }

    @QNL(LIZ = "indicator-color")
    public void setIndicatorColor(String str) {
        int i;
        try {
            i = ColorUtils.LIZ(str);
        } catch (Exception unused) {
            i = LIZIZ;
        }
        C5120QyD qyD = (C5120QyD) this.mView;
        qyD.LJ = i;
        for (int childCount = qyD.LIZIZ.getChildCount() - 1; childCount >= 0; childCount--) {
            if (childCount != qyD.LJFF) {
                qyD.LIZIZ.getChildAt(childCount).setBackground(qyD.LIZ(qyD.LJ));
            }
        }
    }

    @QNL(LIZ = "next-margin")
    public void setNextMargin(LC5 lc5) {
        if (lc5.LJIIIIZZ() == ReadableType.String) {
            String LJFF2 = lc5.LJFF();
            if (LJFF2.endsWith("px") || LJFF2.endsWith("rpx")) {
                int LIZIZ2 = (int) QNX.LIZIZ(LJFF2, -1.0f);
                if (LIZIZ2 >= 0) {
                    this.LJJ = LIZIZ2;
                } else {
                    this.LJJ = -1;
                }
                setMode(this.LJIJI);
            }
        }
    }

    @QNL(LIZ = "orientation")
    public void setOrientation(String str) {
        if ("vertical".equals(str)) {
            ((C5120QyD) this.mView).LIZJ(1);
        } else if ("horizontal".equals(str)) {
            ((C5120QyD) this.mView).LIZJ(0);
        }
    }

    @QNL(LIZ = "previous-margin")
    public void setPreviousMargin(LC5 lc5) {
        if (lc5.LJIIIIZZ() == ReadableType.String) {
            String LJFF2 = lc5.LJFF();
            if (LJFF2.endsWith("px") || LJFF2.endsWith("rpx")) {
                int LIZIZ2 = (int) QNX.LIZIZ(LJFF2, -1.0f);
                if (LIZIZ2 >= 0) {
                    this.LJIL = LIZIZ2;
                } else {
                    this.LJIL = -1;
                }
                setMode(this.LJIJI);
            }
        }
    }

    public XSwiperUI(C4398QmZ qmZ) {
        super(qmZ);
    }

    @QNL(LIZ = "page-margin")
    public void setPageMargin(LC5 lc5) {
        if (lc5.LJIIIIZZ() == ReadableType.String) {
            String LJFF2 = lc5.LJFF();
            if (LJFF2.endsWith("px") || LJFF2.endsWith("rpx")) {
                int LIZIZ2 = (int) QNX.LIZIZ(LJFF2, 10.0f);
                int i = 0;
                if (LIZIZ2 > 0) {
                    this.LJIJJLI = LIZIZ2;
                } else {
                    this.LJIJJLI = 0;
                }
                C5121QyE qyE = ((C5120QyD) this.mView).LIZ;
                int i2 = this.LJIJJLI;
                if (i2 >= 0) {
                    i = i2;
                }
                qyE.LJFF = i;
                qyE.LIZ(qyE.LJIIJJI);
                setMode(this.LJIJI);
            }
        }
    }

    public final void LIZ(String str) {
        for (int i = 0; i < this.mChildren.size(); i++) {
            if (str.equals(this.mChildren.get(i).mName)) {
                LIZ(i, this.LJFF);
                return;
            }
        }
    }

    @QNL(LIZ = "mode")
    public void setMode(String str) {
        int width;
        char c;
        C5121QyE qyE = ((C5120QyD) this.mView).LIZ;
        if (qyE.LIZLLL()) {
            width = getHeight();
        } else {
            width = getWidth();
        }
        str.hashCode();
        switch (str.hashCode()) {
            case -1039745817:
                if (str.equals("normal")) {
                    c = 0;
                    break;
                } else {
                    return;
                }
            case 2908512:
                if (str.equals("carousel")) {
                    c = 1;
                    break;
                } else {
                    return;
                }
            case 94431515:
                if (str.equals("carry")) {
                    c = 2;
                    break;
                } else {
                    return;
                }
            case 1720139793:
                if (str.equals("flat-coverflow")) {
                    c = 3;
                    break;
                } else {
                    return;
                }
            case 1980277093:
                if (str.equals("coverflow")) {
                    c = 4;
                    break;
                } else {
                    return;
                }
            default:
                return;
        }
        switch (c) {
            case 0:
                this.LJIJI = "normal";
                qyE.LIZ((C5125QyI) null);
                qyE.LIZIZ(0);
                qyE.LIZ(1.0f);
                return;
            case 1:
                this.LJIJI = "carousel";
                qyE.LIZ((C5125QyI) null);
                qyE.LIZIZ(0);
                qyE.LIZ(0.8f);
                return;
            case 2:
                this.LJIJI = "carry";
                qyE.LIZ(this.LJJII);
                if (LIZ(qyE)) {
                    qyE.LIZIZ(0);
                    qyE.LIZ(1.0f);
                    return;
                }
                return;
            case 3:
                this.LJIJI = "flat-coverflow";
                qyE.LIZ((C5125QyI) null);
                if (LIZ(qyE)) {
                    int i = (int) ((((float) width) * 0.4f) / 2.0f);
                    if (isRtl()) {
                        qyE.LIZIZ(-i);
                    } else {
                        qyE.LIZIZ(i);
                    }
                    qyE.LIZ(0.6f);
                    return;
                }
                return;
            case 4:
                this.LJIJI = "coverflow";
                qyE.LIZ(this.LJJIFFI);
                if (LIZ(qyE)) {
                    int i2 = (int) ((((float) width) * 0.4f) / 2.0f);
                    if (isRtl()) {
                        qyE.LIZIZ(-i2);
                    } else {
                        qyE.LIZIZ(i2);
                    }
                    qyE.LIZ(0.6f);
                    return;
                }
                return;
            default:
                return;
        }
    }

    public void updateAttributes(QNZ qnz) {
        super.updateAttributes(qnz);
        ReadableMap readableMap = qnz.LIZ;
        ReadableMapKeySetIterator keySetIterator = readableMap.keySetIterator();
        while (keySetIterator.hasNextKey()) {
            String nextKey = keySetIterator.nextKey();
            try {
                switch (nextKey.hashCode()) {
                    case -1992012396:
                        if (!nextKey.equals("duration")) {
                            break;
                        } else {
                            setDuration(readableMap.getInt(nextKey));
                            break;
                        }
                    case -1811312718:
                        if (!nextKey.equals("continuous-switch")) {
                            break;
                        } else {
                            setContinuousSwitch(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case -1596393144:
                        if (!nextKey.equals("indicator-dots")) {
                            break;
                        } else {
                            setIndicator(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case -1498085729:
                        if (!nextKey.equals("circular")) {
                            break;
                        } else {
                            setCircular(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case -1439500848:
                        if (!nextKey.equals("orientation")) {
                            break;
                        } else {
                            setOrientation(readableMap.getString(nextKey));
                            break;
                        }
                    case -1029251878:
                        if (!nextKey.equals("indicator-active-color")) {
                            break;
                        } else {
                            setIndicatorActiveColor(readableMap.getString(nextKey));
                            break;
                        }
                    case -111166008:
                        if (!nextKey.equals("next-margin")) {
                            break;
                        } else {
                            setNextMargin(readableMap.getDynamic(nextKey));
                            break;
                        }
                    case 3357091:
                        if (!nextKey.equals("mode")) {
                            break;
                        } else {
                            setMode(readableMap.getString(nextKey));
                            break;
                        }
                    case 24002884:
                        if (!nextKey.equals("previous-margin")) {
                            break;
                        } else {
                            setPreviousMargin(readableMap.getDynamic(nextKey));
                            break;
                        }
                    case 364166425:
                        if (!nextKey.equals("touchable")) {
                            break;
                        } else {
                            setTouchable(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case 570418373:
                        if (!nextKey.equals("interval")) {
                            break;
                        } else {
                            setInterval(readableMap.getInt(nextKey));
                            break;
                        }
                    case 1090700700:
                        if (!nextKey.equals("norm-translation-factor")) {
                            break;
                        } else {
                            setNormalTranslationFactor(readableMap.getDouble(nextKey));
                            break;
                        }
                    case 1126940025:
                        if (!nextKey.equals("current")) {
                            break;
                        } else {
                            setCurrentIndex(readableMap.getInt(nextKey));
                            break;
                        }
                    case 1127093697:
                        if (!nextKey.equals("current-item-id")) {
                            break;
                        } else {
                            setCurrentItemId(readableMap.getString(nextKey));
                            break;
                        }
                    case 1439562083:
                        if (!nextKey.equals("autoplay")) {
                            break;
                        } else {
                            setAutoPlay(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case 1599847372:
                        if (!nextKey.equals("smooth-scroll")) {
                            break;
                        } else {
                            setSmoothScroll(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case 1665556140:
                        if (!nextKey.equals("page-margin")) {
                            break;
                        } else {
                            setPageMargin(readableMap.getDynamic(nextKey));
                            break;
                        }
                    case 1696908181:
                        if (!nextKey.equals("finish-reset")) {
                            break;
                        } else {
                            setFinishReset(readableMap.getBoolean(nextKey));
                            break;
                        }
                    case 2050488869:
                        if (!nextKey.equals("indicator-color")) {
                            break;
                        } else {
                            setIndicatorColor(readableMap.getString(nextKey));
                            break;
                        }
                }
            } catch (Exception e) {
                0HH.LIZ(e);
                throw new RuntimeException("setProperty error: " + nextKey + "\n" + e.toString());
            }
        }
    }

    public final void LIZ(int i, boolean z) {
        C5121QyE qyE = ((C5120QyD) this.mView).LIZ;
        if (i >= 0 && i < qyE.LJIILIIL) {
            this.LJJI = i;
            qyE.LIZ(i, z);
        }
    }

    public void insertChild(LynxBaseUI lynxBaseUI, int i) {
        MethodCollector.i(2535);
        if (lynxBaseUI instanceof LynxUI) {
            this.mChildren.add(i, lynxBaseUI);
            lynxBaseUI.setParent(this);
            this.LJIIL.add(i, ((LynxUI) lynxBaseUI).mView);
            LIZ();
            C5120QyD qyD = (C5120QyD) this.mView;
            View view = new View(qyD.getContext());
            view.setClickable(false);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(qyD.LIZJ, qyD.LIZJ);
            if (qyD.LJI == 1) {
                int i2 = qyD.LIZJ / 2;
                layoutParams.bottomMargin = i2;
                layoutParams.topMargin = i2;
            } else {
                int i3 = qyD.LIZJ / 2;
                layoutParams.rightMargin = i3;
                layoutParams.leftMargin = i3;
            }
            qyD.LIZIZ.addView(view, layoutParams);
            if (qyD.LIZIZ.getChildCount() == qyD.LIZLLL) {
                view.setBackground(qyD.LIZ(qyD.LIZLLL));
                MethodCollector.o(2535);
                return;
            }
            view.setBackground(qyD.LIZ(qyD.LJ));
        }
        MethodCollector.o(2535);
    }

    public final float LIZ(float f, float f2, float f3) {
        return Math.min(f3, Math.max(f2, f));
    }
}
