package p000.p001.p002.p003.p004;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import ar.tvplayer.core.data.db.entities.ޢ;
import ar.tvplayer.core.data.prefs.ރ;
import ar.tvplayer.core.data.repositories.ޟ;
import ar.tvplayer.core.data.repositories.ჽ;
import ar.tvplayer.core.domain.ލ;
import ar.tvplayer.core.domain2.ކ;
import p000.p001.p002.p003.C0663;
import p000.p001.p021.C1255;
import p000.p001.p021.p022.C1219;
import p025.p026.C1340;
import p025.p026.C1356;
import p037.p091.p093.AbstractC2098;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.p217.C3827;
import p138.p176.p177.p190.p217.C3829;
import p138.p176.p177.p190.p235.AbstractC4033;
import p138.p176.p177.p190.p235.C4022;
import p138.p176.p177.p190.p235.C4039;
import p138.p176.p177.p190.p235.InterfaceC4036;
import p138.p176.p177.p190.p236.C4053;
import p138.p176.p177.p242.p246.p251.C4303;
import p402.p405.InterfaceC6575;
import p402.p411.p413.C6635;

/* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ފ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C0569 extends AbstractC2098 {

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public String f2845;

    @Override // p037.p106.AbstractC2273, androidx.fragment.app.Fragment
    public /* synthetic */ void onDestroyView() {
        super.onDestroyView();
    }

    /* JADX WARN: Removed duplicated region for block: B:29:0x0098  */
    @Override // p037.p106.AbstractC2273
    /* JADX INFO: renamed from: ֏ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void mo1836(Bundle bundle, String str) {
        AbstractC4033.C4034 c4034;
        int i;
        int i2;
        C3431 c3431;
        int i3;
        int i4;
        C3827 c3827;
        int i5;
        String string;
        InterfaceC4036 interfaceC4036;
        PreferenceScreen preferenceScreenM4334 = this.f7243.m4334(getContext());
        preferenceScreenM4334.m389((CharSequence) getString(C0663.player_closed_captions));
        m4320(preferenceScreenM4334);
        C4022 c4022 = C0567.f2834;
        if (c4022 == null || (c4034 = c4022.f12818) == null) {
            return;
        }
        C6635.m9823((Object) c4034, "trackSelector?.currentMappedTrackInfo ?: return");
        Drawable drawable = ލ.֏(this, false, 1);
        Drawable drawable2 = ލ.ޅ(this);
        C4053 c4053 = new C4053(getResources());
        String string2 = getString(C0663.off);
        C6635.m9823((Object) string2, "getString(R.string.off)");
        ލ.֏(this, "off", string2, (CharSequence) null, (C0567.f2836 != null || ރ.ߠ.ހ()) ? drawable : drawable2, false, false, 0, 116);
        int i6 = c4034.f12819;
        C3431 c3431Mo6483 = null;
        int i7 = 0;
        while (i7 < i6) {
            C3829 c3829 = c4034.f12821[i7];
            C6635.m9823((Object) c3829, "trackInfo.getTrackGroups(i)");
            if (c3829.f11785 == 0 || c4034.f12820[i7] != 3) {
                i = i7;
                i2 = i6;
            } else if (c3431Mo6483 != null) {
                c3431 = c3431Mo6483;
                i3 = c3829.f11785;
                i4 = 0;
                while (i4 < i3) {
                    C3827 c38272 = c3829.f11786[i4];
                    int i8 = c38272.f11781;
                    int i9 = 0;
                    while (i9 < i8) {
                        String str2 = ޢ.ށ.֏(i7, i4, i9);
                        C3431 c34312 = c38272.f11782[i9];
                        int i10 = i8;
                        if (c34312.f10108 != null) {
                            string = c4053.m6510(c34312);
                            c3827 = c38272;
                            i5 = i3;
                        } else {
                            StringBuilder sb = new StringBuilder();
                            c3827 = c38272;
                            sb.append(getString(C0663.player_closed_captions));
                            sb.append(' ');
                            PreferenceScreen preferenceScreen = this.f7243.f7289;
                            i5 = i3;
                            C6635.m9823((Object) preferenceScreen, "preferenceScreen");
                            sb.append(preferenceScreen.m411());
                            string = sb.toString();
                        }
                        String str3 = string;
                        C6635.m9823((Object) str3, "if (format.language != n…                        }");
                        boolean zM9825 = C6635.m9825(c34312, c3431);
                        int i11 = i9;
                        int i12 = i4;
                        C3431 c34313 = c3431;
                        C3829 c38292 = c3829;
                        int i13 = i7;
                        int i14 = i6;
                        ލ.֏(this, str2, str3, (CharSequence) null, zM9825 ? drawable2 : drawable, c4034.m6501(i7, i4, i9) == 4, false, 0, 100);
                        if (zM9825) {
                            this.f2845 = str2;
                            m4319(str2);
                        }
                        i9 = i11 + 1;
                        i8 = i10;
                        c38272 = c3827;
                        i3 = i5;
                        c3829 = c38292;
                        c3431 = c34313;
                        i7 = i13;
                        i6 = i14;
                        i4 = i12;
                    }
                    i4++;
                }
                i = i7;
                i2 = i6;
                c3431Mo6483 = c3431;
            } else {
                C4039 c4039 = C0567.f2835;
                if (c4039 == null || (interfaceC4036 = c4039.f12829[i7]) == null) {
                    c3431 = null;
                    i3 = c3829.f11785;
                    i4 = 0;
                    while (i4 < i3) {
                    }
                    i = i7;
                    i2 = i6;
                    c3431Mo6483 = c3431;
                } else {
                    c3431Mo6483 = interfaceC4036.mo6483();
                    c3431 = c3431Mo6483;
                    i3 = c3829.f11785;
                    i4 = 0;
                    while (i4 < i3) {
                    }
                    i = i7;
                    i2 = i6;
                    c3431Mo6483 = c3431;
                }
            }
            i7 = i + 1;
            i6 = i2;
        }
        String string3 = getString(C0663.player_closed_captions_hint);
        C6635.m9823((Object) string3, "getString(R.string.player_closed_captions_hint)");
        ލ.֏(this, "closedCaptionsHint", "", string3, (Drawable) null, false, false, 0, 72);
        String string4 = getString(C0663.player_show_closed_captions_for_all_channels);
        C6635.m9823((Object) string4, "getString(R.string.playe…aptions_for_all_channels)");
        ލ.֏(this, "alwaysShowClosedCaptions", string4, (CharSequence) null, (CharSequence) null, (CharSequence) null, (Drawable) null, false, false, 252);
        String string5 = getString(C0663.player_closed_captions_settings);
        C6635.m9823((Object) string5, "getString(R.string.playe…closed_captions_settings)");
        ލ.֏(this, "settings", string5, (CharSequence) null, (Drawable) null, false, false, 0, 124);
        SwitchPreference switchPreference = (SwitchPreference) mo363("alwaysShowClosedCaptions");
        if (switchPreference != null) {
            switchPreference.m426(ރ.ߠ.ހ());
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x0096  */
    @Override // p037.p106.AbstractC2273, p037.p106.C2287.InterfaceC2290
    /* JADX INFO: renamed from: ؠ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean mo1837(Preference preference) {
        if (preference == null) {
            C6635.m9824("pref");
            throw null;
        }
        if (super.mo1837(preference)) {
            return true;
        }
        String str = preference.f1018;
        if (str != null) {
            int iHashCode = str.hashCode();
            if (iHashCode != 1272933797) {
                if (iHashCode == 1434631203 && str.equals("settings")) {
                    try {
                        startActivity(new Intent("android.settings.CAPTIONING_SETTINGS"), null);
                        ލ.ބ = true;
                        C1255.f4367 = true;
                        C0567.f2841 = true;
                    } catch (ActivityNotFoundException unused) {
                        C1219.m2512(getContext(), C0663.player_unable_to_open_closed_captions_settings);
                    }
                } else if (!C6635.m9825((Object) this.f2845, (Object) preference.f1018)) {
                    this.f2845 = preference.f1018;
                    ލ.֏(this, preference);
                    ޢ r1 = ޢ.ށ.֏(this.f2845);
                    C4022 c4022 = C0567.f2834;
                    if (c4022 != null) {
                        ކ.ؠ(c4022, r1);
                    }
                    ޢ r12 = ޢ.ށ.֏(preference.f1018);
                    Long l = C0567.f2832;
                    if (l == null) {
                        Long l2 = C0567.f2833;
                        if (l2 != null) {
                            if (l2 == null) {
                                C6635.m9822();
                                throw null;
                            }
                            C4303.m7160(C1356.f4507, C1340.f4488, null, new ჽ(l2.longValue(), r12, (InterfaceC6575) null), 2, null);
                        }
                    } else {
                        if (l == null) {
                            C6635.m9822();
                            throw null;
                        }
                        C4303.m7160(C1356.f4507, C1340.f4488, null, new ޟ(l.longValue(), r12, (InterfaceC6575) null), 2, null);
                    }
                }
            } else if (str.equals("alwaysShowClosedCaptions")) {
                boolean zBooleanValue = Boolean.valueOf(!ރ.ߠ.ހ()).booleanValue();
                ރ r13 = ރ.ߠ;
                if (r13 == null) {
                    throw null;
                }
                ރ.г.m9836(r13, ރ.ށ[165], Boolean.valueOf(zBooleanValue));
                SwitchPreference switchPreference = (SwitchPreference) mo363("alwaysShowClosedCaptions");
                if (switchPreference != null) {
                    switchPreference.m426(ރ.ߠ.ހ());
                }
                ޢ r122 = ޢ.ށ.֏(this.f2845);
                C4022 c40222 = C0567.f2834;
                if (c40222 != null) {
                    ކ.ؠ(c40222, r122);
                }
            }
        }
        return true;
    }
}
