package com.google.firebase.messaging;

import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Binder;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.measurement.internal.c2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import xyz.netfly.ui.dashboard.DashboardActivity;
import xyz.stream.api.entity.VideoEntity;
import xyz.stream.api.viewmodel.RecommendViewModel;
import xyz.stream.download.DownloadFile;
import xyz.stream.download.DownloadManager;
import xyz.stream.view.tvrecyclerview.TvRecyclerView;

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

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

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

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

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

    public /* synthetic */ v(Object obj, boolean z10, Object obj2, int i10) {
        this.f24261a = i10;
        this.f24263c = obj;
        this.f24262b = z10;
        this.f24264d = obj2;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = this.f24261a;
        boolean z10 = this.f24262b;
        Object obj = this.f24264d;
        Object obj2 = this.f24263c;
        switch (i10) {
            case 0:
                Context context = (Context) obj2;
                w8.i iVar = (w8.i) obj;
                try {
                    if (Binder.getCallingUid() == context.getApplicationInfo().uid) {
                        SharedPreferences.Editor editorEdit = c2.i(context).edit();
                        editorEdit.putBoolean("proxy_notification_initialized", true);
                        editorEdit.apply();
                        NotificationManager notificationManager = (NotificationManager) context.getSystemService(NotificationManager.class);
                        if (z10) {
                            notificationManager.setNotificationDelegate("com.google.android.gms");
                        } else if ("com.google.android.gms".equals(notificationManager.getNotificationDelegate())) {
                            notificationManager.setNotificationDelegate(null);
                        }
                    } else {
                        context.getPackageName();
                    }
                    iVar.trySetResult(null);
                    return;
                } catch (Throwable th) {
                    iVar.trySetResult(null);
                    throw th;
                }
            case 1:
                DashboardActivity dashboardActivity = (DashboardActivity) obj2;
                v6.j jVar = (v6.j) obj;
                ArrayList arrayList = dashboardActivity.f35284e;
                int size = arrayList.size();
                dashboardActivity.f35290k = false;
                if (z10) {
                    int i11 = (dashboardActivity.f35285f + 1) % size;
                    dashboardActivity.f35285f = i11;
                    v6.j jVar2 = dashboardActivity.f35287h;
                    dashboardActivity.f35287h = dashboardActivity.f35286g;
                    dashboardActivity.f35286g = dashboardActivity.f35288i;
                    dashboardActivity.f35288i = jVar2;
                    dashboardActivity.L(jVar2, (VideoEntity) arrayList.get((i11 + 1) % size));
                    dashboardActivity.L(dashboardActivity.f35287h, (VideoEntity) arrayList.get(((dashboardActivity.f35285f - 1) + size) % size));
                } else {
                    int i12 = ((dashboardActivity.f35285f - 1) + size) % size;
                    dashboardActivity.f35285f = i12;
                    v6.j jVar3 = dashboardActivity.f35288i;
                    dashboardActivity.f35288i = dashboardActivity.f35286g;
                    dashboardActivity.f35286g = dashboardActivity.f35287h;
                    dashboardActivity.f35287h = jVar3;
                    dashboardActivity.L(jVar3, (VideoEntity) arrayList.get(((i12 - 1) + size) % size));
                    dashboardActivity.L(dashboardActivity.f35288i, (VideoEntity) arrayList.get((dashboardActivity.f35285f + 1) % size));
                }
                jVar.h(false);
                ((ViewGroup) jVar.f33700a).setTranslationX(0.0f);
                return;
            case 2:
                xyz.stream.api.live.g gVar = ((xyz.stream.api.live.b) obj2).f35888b;
                gVar.getClass();
                xyz.stream.api.live.d dVar = new xyz.stream.api.live.d(xyz.stream.api.live.g.c((List) obj), gVar, z10);
                xyz.stream.api.o oVarF = xyz.stream.api.o.f();
                oVarF.getClass();
                String str = "live/channels/list";
                HashMap map = new HashMap();
                if (z10) {
                    map.put("nocache", "1");
                }
                map.put("ttl", String.valueOf(86400L));
                xyz.stream.api.o.g("live/channels/list", oVarF.n(), map, new xyz.stream.api.j(oVarF, dVar, str, map, 2));
                return;
            case 3:
                ((RecommendViewModel) obj2).lambda$getRecentList$4(z10, (androidx.lifecycle.w) obj);
                return;
            case 4:
                DownloadManager downloadManager = (DownloadManager) obj2;
                DownloadFile downloadFile = (DownloadFile) obj;
                if (z10) {
                    downloadManager.getClass();
                    if (downloadFile.getStatus().intValue() != 46) {
                        downloadFile.setStatus(45);
                    }
                }
                downloadManager.c(downloadFile);
                return;
            default:
                ((TvRecyclerView) obj2).lambda$onFocusChange$0(z10, (View) obj);
                return;
        }
    }
}
