package androidx.preference;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.AbsSavedState;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import ar.tvplayer.tv.R;
import ar.tvplayer.tv.base.ui.OnOffPreference;
import defpackage.AbstractC0042;
import defpackage.AbstractC2873;
import defpackage.AbstractC4608;
import defpackage.C0642;
import defpackage.C2102;
import defpackage.C5010;
import defpackage.C5553;
import defpackage.InterfaceC0955;
import defpackage.RunnableC2802;
import defpackage.ViewOnClickListenerC4018;
import defpackage.ViewOnCreateContextMenuListenerC5575;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.WeakHashMap;

/* loaded from: classes3.dex */
public class Preference implements Comparable<Preference> {

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public PreferenceGroup f741;

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public final boolean f742;

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public C5553 f743;

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public final Object f744;

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public Bundle f745;

    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public InterfaceC0955 f746;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public boolean f747;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public final boolean f748;

    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public int f749;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public final String f750;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public boolean f751;

    /* renamed from: ˌᵹᵨˑ, reason: contains not printable characters */
    public C0642 f752;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public CharSequence f753;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public final boolean f754;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public boolean f755;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public CharSequence f756;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public Intent f757;

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public boolean f758;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public boolean f759;

    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public ArrayList f760;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public int f761;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public boolean f762;

    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public final boolean f763;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public ᵶﾞᴵ f764;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public C5010 f765;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public boolean f766;

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public ViewOnCreateContextMenuListenerC5575 f767;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public Drawable f768;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final Context f769;

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public boolean f770;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public int f771;

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public final boolean f772;

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final String f773;

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public final int f774;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public String f775;

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public boolean f776;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public final boolean f777;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public long f778;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public ʼٴ f779;

    /* renamed from: ﹶـ, reason: contains not printable characters */
    public final ViewOnClickListenerC4018 f780;

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public boolean f781;

    public Preference(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, ˋˌ.ᵶᵷᵕ(context, R.attr._11_res_0x7f040511, android.R.attr.preferenceStyle), 0);
    }

    public Preference(Context context, AttributeSet attributeSet, int i, int i2) {
        this.f761 = Integer.MAX_VALUE;
        this.f781 = true;
        this.f758 = true;
        this.f755 = true;
        this.f747 = true;
        this.f759 = true;
        this.f751 = true;
        this.f772 = true;
        this.f763 = true;
        this.f754 = true;
        this.f742 = true;
        this.f749 = R.layout._11_res_0x7f0e0129;
        this.f780 = new ViewOnClickListenerC4018(3, this);
        this.f769 = context;
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, AbstractC4608.f17077, i, i2);
        this.f771 = typedArrayObtainStyledAttributes.getResourceId(23, typedArrayObtainStyledAttributes.getResourceId(0, 0));
        String string = typedArrayObtainStyledAttributes.getString(26);
        this.f775 = string == null ? typedArrayObtainStyledAttributes.getString(6) : string;
        CharSequence text = typedArrayObtainStyledAttributes.getText(34);
        this.f756 = text == null ? typedArrayObtainStyledAttributes.getText(4) : text;
        CharSequence text2 = typedArrayObtainStyledAttributes.getText(33);
        this.f753 = text2 == null ? typedArrayObtainStyledAttributes.getText(7) : text2;
        this.f761 = typedArrayObtainStyledAttributes.getInt(28, typedArrayObtainStyledAttributes.getInt(8, Integer.MAX_VALUE));
        String string2 = typedArrayObtainStyledAttributes.getString(22);
        this.f773 = string2 == null ? typedArrayObtainStyledAttributes.getString(13) : string2;
        this.f749 = typedArrayObtainStyledAttributes.getResourceId(27, typedArrayObtainStyledAttributes.getResourceId(3, R.layout._11_res_0x7f0e0129));
        this.f774 = typedArrayObtainStyledAttributes.getResourceId(35, typedArrayObtainStyledAttributes.getResourceId(9, 0));
        this.f781 = typedArrayObtainStyledAttributes.getBoolean(21, typedArrayObtainStyledAttributes.getBoolean(2, true));
        this.f758 = typedArrayObtainStyledAttributes.getBoolean(30, typedArrayObtainStyledAttributes.getBoolean(5, true));
        this.f755 = typedArrayObtainStyledAttributes.getBoolean(29, typedArrayObtainStyledAttributes.getBoolean(1, true));
        String string3 = typedArrayObtainStyledAttributes.getString(19);
        this.f750 = string3 == null ? typedArrayObtainStyledAttributes.getString(10) : string3;
        this.f772 = typedArrayObtainStyledAttributes.getBoolean(16, typedArrayObtainStyledAttributes.getBoolean(16, this.f758));
        this.f763 = typedArrayObtainStyledAttributes.getBoolean(17, typedArrayObtainStyledAttributes.getBoolean(17, this.f758));
        if (typedArrayObtainStyledAttributes.hasValue(18)) {
            this.f744 = mo434(typedArrayObtainStyledAttributes, 18);
        } else if (typedArrayObtainStyledAttributes.hasValue(11)) {
            this.f744 = mo434(typedArrayObtainStyledAttributes, 11);
        }
        this.f742 = typedArrayObtainStyledAttributes.getBoolean(31, typedArrayObtainStyledAttributes.getBoolean(12, true));
        boolean zHasValue = typedArrayObtainStyledAttributes.hasValue(32);
        this.f748 = zHasValue;
        if (zHasValue) {
            this.f754 = typedArrayObtainStyledAttributes.getBoolean(32, typedArrayObtainStyledAttributes.getBoolean(14, true));
        }
        this.f770 = typedArrayObtainStyledAttributes.getBoolean(24, typedArrayObtainStyledAttributes.getBoolean(15, false));
        this.f751 = typedArrayObtainStyledAttributes.getBoolean(25, typedArrayObtainStyledAttributes.getBoolean(25, true));
        this.f777 = typedArrayObtainStyledAttributes.getBoolean(20, typedArrayObtainStyledAttributes.getBoolean(20, false));
        typedArrayObtainStyledAttributes.recycle();
    }

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public static void m440(View view, boolean z) {
        view.setEnabled(z);
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
                m440(viewGroup.getChildAt(childCount), z);
            }
        }
    }

    @Override // java.lang.Comparable
    public final int compareTo(Preference preference) {
        Preference preference2 = preference;
        int i = this.f761;
        int i2 = preference2.f761;
        if (i != i2) {
            return i - i2;
        }
        CharSequence charSequence = this.f756;
        CharSequence charSequence2 = preference2.f756;
        if (charSequence == charSequence2) {
            return 0;
        }
        if (charSequence == null) {
            return 1;
        }
        if (charSequence2 == null) {
            return -1;
        }
        return charSequence.toString().compareToIgnoreCase(preference2.f756.toString());
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder();
        CharSequence charSequence = this.f756;
        if (!TextUtils.isEmpty(charSequence)) {
            sb.append(charSequence);
            sb.append(' ');
        }
        CharSequence charSequenceMo436 = mo436();
        if (!TextUtils.isEmpty(charSequenceMo436)) {
            sb.append(charSequenceMo436);
            sb.append(' ');
        }
        if (sb.length() > 0) {
            sb.setLength(sb.length() - 1);
        }
        return sb.toString();
    }

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final void m441(boolean z) {
        if (this.f758 != z) {
            this.f758 = z;
            mo428();
        }
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final Drawable m442() {
        int i;
        if (this.f768 == null && (i = this.f771) != 0) {
            this.f768 = ᵕˏᵛ.ˑᵥˁ(this.f769, i);
        }
        return this.f768;
    }

    /* renamed from: ˌʾˀ */
    public void mo427() {
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public void mo443(boolean z) {
        ArrayList arrayList = this.f760;
        if (arrayList == null) {
            return;
        }
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            Preference preference = (Preference) arrayList.get(i);
            if (preference.f747 == z) {
                preference.f747 = !z;
                preference.mo443(preference.mo433());
                preference.mo428();
            }
        }
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final String m444(String str) {
        if (!m454()) {
            return str;
        }
        ʼٴ r0 = m459();
        return r0 != null ? r0.ᵶʔᵢˊ(this.f775, str) : this.f765.m10458().getString(this.f775, str);
    }

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final void m445(boolean z) {
        if (this.f751 != z) {
            this.f751 = z;
            C0642 c0642 = this.f752;
            if (c0642 != null) {
                Handler handler = c0642.f3157;
                RunnableC2802 runnableC2802 = c0642.f3156;
                handler.removeCallbacks(runnableC2802);
                handler.post(runnableC2802);
            }
        }
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public long mo446() {
        return this.f778;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public void mo447(Bundle bundle) {
        if (TextUtils.isEmpty(this.f775)) {
            return;
        }
        this.f776 = false;
        Parcelable parcelableMo432 = mo432();
        if (!this.f776) {
            ᵹˉᵞ.ᵳٴᵶ("Derived class did not call super.onSaveInstanceState()");
        } else if (parcelableMo432 != null) {
            bundle.putParcelable(this.f775, parcelableMo432);
        }
    }

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final void m448(CharSequence charSequence) {
        if (TextUtils.equals(charSequence, this.f756)) {
            return;
        }
        this.f756 = charSequence;
        mo428();
    }

    /* renamed from: ˑᵱ */
    public void mo429(Object obj) {
    }

    /* renamed from: ᵝᵵᵺ */
    public CharSequence mo436() {
        InterfaceC0955 interfaceC0955 = this.f746;
        return interfaceC0955 != null ? interfaceC0955.m3234(this) : this.f753;
    }

    /* renamed from: ᵞʡ */
    public void mo431(Parcelable parcelable) {
        this.f776 = true;
        if (parcelable == AbsSavedState.EMPTY_STATE || parcelable == null) {
            return;
        }
        ᵹˉᵞ.ˌᵜᵹᵩ("Wrong state class -- expecting Preference State");
    }

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public void mo449() {
        m460();
    }

    /* renamed from: ᵡˎ */
    public void mo437(CharSequence charSequence) {
        if (this.f746 != null) {
            ᵹˉᵞ.ᵳٴᵶ("Preference already has a SummaryProvider set.");
        } else {
            if (TextUtils.equals(this.f753, charSequence)) {
                return;
            }
            this.f753 = charSequence;
            mo428();
        }
    }

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final void m450(int i) {
        if (i != this.f761) {
            this.f761 = i;
            C0642 c0642 = this.f752;
            if (c0642 != null) {
                Handler handler = c0642.f3157;
                RunnableC2802 runnableC2802 = c0642.f3156;
                handler.removeCallbacks(runnableC2802);
                handler.post(runnableC2802);
            }
        }
    }

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final void m451(String str) {
        if (m454() && !TextUtils.equals(str, m444(null))) {
            ʼٴ r0 = m459();
            if (r0 != null) {
                r0.ᵳᵹᵺˋ(this.f775, str);
                return;
            }
            SharedPreferences.Editor editorM10457 = this.f765.m10457();
            editorM10457.putString(this.f775, str);
            if (this.f765.f18589) {
                return;
            }
            editorM10457.apply();
        }
    }

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final void m452(String str) {
        this.f775 = str;
        if (this.f762 && TextUtils.isEmpty(str)) {
            if (TextUtils.isEmpty(this.f775)) {
                ᵹˉᵞ.ᵳٴᵶ("Preference does not have a key assigned.");
            } else {
                this.f762 = true;
            }
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m453(Serializable serializable) {
        ᵶﾞᴵ r1 = this.f764;
        if (r1 != null) {
            OnOffPreference onOffPreference = (OnOffPreference) r1.ᵢˇᵭ;
            onOffPreference.m448(onOffPreference.f769.getString(ᵲᵝᵪ.ᵹᵝᵶ(serializable, Boolean.TRUE) ? R.string.on : R.string.off));
        }
    }

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final boolean m454() {
        return (this.f765 == null || !this.f755 || TextUtils.isEmpty(this.f775)) ? false : true;
    }

    /* renamed from: ᵧᵾˀˈ */
    public void mo425(View view) {
        Intent intent;
        AbstractC0042 abstractC0042;
        if (mo458() && this.f758) {
            mo427();
            C5553 c5553 = this.f743;
            if (c5553 != null) {
                ((PreferenceGroup) c5553.f20833).f783 = Integer.MAX_VALUE;
                C0642 c0642 = (C0642) c5553.f20835;
                Handler handler = c0642.f3157;
                RunnableC2802 runnableC2802 = c0642.f3156;
                handler.removeCallbacks(runnableC2802);
                handler.post(runnableC2802);
                return;
            }
            C5010 c5010 = this.f765;
            if ((c5010 == null || (abstractC0042 = c5010.f18597) == null || !abstractC0042.m1065(this)) && (intent = this.f757) != null) {
                this.f769.startActivity(intent);
            }
        }
    }

    /* renamed from: ᵨᵳʝ */
    public Parcelable mo432() {
        this.f776 = true;
        return AbsSavedState.EMPTY_STATE;
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final void m455(C5010 c5010) {
        this.f765 = c5010;
        if (!this.f766) {
            this.f778 = c5010.m10455();
        }
        ʼٴ r4 = m459();
        Object obj = this.f744;
        if (r4 != null) {
            mo429(obj);
            return;
        }
        if (m454()) {
            if (((this.f765 == null || m459() != null) ? null : this.f765.m10458()).contains(this.f775)) {
                mo429(null);
                return;
            }
        }
        if (obj != null) {
            mo429(obj);
        }
    }

    /* renamed from: ᵮᵠـˌ */
    public boolean mo433() {
        return !mo458();
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public void mo456() {
        PreferenceScreen preferenceScreen;
        String str = this.f750;
        if (TextUtils.isEmpty(str)) {
            return;
        }
        C5010 c5010 = this.f765;
        Preference preferenceM466 = null;
        if (c5010 != null && (preferenceScreen = c5010.f18590) != null) {
            preferenceM466 = preferenceScreen.m466(str);
        }
        if (preferenceM466 != null) {
            if (preferenceM466.f760 == null) {
                preferenceM466.f760 = new ArrayList();
            }
            preferenceM466.f760.add(this);
            boolean zMo433 = preferenceM466.mo433();
            if (this.f747 == zMo433) {
                this.f747 = !zMo433;
                mo443(mo433());
                mo428();
                return;
            }
            return;
        }
        throw new IllegalStateException("Dependency \"" + str + "\" not found for preference \"" + this.f775 + "\" (title: \"" + ((Object) this.f756) + "\"");
    }

    /* renamed from: ᵳٴᵶ */
    public void mo426(C2102 c2102) {
        Integer numValueOf;
        View view = c2102.f9071;
        view.setOnClickListener(this.f780);
        view.setId(0);
        TextView textView = (TextView) c2102.m5691(android.R.id.summary);
        if (textView != null) {
            CharSequence charSequenceMo436 = mo436();
            if (TextUtils.isEmpty(charSequenceMo436)) {
                textView.setVisibility(8);
                numValueOf = null;
            } else {
                textView.setText(charSequenceMo436);
                textView.setVisibility(0);
                numValueOf = Integer.valueOf(textView.getCurrentTextColor());
            }
        } else {
            numValueOf = null;
        }
        TextView textView2 = (TextView) c2102.m5691(android.R.id.title);
        if (textView2 != null) {
            CharSequence charSequence = this.f756;
            if (TextUtils.isEmpty(charSequence)) {
                textView2.setVisibility(8);
            } else {
                textView2.setText(charSequence);
                textView2.setVisibility(0);
                if (this.f748) {
                    textView2.setSingleLine(this.f754);
                }
                if (!this.f758 && mo458() && numValueOf != null) {
                    textView2.setTextColor(numValueOf.intValue());
                }
            }
        }
        ImageView imageView = (ImageView) c2102.m5691(android.R.id.icon);
        if (imageView != null) {
            int i = this.f771;
            if (i != 0 || this.f768 != null) {
                if (this.f768 == null) {
                    this.f768 = ᵕˏᵛ.ˑᵥˁ(this.f769, i);
                }
                Drawable drawable = this.f768;
                if (drawable != null) {
                    imageView.setImageDrawable(drawable);
                }
            }
            if (this.f768 != null) {
                imageView.setVisibility(0);
            } else {
                imageView.setVisibility(this.f770 ? 4 : 8);
            }
        }
        View viewM5691 = c2102.m5691(R.id._11_res_0x7f0b01f9);
        if (viewM5691 == null) {
            viewM5691 = c2102.m5691(android.R.id.icon_frame);
        }
        if (viewM5691 != null) {
            if (this.f768 != null) {
                viewM5691.setVisibility(0);
            } else {
                viewM5691.setVisibility(this.f770 ? 4 : 8);
            }
        }
        if (this.f742) {
            m440(view, mo458());
        } else {
            m440(view, true);
        }
        boolean z = this.f758;
        view.setFocusable(z);
        view.setClickable(z);
        c2102.f8324 = this.f772;
        c2102.f8323 = this.f763;
        boolean z2 = this.f777;
        if (z2 && this.f767 == null) {
            this.f767 = new ViewOnCreateContextMenuListenerC5575(this);
        }
        view.setOnCreateContextMenuListener(z2 ? this.f767 : null);
        view.setLongClickable(z2);
        if (!z2 || z) {
            return;
        }
        WeakHashMap weakHashMap = AbstractC2873.f11133;
        view.setBackground(null);
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public void mo457(Bundle bundle) {
        Parcelable parcelable;
        if (TextUtils.isEmpty(this.f775) || (parcelable = bundle.getParcelable(this.f775)) == null) {
            return;
        }
        this.f776 = false;
        mo431(parcelable);
        if (this.f776) {
            return;
        }
        ᵹˉᵞ.ᵳٴᵶ("Derived class did not call super.onRestoreInstanceState()");
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public boolean mo458() {
        return this.f781 && this.f747 && this.f759;
    }

    /* renamed from: ᵸʓᵠ */
    public Object mo434(TypedArray typedArray, int i) {
        return null;
    }

    /* renamed from: ᵸˑ */
    public void mo428() {
        int iIndexOf;
        C0642 c0642 = this.f752;
        if (c0642 == null || (iIndexOf = c0642.f3155.indexOf(this)) == -1) {
            return;
        }
        c0642.m4021(iIndexOf, this);
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final ʼٴ m459() {
        ʼٴ r0 = this.f779;
        if (r0 != null) {
            return r0;
        }
        C5010 c5010 = this.f765;
        if (c5010 != null) {
            c5010.getClass();
        }
        return null;
    }

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public final void m460() {
        ArrayList arrayList;
        PreferenceScreen preferenceScreen;
        String str = this.f750;
        if (str != null) {
            C5010 c5010 = this.f765;
            Preference preferenceM466 = null;
            if (c5010 != null && (preferenceScreen = c5010.f18590) != null) {
                preferenceM466 = preferenceScreen.m466(str);
            }
            if (preferenceM466 == null || (arrayList = preferenceM466.f760) == null) {
                return;
            }
            arrayList.remove(this);
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final Bundle m461() {
        if (this.f745 == null) {
            this.f745 = new Bundle();
        }
        return this.f745;
    }

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final void m462(Drawable drawable) {
        if (this.f768 != drawable) {
            this.f768 = drawable;
            this.f771 = 0;
            mo428();
        }
    }
}
