package androidx.emoji2.text;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.f2;
import androidx.fragment.app.s1;
import androidx.fragment.app.x1;
import androidx.fragment.app.z1;
import androidx.media3.common.Format;
import androidx.media3.common.util.Util;
import androidx.media3.exoplayer.DecoderReuseEvaluation;
import androidx.media3.exoplayer.audio.AudioRendererEventListener;
import androidx.media3.exoplayer.drm.DrmSessionEventListener;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.source.preload.BasePreloadManager;
import androidx.media3.exoplayer.source.preload.PreloadException;
import androidx.media3.exoplayer.upstream.CmcdData;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.internal.ads.p80;
import com.google.android.gms.measurement.internal.u1;
import com.google.firebase.messaging.EnhancedIntentService;
import ie.g4;
import ie.w1;
import ie.w4;
import java.io.File;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicReference;
import org.drive_hunter.R;
import tv.danmaku.ijk.media.player.ui.subtitleconverter.subtitleFile.TimedTextObject;
import xyz.netfly.mobile.view.EpisodesActivity;
import xyz.stream.api.database.entity.RecordEntity;
import xyz.stream.api.entity.BaseEntity;
import xyz.stream.api.entity.LiveCategoryEntity;
import xyz.stream.api.entity.LiveChannelEntity;
import xyz.stream.api.entity.LiveEpgEntity;
import xyz.stream.api.entity.SubtitlePlayEntity;
import xyz.stream.api.viewmodel.SearchResultViewModel;
import xyz.stream.view.CustomLoading;
import xyz.stream.view.UiUtils;
import xyz.stream.view.UpdateDialogController;

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

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

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

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

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

    public /* synthetic */ v(Object obj, Object obj2, Object obj3, int i10) {
        this.f2281a = i10;
        this.f2282b = obj;
        this.f2283c = obj2;
        this.f2284d = obj3;
    }

    @Override // java.lang.Runnable
    public final void run() {
        String str = "";
        int i10 = 1;
        switch (this.f2281a) {
            case 0:
                xyz.stream.api.a0 a0Var = (xyz.stream.api.a0) this.f2282b;
                r rVar = (r) this.f2283c;
                ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) this.f2284d;
                a0Var.getClass();
                try {
                    j0 j0VarCreate = h.create((Context) a0Var.f35758b);
                    if (j0VarCreate == null) {
                        throw new RuntimeException("EmojiCompat font provider not available on this device.");
                    }
                    ((h0) j0VarCreate.f2241a).e(threadPoolExecutor);
                    j0VarCreate.f2241a.a(new w(rVar, threadPoolExecutor));
                    return;
                } catch (Throwable th) {
                    rVar.onFailed(th);
                    threadPoolExecutor.shutdown();
                    return;
                }
            case 1:
                ViewGroup viewGroup = (ViewGroup) this.f2282b;
                View view = (View) this.f2283c;
                androidx.fragment.app.f fVar = (androidx.fragment.app.f) this.f2284d;
                nb.g.i(viewGroup, "$container");
                nb.g.i(fVar, "this$0");
                viewGroup.endViewTransition(view);
                ((f2) fVar.f2437c.f31277a).c(fVar);
                return;
            case 2:
                f2 f2Var = (f2) this.f2282b;
                f2 f2Var2 = (f2) this.f2283c;
                androidx.fragment.app.n nVar = (androidx.fragment.app.n) this.f2284d;
                nb.g.i(nVar, "this$0");
                androidx.fragment.app.e0 e0Var = f2Var.f2442c;
                androidx.fragment.app.e0 e0Var2 = f2Var2.f2442c;
                androidx.collection.f fVar2 = nVar.f2527n;
                x1 x1Var = s1.f2581a;
                nb.g.i(e0Var, "inFragment");
                nb.g.i(e0Var2, "outFragment");
                nb.g.i(fVar2, "sharedElements");
                return;
            case 3:
                z1 z1Var = (z1) this.f2282b;
                View view2 = (View) this.f2283c;
                Rect rect = (Rect) this.f2284d;
                nb.g.i(z1Var, "$impl");
                nb.g.i(rect, "$lastInEpicenterRect");
                z1.g(rect, view2);
                return;
            case 4:
                Util.lambda$postOrRunWithCompletion$0((com.google.common.util.concurrent.d0) this.f2282b, (Runnable) this.f2283c, this.f2284d);
                return;
            case 5:
                Util.lambda$transformFutureAsync$2((com.google.common.util.concurrent.w) this.f2282b, (com.google.common.util.concurrent.d0) this.f2283c, (com.google.common.util.concurrent.p) this.f2284d);
                return;
            case 6:
                ((AudioRendererEventListener.EventDispatcher) this.f2282b).lambda$inputFormatChanged$2((Format) this.f2283c, (DecoderReuseEvaluation) this.f2284d);
                return;
            case 7:
                ((DrmSessionEventListener.EventDispatcher) this.f2282b).lambda$drmSessionManagerError$2((DrmSessionEventListener) this.f2283c, (Exception) this.f2284d);
                return;
            case 8:
                ((BasePreloadManager) this.f2282b).lambda$onPreloadError$4((PreloadException) this.f2283c, (MediaSource) this.f2284d);
                return;
            case 9:
                ((EnhancedIntentService) this.f2282b).lambda$processIntent$0((Intent) this.f2283c, (w8.i) this.f2284d);
                return;
            case 10:
                io.flutter.embedding.android.z zVar = (io.flutter.embedding.android.z) this.f2282b;
                l0 l0Var = (l0) this.f2283c;
                KeyEvent keyEvent = (KeyEvent) this.f2284d;
                zVar.getClass();
                zVar.c(false, Long.valueOf(l0Var.f2248c), Long.valueOf(l0Var.f2247b), keyEvent.getEventTime());
                return;
            case 11:
                w4 w4Var = (w4) this.f2282b;
                FrameLayout frameLayout = (FrameLayout) this.f2283c;
                ed.u uVar = (ed.u) this.f2284d;
                int height = w4Var.f27632a.getHeight();
                try {
                    frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, height));
                    uVar.invokeMethod("height", Double.valueOf(height));
                    return;
                } catch (Throwable unused) {
                    return;
                }
            case 12:
                xyz.netfly.ads.q qVar = (xyz.netfly.ads.q) this.f2282b;
                FrameLayout frameLayout2 = (FrameLayout) this.f2283c;
                ed.u uVar2 = (ed.u) this.f2284d;
                qVar.f34884d.getClass();
                frameLayout2.removeAllViews();
                frameLayout2.setLayoutParams(new FrameLayout.LayoutParams(-1, 0));
                frameLayout2.setVisibility(8);
                try {
                    uVar2.invokeMethod("height", Double.valueOf(0.0d));
                    return;
                } catch (Throwable unused2) {
                    return;
                }
            case 13:
                xyz.netfly.api.c cVar = (xyz.netfly.api.c) this.f2282b;
                Map map = (Map) this.f2283c;
                String str2 = (String) this.f2284d;
                cVar.getClass();
                try {
                    map.put("play_id", cVar.f34903d);
                    map.put("timestamp", Long.valueOf(System.currentTimeMillis()));
                    map.put("event_type", str2);
                    map.put("app_version", xyz.stream.utils.e.d().f36113b);
                    xyz.stream.utils.f0 f0VarO = xyz.stream.utils.f0.o();
                    boolean z10 = xyz.stream.utils.e.d().f36121j;
                    map.put("user_id", f0VarO.q("flutter.spUnid", ""));
                    map.put("terminal_type", xyz.stream.utils.e.d().f36118g ? "AndroidStb" : xyz.stream.utils.e.d().f36119h ? "AndroidPad" : "AndroidMobile");
                    xyz.stream.utils.z.f(xyz.stream.utils.m.a(map), new xyz.netfly.api.b(cVar, i10));
                    return;
                } catch (Exception e10) {
                    u.a.g(e10, u1.n("Error reporting event: ", str2, ", error: "));
                    return;
                }
            case 14:
                xyz.netfly.mobile.player.t tVar = (xyz.netfly.mobile.player.t) this.f2282b;
                AppCompatActivity appCompatActivity = (AppCompatActivity) this.f2283c;
                xyz.netfly.mobile.player.y yVar = (xyz.netfly.mobile.player.y) this.f2284d;
                tVar.getClass();
                RecordEntity recordEntityC = xyz.stream.api.database.q.a().c(Integer.valueOf(tVar.f35032z));
                appCompatActivity.runOnUiThread(new androidx.activity.n(tVar, yVar, recordEntityC != null ? recordEntityC.getPlayTime().intValue() : 0, 7));
                return;
            case 15:
                xyz.netfly.mobile.plugin.e eVar = (xyz.netfly.mobile.plugin.e) this.f2282b;
                String str3 = (String) this.f2283c;
                ed.t tVar2 = (ed.t) this.f2284d;
                String strT = kotlinx.coroutines.flow.h.t(eVar.f35056a, Uri.parse(str3));
                if (strT == null) {
                    tVar2.success("");
                    return;
                } else {
                    new Handler(Looper.getMainLooper()).post(new xyz.netfly.mobile.plugin.d(tVar2, strT, 1));
                    return;
                }
            case 16:
                EpisodesActivity episodesActivity = (EpisodesActivity) this.f2282b;
                View view3 = (View) this.f2283c;
                ke.m mVar = (ke.m) this.f2284d;
                xyz.netfly.mobile.player.i iVar = EpisodesActivity.f35120i;
                PopupWindow popupWindow = new PopupWindow(view3, UiUtils.dp2px(120.0f) + ((g4) episodesActivity.binding).f26898e.getWidth(), UiUtils.dp2px(960.0f));
                RecyclerView recyclerView = (RecyclerView) view3.findViewById(R.id.rv_popup);
                popupWindow.setBackgroundDrawable(i0.r.getDrawable(episodesActivity.getResources(), R.color.black, null));
                popupWindow.setFocusable(true);
                popupWindow.setInputMethodMode(1);
                popupWindow.setSoftInputMode(16);
                popupWindow.showAsDropDown(((g4) episodesActivity.binding).f26898e, -50, 0);
                popupWindow.setOnDismissListener(new xyz.netfly.mobile.player.j(episodesActivity, 2));
                recyclerView.setLayoutManager(new LinearLayoutManager());
                recyclerView.setAdapter(mVar);
                int iIndexOf = episodesActivity.f35125f.indexOf(Integer.valueOf(episodesActivity.f35124e));
                if (iIndexOf != -1) {
                    recyclerView.scrollToPosition(iIndexOf);
                }
                mVar.f29145e = new androidx.media3.exoplayer.analytics.g(episodesActivity, popupWindow, 23);
                return;
            case 17:
                xyz.netfly.player.n nVar2 = (xyz.netfly.player.n) this.f2282b;
                File file = (File) this.f2283c;
                String str4 = (String) this.f2284d;
                nVar2.getClass();
                int i11 = 3;
                try {
                    FileInputStream fileInputStream = new FileInputStream(file);
                    try {
                        TimedTextObject file2 = xyz.netfly.player.n.l(str4).parseFile(file.getName(), fileInputStream);
                        if (file2 != null) {
                            nVar2.f35225k.post(new com.tekartik.sqflite.g(nVar2, file2, 17));
                        } else {
                            file.delete();
                            nVar2.f35225k.post(new xyz.netfly.player.c(nVar2, i11));
                        }
                        fileInputStream.close();
                        return;
                    } finally {
                        try {
                            break;
                        } catch (Throwable th2) {
                        }
                    }
                } catch (Exception e11) {
                    xyz.stream.utils.h.b("parseSubtitle error: " + e11);
                    file.delete();
                    nVar2.f35225k.post(new xyz.netfly.player.c(nVar2, i11));
                    xyz.stream.utils.h.c(e11.getMessage());
                    return;
                }
            case 18:
                xyz.netfly.player.h.b((xyz.netfly.player.h) this.f2282b, (BaseEntity) this.f2283c, (SubtitlePlayEntity) this.f2284d);
                return;
            case 19:
                p80 p80Var = (p80) this.f2282b;
                AtomicReference atomicReference = (AtomicReference) this.f2283c;
                CountDownLatch countDownLatch = (CountDownLatch) this.f2284d;
                p80Var.getClass();
                try {
                    atomicReference.set(p80Var.a());
                    return;
                } finally {
                    countDownLatch.countDown();
                }
            case 20:
                te.n nVar3 = (te.n) this.f2282b;
                AppCompatActivity appCompatActivity2 = (AppCompatActivity) this.f2283c;
                List list = (List) this.f2284d;
                if (nVar3.e(appCompatActivity2)) {
                    nVar3.d(list);
                    return;
                }
                return;
            case 21:
                p000if.b bVar = (p000if.b) this.f2282b;
                LiveEpgEntity liveEpgEntity = (LiveEpgEntity) this.f2283c;
                w1 w1Var = (w1) this.f2284d;
                bVar.getClass();
                if (liveEpgEntity == null) {
                    w1Var.f27616d.setText(R.string.no_epg);
                    w1Var.f27617e.setText("");
                    return;
                }
                w1Var.f27616d.setText(liveEpgEntity.getTitle());
                w1Var.f27616d.setSelected(true);
                StringBuilder sb = new StringBuilder();
                p000if.d dVar = bVar.f27809b;
                Activity activity = dVar.f27812b;
                String endTime = liveEpgEntity.getEndTime();
                if (endTime != null && !endTime.isEmpty()) {
                    try {
                        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.getDefault());
                        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
                        long time = simpleDateFormat.parse(endTime).getTime() - Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime().getTime();
                        int i12 = (int) (time / 3600000);
                        int i13 = ((int) (time / 60000)) % 60;
                        str = i12 > 0 ? i12 + CmcdData.STREAMING_FORMAT_HLS + i13 + activity.getString(R.string.min) : i13 + activity.getString(R.string.min);
                    } catch (Exception e12) {
                        u.a.g(e12, new StringBuilder("getEpgLeftTime: "));
                    }
                    break;
                }
                sb.append(str);
                sb.append(" ");
                sb.append(dVar.f27812b.getString(R.string.left));
                w1Var.f27617e.setText(sb.toString());
                return;
            case 22:
                fe.h hVar = (fe.h) this.f2282b;
                Activity activity2 = (Activity) this.f2283c;
                if (hVar != null) {
                    ((UpdateDialogController) hVar.f26080b).dismiss();
                }
                xyz.stream.utils.h.e(activity2, (String) this.f2284d);
                return;
            case 23:
                xyz.stream.api.live.g gVar = (xyz.stream.api.live.g) this.f2282b;
                xyz.stream.api.live.f fVar3 = (xyz.stream.api.live.f) this.f2283c;
                String str5 = (String) this.f2284d;
                gVar.getClass();
                try {
                    ArrayList arrayListC = xyz.stream.api.live.g.c(gVar.f35898a);
                    if (arrayListC.isEmpty()) {
                        gVar.q(fVar3, null);
                        return;
                    }
                    ArrayList arrayList = new ArrayList();
                    Iterator it = arrayListC.iterator();
                    while (it.hasNext()) {
                        ArrayList<LiveChannelEntity> arrayListK = xyz.stream.api.live.g.k((LiveCategoryEntity) it.next());
                        if (!arrayListK.isEmpty()) {
                            for (LiveChannelEntity liveChannelEntity : arrayListK) {
                                if (liveChannelEntity.getName() != null && liveChannelEntity.getName().toLowerCase().contains(str5.toLowerCase())) {
                                    arrayList.add(liveChannelEntity);
                                }
                            }
                            if (arrayList.size() >= 200) {
                                gVar.q(fVar3, arrayList);
                                return;
                            }
                        }
                    }
                    gVar.q(fVar3, arrayList);
                    return;
                } catch (Exception unused3) {
                    gVar.q(fVar3, null);
                    return;
                }
            case 24:
                ((SearchResultViewModel) this.f2282b).lambda$search$3((String) this.f2283c, (androidx.lifecycle.w) this.f2284d);
                return;
            case 25:
                ((xyz.stream.utils.f) this.f2282b).B((String) this.f2283c, (String) this.f2284d);
                return;
            default:
                CustomLoading customLoading = (CustomLoading) this.f2282b;
                Context context = (Context) this.f2283c;
                String str6 = (String) this.f2284d;
                Handler handler = CustomLoading.f36250b;
                customLoading.getClass();
                try {
                    e.m mVar2 = customLoading.f36252a;
                    if (mVar2 != null && mVar2.isShowing()) {
                        customLoading.f36252a.dismiss();
                    }
                    e.m mVarB = CustomLoading.b(context, str6);
                    customLoading.f36252a = mVarB;
                    if (mVarB == null) {
                        return;
                    }
                    mVarB.show();
                    CustomLoading.a(context, customLoading.f36252a);
                    return;
                } catch (Exception unused4) {
                    return;
                }
        }
    }
}
