package com.strmr.ps.ui.mobile.settings;

import android.content.Context;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.strmr.ps.R;
import com.strmr.ps.data.repository.DebridLibraryRepository;
import defpackage.ak1;
import defpackage.bm3;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.hf5;
import defpackage.m56;
import defpackage.o26;
import defpackage.q26;
import defpackage.s38;
import defpackage.y41;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.mobile.settings.MobileDisplayFragment$onViewCreated$1", f = "MobileDisplayFragment.kt", i = {}, l = {59}, m = "invokeSuspend", n = {}, s = {})
final class af extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public MobileDisplayFragment a;
    public int b;
    public final /* synthetic */ MobileDisplayFragment c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public af(MobileDisplayFragment mobileDisplayFragment, Continuation continuation) {
        super(2, continuation);
        this.c = mobileDisplayFragment;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new af(this.c, continuation);
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        return ((af) create((ak1) obj, (Continuation) obj2)).invokeSuspend(e6a.a);
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        Object objHasAnyDebridAccount;
        MobileDisplayFragment mobileDisplayFragment;
        ck1 ck1Var = ck1.a;
        int i = this.b;
        MobileDisplayFragment mobileDisplayFragment2 = this.c;
        int i2 = 1;
        if (i == 0) {
            s38.b(obj);
            DebridLibraryRepository debridLibraryRepository = mobileDisplayFragment2.j;
            if (debridLibraryRepository == null) {
                cr4.n("debridLibraryRepository");
                throw null;
            }
            this.a = mobileDisplayFragment2;
            this.b = 1;
            objHasAnyDebridAccount = debridLibraryRepository.hasAnyDebridAccount(this);
            if (objHasAnyDebridAccount == ck1Var) {
                return ck1Var;
            }
            mobileDisplayFragment = mobileDisplayFragment2;
        } else {
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            mobileDisplayFragment = this.a;
            s38.b(obj);
            objHasAnyDebridAccount = obj;
        }
        mobileDisplayFragment.m = ((Boolean) objHasAnyDebridAccount).booleanValue();
        bm3 bm3Var = mobileDisplayFragment2.f;
        cr4.d(bm3Var);
        TextView textView = bm3Var.c.b;
        String string = mobileDisplayFragment2.getString(R.string.settings_language);
        cr4.f(string, "getString(...)");
        String upperCase = string.toUpperCase(Locale.ROOT);
        cr4.f(upperCase, "toUpperCase(...)");
        textView.setText(upperCase);
        LinkedHashMap linkedHashMap = hf5.a;
        Context contextRequireContext = mobileDisplayFragment2.requireContext();
        cr4.f(contextRequireContext, "requireContext(...)");
        String strD = hf5.d(contextRequireContext);
        LinkedHashMap linkedHashMap2 = hf5.a;
        String str = (String) linkedHashMap2.get(strD);
        if (str == null) {
            str = "English";
        }
        Set setKeySet = linkedHashMap2.keySet();
        cr4.f(setKeySet, "<get-keys>(...)");
        List listBo = y41.bo(setKeySet);
        Collection collectionValues = linkedHashMap2.values();
        cr4.f(collectionValues, "<get-values>(...)");
        int i3 = 0;
        String[] strArr = (String[]) collectionValues.toArray(new String[0]);
        bm3 bm3Var2 = mobileDisplayFragment2.f;
        cr4.d(bm3Var2);
        LinearLayout linearLayout = bm3Var2.e.a;
        ((TextView) linearLayout.findViewById(R.id.select_title)).setText(mobileDisplayFragment2.getString(R.string.settings_language));
        ((TextView) linearLayout.findViewById(R.id.select_value)).setText(str);
        linearLayout.setOnClickListener(new m56(2, strD, listBo, mobileDisplayFragment2, strArr));
        bm3 bm3Var3 = mobileDisplayFragment2.f;
        cr4.d(bm3Var3);
        bm3Var3.b.b.setText("HOMESCREEN");
        bm3 bm3Var4 = mobileDisplayFragment2.f;
        cr4.d(bm3Var4);
        LinearLayout linearLayout2 = bm3Var4.f.a;
        mobileDisplayFragment2.n = linearLayout2;
        bm3 bm3Var5 = mobileDisplayFragment2.f;
        cr4.d(bm3Var5);
        MobileDisplayFragment.p(bm3Var5.k.a, "Show Hero", "Display a featured hero carousel at the top of Home. Choose up to 2 source rows below.", mobileDisplayFragment2.n().getMobileHeroEnabled(), true, new o26(mobileDisplayFragment2, 5));
        ((TextView) linearLayout2.findViewById(R.id.select_title)).setText("Hero Sources");
        mobileDisplayFragment2.o();
        boolean mobileHeroEnabled = mobileDisplayFragment2.n().getMobileHeroEnabled();
        LinearLayout linearLayout3 = mobileDisplayFragment2.n;
        if (linearLayout3 != null) {
            linearLayout3.setEnabled(mobileHeroEnabled);
            linearLayout3.setClickable(mobileHeroEnabled);
            linearLayout3.setAlpha(mobileHeroEnabled ? 1.0f : 0.4f);
        }
        linearLayout2.setOnClickListener(new q26(mobileDisplayFragment2, i3));
        bm3 bm3Var6 = mobileDisplayFragment2.f;
        cr4.d(bm3Var6);
        bm3Var6.d.b.setText("LIBRARY");
        String str2 = mobileDisplayFragment2.m ? "Add Library to navigation to browse your debrid files" : "Connect a debrid service in Accounts to enable";
        bm3 bm3Var7 = mobileDisplayFragment2.f;
        cr4.d(bm3Var7);
        MobileDisplayFragment.p(bm3Var7.g.a, "Show Debrid Library", str2, mobileDisplayFragment2.n().getShowDebridLibrary(), mobileDisplayFragment2.m, new o26(mobileDisplayFragment2, i3));
        bm3 bm3Var8 = mobileDisplayFragment2.f;
        cr4.d(bm3Var8);
        MobileDisplayFragment.p(bm3Var8.h.a, "Hide Unwatched Episodes", "Blur unwatched episode thumbnails to avoid spoilers", mobileDisplayFragment2.n().getGrayscaleUnwatchedEpisodes(), true, new o26(mobileDisplayFragment2, i2));
        bm3 bm3Var9 = mobileDisplayFragment2.f;
        cr4.d(bm3Var9);
        MobileDisplayFragment.p(bm3Var9.l.a, "Separate Movies & TV Continue Watching", "Show separate rows for movies and TV shows", mobileDisplayFragment2.n().getSeparateContinueWatching(), true, new o26(mobileDisplayFragment2, 2));
        bm3 bm3Var10 = mobileDisplayFragment2.f;
        cr4.d(bm3Var10);
        bm3Var10.a.b.setText("CONTENT");
        bm3 bm3Var11 = mobileDisplayFragment2.f;
        cr4.d(bm3Var11);
        MobileDisplayFragment.p(bm3Var11.i.a, "Hide Watched", "Hide movies and shows you've already watched from content rows", mobileDisplayFragment2.n().getHideWatched(), true, new o26(mobileDisplayFragment2, 3));
        bm3 bm3Var12 = mobileDisplayFragment2.f;
        cr4.d(bm3Var12);
        MobileDisplayFragment.p(bm3Var12.j.a, "Hide Watched From Continue Watching", "Hide fully watched items from the continue watching row", mobileDisplayFragment2.n().getHideWatchedFromContinueWatching(), true, new o26(mobileDisplayFragment2, 4));
        return e6a.a;
    }
}
