package xyz.netfly.mobile.player;

import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import ie.m2;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.ExecutorService;
import xyz.netfly.ui.live.epg.EPGView;
import xyz.netfly.ui.live.tablet.LivePlayActivity;
import xyz.stream.api.database.entity.RecordEntity;
import xyz.stream.api.entity.CreditsEntity;
import xyz.stream.api.entity.LiveEpgEntity;
import xyz.stream.view.CustomImageView;
import xyz.stream.view.UiUtils;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class x implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f35038a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ int f35039b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f35040c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f35041d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Object f35042e;

    public /* synthetic */ x(Object obj, int i10, int i11, Object obj2, int i12) {
        this.f35038a = i12;
        this.f35041d = obj;
        this.f35039b = i10;
        this.f35040c = i11;
        this.f35042e = obj2;
    }

    @Override // java.lang.Runnable
    public final void run() {
        switch (this.f35038a) {
            case 0:
                VideoDetailActivity videoDetailActivity = (VideoDetailActivity) this.f35041d;
                List list = (List) this.f35042e;
                WeakReference weakReference = VideoDetailActivity.f34914n0;
                videoDetailActivity.getClass();
                xyz.stream.api.o oVarF = xyz.stream.api.o.f();
                t tVar = videoDetailActivity.f34926g;
                int iIntValue = tVar.f35030x.getId().intValue();
                int i10 = this.f35039b;
                List listU = oVarF.u(iIntValue, i10);
                xyz.netfly.player.r rVar = tVar.f35015i;
                if (rVar != null) {
                    rVar.e(listU);
                    AppCompatActivity appCompatActivity = tVar.f35007a;
                    if (appCompatActivity != null && !appCompatActivity.isDestroyed() && !tVar.f35007a.isFinishing()) {
                        tVar.f35007a.runOnUiThread(new e(tVar, 10));
                    }
                }
                if (listU == null || listU.isEmpty()) {
                    videoDetailActivity.runOnUiThread(new u(videoDetailActivity, 7));
                    return;
                }
                videoDetailActivity.f34936l = false;
                int i11 = this.f35040c;
                if (i11 == -1) {
                    i11 = 0;
                }
                tVar.C = i11;
                RecordEntity recordEntityC = xyz.stream.api.database.q.a().c(Integer.valueOf(i10));
                videoDetailActivity.f34924f = 0;
                if (recordEntityC != null) {
                    videoDetailActivity.f34924f = recordEntityC.getPlayTime().intValue();
                    tVar.T = recordEntityC.getHardwareDecode().intValue();
                    tVar.F = recordEntityC.getSubtitleDelay();
                }
                String strA = xyz.netfly.player.r.a(listU);
                if (strA == null || strA.isEmpty() || videoDetailActivity.f34922e.equals(strA)) {
                    return;
                }
                videoDetailActivity.f34922e = strA;
                videoDetailActivity.runOnUiThread(new androidx.activity.n(videoDetailActivity, list, i10, 11));
                return;
            case 1:
                EPGView ePGView = (EPGView) this.f35041d;
                View view = (View) this.f35042e;
                ArrayList arrayList = ePGView.U;
                int i12 = this.f35039b;
                List list2 = (List) arrayList.get(i12);
                int i13 = this.f35040c;
                ePGView.m(view, (LiveEpgEntity) list2.get(i13), i12, i13);
                return;
            case 2:
                xyz.netfly.ui.live.epg.q qVar = (xyz.netfly.ui.live.epg.q) this.f35041d;
                int i14 = this.f35039b;
                int i15 = this.f35040c;
                xyz.stream.api.e eVar = (xyz.stream.api.e) this.f35042e;
                qVar.getClass();
                try {
                    List list3 = qVar.k(i14, kotlinx.coroutines.flow.h.y("yyyy-MM-dd")).f35365a;
                    if (!qVar.v(i15)) {
                        return;
                    }
                    if (!list3.isEmpty()) {
                        qVar.e(i14);
                        if (qVar.v(i15)) {
                            eVar.onSuccess(xyz.netfly.ui.live.epg.q.g(list3));
                            return;
                        }
                        return;
                    }
                } catch (Exception e10) {
                    u.a.g(e10, new StringBuilder("getEpgNowData cache error: "));
                }
                if (qVar.v(i15)) {
                    String str = i14 + "_" + i15;
                    synchronized (qVar.f35378b) {
                        try {
                            if (i15 != qVar.f35382f) {
                                return;
                            }
                            ((List) qVar.f35379c.computeIfAbsent(str, new pe.l(1))).add(eVar);
                            if (!qVar.f35378b.containsKey(str) && (qVar.f35381e == null || !qVar.f35381e.f35373c.equals(str))) {
                                qVar.f35378b.put(str, new xyz.netfly.ui.live.epg.n(i14, i15, str));
                                qVar.z();
                                return;
                            }
                            return;
                        } finally {
                        }
                    }
                }
                return;
            case 3:
                LivePlayActivity livePlayActivity = (LivePlayActivity) this.f35041d;
                int i16 = this.f35039b;
                String str2 = (String) this.f35042e;
                int i17 = this.f35040c;
                int i18 = LivePlayActivity.f35447f0;
                livePlayActivity.getClass();
                xyz.stream.api.q.g().getClass();
                livePlayActivity.runOnUiThread(new xyz.netfly.ui.live.epg.i(livePlayActivity, xyz.stream.api.q.h(i16), str2, i16, i17));
                return;
            case 4:
                m2 m2Var = (m2) this.f35041d;
                CreditsEntity creditsEntity = (CreditsEntity) this.f35042e;
                CustomImageView customImageView = m2Var.f27203b;
                xyz.stream.api.q qVarG = xyz.stream.api.q.g();
                String profilePath = creditsEntity.getProfilePath();
                qVarG.getClass();
                customImageView.load(CustomImageView.Request.image(xyz.stream.api.q.f(profilePath)).radius(UiUtils.dp2px(12.0f)).size(this.f35039b, this.f35040c));
                return;
            default:
                String str3 = (String) this.f35041d;
                int i19 = this.f35039b;
                int i20 = this.f35040c;
                String str4 = (String) this.f35042e;
                ExecutorService executorService = xyz.stream.utils.l.f36161a;
                try {
                    HashMap map = new HashMap();
                    map.put("time_form_start", kotlinx.coroutines.flow.h.r(str3, kotlinx.coroutines.flow.h.C()) + ", " + i19 + ", " + xyz.stream.utils.e.d().b() + ", " + i20);
                    map.put("channel_id", Integer.valueOf(i20));
                    map.put("channel_name", str4);
                    kotlinx.coroutines.y.R("live_play_stuck", map);
                    return;
                } catch (Exception e11) {
                    xyz.stream.utils.h.c(e11.getMessage());
                    return;
                }
        }
    }

    public /* synthetic */ x(Object obj, Object obj2, int i10, int i11, int i12) {
        this.f35038a = i12;
        this.f35041d = obj;
        this.f35042e = obj2;
        this.f35039b = i10;
        this.f35040c = i11;
    }

    public /* synthetic */ x(LivePlayActivity livePlayActivity, int i10, String str, int i11) {
        this.f35038a = 3;
        this.f35041d = livePlayActivity;
        this.f35039b = i10;
        this.f35042e = str;
        this.f35040c = i11;
    }
}
