package com.ss.android.ugc.aweme.cell;

import X.0HH;
import X.2ha;
import X.4FI;
import X.A7R;
import X.A7S;
import X.A7T;
import X.A7U;
import X.A7V;
import X.A7W;
import X.A7X;
import X.A7Y;
import X.C1901Ajh;
import X.C1902Aji;
import X.C1903Ajj;
import X.C1904Ajk;
import X.C1905Ajl;
import X.C1906Ajm;
import X.C1923Ak3;
import X.C1925Ak5;
import X.C2153Anl;
import X.C2158Anq;
import X.C6519Cbz;
import X.Csa;
import X.Csw;
import X.Csy;
import X.Ct1;
import X.D1G;
import X.DaP;
import X.HeD;
import X.KEM;
import X.M12;
import X.OCa;
import X.OD6;
import X.Qeg;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.lighten.loader.SmartImageView;
import com.ss.android.ugc.aweme.feed.model.AwemeTextLabelModel;
import com.ss.android.ugc.aweme.feed.model.Video;
import com.ss.android.ugc.aweme.viewmodel.MentionMusicVideoVM;
import kotlin.h.b.n;

public final class MusicVideoCell extends BaseVideoCell<C1925Ak5> {
    public final String LJIILLIIL = "MusicVideoCell";
    public final String LJIIZILJ = "Preview music video";
    public final Csa LJIJ;
    public TextView LJIJI;
    public TextView LJIJJ;
    public TextView LJIJJLI;
    public OD6 LJIL;

    static {
        Covode.recordClassIndex(55554);
    }

    public final MentionMusicVideoVM LJIL() {
        return (MentionMusicVideoVM) this.LJIJ.getValue();
    }

    public final void bD_() {
        LIZ().setOnClickListener(new C2158Anq(this));
        LIZLLL().setOnClickListener(new C2153Anl(this));
    }

    public MusicVideoCell() {
        Csa csa;
        Csy csy = Csy.LIZ;
        D1G LIZ = KEM.LIZ.LIZ(MentionMusicVideoVM.class);
        A7Y a7y = new A7Y(LIZ);
        C1904Ajk ajk = C1904Ajk.INSTANCE;
        if (n.LIZ(csy, Csw.LIZ)) {
            csa = new Csa(LIZ, a7y, C1902Aji.INSTANCE, new A7S(this), new A7R(this), C1906Ajm.INSTANCE, ajk);
        } else if (n.LIZ(csy, Csy.LIZ)) {
            csa = new Csa(LIZ, a7y, C1903Ajj.INSTANCE, new A7U(this), new A7T(this), C1905Ajl.INSTANCE, ajk);
        } else if (csy != null && !n.LIZ(csy, Ct1.LIZ)) {
            throw new IllegalArgumentException("Don't support this VMScope: " + csy + " there");
        } else {
            csa = new Csa(LIZ, a7y, C1901Ajh.INSTANCE, new A7X(this), new A7V(this), new A7W(this), ajk);
        }
        this.LJIJ = csa;
    }

    public final View LIZ(ViewGroup viewGroup) {
        M12.LIZ(viewGroup);
        View LIZ = 0HH.LIZ(LayoutInflater.from(viewGroup.getContext()), 2131560609, viewGroup, false);
        SmartImageView findViewById = LIZ.findViewById(2131363809);
        n.LIZIZ(findViewById, "");
        LIZ(findViewById);
        OD6 findViewById2 = LIZ.findViewById(2131366388);
        n.LIZIZ(findViewById2, "");
        this.LJIL = findViewById2;
        4FI findViewById3 = LIZ.findViewById(2131363271);
        n.LIZIZ(findViewById3, "");
        LIZ(findViewById3);
        View findViewById4 = LIZ.findViewById(2131372789);
        n.LIZIZ(findViewById4, "");
        LIZIZ((ViewGroup) findViewById4);
        Qeg findViewById5 = LIZ.findViewById(2131372209);
        n.LIZIZ(findViewById5, "");
        LIZ(findViewById5);
        View findViewById6 = LIZ.findViewById(2131366641);
        n.LIZIZ(findViewById6, "");
        this.LJIJI = (TextView) findViewById6;
        View findViewById7 = LIZ.findViewById(2131366645);
        n.LIZIZ(findViewById7, "");
        this.LJIJJ = (TextView) findViewById7;
        View findViewById8 = LIZ.findViewById(2131366662);
        n.LIZIZ(findViewById8, "");
        this.LJIJJLI = (TextView) findViewById8;
        View findViewById9 = LIZ.findViewById(2131372762);
        n.LIZIZ(findViewById9, "");
        LIZ(findViewById9);
        LJ().setVisibility(8);
        n.LIZIZ(LIZ, "");
        return LIZ;
    }

    public final /* synthetic */ void LIZ(DaP daP) {
        C1925Ak5 ak5 = (C1925Ak5) daP;
        M12.LIZ(ak5);
        MusicVideoCell.super.LIZ(ak5);
        LIZ().setContentDescription("");
        LIZ(ak5.LIZ);
        OD6 od6 = this.LJIL;
        if (od6 == null) {
            n.LIZ("");
        }
        od6.setVisibility(4);
        TextView textView = this.LJIJJLI;
        if (textView == null) {
            n.LIZ("");
        }
        textView.setVisibility(8);
        TextView textView2 = this.LJIJI;
        if (textView2 == null) {
            n.LIZ("");
        }
        textView2.setVisibility(8);
        TextView textView3 = this.LJIJJ;
        if (textView3 == null) {
            n.LIZ("");
        }
        textView3.setVisibility(8);
        C1923Ak3.LIZ(LJ(), ak5.LIZ);
        if (ak5.LIZ.getMusicStarter() != null) {
            TextView textView4 = this.LJIJJ;
            if (textView4 == null) {
                n.LIZ("");
            }
            textView4.setVisibility(0);
            if (!TextUtils.isEmpty(ak5.LIZ.getLabelMusicStarterText())) {
                TextView textView5 = this.LJIJJ;
                if (textView5 == null) {
                    n.LIZ("");
                }
                textView5.setText(ak5.LIZ.getLabelMusicStarterText());
            }
        }
        LIZ(ak5);
        Video video = LJFF().getVideo();
        if (video != null) {
            LIZ(video.getCover(), this.LJIILLIIL);
        }
        if (ak5.LIZ.isPgcShow()) {
            if (ak5.LIZ.getTextTopLabels() != null && ak5.LIZ.getTextTopLabels().size() > 0) {
                TextView textView6 = this.LJIJJLI;
                if (textView6 == null) {
                    n.LIZ("");
                }
                textView6.setVisibility(0);
                OD6 od62 = this.LJIL;
                if (od62 == null) {
                    n.LIZ("");
                }
                od62.setVisibility(8);
                TextView textView7 = this.LJIJJLI;
                if (textView7 == null) {
                    n.LIZ("");
                }
                Object obj = ak5.LIZ.getTextTopLabels().get(0);
                n.LIZIZ(obj, "");
                LIZ(textView7, (AwemeTextLabelModel) obj);
            }
        } else if (ak5.LIZ.getMusicStarter() != null || ak5.LIZ.getOriginAuthor() != null || !TextUtils.equals(this.LJIIZILJ, "challenge") || ak5.LIZ.getIsTop() != 1) {
        } else {
            if (ak5.LIZ.getTextTopLabels() == null || ak5.LIZ.getTextTopLabels().size() <= 0) {
                TextView textView8 = this.LJIJJLI;
                if (textView8 == null) {
                    n.LIZ("");
                }
                textView8.setVisibility(8);
                OD6 od63 = this.LJIL;
                if (od63 == null) {
                    n.LIZ("");
                }
                od63.setVisibility(0);
                OD6 od64 = this.LJIL;
                if (od64 == null) {
                    n.LIZ("");
                }
                OCa.LIZ(od64, ak5.LIZ.getLabelTop(), (int) HeD.LIZIZ(LJIJI(), 6.0f), (int) HeD.LIZIZ(LJIJI(), 6.0f));
                return;
            }
            TextView textView9 = this.LJIJJLI;
            if (textView9 == null) {
                n.LIZ("");
            }
            textView9.setVisibility(0);
            OD6 od65 = this.LJIL;
            if (od65 == null) {
                n.LIZ("");
            }
            od65.setVisibility(8);
            TextView textView10 = this.LJIJJLI;
            if (textView10 == null) {
                n.LIZ("");
            }
            Object obj2 = ak5.LIZ.getTextTopLabels().get(0);
            n.LIZIZ(obj2, "");
            LIZ(textView10, (AwemeTextLabelModel) obj2);
        }
    }

    private final void LIZ(TextView textView, AwemeTextLabelModel awemeTextLabelModel) {
        if (TextUtils.isEmpty(awemeTextLabelModel.getLabelName())) {
            textView.setVisibility(8);
            return;
        }
        textView.setText(awemeTextLabelModel.getLabelName());
        textView.setTextSize(0, (float) 2ha.LIZ(12.0d));
        textView.setTextColor(Color.parseColor(awemeTextLabelModel.getTextColor()));
        textView.setBackground(C6519Cbz.LIZ(Color.parseColor(awemeTextLabelModel.getBgColor()), (float) 2ha.LIZ(2.0d)));
        textView.setSingleLine();
    }
}
