package h1;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ifpdos.certinstaller.R;

/* JADX INFO: compiled from: OSBaseDialog.java */
/* JADX INFO: loaded from: classes.dex */
public class d {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private Dialog f4790a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final b f4791b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private TextView f4792c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private TextView f4793d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private FrameLayout f4794e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private LinearLayout f4795f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private Button f4796g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private Button f4797h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private Button f4798i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private View f4799j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private View f4800k;

    /* JADX INFO: compiled from: OSBaseDialog.java */
    static /* synthetic */ class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        static final /* synthetic */ int[] f4801a;

        static {
            int[] iArr = new int[c.values().length];
            f4801a = iArr;
            try {
                iArr[c.LR.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f4801a[c.M.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f4801a[c.NONE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    /* JADX INFO: compiled from: OSBaseDialog.java */
    public static class b {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        private final Context f4802a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private c f4803b = c.NONE;

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private View f4804c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        private DialogInterface.OnClickListener f4805d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        private DialogInterface.OnClickListener f4806e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        private DialogInterface.OnClickListener f4807f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private DialogInterface.OnDismissListener f4808g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        private int f4809h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        private int f4810i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        private int f4811j;

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        private String f4812k;

        /* JADX INFO: renamed from: l, reason: collision with root package name */
        private String f4813l;

        public b(Context context) {
            this.f4802a = context;
        }

        public d m() {
            return new d(this);
        }

        public b n(int i3, int i4, DialogInterface.OnClickListener onClickListener, DialogInterface.OnClickListener onClickListener2) {
            this.f4803b = c.LR;
            this.f4809h = i3;
            this.f4810i = i4;
            this.f4806e = onClickListener;
            this.f4805d = onClickListener2;
            return this;
        }

        public b o(int i3, DialogInterface.OnClickListener onClickListener) {
            this.f4803b = c.M;
            this.f4811j = i3;
            this.f4807f = onClickListener;
            return this;
        }

        public b p(int i3) {
            this.f4804c = LayoutInflater.from(this.f4802a).inflate(i3, (ViewGroup) null, false);
            return this;
        }

        public b q(DialogInterface.OnDismissListener onDismissListener) {
            this.f4808g = onDismissListener;
            return this;
        }

        public b r(String str) {
            this.f4813l = str;
            return this;
        }

        public b s(int i3) {
            this.f4812k = this.f4802a.getResources().getString(i3);
            return this;
        }

        public b t(String str) {
            this.f4812k = str;
            return this;
        }
    }

    /* JADX INFO: compiled from: OSBaseDialog.java */
    public enum c {
        NONE,
        LR,
        M
    }

    private d(b bVar) {
        this.f4791b = bVar;
        d();
    }

    private void d() {
        this.f4790a = new Dialog(this.f4791b.f4802a);
        View viewInflate = LayoutInflater.from(this.f4791b.f4802a).inflate(R.layout.dialog_os_base, (ViewGroup) null, false);
        this.f4790a.setContentView(viewInflate);
        this.f4790a.setCanceledOnTouchOutside(true);
        if (this.f4791b.f4808g != null) {
            this.f4790a.setOnDismissListener(this.f4791b.f4808g);
        }
        this.f4790a.setCancelable(false);
        k(viewInflate);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void g(View view) {
        if (this.f4791b.f4806e != null) {
            this.f4791b.f4806e.onClick(this.f4790a, 0);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void h(View view) {
        if (this.f4791b.f4805d != null) {
            this.f4791b.f4805d.onClick(this.f4790a, 2);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public /* synthetic */ void i(View view) {
        if (this.f4791b.f4807f != null) {
            this.f4791b.f4807f.onClick(this.f4790a, 1);
        }
    }

    private void k(View view) {
        this.f4792c = (TextView) view.findViewById(R.id.os_dialog_tv_title);
        this.f4793d = (TextView) view.findViewById(R.id.os_dialog_tv_content_tips);
        this.f4794e = (FrameLayout) view.findViewById(R.id.os_dialog_fl_content_container);
        this.f4795f = (LinearLayout) view.findViewById(R.id.os_dialog_ll_bottom);
        this.f4796g = (Button) view.findViewById(R.id.os_dialog_btn_left);
        this.f4797h = (Button) view.findViewById(R.id.os_dialog_btn_right);
        this.f4798i = (Button) view.findViewById(R.id.os_dialog_btn_middle);
        this.f4799j = view.findViewById(R.id.os_dialog_v_divider1);
        this.f4800k = view.findViewById(R.id.os_dialog_v_divider2);
        if (this.f4791b.f4812k == null) {
            this.f4792c.setVisibility(8);
        } else {
            this.f4792c.setVisibility(0);
            this.f4792c.setText(this.f4791b.f4812k);
        }
        if (this.f4791b.f4804c == null) {
            this.f4794e.setVisibility(8);
            this.f4793d.setVisibility(0);
            this.f4793d.setText(this.f4791b.f4813l);
        } else {
            this.f4794e.setVisibility(0);
            this.f4793d.setVisibility(8);
            this.f4794e.addView(this.f4791b.f4804c);
        }
        int i3 = a.f4801a[this.f4791b.f4803b.ordinal()];
        if (i3 == 1) {
            this.f4796g.setVisibility(0);
            this.f4798i.setVisibility(8);
            this.f4797h.setVisibility(0);
            this.f4799j.setVisibility(0);
            this.f4800k.setVisibility(8);
            this.f4796g.setText(this.f4791b.f4809h);
            this.f4797h.setText(this.f4791b.f4810i);
            this.f4796g.setOnClickListener(new View.OnClickListener() { // from class: h1.a
                @Override // android.view.View.OnClickListener
                public final void onClick(View view2) {
                    this.f4787e.g(view2);
                }
            });
            this.f4797h.setOnClickListener(new View.OnClickListener() { // from class: h1.c
                @Override // android.view.View.OnClickListener
                public final void onClick(View view2) {
                    this.f4789e.h(view2);
                }
            });
            return;
        }
        if (i3 != 2) {
            this.f4795f.setVisibility(8);
            this.f4796g.setVisibility(8);
            this.f4798i.setVisibility(8);
            this.f4797h.setVisibility(8);
            this.f4799j.setVisibility(8);
            this.f4800k.setVisibility(8);
            return;
        }
        this.f4796g.setVisibility(8);
        this.f4798i.setVisibility(0);
        this.f4797h.setVisibility(8);
        this.f4799j.setVisibility(8);
        this.f4800k.setVisibility(8);
        this.f4798i.setText(this.f4791b.f4811j);
        this.f4798i.setOnClickListener(new View.OnClickListener() { // from class: h1.b
            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                this.f4788e.i(view2);
            }
        });
    }

    public View e() {
        return this.f4794e;
    }

    public Dialog f() {
        return this.f4790a;
    }

    public void j(boolean z2) {
        if (z2) {
            Button button = this.f4797h;
            button.setTextColor(button.getResources().getColorStateList(R.color.selector_dialog_button_accent_txt, null));
        } else {
            Button button2 = this.f4797h;
            button2.setTextColor(button2.getResources().getColorStateList(R.color.selector_dialog_button_disable_txt, null));
        }
        this.f4797h.setEnabled(z2);
    }

    public void l() {
        Dialog dialog = this.f4790a;
        if (dialog != null) {
            dialog.show();
        }
    }
}
