package com.ss.android.ugc.aweme.choosemusic.sug;

import X.0HH;
import X.2ha;
import X.2nK;
import X.4ZZ;
import X.7he;
import X.Aws;
import X.BGW;
import X.BGa;
import X.C5616Oax;
import X.C5819OeE;
import X.C5821OeG;
import X.C5822OeH;
import X.C5824OeJ;
import X.C5826OeL;
import X.C6225Okm;
import X.CDg;
import X.CEB;
import X.Crj;
import X.DaP;
import X.M12;
import X.MKS;
import X.MKW;
import X.OSU;
import X.Qeg;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.powerlist.PowerCell;
import com.ss.android.ugc.aweme.discover.model.suggest.Word;
import java.util.Map;
import java.util.Objects;
import kotlin.h.b.n;

public final class SearchMusicSugHistoryCell extends PowerCell<C5824OeJ> {
    public final Crj LIZ = 7he.LIZ(C5826OeL.LIZ);
    public final int LIZIZ = 17;
    public int LJIIIZ = 2ha.LIZ(48.0d);

    static {
        Covode.recordClassIndex(56351);
    }

    public final void bD_() {
        SearchMusicSugHistoryCell.super.bD_();
        Qeg findViewById = this.itemView.findViewById(2131371875);
        n.LIZIZ(findViewById, "");
        findViewById.setMaxLines(1);
        View view = this.itemView;
        n.LIZIZ(view, "");
        view.findViewById(2131371875).setTextSize(1, (float) this.LIZIZ);
    }

    public final View LIZ(ViewGroup viewGroup) {
        M12.LIZ(viewGroup);
        View LIZ2 = 0HH.LIZ(LayoutInflater.from(viewGroup.getContext()), 2131561137, viewGroup, false);
        n.LIZIZ(LIZ2, "");
        return LIZ2;
    }

    public final /* synthetic */ void LIZ(DaP daP) {
        String str;
        String str2;
        String id;
        C5824OeJ oeJ = (C5824OeJ) daP;
        M12.LIZ(oeJ);
        SearchMusicSugHistoryCell.super.LIZ(oeJ);
        CDg cDg = oeJ.LIZ;
        View view = this.itemView;
        String str3 = "";
        n.LIZIZ(view, str3);
        Qeg findViewById = view.findViewById(2131371875);
        n.LIZIZ(findViewById, str3);
        View view2 = this.itemView;
        n.LIZIZ(view2, str3);
        String str4 = null;
        BGW.LIZ(cDg, findViewById, view2, (View) null, this.LJIIIZ);
        if (BGa.LIZ.LIZIZ()) {
            View view3 = this.itemView;
            n.LIZIZ(view3, str3);
            4ZZ findViewById2 = view3.findViewById(2131366469);
            n.LIZIZ(findViewById2, str3);
            ViewGroup.LayoutParams layoutParams = findViewById2.getLayoutParams();
            Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
            layoutParams2.setMarginEnd(2ha.LIZ(12.0d));
            View view4 = this.itemView;
            n.LIZIZ(view4, str3);
            4ZZ findViewById3 = view4.findViewById(2131366469);
            n.LIZIZ(findViewById3, str3);
            findViewById3.setLayoutParams(layoutParams2);
        }
        if (CEB.LIZ.LIZ()) {
            int LIZ2 = MKW.LIZ();
            if (LIZ2 == 1) {
                View view5 = this.itemView;
                n.LIZIZ(view5, str3);
                4ZZ findViewById4 = view5.findViewById(2131366469);
                View view6 = this.itemView;
                n.LIZIZ(view6, str3);
                Context context = view6.getContext();
                n.LIZIZ(context, str3);
                Integer LIZ3 = C6225Okm.LIZ(context, 2130968673);
                if (LIZ3 == null) {
                    n.LIZIZ();
                }
                findViewById4.setTintColor(LIZ3.intValue());
                View view7 = this.itemView;
                n.LIZIZ(view7, str3);
                4ZZ findViewById5 = view7.findViewById(2131366387);
                View view8 = this.itemView;
                n.LIZIZ(view8, str3);
                Context context2 = view8.getContext();
                n.LIZIZ(context2, str3);
                Integer LIZ4 = C6225Okm.LIZ(context2, 2130968673);
                if (LIZ4 == null) {
                    n.LIZIZ();
                }
                findViewById5.setTintColor(LIZ4.intValue());
            } else if (LIZ2 == 2) {
                View view9 = this.itemView;
                n.LIZIZ(view9, str3);
                4ZZ findViewById6 = view9.findViewById(2131366469);
                View view10 = this.itemView;
                n.LIZIZ(view10, str3);
                Context context3 = view10.getContext();
                n.LIZIZ(context3, str3);
                Integer LIZ5 = C6225Okm.LIZ(context3, 2130968672);
                if (LIZ5 == null) {
                    n.LIZIZ();
                }
                findViewById6.setTintColor(LIZ5.intValue());
                View view11 = this.itemView;
                n.LIZIZ(view11, str3);
                4ZZ findViewById7 = view11.findViewById(2131366387);
                View view12 = this.itemView;
                n.LIZIZ(view12, str3);
                Context context4 = view12.getContext();
                n.LIZIZ(context4, str3);
                Integer LIZ6 = C6225Okm.LIZ(context4, 2130968672);
                if (LIZ6 == null) {
                    n.LIZIZ();
                }
                findViewById7.setTintColor(LIZ6.intValue());
                View view13 = this.itemView;
                n.LIZIZ(view13, str3);
                View findViewById8 = view13.findViewById(2131372954);
                n.LIZIZ(findViewById8, str3);
                View view14 = this.itemView;
                n.LIZIZ(view14, str3);
                findViewById8.setBackground(view14.getContext().getDrawable(2131233730));
                View view15 = this.itemView;
                n.LIZIZ(view15, str3);
                View findViewById9 = view15.findViewById(2131372954);
                n.LIZIZ(findViewById9, str3);
                findViewById9.setVisibility(0);
                View view16 = this.itemView;
                n.LIZIZ(view16, str3);
                4ZZ findViewById10 = view16.findViewById(2131366469);
                n.LIZIZ(findViewById10, str3);
                ViewGroup.LayoutParams layoutParams3 = findViewById10.getLayoutParams();
                Objects.requireNonNull(layoutParams3, "null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
                FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) layoutParams3;
                layoutParams4.setMarginStart(2ha.LIZ(24.0d));
                layoutParams4.setMarginEnd(2ha.LIZ(14.0d));
                View view17 = this.itemView;
                n.LIZIZ(view17, str3);
                4ZZ findViewById11 = view17.findViewById(2131366469);
                n.LIZIZ(findViewById11, str3);
                findViewById11.setLayoutParams(layoutParams4);
            }
            if (MKS.LIZ()) {
                View view18 = this.itemView;
                n.LIZIZ(view18, str3);
                Qeg findViewById12 = view18.findViewById(2131371875);
                View view19 = this.itemView;
                n.LIZIZ(view19, str3);
                Context context5 = view19.getContext();
                n.LIZIZ(context5, str3);
                Integer LIZ7 = C6225Okm.LIZ(context5, 2130968672);
                if (LIZ7 == null) {
                    n.LIZIZ();
                }
                findViewById12.setTextColor(LIZ7.intValue());
            }
            View view20 = this.itemView;
            n.LIZIZ(view20, str3);
            Qeg findViewById13 = view20.findViewById(2131371875);
            n.LIZIZ(findViewById13, str3);
            View view21 = this.itemView;
            n.LIZIZ(view21, str3);
            findViewById13.setText(Aws.LIZIZ(view21.getContext(), cDg.LIZIZ, cDg.LIZLLL));
        }
        this.itemView.setOnClickListener(new C5819OeE(this, cDg, oeJ));
        View view22 = this.itemView;
        n.LIZIZ(view22, str3);
        view22.findViewById(2131366387).setOnClickListener(new C5821OeG(this, cDg, oeJ));
        int layoutPosition = getLayoutPosition();
        if (!cDg.LJIIIZ) {
            cDg.LJIIIZ = true;
            C5822OeH oeH = new C5822OeH();
            oeH.LIZ("words_source", "sug");
            oeH.LIZ("search_position", "video_music");
            oeH.LIZ("words_position", layoutPosition);
            oeH.LIZ("words_content", cDg.LIZIZ);
            Word word = cDg.LJFF;
            if (word == null || (str = word.getId()) == null) {
                str = str3;
            }
            oeH.LIZ("group_id", str);
            oeH.LIZ("creation_id", OSU.LIZLLL);
            oeH.LIZ(cDg.LJIIJ);
            oeH.LIZ("new_sug_session_id", C5616Oax.LIZ);
            2nK.LIZ("trending_words_show", oeH.LIZ);
            C5822OeH oeH2 = new C5822OeH();
            oeH2.LIZ("enter_method", "sug");
            Map map = cDg.LJIIJ;
            if (map != null) {
                str2 = (String) map.get("impr_id");
            } else {
                str2 = null;
            }
            oeH2.LIZ("query_id", str2);
            Map map2 = cDg.LJIIJ;
            if (map2 != null) {
                str4 = (String) map2.get("raw_query");
            }
            oeH2.LIZ("input_keyword", str4);
            oeH2.LIZ("search_keyword", cDg.LIZIZ);
            oeH2.LIZ("order", layoutPosition);
            oeH2.LIZ("search_type", "video_music");
            Word word2 = cDg.LJFF;
            if (!(word2 == null || (id = word2.getId()) == null)) {
                str3 = id;
            }
            oeH2.LIZ("group_id", str3);
            oeH2.LIZ("words_type", "history");
            oeH2.LIZ("new_sug_session_id", C5616Oax.LIZ);
            2nK.LIZ("search_trending_show", oeH2.LIZ);
        }
    }
}
