package com.strmr.ps.ui.player;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import androidx.media3.extractor.text.ttml.TtmlNode;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.strmr.ps.R;
import com.strmr.ps.data.subtitle.t;
import com.strmr.ps.ui.player.h;
import defpackage.cr4;
import defpackage.fi7;
import defpackage.hn2;
import defpackage.io6;
import defpackage.jn2;
import defpackage.lt6;
import defpackage.n41;
import defpackage.n89;
import defpackage.nb9;
import defpackage.ng3;
import defpackage.pb9;
import defpackage.q07;
import defpackage.qb9;
import defpackage.sb9;
import defpackage.uga;
import defpackage.vx8;
import defpackage.wa;
import defpackage.wo5;
import defpackage.y41;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001:\u0005\u0002\u0003\u0004\u0005\u0006¨\u0006\u0007"}, d2 = {"Lcom/strmr/ps/ui/player/h;", "Landroid/app/Dialog;", "d", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "c", "b", "e", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class h extends Dialog {
    public static final Object af = wo5.j(new q07("en", "English"), new q07("es", "Spanish"), new q07("fr", "French"), new q07("de", "German"), new q07("it", "Italian"), new q07("pt", "Portuguese"), new q07("pt-BR", "Portuguese (BR)"), new q07("nl", "Dutch"), new q07("pl", "Polish"), new q07("ru", "Russian"), new q07("ja", "Japanese"), new q07("ko", "Korean"), new q07("zh", "Chinese"), new q07("ar", "Arabic"), new q07("he", "Hebrew"), new q07("tr", "Turkish"), new q07("sv", "Swedish"), new q07("no", "Norwegian"), new q07("da", "Danish"), new q07("fi", "Finnish"), new q07("cs", "Czech"), new q07("hu", "Hungarian"), new q07("ro", "Romanian"), new q07("el", "Greek"), new q07("th", "Thai"), new q07("vi", "Vietnamese"), new q07(TtmlNode.ATTR_ID, "Indonesian"), new q07("hi", "Hindi"), new q07("uk", "Ukrainian"));
    public List a;
    public String aa;
    public final ArrayList ab;
    public final ArrayList ac;
    public b ad;
    public e ae;
    public final com.strmr.ps.data.subtitle.t b;
    public boolean c;
    public long d;
    public int e;
    public int f;
    public String i;
    public final String j;
    public final uga k;
    public final uga l;
    public RecyclerView m;
    public RecyclerView n;
    public ProgressBar o;
    public View p;
    public View q;
    public View r;
    public View s;
    public View t;
    public TextView u;
    public TextView v;
    public TextView w;
    public TextView x;
    public boolean y;
    public boolean z;

    @Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001R \u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0004\u0010\u0005¨\u0006\u0006"}, d2 = {"Lcom/strmr/ps/ui/player/h$a;", "", "", "", "LANGUAGE_NAMES", "Ljava/util/Map;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class a {
    }

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\f\u0012\b\u0012\u00060\u0002R\u00020\u00000\u0001:\u0001\u0003¨\u0006\u0004"}, d2 = {"Lcom/strmr/ps/ui/player/h$b;", "Landroidx/recyclerview/widget/RecyclerView$g;", "Lcom/strmr/ps/ui/player/h$b$a;", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class b extends RecyclerView.g<a> {
        public final List a;
        public String b;
        public final g c;

        @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/ui/player/h$b$a;", "Landroidx/recyclerview/widget/RecyclerView$ag;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        public final class a extends RecyclerView.ag {
            public static final /* synthetic */ int d = 0;
            public final TextView a;
            public final ImageView b;

            public a(View view) {
                super(view);
                View viewFindViewById = view.findViewById(R.id.language_name);
                cr4.f(viewFindViewById, "findViewById(...)");
                this.a = (TextView) viewFindViewById;
                View viewFindViewById2 = view.findViewById(R.id.check_icon);
                cr4.f(viewFindViewById2, "findViewById(...)");
                this.b = (ImageView) viewFindViewById2;
                boolean zHasSystemFeature = view.getContext().getPackageManager().hasSystemFeature("android.software.leanback");
                view.setFocusable(true);
                view.setFocusableInTouchMode(zHasSystemFeature);
                view.setOnClickListener(new i(b.this, this, 0));
                view.setOnFocusChangeListener(new ng3(view, 1));
            }
        }

        public b(ArrayList arrayList, String str, g gVar) {
            cr4.g(arrayList, "languages");
            this.a = arrayList;
            this.b = str;
            this.c = gVar;
        }

        @Override // androidx.recyclerview.widget.RecyclerView.g
        public final int getItemCount() {
            return this.a.size();
        }

        @Override // androidx.recyclerview.widget.RecyclerView.g
        public final void onBindViewHolder(RecyclerView.ag agVar, int i) {
            a aVar = (a) agVar;
            cr4.g(aVar, "holder");
            c cVar = (c) this.a.get(i);
            cr4.g(cVar, "item");
            aVar.a.setText(cVar.a);
            aVar.b.setVisibility(cr4.b(cVar.b, b.this.b) ? 0 : 8);
        }

        @Override // androidx.recyclerview.widget.RecyclerView.g
        public final RecyclerView.ag onCreateViewHolder(ViewGroup viewGroup, int i) {
            View viewD = n41.d(viewGroup, "parent", R.layout.item_language_filter, viewGroup, false);
            cr4.d(viewD);
            return new a(viewD);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0086\b\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/ui/player/h$c;", "", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final /* data */ class c {
        public final String a;
        public final String b;
        public final boolean c;

        public c(String str, String str2, boolean z) {
            this.a = str;
            this.b = str2;
            this.c = z;
        }

        public final boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof c)) {
                return false;
            }
            c cVar = (c) obj;
            return this.a.equals(cVar.a) && cr4.b(this.b, cVar.b) && this.c == cVar.c;
        }

        public final int hashCode() {
            int iHashCode = this.a.hashCode() * 31;
            String str = this.b;
            return Boolean.hashCode(this.c) + ((iHashCode + (str == null ? 0 : str.hashCode())) * 31);
        }

        public final String toString() {
            StringBuilder sbM = fi7.m("LanguageItem(displayName=", this.a, ", languageCode=", this.b, ", isDisabled=");
            sbM.append(this.c);
            sbM.append(")");
            return sbM.toString();
        }
    }

    /* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
    /* JADX WARN: Unknown enum class pattern. Please report as an issue! */
    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0000\b\u0086\u0081\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/ui/player/h$d;", "", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class d {
        public static final d a;
        public static final d b;
        public static final d c;
        public static final d d;
        public static final /* synthetic */ d[] e;
        public static final /* synthetic */ hn2 f;

        static {
            d dVar = new d("DELAY", 0);
            a = dVar;
            d dVar2 = new d("SIZE", 1);
            b = dVar2;
            d dVar3 = new d("VERTICAL_OFFSET", 2);
            c = dVar3;
            d dVar4 = new d("FONT", 3);
            d = dVar4;
            d[] dVarArr = {dVar, dVar2, dVar3, dVar4};
            e = dVarArr;
            f = jn2.a(dVarArr);
        }

        public static d valueOf(String str) {
            return (d) Enum.valueOf(d.class, str);
        }

        public static d[] values() {
            return (d[]) e.clone();
        }
    }

    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\f\u0012\b\u0012\u00060\u0002R\u00020\u00000\u0001:\u0001\u0003¨\u0006\u0004"}, d2 = {"Lcom/strmr/ps/ui/player/h$e;", "Landroidx/recyclerview/widget/RecyclerView$g;", "Lcom/strmr/ps/ui/player/h$e$a;", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class e extends RecyclerView.g<a> {
        public final List a;
        public com.strmr.ps.data.subtitle.t b;
        public final lt6 c;

        @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lcom/strmr/ps/ui/player/h$e$a;", "Landroidx/recyclerview/widget/RecyclerView$ag;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
        @vx8
        public final class a extends RecyclerView.ag {
            public static final /* synthetic */ int f = 0;
            public final TextView a;
            public final TextView b;
            public final TextView c;
            public final ImageView d;

            /* JADX INFO: renamed from: com.strmr.ps.ui.player.h$e$a$a, reason: collision with other inner class name */
            @Metadata(k = 3, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
            public /* synthetic */ class C0121a {
                static {
                    int[] iArr = new int[t.b.a.values().length];
                    try {
                        iArr[0] = 1;
                    } catch (NoSuchFieldError unused) {
                    }
                    try {
                        t.b.a aVar = t.b.a.a;
                        iArr[1] = 2;
                    } catch (NoSuchFieldError unused2) {
                    }
                }
            }

            public a(View view) {
                super(view);
                View viewFindViewById = view.findViewById(R.id.track_name);
                cr4.f(viewFindViewById, "findViewById(...)");
                this.a = (TextView) viewFindViewById;
                View viewFindViewById2 = view.findViewById(R.id.track_provider);
                cr4.f(viewFindViewById2, "findViewById(...)");
                this.b = (TextView) viewFindViewById2;
                View viewFindViewById3 = view.findViewById(R.id.format_badge);
                cr4.f(viewFindViewById3, "findViewById(...)");
                this.c = (TextView) viewFindViewById3;
                View viewFindViewById4 = view.findViewById(R.id.check_icon);
                cr4.f(viewFindViewById4, "findViewById(...)");
                this.d = (ImageView) viewFindViewById4;
                boolean zHasSystemFeature = view.getContext().getPackageManager().hasSystemFeature("android.software.leanback");
                view.setFocusable(true);
                view.setFocusableInTouchMode(zHasSystemFeature);
                view.setOnClickListener(new i(e.this, this, 1));
                view.setOnFocusChangeListener(new ng3(view, 2));
            }
        }

        public e(ArrayList arrayList, com.strmr.ps.data.subtitle.t tVar, lt6 lt6Var) {
            cr4.g(arrayList, "tracks");
            this.a = arrayList;
            this.b = tVar;
            this.c = lt6Var;
        }

        @Override // androidx.recyclerview.widget.RecyclerView.g
        public final int getItemCount() {
            return this.a.size();
        }

        /* JADX WARN: Removed duplicated region for block: B:94:0x01d9  */
        @Override // androidx.recyclerview.widget.RecyclerView.g
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final void onBindViewHolder(RecyclerView.ag agVar, int i) {
            a aVar = (a) agVar;
            cr4.g(aVar, "holder");
            com.strmr.ps.data.subtitle.t tVar = (com.strmr.ps.data.subtitle.t) this.a.get(i);
            TextView textView = aVar.a;
            TextView textView2 = aVar.c;
            TextView textView3 = aVar.b;
            cr4.g(tVar, "option");
            boolean z = tVar instanceof t.c;
            boolean zB = true;
            if (z) {
                textView.setText("Disabled");
                textView3.setVisibility(8);
                textView2.setVisibility(8);
            } else if (tVar instanceof t.a) {
                t.a aVar2 = (t.a) tVar;
                textView.setText(aVar2.d);
                textView3.setVisibility(0);
                StringBuilder sb = new StringBuilder("Embedded");
                if (aVar2.e) {
                    sb.append(" • Forced");
                }
                if (aVar2.f) {
                    sb.append(" • Default");
                }
                textView3.setText(sb.toString());
                String str = aVar2.g;
                String str2 = (str == null || !n89.l(str, "pgs", true)) ? (str == null || !n89.l(str, "vobsub", true)) ? (str == null || !n89.l(str, "dvb", true)) ? (str == null || !n89.l(str, "subrip", true)) ? (str == null || !n89.l(str, "vtt", true)) ? (str == null || !n89.l(str, "ssa", true)) ? (str == null || !n89.l(str, "ttml", true)) ? "" : "TTML" : "ASS" : "VTT" : "SRT" : "DVB" : "VobSub" : "PGS";
                if (str2.length() > 0) {
                    textView2.setVisibility(0);
                    textView2.setText(str2);
                } else {
                    textView2.setVisibility(8);
                }
            } else {
                if (!(tVar instanceof t.b)) {
                    throw new io6();
                }
                t.b bVar = (t.b) tVar;
                sb9 sb9Var = bVar.a;
                String str3 = sb9Var.b;
                Integer num = sb9Var.g;
                Float f = sb9Var.f;
                textView.setText(str3);
                textView.setSelected(true);
                StringBuilder sb2 = new StringBuilder();
                if (f != null) {
                    sb2.append(String.format("%.1f", Arrays.copyOf(new Object[]{Float.valueOf(f.floatValue())}, 1)).concat("/10"));
                }
                if (f != null && num != null) {
                    sb2.append(" • ");
                }
                if (num != null) {
                    int iIntValue = num.intValue();
                    sb2.append((iIntValue >= 1000000 ? String.format("%.1fM", Arrays.copyOf(new Object[]{Double.valueOf(((double) iIntValue) / 1000000.0d)}, 1)) : iIntValue >= 1000 ? String.format("%.1fk", Arrays.copyOf(new Object[]{Double.valueOf(((double) iIntValue) / 1000.0d)}, 1)) : String.valueOf(iIntValue)) + " Downloads");
                }
                String string = sb2.toString();
                if (string.length() > 0) {
                    textView3.setVisibility(0);
                    textView3.setText(string);
                } else {
                    textView3.setVisibility(0);
                    String upperCase = sb9Var.k.toUpperCase(Locale.ROOT);
                    cr4.f(upperCase, "toUpperCase(...)");
                    textView3.setText(upperCase);
                }
                textView2.setVisibility(0);
                String str4 = sb9Var.p;
                if (str4 == null) {
                    int iOrdinal = bVar.b.ordinal();
                    if (iOrdinal == 0) {
                        str4 = "Stremio";
                    } else {
                        if (iOrdinal != 1) {
                            throw new io6();
                        }
                        str4 = "OpenSubtitles";
                    }
                }
                textView2.setText(str4);
            }
            com.strmr.ps.data.subtitle.t tVar2 = e.this.b;
            if (!z || (tVar2 != null && !(tVar2 instanceof t.c))) {
                if ((tVar instanceof t.a) && (tVar2 instanceof t.a)) {
                    t.a aVar3 = (t.a) tVar;
                    t.a aVar4 = (t.a) tVar2;
                    if (aVar3.a != aVar4.a || aVar3.b != aVar4.b) {
                    }
                } else {
                    zB = ((tVar instanceof t.b) && (tVar2 instanceof t.b)) ? cr4.b(((t.b) tVar).a.a, ((t.b) tVar2).a.a) : false;
                }
            }
            aVar.d.setVisibility(zB ? 0 : 8);
        }

        @Override // androidx.recyclerview.widget.RecyclerView.g
        public final RecyclerView.ag onCreateViewHolder(ViewGroup viewGroup, int i) {
            View viewD = n41.d(viewGroup, "parent", R.layout.item_subtitle_track_enhanced, viewGroup, false);
            cr4.d(viewD);
            return new a(viewD);
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public h(Context context, List list, com.strmr.ps.data.subtitle.t tVar, boolean z, long j, int i, int i2, String str, String str2, uga ugaVar, uga ugaVar2) {
        super(context, R.style.ContextMenuDialogTheme);
        cr4.g(list, "subtitleOptions");
        this.a = list;
        this.b = tVar;
        this.c = z;
        this.d = j;
        this.e = i;
        this.f = i2;
        this.i = str;
        this.j = str2;
        this.k = ugaVar;
        this.l = ugaVar2;
        this.ab = new ArrayList();
        this.ac = new ArrayList();
    }

    /* JADX WARN: Type inference failed for: r3v3, types: [java.lang.Object, java.util.Map] */
    public final void a() {
        LinkedHashSet linkedHashSet = new LinkedHashSet();
        ArrayList arrayList = new ArrayList();
        Iterator it = this.a.iterator();
        while (true) {
            String str = null;
            if (!it.hasNext()) {
                String str2 = this.j;
                if (str2 != null) {
                    String lowerCase = str2.toLowerCase(Locale.ROOT);
                    cr4.f(lowerCase, "toLowerCase(...)");
                    String str3 = (String) af.get(lowerCase);
                    if (str3 != null) {
                        str2 = str3;
                    }
                } else {
                    str2 = null;
                }
                y41.bh(arrayList, new qb9(new pb9(str2)));
                c cVar = new c("Disabled", null, true);
                ArrayList arrayList2 = this.ab;
                arrayList2.add(cVar);
                arrayList2.addAll(arrayList);
                com.strmr.ps.data.subtitle.t tVar = this.b;
                if (!(tVar instanceof t.c) && tVar != null) {
                    if (tVar instanceof t.a) {
                        str = ((t.a) tVar).c;
                    } else {
                        if (!(tVar instanceof t.b)) {
                            throw new io6();
                        }
                        str = ((t.b) tVar).a.c;
                    }
                }
                this.aa = str;
                b();
                return;
            }
            com.strmr.ps.data.subtitle.t tVar2 = (com.strmr.ps.data.subtitle.t) it.next();
            if (tVar2 instanceof t.a) {
                str = ((t.a) tVar2).c;
            } else if (tVar2 instanceof t.b) {
                str = ((t.b) tVar2).a.c;
            } else if (!(tVar2 instanceof t.c)) {
                throw new io6();
            }
            if (str != null && !n89.ab(str) && !linkedHashSet.contains(str)) {
                linkedHashSet.add(str);
                arrayList.add(new c(str, str, false));
            }
        }
    }

    public final void b() {
        boolean zB;
        ArrayList arrayList = this.ac;
        arrayList.clear();
        if (this.aa == null) {
            arrayList.add(t.c.a);
        } else {
            for (com.strmr.ps.data.subtitle.t tVar : this.a) {
                if (tVar instanceof t.a) {
                    zB = ((t.a) tVar).c.equals(this.aa);
                } else if (tVar instanceof t.b) {
                    zB = cr4.b(((t.b) tVar).a.c, this.aa);
                } else {
                    if (!(tVar instanceof t.c)) {
                        throw new io6();
                    }
                    zB = false;
                }
                if (zB) {
                    arrayList.add(tVar);
                }
            }
        }
        e eVar = this.ae;
        if (eVar != null) {
            eVar.notifyDataSetChanged();
        }
        RecyclerView recyclerView = this.n;
        if (recyclerView == null) {
            cr4.n("trackList");
            throw null;
        }
        recyclerView.post(new nb9(this, 0));
    }

    public final void c() {
        if (this.c) {
            ProgressBar progressBar = this.o;
            if (progressBar == null) {
                cr4.n("loadingIndicator");
                throw null;
            }
            progressBar.setVisibility(0);
            View view = this.p;
            if (view != null) {
                view.setVisibility(8);
                return;
            } else {
                cr4.n("columnsContainer");
                throw null;
            }
        }
        ProgressBar progressBar2 = this.o;
        if (progressBar2 == null) {
            cr4.n("loadingIndicator");
            throw null;
        }
        progressBar2.setVisibility(8);
        View view2 = this.p;
        if (view2 != null) {
            view2.setVisibility(0);
        } else {
            cr4.n("columnsContainer");
            throw null;
        }
    }

    public final void d() {
        TextView textView = this.u;
        if (textView == null) {
            cr4.n("delayValue");
            throw null;
        }
        textView.setText(String.format("%+.1fs", Arrays.copyOf(new Object[]{Double.valueOf(this.d / 1000.0d)}, 1)));
        TextView textView2 = this.v;
        if (textView2 == null) {
            cr4.n("sizeValue");
            throw null;
        }
        textView2.setText(this.e + "%");
        TextView textView3 = this.w;
        if (textView3 == null) {
            cr4.n("offsetValue");
            throw null;
        }
        textView3.setText(this.f + "%");
        TextView textView4 = this.x;
        if (textView4 != null) {
            textView4.setText(this.i);
        } else {
            cr4.n("fontValue");
            throw null;
        }
    }

    @Override // android.app.Dialog, android.view.Window.Callback
    public final boolean dispatchKeyEvent(KeyEvent keyEvent) {
        cr4.g(keyEvent, "event");
        int keyCode = keyEvent.getKeyCode();
        if (keyCode == 23 || keyCode == 66) {
            if (!this.z && keyEvent.getAction() == 1) {
                this.z = true;
                return true;
            }
            this.z = true;
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0027  */
    @Override // android.app.Dialog
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void onCreate(Bundle bundle) {
        View childAt;
        super.onCreate(bundle);
        requestWindowFeature(1);
        setContentView(R.layout.dialog_subtitle_multi_column);
        View viewFindViewById = findViewById(android.R.id.content);
        if (viewFindViewById == null) {
            childAt = null;
        } else {
            ViewGroup viewGroup = viewFindViewById instanceof ViewGroup ? (ViewGroup) viewFindViewById : null;
            if (viewGroup != null) {
                childAt = viewGroup.getChildAt(0);
            }
        }
        Drawable background = childAt != null ? childAt.getBackground() : null;
        if (background instanceof LayerDrawable) {
            LayerDrawable layerDrawable = (LayerDrawable) background;
            if (layerDrawable.getNumberOfLayers() >= 4) {
                Drawable drawable = layerDrawable.getDrawable(3);
                if (drawable instanceof GradientDrawable) {
                    TypedValue typedValue = new TypedValue();
                    getContext().getTheme().resolveAttribute(R.attr.colorAccentPrimary, typedValue, true);
                    int i = typedValue.data;
                    int i2 = 16777215 & i;
                    ((GradientDrawable) drawable).setColors(new int[]{i2, i, i2});
                }
            }
        }
        this.m = (RecyclerView) findViewById(R.id.language_list);
        this.n = (RecyclerView) findViewById(R.id.track_list);
        this.o = (ProgressBar) findViewById(R.id.loading_indicator);
        this.p = findViewById(R.id.columns_container);
        this.q = findViewById(R.id.setting_delay);
        this.r = findViewById(R.id.setting_size);
        this.s = findViewById(R.id.setting_offset);
        this.t = findViewById(R.id.setting_font);
        this.u = (TextView) findViewById(R.id.delay_value);
        this.v = (TextView) findViewById(R.id.size_value);
        this.w = (TextView) findViewById(R.id.offset_value);
        this.x = (TextView) findViewById(R.id.font_value);
        a();
        this.ad = new b(this.ab, this.aa, new g(this));
        RecyclerView recyclerView = this.m;
        if (recyclerView == null) {
            cr4.n("languageList");
            throw null;
        }
        getContext();
        recyclerView.setLayoutManager(new LinearLayoutManager());
        RecyclerView recyclerView2 = this.m;
        if (recyclerView2 == null) {
            cr4.n("languageList");
            throw null;
        }
        recyclerView2.setAdapter(this.ad);
        this.ae = new e(this.ac, this.b, new lt6(this, 8));
        RecyclerView recyclerView3 = this.n;
        if (recyclerView3 == null) {
            cr4.n("trackList");
            throw null;
        }
        getContext();
        recyclerView3.setLayoutManager(new LinearLayoutManager());
        RecyclerView recyclerView4 = this.n;
        if (recyclerView4 == null) {
            cr4.n("trackList");
            throw null;
        }
        recyclerView4.setAdapter(this.ae);
        RecyclerView recyclerView5 = this.m;
        if (recyclerView5 == null) {
            cr4.n("languageList");
            throw null;
        }
        recyclerView5.post(new nb9(this, 1));
        d();
        View view = this.q;
        if (view == null) {
            cr4.n("settingDelay");
            throw null;
        }
        final int i3 = 0;
        view.setOnClickListener(new View.OnClickListener(this) { // from class: ob9
            public final /* synthetic */ h b;

            {
                this.b = this;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                switch (i3) {
                    case 0:
                        h hVar = this.b;
                        hVar.l.invoke(h.d.a);
                        hVar.dismiss();
                        break;
                    case 1:
                        h hVar2 = this.b;
                        hVar2.l.invoke(h.d.b);
                        hVar2.dismiss();
                        break;
                    case 2:
                        h hVar3 = this.b;
                        hVar3.l.invoke(h.d.c);
                        hVar3.dismiss();
                        break;
                    default:
                        h hVar4 = this.b;
                        hVar4.l.invoke(h.d.d);
                        hVar4.dismiss();
                        break;
                }
            }
        });
        View view2 = this.r;
        if (view2 == null) {
            cr4.n("settingSize");
            throw null;
        }
        final int i4 = 1;
        view2.setOnClickListener(new View.OnClickListener(this) { // from class: ob9
            public final /* synthetic */ h b;

            {
                this.b = this;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view22) {
                switch (i4) {
                    case 0:
                        h hVar = this.b;
                        hVar.l.invoke(h.d.a);
                        hVar.dismiss();
                        break;
                    case 1:
                        h hVar2 = this.b;
                        hVar2.l.invoke(h.d.b);
                        hVar2.dismiss();
                        break;
                    case 2:
                        h hVar3 = this.b;
                        hVar3.l.invoke(h.d.c);
                        hVar3.dismiss();
                        break;
                    default:
                        h hVar4 = this.b;
                        hVar4.l.invoke(h.d.d);
                        hVar4.dismiss();
                        break;
                }
            }
        });
        View view3 = this.s;
        if (view3 == null) {
            cr4.n("settingOffset");
            throw null;
        }
        final int i5 = 2;
        view3.setOnClickListener(new View.OnClickListener(this) { // from class: ob9
            public final /* synthetic */ h b;

            {
                this.b = this;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view22) {
                switch (i5) {
                    case 0:
                        h hVar = this.b;
                        hVar.l.invoke(h.d.a);
                        hVar.dismiss();
                        break;
                    case 1:
                        h hVar2 = this.b;
                        hVar2.l.invoke(h.d.b);
                        hVar2.dismiss();
                        break;
                    case 2:
                        h hVar3 = this.b;
                        hVar3.l.invoke(h.d.c);
                        hVar3.dismiss();
                        break;
                    default:
                        h hVar4 = this.b;
                        hVar4.l.invoke(h.d.d);
                        hVar4.dismiss();
                        break;
                }
            }
        });
        View view4 = this.t;
        if (view4 == null) {
            cr4.n("settingFont");
            throw null;
        }
        final int i6 = 3;
        view4.setOnClickListener(new View.OnClickListener(this) { // from class: ob9
            public final /* synthetic */ h b;

            {
                this.b = this;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view22) {
                switch (i6) {
                    case 0:
                        h hVar = this.b;
                        hVar.l.invoke(h.d.a);
                        hVar.dismiss();
                        break;
                    case 1:
                        h hVar2 = this.b;
                        hVar2.l.invoke(h.d.b);
                        hVar2.dismiss();
                        break;
                    case 2:
                        h hVar3 = this.b;
                        hVar3.l.invoke(h.d.c);
                        hVar3.dismiss();
                        break;
                    default:
                        h hVar4 = this.b;
                        hVar4.l.invoke(h.d.d);
                        hVar4.dismiss();
                        break;
                }
            }
        });
        View view5 = this.q;
        if (view5 == null) {
            cr4.n("settingDelay");
            throw null;
        }
        View view6 = this.r;
        if (view6 == null) {
            cr4.n("settingSize");
            throw null;
        }
        View view7 = this.s;
        if (view7 == null) {
            cr4.n("settingOffset");
            throw null;
        }
        View view8 = this.t;
        if (view8 == null) {
            cr4.n("settingFont");
            throw null;
        }
        Iterator it = y41.an(view5, view6, view7, view8).iterator();
        while (it.hasNext()) {
            ((View) it.next()).setOnFocusChangeListener(new wa(15));
        }
        c();
        this.y = true;
    }

    @Override // android.app.Dialog
    public final void show() {
        super.show();
        this.z = false;
    }
}
