package defpackage;

import android.R;
import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;
import androidx.preference.DialogPreference;

/* JADX INFO: renamed from: ᵴᵾᵱ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractDialogInterfaceOnClickListenerC4689 extends DialogInterfaceOnCancelListenerC0244 implements DialogInterface.OnClickListener {

    /* JADX INFO: renamed from: ˆˌˁ, reason: contains not printable characters */
    public BitmapDrawable f17814;

    /* JADX INFO: renamed from: ˎʞ, reason: contains not printable characters */
    public DialogPreference f17815;

    /* JADX INFO: renamed from: ᵔﹳ, reason: contains not printable characters */
    public CharSequence f17816;

    /* JADX INFO: renamed from: ᵕˁːᵚ, reason: contains not printable characters */
    public int f17817;

    /* JADX INFO: renamed from: ᵪʚᵯʝ, reason: contains not printable characters */
    public CharSequence f17818;

    /* JADX INFO: renamed from: ᵪᵳˀ, reason: contains not printable characters */
    public CharSequence f17819;

    /* JADX INFO: renamed from: ᵭᵬ, reason: contains not printable characters */
    public CharSequence f17820;

    /* JADX INFO: renamed from: ᵾᵻﹳᵮ, reason: contains not printable characters */
    public int f17821;

    @Override // android.content.DialogInterface.OnClickListener
    public final void onClick(DialogInterface dialogInterface, int i) {
        this.f17821 = i;
    }

    @Override // defpackage.DialogInterfaceOnCancelListenerC0244, android.content.DialogInterface.OnDismissListener
    public final void onDismiss(DialogInterface dialogInterface) {
        super.onDismiss(dialogInterface);
        mo4117(this.f17821 == -1);
    }

    @Override // defpackage.DialogInterfaceOnCancelListenerC0244, defpackage.AbstractComponentCallbacksC3393
    /* JADX INFO: renamed from: ˀᵛᵟ */
    public void mo1436(Bundle bundle) {
        super.mo1436(bundle);
        bundle.putCharSequence("PreferenceDialogFragment.title", this.f17818);
        bundle.putCharSequence("PreferenceDialogFragment.positiveText", this.f17816);
        bundle.putCharSequence("PreferenceDialogFragment.negativeText", this.f17819);
        bundle.putCharSequence("PreferenceDialogFragment.message", this.f17820);
        bundle.putInt("PreferenceDialogFragment.layout", this.f17817);
        BitmapDrawable bitmapDrawable = this.f17814;
        if (bitmapDrawable != null) {
            bundle.putParcelable("PreferenceDialogFragment.icon", bitmapDrawable.getBitmap());
        }
    }

    @Override // defpackage.DialogInterfaceOnCancelListenerC0244, defpackage.AbstractComponentCallbacksC3393
    /* JADX INFO: renamed from: ˆˀᵯ */
    public void mo1439(Bundle bundle) {
        super.mo1439(bundle);
        AbstractComponentCallbacksC3393 abstractComponentCallbacksC3393M7768 = m7768(true);
        if (!(abstractComponentCallbacksC3393M7768 instanceof AbstractC4785)) {
            ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Target fragment must implement TargetFragment interface");
            return;
        }
        AbstractC4785 abstractC4785 = (AbstractC4785) abstractComponentCallbacksC3393M7768;
        Bundle bundle2 = this.f13079;
        if (bundle2 == null) {
            ˆˌᵣ.ᵨᵣ("Fragment ", this, " does not have any arguments.");
            return;
        }
        String string = bundle2.getString("key");
        if (bundle != null) {
            this.f17818 = bundle.getCharSequence("PreferenceDialogFragment.title");
            this.f17816 = bundle.getCharSequence("PreferenceDialogFragment.positiveText");
            this.f17819 = bundle.getCharSequence("PreferenceDialogFragment.negativeText");
            this.f17820 = bundle.getCharSequence("PreferenceDialogFragment.message");
            this.f17817 = bundle.getInt("PreferenceDialogFragment.layout", 0);
            Bitmap bitmap = (Bitmap) bundle.getParcelable("PreferenceDialogFragment.icon");
            if (bitmap != null) {
                this.f17814 = new BitmapDrawable(m7754(), bitmap);
                return;
            }
            return;
        }
        DialogPreference dialogPreference = (DialogPreference) abstractC4785.m9980(string);
        this.f17815 = dialogPreference;
        this.f17818 = dialogPreference.f726;
        this.f17816 = dialogPreference.f723;
        this.f17819 = dialogPreference.f728;
        this.f17820 = dialogPreference.f724;
        this.f17817 = dialogPreference.f727;
        Drawable drawable = dialogPreference.f725;
        if (drawable == null || (drawable instanceof BitmapDrawable)) {
            this.f17814 = (BitmapDrawable) drawable;
            return;
        }
        Bitmap bitmapCreateBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmapCreateBitmap);
        drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        drawable.draw(canvas);
        this.f17814 = new BitmapDrawable(m7754(), bitmapCreateBitmap);
    }

    /* JADX INFO: renamed from: ˊᵨˌ */
    public void mo4116(C1868 c1868) {
    }

    /* JADX INFO: renamed from: ˋʿᵥᵔ */
    public void mo8002(View view) {
        int i;
        View viewFindViewById = view.findViewById(R.id.message);
        if (viewFindViewById != null) {
            CharSequence charSequence = this.f17820;
            if (TextUtils.isEmpty(charSequence)) {
                i = 8;
            } else {
                if (viewFindViewById instanceof TextView) {
                    ((TextView) viewFindViewById).setText(charSequence);
                }
                i = 0;
            }
            if (viewFindViewById.getVisibility() != i) {
                viewFindViewById.setVisibility(i);
            }
        }
    }

    /* JADX INFO: renamed from: ˑˀˉᵲ */
    public abstract void mo4117(boolean z);

    @Override // defpackage.DialogInterfaceOnCancelListenerC0244
    /* JADX INFO: renamed from: ᵕʢ */
    public final Dialog mo1441(Bundle bundle) {
        this.f17821 = -2;
        C1868 title = new C1868(m7785()).setTitle(this.f17818);
        BitmapDrawable bitmapDrawable = this.f17814;
        C3223 c3223 = title.f7403;
        c3223.f12268 = bitmapDrawable;
        c3223.f12277 = this.f17816;
        c3223.f12265 = this;
        c3223.f12280 = this.f17819;
        c3223.f12275 = this;
        m7785();
        int i = this.f17817;
        View viewInflate = null;
        if (i != 0) {
            LayoutInflater layoutInflaterMo1444 = this.f13071;
            if (layoutInflaterMo1444 == null) {
                layoutInflaterMo1444 = mo1444(null);
                this.f13071 = layoutInflaterMo1444;
            }
            viewInflate = layoutInflaterMo1444.inflate(i, (ViewGroup) null);
        }
        if (viewInflate != null) {
            mo8002(viewInflate);
            title.setView(viewInflate);
        } else {
            c3223.f12281 = this.f17820;
        }
        mo4116(title);
        DialogInterfaceC3504 dialogInterfaceC3504Create = title.create();
        if (this instanceof C3503) {
            Window window = dialogInterfaceC3504Create.getWindow();
            if (Build.VERSION.SDK_INT >= 30) {
                AbstractC2777.m6706(window);
                return dialogInterfaceC3504Create;
            }
            C3503 c3503 = (C3503) this;
            c3503.f13459 = SystemClock.currentThreadTimeMillis();
            c3503.m8003();
        }
        return dialogInterfaceC3504Create;
    }

    /* JADX INFO: renamed from: ᵠᐧ, reason: contains not printable characters */
    public final DialogPreference m9817() {
        if (this.f17815 == null) {
            Bundle bundle = this.f13079;
            if (bundle == null) {
                ˆˌᵣ.ᵨᵣ("Fragment ", this, " does not have any arguments.");
                return null;
            }
            this.f17815 = (DialogPreference) ((AbstractC4785) m7768(true)).m9980(bundle.getString("key"));
        }
        return this.f17815;
    }
}
