package androidx.preference;

import android.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import androidx.core.content.res.k;
import androidx.preference.Preference;
import z4.c;
import z4.f;
import z4.g;

/* loaded from: classes.dex */
public class EditTextPreference extends DialogPreference {
    private String Y;

    /* loaded from: classes.dex */
    public static final class a implements Preference.b {

        /* renamed from: a, reason: collision with root package name */
        private static a f4988a;

        private a() {
        }

        public static a b() {
            if (f4988a == null) {
                f4988a = new a();
            }
            return f4988a;
        }

        @Override // androidx.preference.Preference.b
        /* renamed from: c, reason: merged with bridge method [inline-methods] */
        public CharSequence a(EditTextPreference editTextPreference) {
            return TextUtils.isEmpty(editTextPreference.S()) ? editTextPreference.g().getString(f.f53166a) : editTextPreference.S();
        }
    }

    public EditTextPreference(Context context, AttributeSet attributeSet, int i10, int i11) {
        super(context, attributeSet, i10, i11);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, g.f53214v, i10, i11);
        int i12 = g.f53216w;
        if (k.b(obtainStyledAttributes, i12, i12, false)) {
            P(a.b());
        }
        obtainStyledAttributes.recycle();
    }

    @Override // androidx.preference.Preference
    protected Object I(TypedArray typedArray, int i10) {
        return typedArray.getString(i10);
    }

    @Override // androidx.preference.Preference
    public boolean Q() {
        return TextUtils.isEmpty(this.Y) || super.Q();
    }

    public String S() {
        return this.Y;
    }

    public EditTextPreference(Context context, AttributeSet attributeSet, int i10) {
        this(context, attributeSet, i10, 0);
    }

    public EditTextPreference(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, k.a(context, c.f53157d, R.attr.editTextPreferenceStyle));
    }
}
