package com.webh5app.app;

import IMuAHx_6.QxJ9d_1.KQgRr5e_0.KQgRr5e_0;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.FDJAfGbVdJFkP.fpOujAROks.R;
import com.webh5app.wrap.config.AppConfig;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public class GuideActivity extends BaseActivity implements ViewPager.Xgtqvk_8 {
    public ImageView KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public List<Integer> f2951KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public ImageView[] f2952KQgRr5e_0;
    public List<View> QxJ9d_1;
    @BindView
    public Button guideIbStart;
    @BindView
    public ViewPager guideVp;
    @BindView
    public LinearLayout llGuidePoint;

    public final void FSaI4_7() {
        this.f2951KQgRr5e_0 = new ArrayList();
        for (int i = 1; i <= 10; i++) {
            Resources resources = getResources();
            int identifier = resources.getIdentifier("img_guide_" + i, "mipmap", getPackageName());
            if (identifier <= 0) {
                break;
            }
            this.f2951KQgRr5e_0.add(Integer.valueOf(identifier));
        }
        this.QxJ9d_1 = new ArrayList();
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1);
        int size = this.f2951KQgRr5e_0.size();
        for (int i2 = 0; i2 < size; i2++) {
            ImageView imageView = new ImageView(this);
            imageView.setLayoutParams(layoutParams);
            imageView.setBackgroundResource(this.f2951KQgRr5e_0.get(i2).intValue());
            this.QxJ9d_1.add(imageView);
        }
        this.guideVp.setAdapter(new KQgRr5e_0(this.QxJ9d_1));
        this.guideVp.m994KQgRr5e_0((ViewPager.Xgtqvk_8) this);
    }

    public final void IMuAHx_6() {
        this.llGuidePoint = (LinearLayout) findViewById(R.id.ll_guide_point);
        this.f2952KQgRr5e_0 = new ImageView[this.QxJ9d_1.size()];
        int size = this.QxJ9d_1.size();
        for (int i = 0; i < size; i++) {
            this.KQgRr5e_0 = new ImageView(this);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
            layoutParams.setMargins(20, 0, 20, 0);
            this.KQgRr5e_0.setLayoutParams(layoutParams);
            ImageView[] imageViewArr = this.f2952KQgRr5e_0;
            ImageView imageView = this.KQgRr5e_0;
            imageViewArr[i] = imageView;
            if (i == 0) {
                imageView.setBackgroundResource(R.drawable.guide_dot_select);
            } else {
                imageView.setBackgroundResource(R.drawable.guide_dot_unselect);
            }
            this.llGuidePoint.addView(this.f2952KQgRr5e_0[i]);
        }
    }

    public int getLayoutId() {
        return R.layout.activity_guide;
    }

    public void initView() {
        FSaI4_7();
        IMuAHx_6();
    }

    @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();
        setContentView(R.layout.activity_guide);
        ButterKnife.KQgRr5e_0(this);
        initView();
        if (AppConfig.Instance.guide.color.isEmpty()) {
            return;
        }
        int parseColor = Color.parseColor(AppConfig.Instance.guide.color);
        ((GradientDrawable) this.guideIbStart.getBackground()).setStroke(2, parseColor);
        this.guideIbStart.setTextColor(parseColor);
    }

    @Override // androidx.viewpager.widget.ViewPager.Xgtqvk_8
    public void onPageScrollStateChanged(int i) {
    }

    @Override // androidx.viewpager.widget.ViewPager.Xgtqvk_8
    public void onPageScrolled(int i, float f, int i2) {
    }

    @Override // androidx.viewpager.widget.ViewPager.Xgtqvk_8
    public void onPageSelected(int i) {
        int size = this.f2951KQgRr5e_0.size();
        for (int i2 = 0; i2 < size; i2++) {
            this.f2952KQgRr5e_0[i].setBackgroundResource(R.drawable.guide_dot_select);
            if (i != i2) {
                this.f2952KQgRr5e_0[i2].setBackgroundResource(R.drawable.guide_dot_unselect);
            }
        }
        if (i == this.f2951KQgRr5e_0.size() - 1) {
            this.guideIbStart.setVisibility(0);
        } else {
            this.guideIbStart.setVisibility(8);
        }
    }

    @OnClick
    public void onViewClicked(View view) {
        if (view.getId() != R.id.guide_ib_start) {
            return;
        }
        startActivity(new Intent(this, MainActivity.class));
        finish();
    }
}
