package com.seewo.ota.view;

import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.seewo.ota.R;
import f.t;
import f.z.c.p;
import f.z.d.k;

/* JADX INFO: compiled from: MessageDialog.kt */
/* JADX INFO: loaded from: classes.dex */
public final class g extends e {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private com.seewo.ota.l.a f2658b;

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

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

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

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

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

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private boolean f2664k;
    private p<? super DialogInterface, ? super Integer, t> l;
    private p<? super DialogInterface, ? super Integer, t> m;
    private p<? super DialogInterface, ? super Integer, t> n;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public g(Context context) {
        super(context, R.style.TransparentDialogNoTitle);
        k.e(context, "context");
        this.f2659f = "";
        this.f2660g = "";
        this.f2661h = "";
        this.f2662i = "";
        this.f2663j = "";
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void m(g gVar, View view) {
        k.e(gVar, "this$0");
        p<? super DialogInterface, ? super Integer, t> pVar = gVar.l;
        if (pVar != null) {
            pVar.invoke(gVar, -1);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void n(g gVar, View view) {
        k.e(gVar, "this$0");
        p<? super DialogInterface, ? super Integer, t> pVar = gVar.m;
        if (pVar != null) {
            pVar.invoke(gVar, -2);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void o(g gVar, View view) {
        k.e(gVar, "this$0");
        p<? super DialogInterface, ? super Integer, t> pVar = gVar.n;
        if (pVar != null) {
            pVar.invoke(gVar, -3);
        }
    }

    @Override // android.app.Dialog
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        com.seewo.ota.l.a aVarC = com.seewo.ota.l.a.c(getLayoutInflater());
        k.d(aVarC, "inflate(layoutInflater)");
        this.f2658b = aVarC;
        if (aVarC == null) {
            k.p("binding");
            throw null;
        }
        setContentView(aVarC.b());
        if (getWindow() != null) {
            WindowManager.LayoutParams attributes = getWindow().getAttributes();
            if (attributes != null) {
                attributes.height = -2;
                attributes.width = -2;
                attributes.gravity = 17;
            }
            getWindow().setDimAmount(0.4f);
        }
        com.seewo.ota.l.a aVar = this.f2658b;
        if (aVar == null) {
            k.p("binding");
            throw null;
        }
        aVar.f2140e.setText(this.f2659f);
        com.seewo.ota.l.a aVar2 = this.f2658b;
        if (aVar2 == null) {
            k.p("binding");
            throw null;
        }
        aVar2.f2142g.setText(this.f2660g);
        com.seewo.ota.l.a aVar3 = this.f2658b;
        if (aVar3 == null) {
            k.p("binding");
            throw null;
        }
        TextView textView = aVar3.f2139d;
        k.d(textView, "binding.dialogButtonPositive");
        textView.setVisibility(this.f2661h.length() > 0 ? 0 : 8);
        com.seewo.ota.l.a aVar4 = this.f2658b;
        if (aVar4 == null) {
            k.p("binding");
            throw null;
        }
        aVar4.f2139d.setText(this.f2661h);
        com.seewo.ota.l.a aVar5 = this.f2658b;
        if (aVar5 == null) {
            k.p("binding");
            throw null;
        }
        TextView textView2 = aVar5.f2137b;
        k.d(textView2, "binding.dialogButtonNegative");
        textView2.setVisibility(this.f2662i.length() > 0 ? 0 : 8);
        com.seewo.ota.l.a aVar6 = this.f2658b;
        if (aVar6 == null) {
            k.p("binding");
            throw null;
        }
        aVar6.f2137b.setText(this.f2662i);
        com.seewo.ota.l.a aVar7 = this.f2658b;
        if (aVar7 == null) {
            k.p("binding");
            throw null;
        }
        TextView textView3 = aVar7.f2138c;
        k.d(textView3, "binding.dialogButtonNeutral");
        textView3.setVisibility(this.f2663j.length() > 0 ? 0 : 8);
        com.seewo.ota.l.a aVar8 = this.f2658b;
        if (aVar8 == null) {
            k.p("binding");
            throw null;
        }
        aVar8.f2138c.setText(this.f2663j);
        com.seewo.ota.l.a aVar9 = this.f2658b;
        if (aVar9 == null) {
            k.p("binding");
            throw null;
        }
        ProgressBar progressBar = aVar9.f2141f;
        k.d(progressBar, "binding.dialogProgress");
        progressBar.setVisibility(this.f2664k ? 0 : 8);
        com.seewo.ota.l.a aVar10 = this.f2658b;
        if (aVar10 == null) {
            k.p("binding");
            throw null;
        }
        TextView textView4 = aVar10.f2140e;
        k.d(textView4, "binding.dialogMessage");
        textView4.setVisibility(this.f2664k ^ true ? 0 : 8);
        com.seewo.ota.l.a aVar11 = this.f2658b;
        if (aVar11 == null) {
            k.p("binding");
            throw null;
        }
        aVar11.f2139d.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.view.a
            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                g.m(this.f2652b, view);
            }
        });
        com.seewo.ota.l.a aVar12 = this.f2658b;
        if (aVar12 == null) {
            k.p("binding");
            throw null;
        }
        aVar12.f2137b.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.view.c
            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                g.n(this.f2654b, view);
            }
        });
        com.seewo.ota.l.a aVar13 = this.f2658b;
        if (aVar13 != null) {
            aVar13.f2138c.setOnClickListener(new View.OnClickListener() { // from class: com.seewo.ota.view.b
                @Override // android.view.View.OnClickListener
                public final void onClick(View view) {
                    g.o(this.f2653b, view);
                }
            });
        } else {
            k.p("binding");
            throw null;
        }
    }

    public final void p() {
        this.f2664k = true;
    }

    public final void q(int i2) {
        String string = getContext().getString(i2);
        k.d(string, "context.getString(message)");
        this.f2659f = string;
    }

    public final void r(String str) {
        k.e(str, "message");
        this.f2659f = str;
    }

    public final void s(int i2, p<? super DialogInterface, ? super Integer, t> pVar) {
        k.e(pVar, "listener");
        String string = getContext().getString(i2);
        k.d(string, "context.getString(text)");
        this.f2662i = string;
        this.m = pVar;
    }

    @Override // android.app.Dialog
    public void setTitle(int i2) {
        String string = getContext().getString(i2);
        k.d(string, "context.getString(title)");
        this.f2660g = string;
    }

    public final void t(int i2, p<? super DialogInterface, ? super Integer, t> pVar) {
        k.e(pVar, "listener");
        String string = getContext().getString(i2);
        k.d(string, "context.getString(text)");
        this.f2661h = string;
        this.l = pVar;
    }
}
