package com.ss.android.ugc.aweme.compliance.common.policynotice.ui;

import X.070;
import X.2GO;
import X.2HZ;
import X.2uR;
import X.3c7;
import X.3cA;
import X.3cI;
import X.3v3;
import X.8gF;
import X.C1069Rc9;
import X.C2704S6a;
import X.CbG;
import X.Hx0;
import X.ISm;
import X.M12;
import X.P8V;
import X.P8a;
import X.P8b;
import X.Qeg;
import X.S6U;
import X.S6W;
import X.S6Y;
import X.S6Z;
import X.SNU;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.SparseArray;
import android.view.View;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kotlin.h.b.n;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public final class PolicyNoticeFullscreenActivity extends SNU implements 2HZ, 2GO {
    public P8a LIZ;
    public SparseArray LIZIZ;

    static {
        Covode.recordClassIndex(61325);
    }

    public final void _$_clearFindViewByIdCache() {
        SparseArray sparseArray = this.LIZIZ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final View _$_findCachedViewById(int i) {
        if (this.LIZIZ == null) {
            this.LIZIZ = new SparseArray();
        }
        View view = (View) this.LIZIZ.get(i);
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LIZIZ.put(i, findViewById);
        return findViewById;
    }

    public final Map<Integer, Object> getSubscriberEventTypes() {
        HashMap hashMap = new HashMap();
        hashMap.put(58, new C1069Rc9(PolicyNoticeFullscreenActivity.class, "onJsBroadCastEvent", Hx0.class, ThreadMode.MAIN, 0, false));
        return hashMap;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [X.SNU, com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        super.onPause();
    }

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

    /* JADX WARNING: type inference failed for: r0v0, types: [X.SNU, com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        super.onStart();
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity", "onWindowFocusChanged", true);
        super.onWindowFocusChanged(z);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.SNU, java.lang.Object, com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        super.onDestroy();
        EventBus.LIZ().LIZIZ((Object) this);
    }

    public final void onBackPressed() {
        Boolean bool;
        P8a p8a = this.LIZ;
        if (p8a != null) {
            bool = p8a.isSubPopUp();
        } else {
            bool = null;
        }
        if (n.LIZ(bool, true)) {
            PolicyNoticeFullscreenActivity.super.onBackPressed();
        }
    }

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

    @ISm(LIZ = ThreadMode.MAIN)
    public final void onJsBroadCastEvent(Hx0 hx0) {
        M12.LIZ(hx0);
        if (TextUtils.equals(hx0.LIZIZ.optString("eventName"), "cancel_post_success")) {
            finish();
        }
    }

    public final void LIZ(P8V p8v) {
        P8b p8b = 3v3.LIZ;
        if (p8b != null) {
            p8b.LIZ(this.LIZ, p8v);
        }
        P8b p8b2 = 3v3.LIZ;
        if (p8b2 != null) {
            p8b2.LIZ();
        }
        finish();
    }

    /* JADX WARNING: type inference failed for: r13v0, types: [X.4Qh, X.SNU, java.lang.Object, com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        String str;
        String str2;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity", "onCreate", true);
        activityConfiguration(S6W.LIZ);
        super.onCreate(bundle);
        setContentView(2131559403);
        Serializable serializableExtra = getIntent().getSerializableExtra("extra_key_policy_notice");
        List list = null;
        if (!(serializableExtra instanceof P8a)) {
            serializableExtra = null;
        }
        P8a p8a = (P8a) serializableExtra;
        this.LIZ = p8a;
        if (p8a != null) {
            if (n.LIZ(p8a.isSubPopUp(), true)) {
                3c7 _$_findCachedViewById = _$_findCachedViewById(2131371262);
                n.LIZIZ(_$_findCachedViewById, "");
                _$_findCachedViewById.setVisibility(0);
                2uR r8 = new 2uR();
                3cA r1 = new 3cA();
                r1.LIZ(2131755170);
                r1.LIZ(new C2704S6a(this));
                r8.LIZ(new 3cI[]{r1});
                _$_findCachedViewById(2131371262).setNavActions(r8);
            } else {
                3c7 _$_findCachedViewById2 = _$_findCachedViewById(2131371262);
                n.LIZIZ(_$_findCachedViewById2, "");
                _$_findCachedViewById2.setVisibility(4);
            }
            Qeg _$_findCachedViewById3 = _$_findCachedViewById(2131368635);
            P8a p8a2 = this.LIZ;
            if (p8a2 != null) {
                str = p8a2.getTitle();
            } else {
                str = null;
            }
            _$_findCachedViewById3.setText(str);
            _$_findCachedViewById3.setTuxFont(23);
            Qeg _$_findCachedViewById4 = _$_findCachedViewById(2131363684);
            3v3 r7 = 3v3.LIZIZ;
            Context context = _$_findCachedViewById4.getContext();
            n.LIZIZ(context, "");
            P8a p8a3 = this.LIZ;
            if (p8a3 != null) {
                str2 = p8a3.getBody();
            } else {
                str2 = null;
            }
            P8a p8a4 = this.LIZ;
            if (p8a4 != null) {
                list = p8a4.getPolicyLinkList();
            }
            _$_findCachedViewById4.setText(r7.LIZ(context, str2, list, new S6Y(this), new S6Z(this)));
            _$_findCachedViewById4.setHighlightColor(070.LIZJ(_$_findCachedViewById4.getContext(), 2131099762));
            _$_findCachedViewById4.setMovementMethod(LinkMovementMethod.getInstance());
            P8b p8b = 3v3.LIZ;
            if (p8b != null) {
                P8a p8a5 = this.LIZ;
                if (p8a5 == null) {
                    n.LIZIZ();
                }
                p8b.LIZ(p8a5);
            }
            CbG _$_findCachedViewById5 = _$_findCachedViewById(2131363084);
            _$_findCachedViewById5.setTuxFont(43);
            P8a p8a6 = this.LIZ;
            if (p8a6 == null) {
                n.LIZIZ();
            }
            LIZ(_$_findCachedViewById5, (P8V) p8a6.getActions().get(0));
            P8a p8a7 = this.LIZ;
            if (p8a7 == null) {
                n.LIZIZ();
            }
            if (p8a7.getActions().size() > 1) {
                Qeg _$_findCachedViewById6 = _$_findCachedViewById(2131363085);
                _$_findCachedViewById6.setVisibility(0);
                P8a p8a8 = this.LIZ;
                if (p8a8 == null) {
                    n.LIZIZ();
                }
                LIZ(_$_findCachedViewById6, (P8V) p8a8.getActions().get(1));
            } else {
                Qeg _$_findCachedViewById7 = _$_findCachedViewById(2131363085);
                n.LIZIZ(_$_findCachedViewById7, "");
                _$_findCachedViewById7.setVisibility(8);
            }
            EventBus.LIZ(EventBus.LIZ(), (Object) this);
            ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity", "onCreate", false);
            return;
        }
        finish();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.common.policynotice.ui.PolicyNoticeFullscreenActivity", "onCreate", false);
    }

    private final void LIZ(Qeg qeg, P8V p8v) {
        if (qeg != null) {
            qeg.setText(p8v.getText());
            qeg.setOnClickListener(new S6U(this, p8v));
        }
    }
}
