package com.ss.android.ugc.aweme.detail.panel;

import X.070;
import X.0HH;
import X.2GO;
import X.2Ro;
import X.3Fl;
import X.3GT;
import X.6mb;
import X.BPA;
import X.ESC;
import X.OCa;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.homepage.msadapt.MSAdaptionService;
import com.ss.android.ugc.aweme.music.model.Music;
import com.ss.android.ugc.aweme.out.AVExternalServiceImpl;
import com.ss.android.ugc.aweme.prop.impl.PropReuseServiceImpl;
import com.ss.android.ugc.aweme.tools.detail.IPropReuseService;
import java.util.ArrayList;
import java.util.List;

public class StickerFeedPanel extends ShootFeedPanel implements 2GO {
    public List<BPA> LIZ;
    public String LIZIZ;
    public View LJJIZ;

    static {
        Covode.recordClassIndex(63770);
    }

    public final int LJIILIIL() {
        return 2131834584;
    }

    private BPA LJJLIIIJLJLI() {
        List<BPA> list = this.LIZ;
        if (list == null || list.isEmpty()) {
            return null;
        }
        return this.LIZ.get(0);
    }

    public final void cs_() {
        View view;
        super.cs_();
        if (3Fl.LJIILIIL == 0 && (view = this.LJJIZ) != null) {
            view.setBackgroundColor(070.LIZJ(this.LLL, 2131099655));
        }
    }

    public StickerFeedPanel(Bundle bundle) {
        this.LIZ = (List) bundle.getSerializable("feed_data_sticker_model");
        this.LIZIZ = bundle.getString("feed_data_sticker_group_id", "");
    }

    public final View LIZ(RelativeLayout relativeLayout) {
        View LIZ2 = 0HH.LIZ(LayoutInflater.from(this.LLL), 2131559533, relativeLayout, false);
        this.LJJIZ = LIZ2.findViewById(2131370698);
        BPA LJJLIIIJLJLI = LJJLIIIJLJLI();
        if (LJJLIIIJLJLI != null) {
            OCa.LIZ(LIZ2.findViewById(2131370697), LJJLIIIJLJLI.iconUrl);
            LIZ(LIZ2.findViewById(2131364812), LJJLIIIJLJLI.name);
            6mb.LIZ(LJJLIIIJLJLI.isFavorite);
        }
        return LIZ2;
    }

    public final void LIZ(View view) {
        String str;
        int i = 0;
        if (this.LLL == null || !MSAdaptionService.LIZJ().LIZIZ(this.LLL)) {
            IPropReuseService LIZJ = PropReuseServiceImpl.LIZJ();
            if (LJJLIIIJLJLI() != null) {
                Aweme LJLLLL = LJLLLL();
                String str2 = "";
                Music music = null;
                if (LJLLLL != null) {
                    music = LJLLLL.getMusic();
                    str = LJLLLL.getAid();
                    if (2Ro.LIZ() && !ESC.LJ() && Aweme.containsGreenScreenGiphyAnchor(LJLLLL.getAnchors())) {
                        str2 = LJLLLL.getGiphyGifIds();
                    }
                    if (LJLLLL.getVideo() != null) {
                        i = LJLLLL.getVideo().getVideoLength();
                    }
                } else {
                    str = null;
                    i = 0;
                }
                LIZJ.LIZ(this.LLL, new ArrayList(this.LIZ), str2, music, this.LLIFFJFJJ.getPreviousPage(), str, i, AVExternalServiceImpl.LIZ().configService().avsettingsConfig().downloadEffectOrMusicAfterEnterCamera());
                return;
            }
            return;
        }
        Toast makeText = Toast.makeText(this.LLL, this.LLL.getString(2131824145), 0);
        if (Build.VERSION.SDK_INT == 25) {
            3GT.LIZ(makeText);
        }
        makeText.show();
    }
}
