TikTok.apk(点击下载) / DynamicAdExplainDialog.java


package com.ss.android.ugc.aweme.ad.feed.dialog;

import X.AbstractC50396Jqb;
import X.ActivityC31021Kp;
import X.AnonymousClass0EJ;
import X.AnonymousClass1IL;
import X.AnonymousClass1ZP;
import X.AnonymousClass1ZS;
import X.BN1;
import X.C14040hF;
import X.C21090sc;
import X.C23860x5;
import X.C28643BMy;
import X.C39321gv;
import X.C47093IeQ;
import X.C47173Ifi;
import X.C71282rN;
import X.C71312rQ;
import X.C71332rS;
import X.C71342rT;
import X.C71352rU;
import X.C85703Yx;
import X.View$OnClickListenerC71322rR;
import android.content.Context;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.covode.number.Covode;
import com.bytedance.tux.button.TuxButton;
import com.bytedance.tux.input.TuxTextView;
import com.bytedance.tux.sheet.sheet.TuxSheet;
import com.ss.android.ugc.aweme.feed.model.AwemeRawAd;
import com.zhiliaoapp.musically.R;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import kotlin.g.b.m;

public final class DynamicAdExplainDialog extends Fragment implements View.OnClickListener, AbstractC50396Jqb {
    public static final List<String> LJFF = AnonymousClass1ZP.LJ("UNKNOWN", "STATIC_CONTENT", "AGE", "LOCATION", "INTEREST", "CREATOR", "VIDEO");
    public static final C71342rT LJI = new C71342rT((byte) 0);
    public AwemeRawAd LIZ;
    public String LIZIZ;
    public ActivityC31021Kp LIZJ;
    public TuxSheet LIZLLL;
    public long LJ;
    public C14040hF LJII;
    public boolean LJIIIIZZ;
    public List<C71332rS> LJIIIZ;
    public RecyclerView LJIIJ;
    public C71352rU LJIIJJI;
    public RelativeLayout LJIIL;
    public RelativeLayout LJIILIIL;
    public HashMap LJIILJJIL;

    static {
        Covode.recordClassIndex(46034);
    }

    public DynamicAdExplainDialog(ActivityC31021Kp r2, AwemeRawAd awemeRawAd, String str) {
        List<C39321gv> contentItem;
        C21090sc.LIZ(r2, awemeRawAd, str);
        this.LIZ = awemeRawAd;
        this.LJII = awemeRawAd.getAboutThisAd();
        this.LIZIZ = str;
        this.LIZJ = r2;
        C14040hF aboutThisAd = awemeRawAd.getAboutThisAd();
        this.LJIIIIZZ = aboutThisAd == null || (contentItem = aboutThisAd.getContentItem()) == null || contentItem.isEmpty();
        this.LJIIIZ = new ArrayList();
    }

    public static final /* synthetic */ TuxSheet LIZ(DynamicAdExplainDialog dynamicAdExplainDialog) {
        TuxSheet tuxSheet = dynamicAdExplainDialog.LIZLLL;
        if (tuxSheet == null) {
            m.LIZ("");
        }
        return tuxSheet;
    }

    @Override // X.AbstractC50396Jqb
    public final C85703Yx LIZ() {
        String string = this.LIZJ.getBaseContext().getString(R.string.sd);
        m.LIZIZ(string, "");
        C85703Yx LIZIZ2 = new C85703Yx().LIZ(new BN1().LIZ(string)).LIZIZ(new C28643BMy().LIZ(R.raw.icon_x_mark_small).LIZ((AnonymousClass1IL<C23860x5>) new C71312rQ(this)));
        LIZIZ2.LIZLLL = true;
        return LIZIZ2;
    }

    public final void onClick(View view) {
        Integer valueOf = view != null ? Integer.valueOf(view.getId()) : null;
        if (valueOf != null && valueOf.intValue() == R.id.asu) {
            RelativeLayout relativeLayout = this.LJIIL;
            if (relativeLayout == null) {
                m.LIZ("");
            }
            relativeLayout.setVisibility(8);
            RelativeLayout relativeLayout2 = this.LJIILIIL;
            if (relativeLayout2 == null) {
                m.LIZ("");
            }
            relativeLayout2.setVisibility(0);
            C47173Ifi.LIZ("about_this_ad", "otherclick", this.LIZ).LIZIZ("refer", "button").LIZ("feedback_value", "yes").LIZIZ();
        } else if (valueOf != null && valueOf.intValue() == R.id.ass) {
            RelativeLayout relativeLayout3 = this.LJIIL;
            if (relativeLayout3 == null) {
                m.LIZ("");
            }
            relativeLayout3.setVisibility(8);
            RelativeLayout relativeLayout4 = this.LJIILIIL;
            if (relativeLayout4 == null) {
                m.LIZ("");
            }
            relativeLayout4.setVisibility(0);
            C47173Ifi.LIZ("about_this_ad", "otherclick", this.LIZ).LIZIZ("refer", "button").LIZ("feedback_value", "no").LIZIZ();
        }
    }

    @Override // androidx.fragment.app.Fragment
    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        C21090sc.LIZ(layoutInflater);
        return this.LJIIIIZZ ? AnonymousClass0EJ.LIZ(layoutInflater, R.layout.a36, viewGroup, false) : AnonymousClass0EJ.LIZ(layoutInflater, R.layout.a35, viewGroup, false);
    }

    @Override // androidx.fragment.app.Fragment
    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        HashMap hashMap = this.LJIILJJIL;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    @Override // androidx.fragment.app.Fragment
    public final void onViewCreated(View view, Bundle bundle) {
        C14040hF r7;
        int i2;
        String str;
        List<C39321gv> contentItem;
        List<C39321gv> contentItem2;
        C21090sc.LIZ(view);
        super.onViewCreated(view, bundle);
        if (this.LJIIIIZZ) {
            View findViewById = view.findViewById(R.id.aso);
            m.LIZIZ(findViewById, "");
            TuxTextView tuxTextView = (TuxTextView) findViewById;
            View findViewById2 = view.findViewById(R.id.ati);
            m.LIZIZ(findViewById2, "");
            RelativeLayout relativeLayout = (RelativeLayout) findViewById2;
            Context baseContext = this.LIZJ.getBaseContext();
            m.LIZIZ(baseContext, "");
            String string = baseContext.getResources().getString(R.string.rz);
            m.LIZIZ(string, "");
            Context baseContext2 = this.LIZJ.getBaseContext();
            m.LIZIZ(baseContext2, "");
            String string2 = baseContext2.getResources().getString(R.string.s3);
            m.LIZIZ(string2, "");
            String LIZ2 = AnonymousClass1ZS.LIZ(string, "%s", string2, false);
            if (AnonymousClass1ZS.LIZ((CharSequence) LIZ2) || AnonymousClass1ZS.LIZ((CharSequence) string2)) {
                tuxTextView.setText(LIZ2);
            } else {
                C71282rN r21 = C71282rN.LIZ;
                AwemeRawAd awemeRawAd = this.LIZ;
                Long valueOf = Long.valueOf(this.LJ);
                TuxSheet tuxSheet = this.LIZLLL;
                if (tuxSheet == null) {
                    m.LIZ("");
                }
                tuxTextView.setText(r21.LIZ(LIZ2, string2, "https://www.tiktok.com/safety/en/ads-and-data/", awemeRawAd, valueOf, tuxSheet, true));
                tuxTextView.setMovementMethod(LinkMovementMethod.getInstance());
            }
            if (C71282rN.LIZ.LIZ()) {
                relativeLayout.setVisibility(0);
                relativeLayout.setOnClickListener(new View$OnClickListenerC71322rR(this));
            }
            View findViewById3 = view.findViewById(R.id.asr);
            m.LIZIZ(findViewById3, "");
            this.LJIIL = (RelativeLayout) findViewById3;
            View findViewById4 = view.findViewById(R.id.asw);
            m.LIZIZ(findViewById4, "");
            this.LJIILIIL = (RelativeLayout) findViewById4;
            View findViewById5 = view.findViewById(R.id.asu);
            m.LIZIZ(findViewById5, "");
            View findViewById6 = view.findViewById(R.id.ass);
            m.LIZIZ(findViewById6, "");
            ((TuxButton) findViewById5).setOnClickListener(this);
            ((TuxButton) findViewById6).setOnClickListener(this);
            C47173Ifi.LIZ("draw_ad", "othershow", this.LIZ).LIZIZ("refer", "about_tiktok_ads").LIZ("age_range", "").LIZ("behavior_creator_categories", "").LIZ("behavior_video_categories", "").LIZ("interest_categories", "").LIZ("interest_categories", "").LIZIZ();
            return;
        }
        this.LJIIJ = (RecyclerView) view.findViewById(R.id.gf0);
        View findViewById7 = view.findViewById(R.id.asr);
        m.LIZIZ(findViewById7, "");
        this.LJIIL = (RelativeLayout) findViewById7;
        View findViewById8 = view.findViewById(R.id.asw);
        m.LIZIZ(findViewById8, "");
        this.LJIILIIL = (RelativeLayout) findViewById8;
        View findViewById9 = view.findViewById(R.id.asu);
        m.LIZIZ(findViewById9, "");
        View findViewById10 = view.findViewById(R.id.ass);
        m.LIZIZ(findViewById10, "");
        ((TuxButton) findViewById9).setOnClickListener(this);
        ((TuxButton) findViewById10).setOnClickListener(this);
        if (!this.LJIIIIZZ) {
            C14040hF r72 = this.LJII;
            if (!(r72 == null || r72 == null || r72.getContentItem() == null || !((r7 = this.LJII) == null || (contentItem2 = r7.getContentItem()) == null || contentItem2.size() != 0))) {
                HashMap hashMap = new HashMap();
                C14040hF r73 = this.LJII;
                if (!(r73 == null || (contentItem = r73.getContentItem()) == null)) {
                    for (C39321gv r74 : contentItem) {
                        String groupTitle = r74.getGroupTitle();
                        List<C71332rS> orientationInfo = r74.getOrientationInfo();
                        if (orientationInfo != null && !orientationInfo.isEmpty()) {
                            int i3 = 0;
                            for (T t : orientationInfo) {
                                if (i3 == 0) {
                                    t.setTitle(groupTitle);
                                }
                                if (i3 == orientationInfo.size() - 1) {
                                    t.setLastItem(true);
                                }
                                t.setItemType(0);
                                List<C71332rS> list = this.LJIIIZ;
                                if (list != null) {
                                    list.add(t);
                                }
                                List<String> list2 = LJFF;
                                Integer infoType = t.getInfoType();
                                Object LIZIZ2 = AnonymousClass1ZP.LIZIZ((List) list2, infoType != null ? infoType.intValue() : -1);
                                if (LIZIZ2 != null) {
                                    String linkText = t.getLinkText();
                                    if (linkText == null) {
                                        linkText = "";
                                    }
                                    hashMap.put(LIZIZ2, linkText);
                                }
                                i3++;
                            }
                        }
                    }
                }
                List<C71332rS> list3 = this.LJIIIZ;
                if (list3 != null) {
                    C14040hF r11 = this.LJII;
                    if (r11 != null) {
                        str = r11.getLinkText();
                        i2 = 1;
                    } else {
                        i2 = 1;
                        str = null;
                    }
                    list3.add(new C71332rS(0, str, "", "", "", Integer.valueOf(i2), false));
                }
                C47093IeQ LIZIZ3 = C47173Ifi.LIZ("draw_ad", "othershow", this.LIZ).LIZIZ("refer", "about_tiktok_ads");
                Object obj = hashMap.get("AGE");
                if (obj == null) {
                    obj = "";
                }
                C47093IeQ LIZ3 = LIZIZ3.LIZ("age_range", obj);
                Object obj2 = hashMap.get("CREATOR");
                if (obj2 == null) {
                    obj2 = "";
                }
                C47093IeQ LIZ4 = LIZ3.LIZ("behavior_creator_categories", obj2);
                Object obj3 = hashMap.get("VIDEO");
                if (obj3 == null) {
                    obj3 = "";
                }
                C47093IeQ LIZ5 = LIZ4.LIZ("behavior_video_categories", obj3);
                Object obj4 = hashMap.get("INTEREST");
                if (obj4 == null) {
                    obj4 = "";
                }
                C47093IeQ LIZ6 = LIZ5.LIZ("interest_categories", obj4);
                Object obj5 = hashMap.get("LOCATION");
                if (obj5 == null) {
                    obj5 = "";
                }
                LIZ6.LIZ("location", obj5).LIZIZ();
                hashMap.clear();
            }
            this.LJ = System.currentTimeMillis();
            RecyclerView recyclerView = this.LJIIJ;
            if (recyclerView != null) {
                this.LIZJ.getBaseContext();
                recyclerView.setLayoutManager(new LinearLayoutManager());
            }
            AwemeRawAd awemeRawAd2 = this.LIZ;
            String str2 = this.LIZIZ;
            Long valueOf2 = Long.valueOf(this.LJ);
            TuxSheet tuxSheet2 = this.LIZLLL;
            if (tuxSheet2 == null) {
                m.LIZ("");
            }
            C71352rU r5 = new C71352rU(awemeRawAd2, str2, valueOf2, tuxSheet2);
            this.LJIIJJI = r5;
            if (r5 != null) {
                List<C71332rS> list4 = this.LJIIIZ;
                if (list4 == null) {
                    list4 = new ArrayList<>();
                }
                C21090sc.LIZ(list4);
                r5.LIZIZ = list4;
            }
            RecyclerView recyclerView2 = this.LJIIJ;
            if (recyclerView2 != null) {
                recyclerView2.setAdapter(this.LJIIJJI);
            }
        }
    }
}