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

import X.0AB;
import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0CH;
import X.0CM;
import X.0Gf;
import X.0Gp;
import X.0HH;
import X.1hK;
import X.2EE;
import X.2GD;
import X.2GO;
import X.2HZ;
import X.2J6;
import X.2UX;
import X.2WY;
import X.2kf;
import X.2nK;
import X.3BB;
import X.414;
import X.7W7;
import X.7bf;
import X.7df;
import X.7dj;
import X.8ON;
import X.8bl;
import X.9HD;
import X.9oY;
import X.Aie;
import X.Aif;
import X.B9S;
import X.Bcz;
import X.C0043Chr;
import X.C4664Eke;
import X.C4680Eku;
import X.C4810En0;
import X.C4900EoS;
import X.C4901EoT;
import X.C4945EpB;
import X.C4951EpH;
import X.C5232Eto;
import X.C5233Etp;
import X.C5234Etq;
import X.C5236Ets;
import X.C5237Ett;
import X.C5238Etu;
import X.C5239Etv;
import X.C5240Etw;
import X.C5241Etx;
import X.C5242Ety;
import X.C5243Etz;
import X.C5244Eu0;
import X.C5245Eu1;
import X.C5246Eu2;
import X.C5264EuK;
import X.C5265EuL;
import X.C5269EuP;
import X.C5281Eub;
import X.CqM;
import X.D0M;
import X.ESC;
import X.EU0;
import X.EU4;
import X.FBJ;
import X.ISm;
import X.LFp;
import X.LVj;
import X.M12;
import X.Rc9;
import X.TnV;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.ugc.aweme.commercialize.scene.api.IAdSceneService;
import com.bytedance.ies.ugc.aweme.commercialize.scene.impl.AdSceneServiceImpl;
import com.bytedance.router.SmartRouter;
import com.ss.android.ugc.aweme.analysis.Analysis;
import com.ss.android.ugc.aweme.arch.widgets.base.DataCenter;
import com.ss.android.ugc.aweme.awemeservice.RequestIdService;
import com.ss.android.ugc.aweme.base.component.AnalysisStayTimeFragmentComponent;
import com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment;
import com.ss.android.ugc.aweme.base.ui.CommonPageFragment;
import com.ss.android.ugc.aweme.commercialize.profile.talent.ITalentAdRevenueShareService;
import com.ss.android.ugc.aweme.commercialize.profile.talent.TalentAdRevenueShareServiceImpl;
import com.ss.android.ugc.aweme.detail.panel.DetailFragmentPanel;
import com.ss.android.ugc.aweme.detail.ui.story.StoryDetailPageFragment;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.feed.model.FeedSharePlayerViewModel;
import com.ss.android.ugc.aweme.feed.param.FeedParamProvider;
import com.ss.android.ugc.aweme.homepage.api.data.HomePageDataViewModel;
import com.ss.android.ugc.aweme.homepage.api.interaction.ScrollSwitchStateManager;
import com.ss.android.ugc.aweme.homepage.msadapt.MSAdaptionService;
import com.ss.android.ugc.aweme.main.page.AwemeChangeCallBack;
import com.ss.android.ugc.aweme.out.AVExternalServiceImpl;
import com.ss.android.ugc.aweme.search.SearchServiceImpl;
import com.ss.android.ugc.aweme.services.BusinessComponentServiceUtils;
import com.ss.android.ugc.aweme.services.external.ui.RecordConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import kotlin.h.b.n;
import org.greenrobot.eventbus.ThreadMode;

public class DetailFragment extends AmeBaseFragment implements 2HZ, 2GO {
    public static final Map<String, String> LJJI = new HashMap<String, String>() {
        static {
            Covode.recordClassIndex(63860);
        }

        public final boolean containsKey(Object obj) {
            if (obj == null) {
                return false;
            }
            return super.containsKey(obj);
        }
    };
    public C5265EuL LIZ;
    public C5246Eu2 LIZIZ;
    public ScrollSwitchStateManager LIZJ;
    public HomePageDataViewModel LIZLLL;
    public Aie LJ;
    public TnV LJIIIZ = new TnV();
    public boolean LJIIJ = false;
    public boolean LJIIJJI;
    public DataCenter LJIIL;
    public String LJIILIIL;
    public Aweme LJIILJJIL;
    public Aweme LJIILL;
    public String LJIIZILJ = "";
    public IAdSceneService LJIJ;
    public boolean LJIJI = false;
    public String LJIJJ = "";
    public String LJIJJLI = "";
    public boolean LJIL = true;
    public boolean LJJ = false;
    public int LJJIFFI = -1;
    public boolean LJJII = false;
    public AnalysisStayTimeFragmentComponent LJJIII;
    public C4901EoT LJJIIJ;
    public C4900EoS LJJIIJZLJL;
    public String LJJIIZ = "";
    public String LJJIIZI = "DetailFragment";

    public final boolean LJJIJIIJI() {
        return true;
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(26, new Rc9(DetailFragment.class, "onScrollToProfileEvent", C0043Chr.class, ThreadMode.POSTING, 0, false));
        hashMap.put(478, new Rc9(DetailFragment.class, "onTalentProfileAdEvent", EU4.class, ThreadMode.MAIN, 0, false));
        hashMap.put(221, new Rc9(DetailFragment.class, "receiveJumpToRecord", C4810En0.class, ThreadMode.POSTING, 0, false));
        return hashMap;
    }

    public final Aweme LJII() {
        return this.LJIILJJIL;
    }

    public void onPause() {
        DetailFragment.super.onPause();
    }

    public final void LIZ(boolean z, int i) {
        long j;
        C5232Eto eto = C5232Eto.LIZ;
        Aweme LJIJ2 = LJIJ();
        String from = this.LJIIIZ.getFrom();
        int videoType = this.LJIIIZ.getVideoType();
        String eventType = this.LJIIIZ.getEventType();
        DetailPageFragment LJI = LJI();
        if (LJI != null) {
            j = LJI.LJIIJ.LJJIZ();
        } else {
            j = -1;
        }
        eto.LIZ(LJIJ2, from, videoType, eventType, j, z, i, this.LJIIIZ);
    }

    public final /* synthetic */ void LIZ(String str) {
        if (!"on_ear_phone_unplug".equals(str)) {
            return;
        }
        if (7df.LJJJI().LJIILJJIL()) {
            7df.LJJJI().LJJIII();
            414.LIZ("play", this.LJIIIZ.getFrom(), this.LJIILJJIL);
            return;
        }
        414.LIZ("pause", this.LJIIIZ.getFrom(), this.LJIILJJIL);
    }

    private boolean LJIILIIL() {
        return LFp.LJJLIIIJLLLLLLLZ(this.LJIILJJIL);
    }

    static {
        Covode.recordClassIndex(63850);
    }

    private boolean LJIIJJI() {
        ITalentAdRevenueShareService LJ2 = TalentAdRevenueShareServiceImpl.LJ();
        if (LJ2 != null) {
            return LJ2.LIZJ();
        }
        return false;
    }

    private Aweme LJIJ() {
        DetailPageFragment LJI = LJI();
        if (LJI != null) {
            return LJI.LJIIJ.LJJIFFI();
        }
        return null;
    }

    private boolean LJIL() {
        return TextUtils.equals(this.LJIIIZ.getEventType(), "playlist");
    }

    private boolean LJJ() {
        return TextUtils.equals(this.LJIIIZ.getFrom(), "STORY_ENTRANCE_INBOX_TOP_LIST");
    }

    public final void LJIIIIZZ() {
        this.LJIIL.LIZ("onBack", (Object) null);
    }

    public final void LIZ() {
        if (LFp.LJJLIIIJLLLLLLLZ(this.LJIILJJIL)) {
            this.LIZ.setOnFlingEndListener(new C5269EuP() {
                static {
                    Covode.recordClassIndex(63858);
                }

                public final void LIZ() {
                    DetailFragment.this.LIZJ.LIZ(C4951EpH.INSTANCE);
                }
            });
        }
    }

    public final boolean LJ() {
        if (this.LIZIZ == null || !this.LIZJ.LIZIZ("page_profile")) {
            return false;
        }
        this.LIZIZ.LIZ();
        return true;
    }

    public final DetailPageFragment LJI() {
        if (this.LJ == null) {
            return null;
        }
        DetailPageFragment LIZLLL2 = this.LIZJ.LIZLLL("page_feed");
        if (LIZLLL2 instanceof DetailPageFragment) {
            return LIZLLL2;
        }
        return null;
    }

    public final Analysis cU_() {
        if (!LJIJI()) {
            return DetailFragment.super.cU_();
        }
        Analysis analysis = new Analysis();
        analysis.setLabelName("others_homepage");
        return analysis;
    }

    private boolean LJIIL() {
        if (ESC.LIZLLL() || LJIILJJIL() || LFp.LJJLIIIJLLLLLLLZ(this.LJIILJJIL) || TextUtils.equals("new_ad_fake_user", this.LJIIIZ.getEventType()) || "from_publish_add_video".equals(this.LJIIIZ.getFrom())) {
            return true;
        }
        return false;
    }

    private boolean LJIILJJIL() {
        boolean z;
        int videoType = this.LJIIIZ.getVideoType();
        if (videoType == 0 || videoType == 15) {
            z = true;
        } else {
            z = false;
        }
        boolean equals = "from_profile_self".equals(this.LJIIIZ.getFrom());
        boolean equals2 = "from_profile_other".equals(this.LJIIIZ.getFrom());
        if ((equals || equals2) && z) {
            return true;
        }
        return false;
    }

    private boolean LJIILLIIL() {
        Aweme aweme;
        if (this.LJIIIZ.getVideoType() == 14 || !LJIIZILJ() || (aweme = this.LJIILJJIL) == null || aweme.getAuthor() == null || !TextUtils.equals(this.LJIILJJIL.getAuthor().getUid(), this.LJIIIZ.getUid())) {
            return false;
        }
        return true;
    }

    private boolean LJIJI() {
        if (LJIJJLI() || LJJI.containsKey(this.LJIIIZ.getEventType()) || LJIL() || LJJ()) {
            return true;
        }
        return false;
    }

    private boolean LJIJJLI() {
        if (TextUtils.isEmpty(this.LJIIIZ.getFeedsAwemeId())) {
            return false;
        }
        if (TextUtils.equals(this.LJIIIZ.getPreviousPage(), "homepage_follow") || TextUtils.equals(this.LJIIIZ.getPreviousPage(), "homepage_hot")) {
            return true;
        }
        return false;
    }

    public Class<? extends CommonPageFragment> LIZJ() {
        if (this.LJIIIZ.isFromDuetMode() || !this.LJIIIZ.isStoryPage()) {
            return DetailPageFragment.class;
        }
        String from = this.LJIIIZ.getFrom();
        if (TextUtils.equals(from, "STORY_ENTRANCE_AVATAR") || TextUtils.equals(from, "STORY_ENTRANCE_MINE") || TextUtils.equals(from, "STORY_ENTRANCE_OTHER") || LJJ()) {
            return StoryDetailPageFragment.class;
        }
        return DetailPageFragment.class;
    }

    public final void LJFF() {
        if (C5234Etq.LIZ(this.LJIIIZ.getFrom()) && getActivity() != null) {
            8ON.LIZ().LIZ = FeedSharePlayerViewModel.getPlayerManager(getActivity());
            8ON.LIZ().LJIIJJI = true;
        }
    }

    public void onDestroy() {
        DetailFragment.super.onDestroy();
        if (!TextUtils.isEmpty(this.LJIIIZ.getReactSessionId()) && this.LJIILJJIL != null) {
            CqM.LIZ(new LVj(this.LJIIIZ.getReactSessionId(), 2, 7df.LJJJI().LJIILIIL(), this.LJIILJJIL.getAid()));
        }
    }

    private boolean LJIILL() {
        if (("from_nearby".equals(this.LJIIIZ.getFrom()) || "from_search_mix".equals(this.LJIIIZ.getFrom()) || "from_search_live".equals(this.LJIIIZ.getFrom()) || "trending_page".equals(this.LJIIIZ.getFrom())) && this.LJIILJJIL.isLive()) {
            return true;
        }
        return LJIILLIIL();
    }

    private boolean LJIIZILJ() {
        if ("from_profile_self".equals(this.LJIIIZ.getFrom()) || "from_profile_other".equals(this.LJIIIZ.getFrom()) || "STORY_ENTRANCE_OTHER".equals(this.LJIIIZ.getFrom()) || "STORY_ENTRANCE_MINE".equals(this.LJIIIZ.getFrom()) || "from_ad_new_fake_user".equals(this.LJIIIZ.getFrom())) {
            return true;
        }
        return false;
    }

    public final /* synthetic */ void LJIIIZ() {
        1hK activity = getActivity();
        if (activity != null) {
            if (2J6.LIZ(this.LJIILJJIL)) {
                String LIZ2 = 2J6.LIZ(this.LJIILJJIL, 2131834754);
                if (LIZ2 != null) {
                    3BB r1 = new 3BB(getContext());
                    r1.LIZ(LIZ2);
                    r1.LIZIZ();
                }
            } else if (this.LJIILJJIL.isImage()) {
                3BB r12 = new 3BB(activity);
                r12.LIZIZ(2131826042);
                r12.LIZIZ();
            } else {
                3BB r0 = new 3BB(activity);
                r0.LIZIZ(2131834754);
                r0.LIZIZ();
            }
        }
    }

    public final /* synthetic */ void LJIIJ() {
        Aweme aweme;
        IAdSceneService iAdSceneService;
        if (!(!this.LIZJ.LIZIZ("page_feed") || LJI() == null || (aweme = this.LJIILJJIL) == null || !aweme.isAd() || (iAdSceneService = this.LJIJ) == null)) {
            iAdSceneService.LIZJ().LIZ(getContext());
        }
        if (LJIILIIL() || this.LJJ) {
            3BB r1 = new 3BB(getContext());
            r1.LIZIZ(2131821339);
            r1.LIZIZ();
        }
    }

    public void onResume() {
        DetailFragment.super.onResume();
        if (this.LJJII) {
            C5281Eub.LIZ = "prop_reuse";
            new Intent();
            ArrayList arrayList = new ArrayList();
            for (String str : this.LJIILJJIL.getStickerIDs().split(",")) {
                if (!arrayList.contains(str)) {
                    arrayList.add(str);
                }
            }
            RecordConfig.Builder builder = new RecordConfig.Builder();
            builder.creationId(UUID.randomUUID().toString());
            builder.stickers(arrayList);
            builder.autoUseSticker((String) arrayList.get(0));
            builder.stickerMusic(this.LJIILJJIL.getMusic());
            builder.translationType(3);
            AVExternalServiceImpl.LIZ().asyncService("DetailFeed", new 1(this, builder));
            this.LJJII = false;
        }
    }

    public Aif LIZIZ() {
        Aif aif = new Aif();
        if (this.LJIIIZ.isFromDuetMode()) {
            aif.LIZ(LIZJ(), "page_feed", 0, getArguments());
            return aif;
        }
        aif.LIZ(LIZJ(), "page_feed", 0, getArguments());
        Bundle bundle = new Bundle();
        bundle.putString("related_gid", this.LJIIIZ.getRelatedId());
        bundle.putInt("from_recommend_card", this.LJIIIZ.getFromRecommendCard());
        if (this.LJIIIZ.isStoryPage()) {
            if (!TextUtils.equals(this.LJIIIZ.getEventType(), "personal_homepage") && !TextUtils.equals(this.LJIIIZ.getEventType(), "others_homepage") && (!LJIIL() || LJIIJJI())) {
                aif.LIZ(BusinessComponentServiceUtils.getProfilePageClass(), "page_profile", bundle);
            }
        } else if (!LJIIL() || LJIIJJI()) {
            aif.LIZ(BusinessComponentServiceUtils.getProfilePageClass(), "page_profile", bundle);
        }
        return aif;
    }

    public final void LIZLLL() {
        Aweme aweme = this.LJIILJJIL;
        if (aweme != null) {
            if (!aweme.isCanPlay() || this.LJIILJJIL.isDelete()) {
                this.LIZJ.LIZ((C5264EuK) this.LJJIIJZLJL);
                String str = this.LJJIIZI;
                2kf.LIZIZ(4, str, "aweme id:" + this.LJIILJJIL.getAid() + "can play: " + this.LJIILJJIL.isCanPlay() + "  is delete:" + this.LJIILJJIL.isDelete());
                if (!this.LJIILJJIL.isCanPlay()) {
                    this.LIZ.post(new C5242Ety(this));
                }
            } else if (LJIILIIL()) {
                this.LIZJ.LIZ((C5264EuK) this.LJJIIJZLJL);
                this.LJJ = true;
            } else {
                if (!LFp.LJIJ(this.LJIILJJIL) || !LFp.LJJIIZ(this.LJIILJJIL)) {
                    if (!LFp.LJJIIZ(this.LJIILJJIL)) {
                        this.LIZJ.LIZ((C5264EuK) this.LJJIIJ);
                    } else {
                        this.LJJ = true;
                        this.LIZJ.LIZ((C5264EuK) this.LJJIIJZLJL);
                    }
                } else if (LFp.LJJIIZI(this.LJIILJJIL)) {
                    this.LIZJ.LIZ((C5264EuK) this.LJJIIJ);
                    return;
                } else if (LFp.LJJLJLI(this.LJIILJJIL).booleanValue()) {
                    this.LJJ = true;
                    this.LIZJ.LIZ((C5264EuK) this.LJJIIJZLJL);
                    return;
                } else if (!LFp.LJLLJ(this.LJIILJJIL) || LFp.LJIIZILJ(this.LJIILJJIL) || LFp.LIZLLL(this.LJIILJJIL.getAwemeRawAd())) {
                    this.LJJ = true;
                    this.LIZJ.LIZ((C5264EuK) this.LJJIIJZLJL);
                } else {
                    this.LIZJ.LIZ((C5264EuK) this.LJJIIJ);
                }
                if (ESC.LIZLLL() || LJIILL()) {
                    this.LIZJ.LIZ((C5264EuK) this.LJJIIJZLJL);
                }
            }
        }
    }

    @ISm
    public void receiveJumpToRecord(C4810En0 en0) {
        this.LJJII = true;
    }

    public final /* synthetic */ Object LIZJ(String str) {
        this.LJ.LIZ(str);
        return null;
    }

    public final /* synthetic */ void LIZIZ(Boolean bool) {
        this.LIZ.LJII = bool.booleanValue();
    }

    public void setUserVisibleHint(boolean z) {
        DetailFragment.super.setUserVisibleHint(z);
        AnalysisStayTimeFragmentComponent analysisStayTimeFragmentComponent = this.LJJIII;
        if (analysisStayTimeFragmentComponent != null) {
            analysisStayTimeFragmentComponent.LIZIZ(z);
        }
    }

    public final /* synthetic */ void LIZIZ(String str) {
        if (!0AB.LIZ(this.LJ.LJI)) {
            this.LJ.LIZ(str);
        } else {
            0Gp.LIZ(new C5241Etx(this, str), 0Gp.LIZIZ, (0Gf) null);
        }
    }

    @ISm(LIZ = ThreadMode.MAIN)
    public void onTalentProfileAdEvent(EU4 eu4) {
        List<Aweme> list;
        DetailPageFragment LJI;
        if (eu4 != null && (list = eu4.LIZ) != null && (LJI = LJI()) != null && LJI.LJIIJ != null) {
            LJI.LJIIJ.LIZLLL(list);
        }
    }

    public final /* synthetic */ void LIZ(C5264EuK euK) {
        if (getActivity() != null) {
            Aweme LIZ2 = AwemeChangeCallBack.LIZ(getActivity());
            if (D0M.LJFF(LIZ2)) {
                C5264EuK LIZ3 = 9HD.LIZ.LIZ((Activity) getActivity(), LIZ2);
                if (LIZ3 != null) {
                    this.LIZ.LJIIIZ = LIZ3;
                    return;
                }
                return;
            }
        }
        if (this.LJIIIZ.isPlaylistCleanMode()) {
            this.LIZ.LJIIIZ = new C5264EuK() {
                static {
                    Covode.recordClassIndex(63854);
                }

                public final void LIZ(MotionEvent motionEvent) {
                }

                public final boolean LIZ(float f, float f2) {
                    return false;
                }

                public final boolean LIZ(int i) {
                    return false;
                }
            };
            return;
        }
        this.LIZ.LJIIIZ = euK;
    }

    public final /* synthetic */ B9S LIZ(B9S b9s) {
        b9s.LIZLLL = this.LJIIIZ.getPreviousPage();
        b9s.LJ = this.LJIIIZ.getUid();
        b9s.LIZJ = this.LJIIIZ.getFeedsAwemeId();
        String str = LJJI.get(this.LJIIIZ.getEventType());
        if (!TextUtils.isEmpty(str)) {
            b9s.LIZ(str);
        }
        if (LJIL()) {
            b9s.LIZ("playlist");
            b9s.LJIIZILJ = this.LJIIIZ.getPlayListId();
            b9s.LIZIZ = this.LJIIIZ.getEnterPlaylistGroupId();
        }
        return b9s;
    }

    public final void LIZIZ(Aweme aweme) {
        String authorUid = aweme.getAuthorUid();
        if ((!aweme.isAd() || !LFp.LJJIIZ(aweme)) && aweme.isAd() && aweme.getAwemeRawAd() != null) {
            aweme.getAwemeRawAd().setPageFrom(this.LJIIIZ.getEventType());
        }
        this.LJIIZILJ = authorUid;
        String eventType = this.LJIIIZ.getEventType();
        int i = this.LJJIFFI;
        M12.LIZ(aweme, eventType);
        C5233Etp etp = new C5233Etp(21, aweme);
        etp.LJFF = eventType;
        etp.LJIIIZ = i;
        CqM.LIZ(etp);
    }

    public final void LIZ(int i) {
        String str;
        String str2;
        Aweme LJIJ2 = LJIJ();
        String from = this.LJIIIZ.getFrom();
        int videoType = this.LJIIIZ.getVideoType();
        String eventType = this.LJIIIZ.getEventType();
        DetailPageFragment LJI = LJI();
        long j = -1;
        if (LJI != null) {
            DetailFragmentPanel detailFragmentPanel = LJI.LJIIJ;
            Aweme LJJIFFI2 = detailFragmentPanel.LJJIFFI();
            if (LJJIFFI2 != null) {
                str2 = LJJIFFI2.getAid();
            } else {
                str2 = "";
            }
            if (detailFragmentPanel.LLII != null) {
                j = detailFragmentPanel.LLII.LIZLLL(str2);
            }
        }
        TnV tnV = this.LJIIIZ;
        C5233Etp etp = new C5233Etp(66, LJIJ2);
        etp.LJ = from;
        etp.LJII = videoType;
        7W7 LJJJI = 7df.LJJJI();
        n.LIZIZ(LJJJI, "");
        etp.LJIIJJI = LJJJI.LJIILIIL();
        7W7 LJJJI2 = 7df.LJJJI();
        n.LIZIZ(LJJJI2, "");
        etp.LJIIL = LJJJI2.LJIILJJIL();
        etp.LJFF = eventType;
        etp.LJI = j;
        7W7 LJJJI3 = 7df.LJJJI();
        n.LIZIZ(LJJJI3, "");
        7dj LJJIJL = LJJJI3.LJJIJL();
        n.LIZIZ(LJJIJL, "");
        7bf LJII = LJJIJL.LJII();
        n.LIZIZ(LJII, "");
        etp.LJIIIIZZ = LJII.LJFF();
        etp.LJIIIZ = i;
        Bundle bundle = new Bundle();
        if (tnV != null) {
            str = tnV.getSearchType();
        } else {
            str = null;
        }
        bundle.putString("key_search_type", str);
        etp.LIZJ = bundle;
        CqM.LIZ(etp);
    }

    public final void LIZ(Aweme aweme) {
        if (!this.LJIJI) {
            if (TextUtils.equals(this.LJIJJ, aweme.getAid())) {
                this.LJIJI = true;
            } else {
                return;
            }
        }
        if (!TextUtils.equals(this.LJIJJLI, aweme.getAid())) {
            this.LJIJJLI = aweme.getAid();
            if (TextUtils.equals(this.LJIIIZ.getFrom(), "from_challenge") && TextUtils.equals(this.LJIIIZ.getEventType(), "challenge") && TextUtils.equals(this.LJIIIZ.getPreviousPage(), "discovery")) {
                2UX r10 = new 2UX();
                r10.LIZ("enter_from", "challenge");
                r10.LIZ("tag_id", this.LJIIIZ.getChallengeId());
                r10.LIZ("group_id", aweme.getAid());
                r10.LIZ("process_id", this.LJIIIZ.getProcessId());
                r10.LIZ("log_pb", 9oY.LIZ.LIZ(RequestIdService.LIZ().LIZ(aweme, this.LJIIIZ.getVideoType() + 3000)));
                r10.LIZ("tag_line", this.LJJIIZ);
                2nK.LIZ("discovery_video_play", r10.LIZ);
            } else if (TextUtils.equals(this.LJIIIZ.getFrom(), "from_music") && TextUtils.equals(this.LJIIIZ.getEventType(), "single_song") && TextUtils.equals(this.LJIIIZ.getPreviousPage(), "discovery")) {
                2UX r102 = new 2UX();
                r102.LIZ("enter_from", "single_song");
                r102.LIZ("music_id", this.LJIIIZ.getMusicId());
                r102.LIZ("group_id", aweme.getAid());
                r102.LIZ("log_pb", 9oY.LIZ.LIZ(RequestIdService.LIZ().LIZ(aweme, this.LJIIIZ.getVideoType() + 4000)));
                r102.LIZ("tag_line", this.LJJIIZ);
                2nK.LIZ("discovery_video_play", r102.LIZ);
            }
            if (TextUtils.equals(this.LJIIIZ.getFrom(), "from_discovery_challenge") && TextUtils.equals(this.LJIIIZ.getEventType(), "discovery")) {
                2UX r2 = new 2UX();
                r2.LIZ("enter_from", "discovery");
                r2.LIZ("tag_id", this.LJIIIZ.getChallengeId());
                r2.LIZ("group_id", aweme.getAid());
                r2.LIZ("log_pb", 9oY.LIZ.LIZ(RequestIdService.LIZ().LIZ(aweme, this.LJIIIZ.getVideoType() + 3000)));
                r2.LIZ("tag_line", this.LJJIIZ);
                2nK.LIZ("discovery_video_play", r2.LIZ);
            } else if (TextUtils.equals(this.LJIIIZ.getFrom(), "from_music") && TextUtils.equals(this.LJIIIZ.getEventType(), "discovery")) {
                2UX r3 = new 2UX();
                r3.LIZ("enter_from", "discovery");
                r3.LIZ("music_id", this.LJIIIZ.getMusicId());
                r3.LIZ("group_id", aweme.getAid());
                r3.LIZ("log_pb", 9oY.LIZ.LIZ(RequestIdService.LIZ().LIZ(aweme, this.LJIIIZ.getVideoType() + 4000)));
                r3.LIZ("tag_line", this.LJJIIZ);
                2nK.LIZ("discovery_video_play", r3.LIZ);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:36:0x00be  */
    /* JADX WARNING: Removed duplicated region for block: B:74:0x01a9  */
    @X.ISm
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void onScrollToProfileEvent(X.C0043Chr r6) {
        /*
            r5 = this;
            if (r6 == 0) goto L_0x001c
            X.Eu2 r0 = r5.LIZIZ
            if (r0 == 0) goto L_0x001c
            X.1hK r0 = r5.getActivity()
            if (r0 == 0) goto L_0x001c
            int r1 = r6.LIZ
            X.1hK r0 = r5.getActivity()
            int r0 = r0.hashCode()
            if (r1 != r0) goto L_0x001c
            X.Eu2 r0 = r5.LIZIZ
            if (r0 != 0) goto L_0x001d
        L_0x001c:
            return
        L_0x001d:
            boolean r0 = r5.LJIILIIL()
            if (r0 == 0) goto L_0x0036
            X.3BB r1 = new X.3BB
            android.content.Context r0 = r5.getContext()
            r1.<init>(r0)
            r0 = 2131821339(0x7f11031b, float:1.9275418E38)
            r1.LIZIZ(r0)
            r1.LIZIZ()
            return
        L_0x0036:
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJIJ(r0)
            if (r0 == 0) goto L_0x006f
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJLLJ(r0)
            if (r0 != 0) goto L_0x006f
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJJIIZ(r0)
            if (r0 == 0) goto L_0x006f
            X.TnV r0 = r5.LJIIIZ
            java.lang.String r1 = r0.getEventType()
            java.lang.String r0 = "new_ad_fake_user"
            boolean r0 = android.text.TextUtils.equals(r0, r1)
            if (r0 != 0) goto L_0x006f
            X.3BB r1 = new X.3BB
            android.content.Context r0 = r5.getContext()
            r1.<init>(r0)
            r0 = 2131821338(0x7f11031a, float:1.9275416E38)
            r1.LIZIZ(r0)
            r1.LIZIZ()
            return
        L_0x006f:
            boolean r0 = r5.LJIILLIIL()
            if (r0 == 0) goto L_0x0079
            r5.LJIIIIZZ()
            return
        L_0x0079:
            X.1hK r0 = r5.getActivity()
            boolean r0 = r0 instanceof X.7T9
            if (r0 == 0) goto L_0x00ef
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            com.ss.android.ugc.aweme.profile.model.User r0 = r0.getAuthor()
            java.lang.String r1 = r0.getUid()
            X.46i.LIZ()
            com.ss.android.ugc.aweme.IAccountService r0 = X.46i.LIZ
            com.ss.android.ugc.aweme.IAccountUserService r0 = r0.LJFF()
            if (r0 == 0) goto L_0x00ec
            X.46i.LIZ()
            com.ss.android.ugc.aweme.IAccountService r0 = X.46i.LIZ
            com.ss.android.ugc.aweme.IAccountUserService r0 = r0.LJFF()
            java.lang.String r0 = r0.getCurUserId()
            if (r0 == 0) goto L_0x00ec
            X.46i.LIZ()
            com.ss.android.ugc.aweme.IAccountService r0 = X.46i.LIZ
            com.ss.android.ugc.aweme.IAccountUserService r0 = r0.LJFF()
            java.lang.String r0 = r0.getCurUserId()
        L_0x00b2:
            boolean r0 = android.text.TextUtils.equals(r1, r0)
            java.lang.String r2 = "enter_from"
            java.lang.String r3 = "sec_userid"
            java.lang.String r4 = "uid"
            if (r0 == 0) goto L_0x01a9
            android.content.Context r1 = r5.getContext()
            java.lang.String r0 = "aweme://user/homepage"
            com.bytedance.router.SmartRoute r1 = com.bytedance.router.SmartRouter.buildRoute(r1, r0)
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            java.lang.String r0 = r0.getAuthorUid()
            r1.withParam(r4, r0)
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            java.lang.String r0 = r0.getSecAuthorUid()
            r1.withParam(r3, r0)
            X.TnV r0 = r5.LJIIIZ
            java.lang.String r0 = r0.getFrom()
            r1.withParam(r2, r0)
            r0 = 67108864(0x4000000, float:1.5046328E-36)
            r1.addFlags(r0)
            r1.open()
            return
        L_0x00ec:
            java.lang.String r0 = ""
            goto L_0x00b2
        L_0x00ef:
            com.ss.android.ugc.aweme.feed.model.Aweme r1 = r5.LJIILJJIL
            r0 = 1
            r0 = 0
            if (r1 == 0) goto L_0x012d
            boolean r0 = r1.isAd()
            if (r0 == 0) goto L_0x012d
            com.ss.android.ugc.aweme.profile.model.User r0 = r1.getAuthor()
            if (r0 == 0) goto L_0x012d
            boolean r0 = r0.isAdFake()
            if (r0 == 0) goto L_0x012d
            java.lang.Boolean r0 = X.LFp.LJJLJLI(r1)
            boolean r0 = r0.booleanValue()
            if (r0 != 0) goto L_0x011b
            com.ss.android.ugc.aweme.feed.model.AwemeRawAd r0 = r1.getAwemeRawAd()
            boolean r0 = r0.isAllowDspAutoJump()
            if (r0 == 0) goto L_0x012d
        L_0x011b:
            X.Etr r2 = X.LDj.LIZJ()
            android.content.Context r1 = r5.getContext()
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = r2.LIZIZ((android.content.Context) r1, (com.ss.android.ugc.aweme.feed.model.Aweme) r0)
            if (r0 == 0) goto L_0x012d
            goto L_0x001c
        L_0x012d:
            boolean r0 = r5.LJIILL()
            if (r0 != 0) goto L_0x001c
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            if (r0 == 0) goto L_0x013d
            boolean r0 = r0.isAd()
            if (r0 != 0) goto L_0x016f
        L_0x013d:
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJIIJ(r0)
            if (r0 == 0) goto L_0x019e
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJJIIZ(r0)
            if (r0 == 0) goto L_0x019e
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJJIIZI(r0)
            if (r0 != 0) goto L_0x019e
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = X.LFp.LJJIJIL(r0)
            if (r0 != 0) goto L_0x019e
            X.Etr r2 = X.LDj.LIZJ()
            android.content.Context r1 = r5.getContext()
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            boolean r0 = r2.LIZJ(r1, r0)
            if (r0 == 0) goto L_0x019e
            goto L_0x001c
        L_0x016f:
            X.LTB r0 = X.BCe.LIZ
            com.ss.android.ugc.aweme.miniapp_api.services.IMiniAppService r3 = r0.LIZ()
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            com.ss.android.ugc.aweme.feed.model.AwemeRawAd r0 = r0.getAwemeRawAd()
            java.lang.String r2 = r0.getMicroAppUrl()
            X.Kve r1 = new X.Kve
            r1.<init>()
            java.lang.String r0 = "mp_url"
            r1.LIZLLL = r0
            X.Kvf r1 = r1.LIZ()
            boolean r0 = X.LGL.LIZJ(r2)
            if (r0 == 0) goto L_0x013d
            android.content.Context r0 = r5.getContext()
            boolean r0 = r3.openMiniApp(r0, r2, r1)
            if (r0 == 0) goto L_0x013d
            goto L_0x001c
        L_0x019e:
            X.Eu2 r2 = r5.LIZIZ
            com.ss.android.ugc.aweme.feed.model.Aweme r1 = r5.LJIILJJIL
            java.lang.String r0 = r6.LIZJ
            r2.LIZ(r1, r0)
            goto L_0x001c
        L_0x01a9:
            android.content.Context r1 = r5.getContext()
            java.lang.String r0 = "aweme://user/profile/"
            com.bytedance.router.SmartRoute r1 = com.bytedance.router.SmartRouter.buildRoute(r1, r0)
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            java.lang.String r0 = r0.getAuthorUid()
            r1.withParam(r4, r0)
            com.ss.android.ugc.aweme.feed.model.Aweme r0 = r5.LJIILJJIL
            java.lang.String r0 = r0.getSecAuthorUid()
            r1.withParam(r3, r0)
            X.TnV r0 = r5.LJIIIZ
            java.lang.String r0 = r0.getFrom()
            r1.withParam(r2, r0)
            r1.open()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.detail.ui.DetailFragment.onScrollToProfileEvent(X.Chr):void");
    }

    public final /* synthetic */ void LIZ(Boolean bool) {
        this.LIZ.setPagingMainValve(bool.booleanValue());
    }

    public final /* synthetic */ void LIZ(Integer num) {
        IAdSceneService iAdSceneService;
        DetailFragmentPanel detailFragmentPanel;
        2EE LJLLL;
        String aid;
        String LIZ2 = this.LIZJ.LIZ(num.intValue());
        if ("page_profile".equals(LIZ2)) {
            String str = this.LIZLLL.LJFF;
            EU0 eu0 = EU0.LIZLLL;
            if (this.LIZLLL.LJI == null) {
                aid = "";
            } else {
                aid = this.LIZLLL.LJI.getAid();
            }
            eu0.LIZ(str, aid);
        }
        String LIZ3 = this.LIZJ.LIZ(num.intValue());
        if ("page_feed".equals(LIZ3) || "page_profile".equals(LIZ3)) {
            if (num.intValue() == 0) {
                CqM.LIZ(new Bcz());
                if (this.LJJIII != null && LJIJI()) {
                    this.LJJIII.onResume();
                }
            } else if (num.intValue() == 1) {
                if (this.LJJIII != null && LJIJI()) {
                    this.LJJIII.onPause();
                }
                C4680Eku.LIZLLL = String.valueOf(num);
                DetailPageFragment LJI = LJI();
                if (!(LJI == null || (detailFragmentPanel = LJI.LJIIJ) == null || (LJLLL = detailFragmentPanel.LJLLL()) == null)) {
                    LJLLL.LIZIZ(6);
                }
            }
        }
        if (!this.LIZLLL.LJIIJJI && this.LIZ != null && TextUtils.equals(LIZ2, "page_profile") && this.LJIILJJIL != null && (iAdSceneService = this.LJIJ) != null) {
            iAdSceneService.LIZJ().LIZJ(this.LJIILJJIL, getContext());
        }
    }

    public static DetailFragment LIZ(TnV tnV, Bundle bundle) {
        bundle.putSerializable("feed_param", tnV);
        DetailFragment detailFragment = new DetailFragment();
        detailFragment.setArguments(bundle);
        return detailFragment;
    }

    public void onViewCreated(View view, Bundle bundle) {
        DetailFragment.super.onViewCreated(view, bundle);
        1hK activity = getActivity();
        0Bx LIZ2 = 0By.LIZ(activity, (0Bv) null);
        if (2GD.LIZ) {
            0Bs.LIZ(LIZ2, activity);
        }
        this.LJIIL = DataCenter.LIZ(LIZ2, (0CH) this);
        this.LIZ = (C5265EuL) view.findViewById(2131372992);
        this.LJIJ = AdSceneServiceImpl.LJII();
        Bundle arguments = getArguments();
        this.LJIIIZ = arguments.getSerializable("feed_param");
        this.LJIIJ = arguments.getBoolean("extra_challenge_is_hashtag", false);
        this.LJJIFFI = arguments.getInt("com.ss.android.ugc.aweme.intent.extra.FEED_TYPE", -1);
        this.LJJIIZ = arguments.getString("extra_hashtag_tagline", "");
        if (TextUtils.equals("", this.LJIJJ) && this.LJIIIZ.getAid() != null) {
            this.LJIJJ = this.LJIIIZ.getAid();
        }
        String from = this.LJIIIZ.getFrom();
        if (n.LIZ("from_profile_self", from) || n.LIZ("from_profile_other", from) || n.LIZ("from_roaming", from)) {
            this.LJIIJJI = true;
        }
        String string = arguments.getString("auto_route_schema", "");
        if (!TextUtils.isEmpty(string)) {
            SmartRouter.buildRoute(this, string).open();
        }
        this.LIZJ = ScrollSwitchStateManager.LJIILL.LIZ(getActivity());
        this.LIZLLL = HomePageDataViewModel.LJIILJJIL.LIZ(getActivity());
        Aif LIZIZ2 = LIZIZ();
        LIZIZ2.LIZIZ = new 8(this);
        if (this.LJIIIZ.isHotSpot() || MSAdaptionService.LIZJ().LIZJ(getContext())) {
            this.LJ = LIZIZ2.LIZ(getChildFragmentManager());
        } else {
            this.LJ = LIZIZ2.LIZ(getFragmentManager());
        }
        this.LIZ.setAdapter(this.LJ);
        this.LIZ.LIZ(new 2(this));
        this.LIZJ.LIZ((C4945EpB) new C4945EpB() {
            static {
                Covode.recordClassIndex(63853);
            }

            public final int LIZ() {
                return DetailFragment.this.LIZ.getCurrentItem();
            }

            public final void LIZ(int i) {
                DetailFragment.this.LIZ.setCurrentItem(i);
            }

            public final void LIZ(int i, boolean z) {
                DetailFragment.this.LIZ.LIZ(i, z);
            }
        });
        this.LIZ.setOnFlingEndListener(new C5269EuP() {
            static {
                Covode.recordClassIndex(63857);
            }

            public final void LIZ() {
                DetailFragment.this.LIZJ.LIZ(C4951EpH.INSTANCE);
            }
        });
        this.LIZJ.LJ(getActivity(), new C5244Eu0(this));
        this.LIZJ.LIZ((0CH) getActivity(), (0CM<Boolean>) new C5236Ets(this));
        ScrollSwitchStateManager scrollSwitchStateManager = this.LIZJ;
        1hK activity2 = getActivity();
        C5237Ett ett = new C5237Ett(this);
        M12.LIZ(activity2, ett);
        scrollSwitchStateManager.LIZJ.observe(activity2, ett);
        this.LIZJ.LIZJ(this, new C5238Etu(this));
        this.LIZJ.LIZIZ((0CH) getActivity(), (0CM<String>) new C5243Etz(this));
        this.LIZJ.LJFF(getActivity(), new C5239Etv(this));
        this.LIZIZ = BusinessComponentServiceUtils.newScrollSwitchHelper(getActivity(), this.LIZ, this.LJ);
        this.LJJIIJ = new C4901EoT(getActivity());
        this.LJJIIJZLJL = new C4900EoS(getActivity(), this.LJJIIJ);
        this.LJ.LIZJ();
        HomePageDataViewModel.LJIILJJIL.LIZ(getActivity()).LIZ(this.LJIIIZ.getEventType());
        this.LIZJ.LIZ("page_feed", false);
        if (this.LJIIIZ.isChain()) {
            this.LJ.LJIIIIZZ = C4664Eke.LIZ;
        }
        AwemeChangeCallBack.LIZ(getActivity(), this, new 2WY() {
            static {
                Covode.recordClassIndex(63855);
            }

            public final void LIZ(Aweme aweme) {
                boolean z;
                DetailFragment.this.LJIL = false;
                if (!(aweme == null || !aweme.isAd() || aweme.getAwemeRawAd() == null)) {
                    aweme.getAwemeRawAd().setPageFrom(DetailFragment.this.LJIIIZ.getEventType());
                }
                if (!(DetailFragment.this.LJIILL == aweme || DetailFragment.this.LJIJ == null)) {
                    FBJ LIZJ = DetailFragment.this.LJIJ.LIZJ();
                    Context context = DetailFragment.this.getContext();
                    if (!TextUtils.equals(DetailFragment.this.LJIIIZ.getEventType(), "general_search") || DetailFragment.this.LJIILL != null) {
                        z = false;
                    } else {
                        z = true;
                    }
                    LIZJ.LIZ(aweme, context, false, z);
                }
                DetailFragment.this.LJIILL = aweme;
                if (aweme != null) {
                    if (aweme.getSearchFeedType() == "SearchHotSpot") {
                        FeedParamProvider.LIZIZ.LIZ(DetailFragment.this.getContext()).extra.put("token_type", "tt_trendingcontent");
                    } else if (SearchServiceImpl.LJJIIZ().LJJIFFI()) {
                        if (FeedParamProvider.LIZIZ.LIZ(DetailFragment.this.getContext()).extra.containsKey("token_type")) {
                            if ("tt_trendingcontent".equals(FeedParamProvider.LIZIZ.LIZ(DetailFragment.this.getContext()).extra.get("token_type"))) {
                                FeedParamProvider.LIZIZ.LIZ(DetailFragment.this.getContext()).extra.remove("token_type");
                            }
                        }
                    }
                    if (aweme.getAuthor() != null) {
                        DetailFragment.this.LJIILJJIL = aweme;
                        DetailFragment.this.LJJ = false;
                        DetailFragment.this.LIZ(aweme);
                        DetailFragment.this.LIZLLL();
                        DetailFragment.this.LIZ();
                        DetailFragment.this.LJIILIIL = aweme.getAuthorUid();
                        8bl.LIZ(new Runnable() {
                            static {
                                Covode.recordClassIndex(63856);
                            }

                            public final void run() {
                                if (DetailFragment.this.isAdded() && !DetailFragment.this.getActivity().isFinishing() && DetailFragment.this.LJIILJJIL != null) {
                                    DetailFragment.this.LIZIZ(DetailFragment.this.LJIILJJIL);
                                }
                            }
                        }, 300);
                    }
                }
            }
        });
        this.LIZJ.LIZ((C5264EuK) this.LJJIIJ);
        this.LIZLLL.LJIIIIZZ.observe(getActivity(), new C5245Eu1(this));
        if (LJIJI()) {
            AnalysisStayTimeFragmentComponent analysisStayTimeFragmentComponent = new AnalysisStayTimeFragmentComponent(this, true);
            this.LJJIII = analysisStayTimeFragmentComponent;
            analysisStayTimeFragmentComponent.LIZIZ = new C5240Etw(this);
        }
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return 0HH.LIZ(layoutInflater, 2131559521, viewGroup, false);
    }
}
