package com.webh5app.app;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.FDJAfGbVdJFkP.fpOujAROks.R;
import com.webh5app.utils.Utils;
import com.webh5app.wrap.config.AppConfig;
import com.webh5app.wrap.config.GuideModule;
/* loaded from: classes.dex */
public class ADActivity extends BaseActivity {

    /* renamed from: FSaI4_7  reason: collision with root package name */
    public boolean f3706FSaI4_7;
    public Runnable KQgRr5e_0;
    public int PGPF6hQ_2;
    public Handler QxJ9d_1;
    @BindView
    public Button timerAD;

    /* loaded from: classes.dex */
    public class KQgRr5e_0 implements Runnable {
        public KQgRr5e_0() {
        }

        @Override // java.lang.Runnable
        public void run() {
            ADActivity aDActivity = ADActivity.this;
            int i = aDActivity.PGPF6hQ_2 - 1;
            aDActivity.PGPF6hQ_2 = i;
            if (i <= 0) {
                aDActivity.nextStep();
                return;
            }
            aDActivity.timerAD.setText("（跳过 " + ADActivity.this.PGPF6hQ_2 + "）");
            ADActivity.this.QxJ9d_1.postDelayed(this, 1000L);
        }
    }

    public final void IMuAHx_6() {
    }

    public void nextStep() {
        Intent intent;
        if (this.f3706FSaI4_7) {
            return;
        }
        GuideModule guideModule = AppConfig.Instance.guide;
        if (guideModule != null && guideModule.open.equals("1")) {
            intent = new Intent(this, GuideActivity.class);
        } else {
            intent = new Intent(this, MainActivity.class);
        }
        startActivity(intent);
        finish();
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        PGPF6hQ_2();
        this.PGPF6hQ_2 = Integer.parseInt(AppConfig.Instance.advertising.time);
        setContentView(R.layout.activity_ad);
        ButterKnife.KQgRr5e_0(this);
        Button button = this.timerAD;
        button.setText("（跳过 " + this.PGPF6hQ_2 + "）");
        this.QxJ9d_1.postDelayed(this.KQgRr5e_0, 1000L);
        IMuAHx_6();
    }

    @Override // androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onPause() {
        super.onPause();
        this.f3706FSaI4_7 = true;
        Log.i("ADActivity", "onPause");
    }

    @Override // androidx.fragment.app.FragmentActivity, android.app.Activity
    public void onResume() {
        super.onResume();
        this.f3706FSaI4_7 = false;
        if (this.PGPF6hQ_2 <= 0) {
            nextStep();
        }
        Log.i("ADActivity", "onResume");
    }

    @OnClick
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id != R.id.btn_ad) {
            if (id != R.id.timer_ad) {
                return;
            }
            Log.i("ADActivity", "on ignore click");
            nextStep();
            return;
        }
        Log.i("ADActivity", "on ad click");
        String str = AppConfig.Instance.advertising.action;
        if (str.equals("0")) {
            return;
        }
        if (str.equals("6")) {
            MainActivity mainActivity = MainActivity.instance;
            if (mainActivity != null) {
                mainActivity.loadUrl(AppConfig.Instance.advertising.url);
            }
            nextStep();
        } else if (str.equals("7")) {
            Utils.doOpenWeb(getApplicationContext(), AppConfig.Instance.advertising.url);
        }
    }
}
