package com.ss.android.ugc.aweme.shortvideo.mentionvideo;

import X.0AA;
import X.2ha;
import X.2nK;
import X.37i;
import X.3P4;
import X.3QF;
import X.3j6;
import X.3jC;
import X.40g;
import X.48s;
import X.492;
import X.6J4;
import X.6nl;
import X.74z;
import X.8gF;
import X.8no;
import X.9wk;
import X.Ltg;
import X.OHP;
import X.OHQ;
import X.OHR;
import X.OHS;
import X.OZG;
import X.Qz3;
import X.Qz9;
import X.Ss1;
import X.Szo;
import X.ToU;
import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import androidx.fragment.app.Fragment;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.port.internal.IVideoRecordPreferences;
import java.util.ArrayList;
import java.util.HashMap;
import kotlin.h.b.n;

public final class MentionVideoActivity extends Ltg {
    public static final OHS LJIIIIZZ = new OHS((byte) 0);
    public Ss1 LIZLLL;
    public 37i LJ;
    public final ArrayList<Fragment> LJFF = new ArrayList<>();
    public int LJI;
    public String LJII;
    public ImageView LJIIIZ;
    public Qz3 LJIIJ;
    public final ArrayList<String> LJIIJJI = new ArrayList<>();
    public String LJIIL = "";
    public String LJIILIIL = "";
    public HashMap LJIILJJIL;

    static {
        Covode.recordClassIndex(110954);
    }

    public final View g_(int i) {
        if (this.LJIILJJIL == null) {
            this.LJIILJJIL = new HashMap();
        }
        View view = (View) this.LJIILJJIL.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LJIILJJIL.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [X.Ltg, com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        MentionVideoActivity.super.onDestroy();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [X.Ltg, com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        MentionVideoActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [X.Ltg, com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity", "onResume", true);
        MentionVideoActivity.super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity", "onResume", false);
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity", "onWindowFocusChanged", true);
        MentionVideoActivity.super.onWindowFocusChanged(z);
    }

    public final void finish() {
        MentionVideoActivity.super.finish();
        overridePendingTransition(2130771981, 2130771991);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.Ltg, com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        MentionVideoActivity.super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    /* JADX WARNING: type inference failed for: r9v0, types: [X.1hK, X.1oX, com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        MentionVideoActivity.super.onStart();
        8no r2 = new 8no();
        Application application = 74z.LIZ;
        n.LIZIZ(application, "");
        if (((IVideoRecordPreferences) r2.LIZ(application, IVideoRecordPreferences.class)).getShouldShowMentionVideoGuidePanel(true)) {
            3j6 r5 = new 3j6();
            r5.LIZJ = 40g.LIZ(48s.LIZ).LIZ(this);
            r5.LJFF = 2;
            String string = getString(2131823449);
            n.LIZIZ(string, "");
            r5.LIZ(string);
            String string2 = getString(2131823446);
            n.LIZIZ(string2, "");
            String string3 = getString(2131823447);
            n.LIZIZ(string3, "");
            String string4 = getString(2131823448);
            n.LIZIZ(string4, "");
            r5.LIZ(new 3jC[]{new 3jC(2131755197, string2), new 3jC(2131755700, string3), new 3jC(2131755206, string4)});
            r5.LJIILL = false;
            String string5 = getString(2131823445);
            n.LIZIZ(string5, "");
            r5.LIZ(string5, new 492(this));
            r5.LIZ().LIZ.show(getSupportFragmentManager(), "mention_video_educational_panel");
            8no r22 = new 8no();
            Application application2 = 74z.LIZ;
            n.LIZIZ(application2, "");
            ((IVideoRecordPreferences) r22.LIZ(application2, IVideoRecordPreferences.class)).setShouldShowMentionVideoGuidePanel(false);
            6J4 r23 = new 6J4();
            r23.LIZ("enter_from", "video_post_page");
            String str = this.LJII;
            if (str == null) {
                n.LIZ("");
            }
            r23.LIZ("creation_id", str);
            2nK.LIZ("show_credits_video_popup", r23.LIZ);
        }
    }

    /* JADX WARNING: type inference failed for: r12v0, types: [X.1hK, X.Ltg, X.1oX, com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        View view;
        String str;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity", "onCreate", true);
        MentionVideoActivity.super.onCreate(bundle);
        setContentView(2131558497);
        getWindow().addFlags(128);
        overridePendingTransition(2130772011, 2130771981);
        String LIZ = LIZ(getIntent(), "creation_id");
        if (LIZ == null) {
            LIZ = "";
        }
        this.LJII = LIZ;
        Szo LIZ2 = Szo.LIZIZ.LIZ(this);
        LIZ2.LIZ(2131099659);
        LIZ2.LIZLLL(2131099659);
        LIZ2.LIZ(true);
        LIZ2.LIZ.LIZJ();
        if (!3QF.LIZ(this)) {
            3P4.LIZ(getWindow());
        }
        37i findViewById = findViewById(2131367420);
        n.LIZIZ(findViewById, "");
        this.LJ = findViewById;
        View findViewById2 = findViewById(2131363390);
        n.LIZIZ(findViewById2, "");
        ImageView imageView = (ImageView) findViewById2;
        this.LJIIIZ = imageView;
        if (imageView == null) {
            n.LIZ("");
        }
        imageView.setOnClickListener(new OHR(this));
        Qz3 findViewById3 = findViewById(2131372798);
        n.LIZIZ(findViewById3, "");
        this.LJIIJ = findViewById3;
        Ss1 findViewById4 = findViewById(2131372800);
        n.LIZIZ(findViewById4, "");
        Ss1 ss1 = findViewById4;
        this.LIZLLL = ss1;
        if (ss1 == null) {
            n.LIZ("");
        }
        ss1.setOffscreenPageLimit(3);
        OZG ozg = 6nl.LIZ().LIZ;
        if (ozg != null) {
            String musicId = ozg.getMusicId();
            n.LIZIZ(musicId, "");
            this.LJIIL = musicId;
            this.LJIILIIL = ozg.musicName + " — " + ozg.authorName;
        }
        ToU toU = ToU.LIZ;
        String str2 = this.LJII;
        if (str2 == null) {
            n.LIZ("");
        }
        toU.LIZ(str2);
        ArrayList<String> arrayList = this.LJIIJJI;
        String str3 = this.LJIIL;
        if (!(str3 == null || str3.length() == 0 || (str = this.LJIILIIL) == null || str.length() == 0)) {
            arrayList.add(getString(2131823469));
            this.LJFF.add(ToU.LIZ.LIZ(8, this.LJIIL, this.LJIILIIL));
        }
        arrayList.add(getString(2131823468));
        this.LJFF.add(ToU.LIZ.LIZ(6));
        arrayList.add(getString(2131823467));
        this.LJFF.add(ToU.LIZ.LIZ(9));
        arrayList.add(getString(2131823466));
        this.LJFF.add(ToU.LIZ.LIZ(10));
        Qz3 qz3 = this.LJIIJ;
        if (qz3 == null) {
            n.LIZ("");
        }
        qz3.setTabMode(0);
        Qz3 qz32 = this.LJIIJ;
        if (qz32 == null) {
            n.LIZ("");
        }
        qz32.setAutoFillWhenScrollable(true);
        Qz3 qz33 = this.LJIIJ;
        if (qz33 == null) {
            n.LIZ("");
        }
        qz33.LIZ(2ha.LIZ(16.0d), 2ha.LIZ(16.0d));
        Qz3 qz34 = this.LJIIJ;
        if (qz34 == null) {
            n.LIZ("");
        }
        qz34.setCustomTabViewResId(2131560611);
        Ss1 ss12 = this.LIZLLL;
        if (ss12 == null) {
            n.LIZ("");
        }
        0AA supportFragmentManager = getSupportFragmentManager();
        n.LIZIZ(supportFragmentManager, "");
        ss12.setAdapter(new 9wk(supportFragmentManager, this.LJFF, this.LJIIJJI));
        Qz3 qz35 = this.LJIIJ;
        if (qz35 == null) {
            n.LIZ("");
        }
        Ss1 ss13 = this.LIZLLL;
        if (ss13 == null) {
            n.LIZ("");
        }
        qz35.setupWithViewPager(ss13);
        int size = this.LJIIJJI.size();
        for (int i = 0; i < size; i++) {
            Qz3 qz36 = this.LJIIJ;
            if (qz36 == null) {
                n.LIZ("");
            }
            Qz9 LIZIZ = qz36.LIZIZ(i);
            if (!(LIZIZ == null || (view = LIZIZ.LJFF) == null)) {
                view.setOnClickListener(new OHQ(this, i, LIZIZ));
            }
        }
        Ss1 ss14 = this.LIZLLL;
        if (ss14 == null) {
            n.LIZ("");
        }
        ss14.addOnPageChangeListener(new OHP(this));
        6J4 r2 = new 6J4();
        r2.LIZ("enter_from", "video_post_page");
        String str4 = this.LJII;
        if (str4 == null) {
            n.LIZ("");
        }
        r2.LIZ("creation_id", str4);
        2nK.LIZ("show_credits_page", r2.LIZ);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.shortvideo.mentionvideo.MentionVideoActivity", "onCreate", false);
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }
}
