package com.ss.android.ugc.aweme.compliance.protection.timelock.ui;

import X.070;
import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.1hK;
import X.8gF;
import X.AnonymousClass2GD;
import X.AnonymousClass3Z4;
import X.AnonymousClass4TL;
import X.C24223Fe;
import X.C34683i8;
import X.C45353zL;
import X.C45393zP;
import X.C45403zQ;
import X.C45413zR;
import X.C45693zt;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.ViewGroup;
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.compliance.protection.timelock.viewmodel.SetLockParamViewModel;
import com.ss.android.ugc.aweme.compliance.protection.timelock.viewmodel.TimeLockOptionViewModel;

public class SetTimeLockActivity extends C24223Fe {
    public ViewGroup LIZIZ;
    public C45413zR LIZJ;

    static {
        Covode.recordClassIndex(62132);
    }

    public final int LIZ() {
        return 2131559400;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.compliance.protection.timelock.ui.SetTimeLockActivity, X.SNU, android.app.Activity] */
    public void onDestroy() {
        8gF.LJ(this);
        SetTimeLockActivity.super.onDestroy();
    }

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

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

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

    public void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.protection.timelock.ui.SetTimeLockActivity", "onWindowFocusChanged", true);
        SetTimeLockActivity.super.onWindowFocusChanged(z);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.compliance.protection.timelock.ui.SetTimeLockActivity, X.SNU, android.app.Activity] */
    public void onStop() {
        8gF.LIZLLL(this);
        SetTimeLockActivity.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 LIZIZ() {
        Fragment LIZ;
        Fragment LIZ2;
        Fragment LIZ3;
        this.LIZIZ = (ViewGroup) findViewById(2131369724);
        C45413zR r2 = new C45413zR();
        this.LIZJ = r2;
        r2.LIZ = getIntent().getIntExtra("SetTimeLockActivityKeyType", 0);
        if (getIntent().getBooleanExtra("SetTimeLockActivityKeyFromParent", false)) {
            C45393zP r4 = new C45393zP();
            r4.LIZ = LIZ(getIntent(), "SetTimeLockActivityKeyUid");
            r4.LIZIZ = LIZ(getIntent(), "SetTimeLockActivityKeySecUid");
            r4.LIZJ = LIZ(getIntent(), "SetTimeLockActivityKeyUsername");
            this.LIZJ.LIZIZ = r4;
        }
        LIZ(this).LIZ(SetLockParamViewModel.class).LIZ.setValue(this.LIZJ);
        if (getIntent().getBooleanExtra("SetTimeLockActivityKeyFromParent", false)) {
            int intExtra = getIntent().getIntExtra("SetTimeLockActivityKeyLockTimeInMin", 0);
            if (intExtra > 0) {
                LIZ(this).LIZ(TimeLockOptionViewModel.class).LIZ.setValue(new AnonymousClass3Z4(intExtra));
            }
            if (getIntent().getBooleanExtra("SetTimeLockActivityKeyParentState", false)) {
                LIZ3 = C45353zL.LIZJ(this.LIZJ.LIZ);
            } else {
                LIZ3 = C45353zL.LIZ(this.LIZJ.LIZ);
            }
            LIZ(LIZ3);
        } else if (this.LIZJ.LIZ == 0) {
            if (C45693zt.LIZLLL.LIZIZ()) {
                LIZ2 = C45353zL.LIZJ(this.LIZJ.LIZ);
            } else {
                LIZ2 = C45353zL.LIZ(this.LIZJ.LIZ);
            }
            LIZ(LIZ2);
        } else {
            if (C45693zt.LIZLLL.LIZ()) {
                LIZ = C45353zL.LIZJ(this.LIZJ.LIZ);
            } else {
                LIZ = C45353zL.LIZ(this.LIZJ.LIZ);
            }
            LIZ(LIZ);
        }
        ViewGroup viewGroup = this.LIZIZ;
        viewGroup.setBackgroundColor(070.LIZJ(viewGroup.getContext(), 2131099659));
    }

    public static 0Bx LIZ(1hK r2) {
        0Bx LIZ = 0By.LIZ(r2, (0Bv) null);
        if (AnonymousClass2GD.LIZ) {
            0Bs.LIZ(LIZ, r2);
        }
        return LIZ;
    }

    /* JADX WARNING: type inference failed for: r5v0, types: [X.3Fe, com.ss.android.ugc.aweme.compliance.protection.timelock.ui.SetTimeLockActivity, X.SNU, android.app.Activity] */
    public void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.protection.timelock.ui.SetTimeLockActivity", "onCreate", true);
        AnonymousClass4TL r2 = new AnonymousClass4TL((byte) 0);
        r2.LIZ = true;
        r2.LJII = 2131100281;
        activityConfiguration(new C45403zQ(r2));
        super.onCreate(bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.compliance.protection.timelock.ui.SetTimeLockActivity", "onCreate", false);
    }

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

    public static void LIZ(Context context, int i) {
        Intent intent = new Intent(context, SetTimeLockActivity.class);
        intent.putExtra("SetTimeLockActivityKeyType", i);
        intent.putExtra("SetTimeLockActivityKeyFromParent", false);
        LIZ(context, intent);
    }

    public static void LIZ(Context context, Intent intent) {
        C34683i8.LIZ(intent, context);
        context.startActivity(intent);
    }

    public static void LIZ(Context context, int i, String str, String str2, String str3, boolean z, int i2) {
        Intent intent = new Intent(context, SetTimeLockActivity.class);
        intent.putExtra("SetTimeLockActivityKeyType", i);
        if (!TextUtils.isEmpty(str)) {
            intent.putExtra("SetTimeLockActivityKeyFromParent", true);
            intent.putExtra("SetTimeLockActivityKeyUid", str);
            intent.putExtra("SetTimeLockActivityKeySecUid", str2);
            intent.putExtra("SetTimeLockActivityKeyUsername", str3);
            intent.putExtra("SetTimeLockActivityKeyParentState", z);
            intent.putExtra("SetTimeLockActivityKeyLockTimeInMin", i2);
        }
        if (context instanceof Application) {
            intent.addFlags(268435456);
        }
        LIZ(context, intent);
    }
}
