package com.ss.android.ugc.aweme.anchor.liveevent;

import X.070;
import X.0AP;
import X.8gF;
import X.FkL;
import X.FkV;
import X.Lel;
import X.Qeg;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
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 com.ss.android.ugc.aweme.anchor.AnchorBaseActivity;
import com.ss.android.ugc.aweme.liveevent.LiveEventSelectionFragment;
import java.util.List;
import kotlin.h.b.n;
import kotlin.o.y;

public final class LiveEventSelectionActivity extends AnchorBaseActivity {
    public LiveEventSelectionFragment LIZ;
    public SparseArray LIZIZ;

    static {
        Covode.recordClassIndex(52991);
    }

    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;
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.anchor.AnchorBaseActivity, com.ss.android.ugc.aweme.anchor.liveevent.LiveEventSelectionActivity, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.anchor.liveevent.LiveEventSelectionActivity", "onCreate", true);
        super.onCreate(bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.anchor.liveevent.LiveEventSelectionActivity", "onCreate", false);
    }

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

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

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

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.anchor.AnchorBaseActivity, com.ss.android.ugc.aweme.anchor.liveevent.LiveEventSelectionActivity, 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.anchor.liveevent.LiveEventSelectionActivity", "onWindowFocusChanged", true);
        super.onWindowFocusChanged(z);
    }

    public final void LJFF() {
        0AP LIZ2 = getSupportFragmentManager().LIZ();
        n.LIZIZ(LIZ2, "");
        if (this.LIZ == null) {
            this.LIZ = new LiveEventSelectionFragment();
        }
        LiveEventSelectionFragment liveEventSelectionFragment = this.LIZ;
        if (liveEventSelectionFragment != null) {
            LIZ2.LIZ(2131365155, liveEventSelectionFragment);
            LIZ2.LIZJ();
        }
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.anchor.AnchorBaseActivity, com.ss.android.ugc.aweme.anchor.liveevent.LiveEventSelectionActivity, 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) {
        }
    }

    public final void LIZ(FkV fkV) {
        List<?> list;
        LiveEventSelectionFragment liveEventSelectionFragment = this.LIZ;
        if (liveEventSelectionFragment != null && fkV != null) {
            liveEventSelectionFragment.LJ = fkV;
            Qeg LIZ2 = liveEventSelectionFragment.LIZ(2131362975);
            n.LIZIZ(LIZ2, "");
            LIZ2.setClickable(true);
            Qeg LIZ3 = liveEventSelectionFragment.LIZ(2131362975);
            n.LIZIZ(LIZ3, "");
            Context context = liveEventSelectionFragment.getContext();
            if (context == null) {
                n.LIZIZ();
            }
            LIZ3.setBackground(new ColorDrawable(070.LIZJ(context, 2131099731)));
            Qeg LIZ4 = liveEventSelectionFragment.LIZ(2131362975);
            Context context2 = liveEventSelectionFragment.getContext();
            if (context2 == null) {
                n.LIZIZ();
            }
            LIZ4.setTextColor(070.LIZJ(context2, 2131099685));
            FkL fkL = liveEventSelectionFragment.LJFF;
            if (fkL == null || (list = fkL.LIZIZ) == null) {
                list = Lel.INSTANCE;
            }
            for (T next : list) {
                if ((next instanceof FkV) && (!n.LIZ(next, fkV))) {
                    FkV fkV2 = (FkV) next;
                    if (!y.LIZ(fkV2.LIZ, fkV.LIZ, true)) {
                        fkV2.LIZLLL = false;
                    }
                }
            }
            FkL fkL2 = liveEventSelectionFragment.LJFF;
            if (fkL2 != null) {
                fkL2.notifyDataSetChanged();
            }
        }
    }
}
