package com.ss.android.ugc.aweme.xsearch.horizontallist;

import X.0Rw;
import X.2cN;
import X.7tl;
import X.8Dq;
import X.C3769Seb;
import X.C3771Sed;
import X.C3772See;
import X.C3774Seg;
import X.C3803Sf9;
import X.C3834Sfe;
import X.C3880SgO;
import X.C3931ShD;
import X.C3987Si7;
import X.C4051Sj9;
import X.C4052SjA;
import X.C4077SjZ;
import X.C4289Smz;
import X.C4302SnC;
import X.C4319SnT;
import X.C4427SpD;
import X.LeG;
import X.LvU;
import X.M12;
import X.Mk2;
import X.Mk3;
import X.PhE;
import X.PiN;
import X.PlI;
import X.QNE;
import X.QNL;
import X.QmA;
import X.QmZ;
import X.SS5;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.bytedance.covode.number.Covode;
import com.lynx.react.bridge.JavaOnlyMap;
import com.lynx.react.bridge.ReadableMap;
import com.lynx.tasm.behavior.ui.LynxBaseUI;
import com.lynx.tasm.behavior.ui.view.UISimpleView;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import kotlin.h.b.n;

public final class LynxSearchHorizontal extends UISimpleView<C3774Seg> implements C4302SnC {
    public static final C4427SpD LIZIZ = new C4427SpD((byte) 0);
    public SearchHorizontalBounceView LIZJ;

    static {
        Covode.recordClassIndex(124608);
    }

    @QNL(LIZ = "anchormargin")
    public final void anchorMarginFromLynx(String str) {
    }

    @QNL(LIZ = "anchortype")
    public final void anchorTypeFromLynx(String str) {
    }

    public final void layout() {
        M12.LIZ("LynxSearchHorizontal layout");
        LynxSearchHorizontal.super.layout();
    }

    public final void measure() {
        M12.LIZ("LynxSearchHorizontal measure");
        LynxSearchHorizontal.super.measure();
    }

    @7tl
    public final void becomeactive() {
        C3774Seg seg = (C3774Seg) this.mView;
        seg.LJ.LJFF = true;
        C3769Seb seb = seg.LJ;
        0Rw.LIZ(1, "HorizontalContainer", "SearchHorizontalInnerContainer:  attachAutoPlay");
        seb.LJIIJ.LIZIZ.notifyDataSetChanged();
        seg.LJ.LIZIZ();
    }

    public final void initialize() {
        LynxSearchHorizontal.super.initialize();
        ((C3774Seg) this.mView).setEventChangeListener(new QNE(this, (Set) SS5.LIZ.getValue()));
    }

    @7tl
    public final void resignactive() {
        C3774Seg seg = (C3774Seg) this.mView;
        seg.LJ.LJFF = false;
        C3769Seb seb = seg.LJ;
        0Rw.LIZ(1, "HorizontalContainer", "SearchHorizontalInnerContainer:  detachAutoPlay");
        seb.LJIIJ.LIZIZ.notifyDataSetChanged();
    }

    public final void destroy() {
        C3803Sf9 sf9;
        LynxSearchHorizontal.super.destroy();
        List<LvU> LIZJ2 = ((C3774Seg) this.mView).LJ.LIZJ();
        ArrayList<C3772See> arrayList = new ArrayList<>();
        for (T next : LIZJ2) {
            if (next instanceof C3772See) {
                arrayList.add(next);
            }
        }
        for (C3772See see : arrayList) {
            8Dq r0 = see.LIZ;
            if (!(r0 == null || (sf9 = r0.LJIIJJI) == null)) {
                sf9.LJFF();
            }
        }
    }

    public final void measureChildren() {
        ViewGroup.LayoutParams layoutParams;
        M12.LIZ("LynxSearchHorizontal measureChildren");
        LynxSearchHorizontal.super.measureChildren();
        SearchHorizontalBounceView searchHorizontalBounceView = this.LIZJ;
        if (searchHorizontalBounceView != null) {
            int width = searchHorizontalBounceView.getWidth();
            int height = searchHorizontalBounceView.getHeight();
            SearchHorizontalBounceView searchHorizontalBounceView2 = this.LIZJ;
            if (searchHorizontalBounceView2 != null) {
                searchHorizontalBounceView2.measure();
            }
            C3771Sed subHolder = ((C3774Seg) this.mView).getSubHolder();
            View view = subHolder.LJIIJJI;
            if (view == null || (layoutParams = view.getLayoutParams()) == null) {
                layoutParams = new FrameLayout.LayoutParams(width, height);
            }
            layoutParams.width = width;
            layoutParams.height = height;
            View view2 = subHolder.LJIIJJI;
            if (view2 != null) {
                view2.setLayoutParams(layoutParams);
            }
            ViewGroup viewGroup = subHolder.LJIIJ.LIZJ;
            if (viewGroup != null) {
                ViewGroup.LayoutParams layoutParams2 = viewGroup.getLayoutParams();
                if (layoutParams2 == null) {
                    layoutParams2 = new LinearLayout.LayoutParams(width, -1);
                }
                layoutParams2.width = width;
                viewGroup.setLayoutParams(layoutParams2);
            }
            SearchHorizontalBounceView searchHorizontalBounceView3 = this.LIZJ;
            if (searchHorizontalBounceView3 != null) {
                searchHorizontalBounceView3.layout();
            }
        }
    }

    public LynxSearchHorizontal(QmZ qmZ) {
        super(qmZ);
    }

    @QNL(LIZ = "sessionid")
    public final void setSessionIdFromLynx(int i) {
        ((C3774Seg) this.mView).setSessionIdFromLynx(i);
    }

    @QNL(LIZ = "bounce")
    public final void bounceFromLynx(boolean z) {
        ((C3774Seg) this.mView).getSubHolder().LIZ(z);
    }

    public final /* synthetic */ View createView(Context context) {
        if (context == null) {
            n.LIZIZ();
        }
        return new C3774Seg(context, (byte) 0);
    }

    @QNL(LIZ = "autoplay")
    public final void setAutoPlay(boolean z) {
        if (z) {
            becomeactive();
        } else {
            resignactive();
        }
    }

    @QNL(LIZ = "snaptogrid")
    public final void snapToGridFromLynx(boolean z) {
        ((C3774Seg) this.mView).getHolderWrapper().LIZ(z);
    }

    @QNL(LIZ = "activearea")
    public final void activeAreaFromLynx(ReadableMap readableMap) {
        C3774Seg seg = (C3774Seg) this.mView;
        if (readableMap instanceof JavaOnlyMap) {
            seg.LIZ((JavaOnlyMap) readableMap, C3931ShD.class, new C3880SgO(seg.getHolderWrapper()));
        }
    }

    @QNL(LIZ = "horizontalstyle")
    public final void horizontalStyleFromLynx(ReadableMap readableMap) {
        C3774Seg seg = (C3774Seg) this.mView;
        if (!(readableMap instanceof JavaOnlyMap)) {
            seg.LIZLLL = true;
        } else {
            seg.LIZ((JavaOnlyMap) readableMap, C4077SjZ.class, new C3834Sfe(seg.getHolderWrapper(), seg, readableMap));
        }
    }

    @QNL(LIZ = "logextra")
    public final void logExtraFromLynx(ReadableMap readableMap) {
        C3774Seg seg = (C3774Seg) this.mView;
        if (readableMap != null) {
            C3769Seb seb = seg.LJ;
            seb.LIZIZ = readableMap;
            String string = readableMap.getString("token_type");
            if (string == null) {
                string = "";
            }
            seb.LJ = string;
            seg.LIZIZ = true;
        }
    }

    @7tl
    public final void scrolltoindex(ReadableMap readableMap) {
        C3774Seg seg = (C3774Seg) this.mView;
        if (readableMap instanceof JavaOnlyMap) {
            seg.LIZ((JavaOnlyMap) readableMap, C4052SjA.class, new C4051Sj9(seg));
        } else {
            seg.LJ.LIZ((C4052SjA) null);
        }
    }

    @QNL(LIZ = "datalist")
    public final void bind(ReadableMap readableMap) {
        C3774Seg seg = (C3774Seg) this.mView;
        if (readableMap != null) {
            2cN LIZ = PiN.LIZ(readableMap).LIZIZ(new LeG(seg)).LIZIZ(PhE.LIZ(PlI.LIZIZ)).LIZ(Mk2.LIZ(Mk3.LIZ)).LIZ(new C3987Si7(seg), C4319SnT.LIZ, new C4289Smz(seg, seg.getDisposableList().size()));
            List<2cN> disposableList = seg.getDisposableList();
            n.LIZIZ(LIZ, "");
            disposableList.add(LIZ);
        }
    }

    public final void insertChild(LynxBaseUI lynxBaseUI, int i) {
        if (lynxBaseUI instanceof SearchHorizontalBounceView) {
            SearchHorizontalBounceView searchHorizontalBounceView = (SearchHorizontalBounceView) lynxBaseUI;
            this.LIZJ = searchHorizontalBounceView;
            QmA qmA = searchHorizontalBounceView.mView;
            n.LIZIZ(qmA, "");
            ((C3774Seg) this.mView).setBounceView(qmA);
        }
    }

    public final void updateLayout(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, Rect rect) {
        M12.LIZ("LynxSearchHorizontal updateLayout");
        LynxSearchHorizontal.super.updateLayout(i, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, rect);
    }

    public final void updateLayoutInfo(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, Rect rect) {
        M12.LIZ("LynxSearchHorizontal updateLayoutInfo");
        LynxSearchHorizontal.super.updateLayoutInfo(i, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, rect);
    }
}
