package com.ss.android.ugc.aweme.library;

import X.070;
import X.0Bv;
import X.0CH;
import X.1B1;
import X.1hK;
import X.2GO;
import X.2K7;
import X.2Pr;
import X.2cN;
import X.2f3;
import X.2f4;
import X.30v;
import X.3WG;
import X.3af;
import X.40q;
import X.4Pd;
import X.5Am;
import X.5An;
import X.5vY;
import X.5wO;
import X.7hc;
import X.7he;
import X.B1N;
import X.B20;
import X.B21;
import X.B22;
import X.B25;
import X.B26;
import X.B27;
import X.B29;
import X.B2A;
import X.B2B;
import X.B2C;
import X.B2D;
import X.B2E;
import X.B2F;
import X.B2G;
import X.B2H;
import X.B2I;
import X.B2K;
import X.B2L;
import X.B2N;
import X.B2R;
import X.B8T;
import X.BQV;
import X.C01329rc;
import X.C1807AiB;
import X.C1835Aid;
import X.C2960B1w;
import X.C2963B1z;
import X.C3444BKm;
import X.C3551BOp;
import X.Crj;
import X.Cwt;
import X.D1G;
import X.D4t;
import X.DRZ;
import X.DUT;
import X.DUy;
import X.DUz;
import X.DV0;
import X.DV9;
import X.DVU;
import X.El0;
import X.HeD;
import X.ISm;
import X.IxE;
import X.KEM;
import X.LsC;
import X.LsD;
import X.LsE;
import X.LsF;
import X.Lsh;
import X.M12;
import X.OQg;
import X.OQh;
import X.PHD;
import X.Qz3;
import X.Rc9;
import X.T5D;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.SparseArray;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.jedi.arch.JediViewModel;
import com.bytedance.jedi.arch.lifecycleAwareLazy;
import com.bytedance.router.arg.RouteArgExtension;
import com.ss.android.ugc.aweme.challenge.ui.BaseDetailFragment;
import com.ss.android.ugc.aweme.homepage.msadapt.MSAdaptionService;
import com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment;
import com.ss.android.ugc.aweme.library.viewmodel.LibraryDetailViewModel;
import com.ss.android.ugc.aweme.model.library.LibraryDetailParam;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.h.b.n;
import kotlin.o.z;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.ThreadMode;

public class LibraryDetailFragment extends BaseDetailFragment implements B1N<C1835Aid>, 5vY, 2GO {
    public static final B2N LJIILIIL = new B2N((byte) 0);
    public final Crj LIZLLL = RouteArgExtension.INSTANCE.navArg(this);
    public LibraryDetailAwemeListFragment LJ;
    public B2R LJIIIZ;
    public int LJIIJ;
    public String LJIIJJI = "";
    public C1835Aid LJIIL = new C1835Aid();
    public final Crj LJIILJJIL = 7he.LIZ(7hc.NONE, new C2960B1w(this));
    public final Crj LJIILL = 7he.LIZ(7hc.NONE, new B2E(this));
    public final Crj LJIIZILJ = 7he.LIZ(7hc.NONE, new B2G(this));
    public final Crj LJIJ = 7he.LIZ(7hc.NONE, new B2B(this));
    public final Crj LJIJI = 7he.LIZ(7hc.NONE, new B2C(this));
    public final Crj LJIJJ = 7he.LIZ(7hc.NONE, new B2F(this));
    public final Crj LJIJJLI = 7he.LIZ(7hc.NONE, new B2D(this));
    public final Crj LJIL = 7he.LIZ(7hc.NONE, new B2H(this));
    public final Crj LJJJJI = 7he.LIZ(7hc.NONE, new B2K(this));
    public C2963B1z LJJJJIZL;
    public String LJJJJJ;
    public B29 LJJJJJL;
    public boolean LJJJJL = true;
    public String LJJJJLI = "";
    public boolean LJJJJLL;
    public boolean LJJJJZ;
    public final lifecycleAwareLazy LJJJJZI;
    public final Crj LJJJLIIL;
    public final Crj LJJJLL;
    public BQV LJJJLZIJ;
    public boolean LJJJZ;
    public 1B1 LJJL;
    public float LJJLI;
    public float LJJLIIIIJ;
    public int LJJLIIIJ;
    public SparseArray LJJLIIIJILLIZJL;

    static {
        Covode.recordClassIndex(90867);
    }

    private final View LJI() {
        return (View) this.LJIILL.getValue();
    }

    private final View LJII() {
        return (View) this.LJIIZILJ.getValue();
    }

    private final RelativeLayout LJIIIIZZ() {
        return (RelativeLayout) this.LJIJ.getValue();
    }

    private final OQg LJIIJJI() {
        return (OQg) this.LJIJJ.getValue();
    }

    private final ImageView LJIILJJIL() {
        return (ImageView) this.LJIJJLI.getValue();
    }

    private final IxE LJIJ() {
        return (IxE) this.LJIL.getValue();
    }

    private final 3WG LJIJI() {
        return (3WG) this.LJJJJI.getValue();
    }

    private final LibraryDetailViewModel LJIJJLI() {
        return (LibraryDetailViewModel) this.LJJJJZI.getValue();
    }

    public final String LIZJ(int i) {
        return i != 0 ? "" : "library_detail_page";
    }

    public final View LIZLLL(int i) {
        if (this.LJJLIIIJILLIZJL == null) {
            this.LJJLIIIJILLIZJL = new SparseArray();
        }
        View view = (View) this.LJJLIIIJILLIZJL.get(i);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJJLIIIJILLIZJL.put(i, findViewById);
        return findViewById;
    }

    public final LibraryDetailParam LIZLLL() {
        return (LibraryDetailParam) this.LJIILJJIL.getValue();
    }

    public final T5D LJ() {
        return (T5D) this.LJIJI.getValue();
    }

    public final int LJIIIZ() {
        return 2131561474;
    }

    public final boolean LJJIJIIJI() {
        return true;
    }

    public Map<Integer, Object> getSubscriberEventTypes() {
        Map<Integer, Object> subscriberEventTypes = super.getSubscriberEventTypes();
        subscriberEventTypes.put(52, new Rc9(LibraryDetailFragment.class, "onAntiCrawlerEvent", El0.class, ThreadMode.POSTING, 0, false));
        return subscriberEventTypes;
    }

    public boolean getUniqueOnlyGlobal() {
        return true;
    }

    public final 1B1 LJIILIIL() {
        return this.LJJL;
    }

    public final /* bridge */ /* synthetic */ 0Bv be_() {
        return this.LJIIL;
    }

    public /* bridge */ /* synthetic */ 5An getReceiver() {
        return this;
    }

    public 0CH getLifecycleOwner() {
        5wO.LIZJ(this);
        return this;
    }

    public DUz getLifecycleOwnerHolder() {
        5wO.LIZ(this);
        return this;
    }

    public DUy<DVU> getReceiverHolder() {
        5wO.LIZIZ(this);
        return this;
    }

    public static boolean LJIL() {
        try {
            return 2K7.LIZ.LIZJ();
        } catch (Exception unused) {
            return false;
        }
    }

    public final String LJIIJ() {
        String str = this.LJJJJJ;
        if (str == null) {
            n.LIZ("");
        }
        return str;
    }

    public final void LJIIL() {
        super.LJIIL();
        Qz3 qz3 = this.LJJIIJZLJL;
        if (qz3 != null) {
            qz3.setBackgroundResource(2131099659);
        }
    }

    public /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        SparseArray sparseArray = this.LJJLIIIJILLIZJL;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final void LJFF() {
        LJ().setRefreshing(false);
        LJ().setVisibility(8);
        LJ().setScrollMode(40q.NONE);
        LJIILJJIL().setVisibility(8);
        LJIJ().setVisibility(8);
        LJIIIIZZ().setVisibility(8);
        OQg LJIIJJI2 = LJIIJJI();
        OQh oQh = new OQh();
        30v.LIZ(oQh, new B27(this));
        LJIIJJI2.setStatus(oQh);
        LJIIJJI().setVisibility(0);
    }

    public LibraryDetailFragment() {
        D1G LIZ = KEM.LIZ.LIZ(LibraryDetailViewModel.class);
        4Pd r4 = new 4Pd(LIZ);
        this.LJJJJZI = new lifecycleAwareLazy(this, r4, new B2I(this, r4, LIZ, B25.INSTANCE));
        this.LJJJLIIL = 7he.LIZ(7hc.NONE, new 2f3(this));
        this.LJJJLL = 7he.LIZ(7hc.NONE, 2f4.LIZ);
        this.LJJLIIIJ = -1;
    }

    @ISm
    public final void onAntiCrawlerEvent(El0 el0) {
        M12.LIZ(el0);
        String str = el0.LIZ;
        if (str != null && z.LIZ(str, "/tiktok/material/details/v1/?", false)) {
            EventBus.LIZ().LIZLLL(el0);
            LIZ(this, true, 2);
        }
    }

    public final void LIZ(Bundle bundle) {
        String id = LIZLLL().getId();
        String str = "";
        if (id == null) {
            id = str;
        }
        this.LJJJJJ = id;
        String processId = LIZLLL().getProcessId();
        if (processId != null) {
            str = processId;
        }
        this.LJJJJLI = str;
    }

    /*  JADX ERROR: JadxRuntimeException in pass: CodeShrinkVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Don't wrap MOVE or CONST insns: 0x00a7: MOVE  (r1v38 com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment) = 
          (r1v30 com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment)
        
        	at jadx.core.dex.instructions.args.InsnArg.wrapArg(InsnArg.java:164)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.assignInline(CodeShrinkVisitor.java:133)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.checkInline(CodeShrinkVisitor.java:118)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkBlock(CodeShrinkVisitor.java:65)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.shrinkMethod(CodeShrinkVisitor.java:43)
        	at jadx.core.dex.visitors.shrink.CodeShrinkVisitor.visit(CodeShrinkVisitor.java:35)
        */
    public final void LIZ(X.B29 r16) {
        /*
            r15 = this;
            boolean r0 = r15.aq_()
            if (r0 != 0) goto L_0x0007
            return
        L_0x0007:
            X.T5D r0 = r15.LJ()
            r5 = 0
            r0.setRefreshing(r5)
            r4 = 0
            r1 = r16
            if (r1 == 0) goto L_0x001a
            X.B2R r0 = r1.getLibraryMaterialInfo()
            if (r0 != 0) goto L_0x001e
        L_0x001a:
            r15.LJFF()
            return
        L_0x001e:
            X.B2R r2 = r1.getLibraryMaterialInfo()
            r15.LJJJJJL = r1
            r15.LJIIIZ = r2
            java.lang.String r1 = r15.LJJJJJ
            java.lang.String r3 = ""
            if (r1 != 0) goto L_0x002f
            kotlin.h.b.n.LIZ(r3)
        L_0x002f:
            if (r2 == 0) goto L_0x0471
            java.lang.String r0 = r2.getId()
        L_0x0035:
            java.lang.String r0 = java.lang.String.valueOf(r0)
            boolean r0 = android.text.TextUtils.equals(r1, r0)
            if (r0 != 0) goto L_0x0062
            if (r2 == 0) goto L_0x046e
            java.lang.String r0 = r2.getId()
        L_0x0045:
            java.lang.String r0 = java.lang.String.valueOf(r0)
            r15.LJJJJJ = r0
            X.1hK r1 = r15.getActivity()
            java.lang.String r0 = "null cannot be cast to non-null type com.ss.android.ugc.aweme.library.LibraryDetailActivity"
            java.util.Objects.requireNonNull(r1, r0)
            com.ss.android.ugc.aweme.library.LibraryDetailActivity r1 = (com.ss.android.ugc.aweme.library.LibraryDetailActivity) r1
            java.lang.String r0 = r15.LJJJJJ
            if (r0 != 0) goto L_0x005d
            kotlin.h.b.n.LIZ(r3)
        L_0x005d:
            X.M12.LIZ(r0)
            r1.LIZIZ = r0
        L_0x0062:
            java.util.List<X.BKm> r0 = r15.LJJIJIL
            r7 = 33
            r2 = 1
            if (r0 == 0) goto L_0x0075
            java.util.List<X.BKm> r0 = r15.LJJIJIL
            kotlin.h.b.n.LIZIZ(r0, r3)
            boolean r0 = r0.isEmpty()
            r0 = r0 ^ r2
            if (r0 != 0) goto L_0x0157
        L_0x0075:
            java.util.ArrayList r0 = new java.util.ArrayList
            r0.<init>()
            r15.LJJIJIL = r0
            java.util.ArrayList r0 = new java.util.ArrayList
            r0.<init>()
            r15.LJJIJL = r0
            java.util.ArrayList r0 = new java.util.ArrayList
            r0.<init>()
            r15.LIZ = r0
            X.0AA r6 = r15.getChildFragmentManager()
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            java.lang.String r0 = com.ss.android.ugc.aweme.detail.AbstractDetailFragment.LJJ
            r1.append(r0)
            r1.append(r5)
            java.lang.String r0 = r1.toString()
            androidx.fragment.app.Fragment r1 = r6.LIZ(r0)
            boolean r0 = r1 instanceof com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment
            if (r0 == 0) goto L_0x00ab
            com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment r1 = (com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment) r1
            if (r1 != 0) goto L_0x0101
        L_0x00ab:
            X.B2R r11 = r15.LJIIIZ
            java.lang.String r13 = r15.LJJJJJ
            if (r13 != 0) goto L_0x00b4
            kotlin.h.b.n.LIZ(r3)
        L_0x00b4:
            com.ss.android.ugc.aweme.model.library.LibraryDetailParam r0 = r15.LIZLLL()
            java.lang.String r12 = r0.getEnterFrom()
            java.lang.String r10 = r15.LJJJJLI
            com.ss.android.ugc.aweme.model.library.LibraryDetailParam r0 = r15.LIZLLL()
            java.lang.String r9 = r0.getAwemeId()
            X.BMZ r8 = new X.BMZ
            X.B2R r0 = r15.LJIIIZ
            r8.<init>(r0)
            com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment r1 = new com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment
            r1.<init>()
            android.os.Bundle r6 = new android.os.Bundle
            r6.<init>()
            java.lang.String r0 = "detail_aweme_list_type"
            r6.putInt(r0, r7)
            java.lang.String r14 = "event_label"
            java.lang.String r0 = "library_detail_page"
            r6.putString(r14, r0)
            java.lang.String r0 = "detail_id"
            r6.putString(r0, r13)
            java.lang.String r0 = "detail_aweme_from"
            r6.putString(r0, r12)
            java.lang.String r0 = "detail_library_data"
            r6.putSerializable(r0, r11)
            java.lang.String r0 = "process_id"
            r6.putString(r0, r10)
            java.lang.String r0 = "from_group_id"
            r6.putString(r0, r9)
            r1.setArguments(r6)
            r1.LJJIJIL = r8
        L_0x0101:
            X.B1y r0 = new X.B1y
            r0.<init>(r15)
            r1.LJIJJLI = r0
            int r0 = r15.LJJIJIIJI
            if (r0 != 0) goto L_0x046b
            r0 = 1
        L_0x010d:
            r1.LJJIIJ = r0
            r1.LJJIIJZLJL = r2
            r15.LJ = r1
            java.util.List<X.BKm> r1 = r15.LJJIJIL
            com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment r0 = r15.LJ
            if (r0 != 0) goto L_0x011c
            kotlin.h.b.n.LIZ(r3)
        L_0x011c:
            r1.add(r0)
            java.util.List<com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment> r1 = r15.LJJIJL
            com.ss.android.ugc.aweme.library.aweme.LibraryDetailAwemeListFragment r0 = r15.LJ
            if (r0 != 0) goto L_0x0128
            kotlin.h.b.n.LIZ(r3)
        L_0x0128:
            r1.add(r0)
            java.util.List<java.lang.Integer> r1 = r15.LIZ
            java.lang.Integer r0 = java.lang.Integer.valueOf(r7)
            r1.add(r0)
            r15.LJJJJZ = r2
            X.BQM r8 = new X.BQM
            X.0AA r6 = r15.getChildFragmentManager()
            java.util.List<com.ss.android.ugc.aweme.base.fragment.AmeBaseFragment> r1 = r15.LJJIJL
            java.util.List<java.lang.Integer> r0 = r15.LIZ
            r8.<init>(r6, r1, r0)
            r15.LJJL = r8
            r8.LIZJ()
            X.0GZ r1 = r15.LJJIIJ
            kotlin.h.b.n.LIZIZ(r1, r3)
            X.1B1 r0 = r15.LJJL
            r1.setAdapter(r0)
            int r0 = r15.LJJIJIIJI
            r15.e_(r0)
        L_0x0157:
            boolean r0 = r15.LJJJZ
            if (r0 != 0) goto L_0x0462
            android.widget.RelativeLayout r0 = r15.LJIIIIZZ()
            r0.setVisibility(r5)
            X.BQV r9 = new X.BQV
            android.content.Context r8 = r15.requireContext()
            kotlin.h.b.n.LIZIZ(r8, r3)
            android.view.LayoutInflater r6 = r15.getLayoutInflater()
            kotlin.h.b.n.LIZIZ(r6, r3)
            X.B2R r0 = r15.LJIIIZ
            if (r0 == 0) goto L_0x045f
            X.B2P r1 = r0.getMaterialType()
        L_0x017a:
            X.B2P r0 = X.B2P.Gif
            if (r1 != r0) goto L_0x045a
            r0 = 2131826594(0x7f1117a2, float:1.9286077E38)
        L_0x0181:
            r9.<init>(r8, r6, r0)
            r15.LJJJLZIJ = r9
            android.widget.RelativeLayout r0 = r15.LJIIIIZZ()
            r9.LIZ((android.widget.RelativeLayout) r0)
            X.BQV r1 = r15.LJJJLZIJ
            if (r1 == 0) goto L_0x0457
            android.widget.RelativeLayout r0 = r15.LJIIIIZZ()
            X.BOt r0 = r1.LIZ((android.view.ViewGroup) r0)
        L_0x0199:
            r15.LJJJIL = r0
            X.BQV r0 = r15.LJJJLZIJ
            if (r0 == 0) goto L_0x01a2
            r0.LIZ()
        L_0x01a2:
            X.BQV r0 = r15.LJJJLZIJ
            if (r0 == 0) goto L_0x01bc
            android.widget.RelativeLayout r1 = r15.LJIIIIZZ()
            r0 = 2131370589(0x7f0a225d, float:1.8361189E38)
            android.view.View r1 = r1.findViewById(r0)
            kotlin.h.b.n.LIZIZ(r1, r3)
            X.B9j r0 = new X.B9j
            r0.<init>(r15)
            r15.LIZ((android.view.View) r1, (X.LsC<? super android.view.View, X.2Pr>) r0)
        L_0x01bc:
            r15.LJJJZ = r2
        L_0x01be:
            android.view.View r0 = r15.LJI()
            r1 = 0
            r0.setAlpha(r1)
            android.view.View r0 = r15.LJJIII
            kotlin.h.b.n.LIZIZ(r0, r3)
            r0.setAlpha(r1)
            android.widget.TextView r6 = r15.LJJII
            r6.setVisibility(r5)
            kotlin.h.b.n.LIZIZ(r6, r3)
            android.content.Context r1 = r6.getContext()
            r0 = 2131099750(0x7f060066, float:1.7811862E38)
            int r0 = X.070.LIZJ(r1, r0)
            r6.setTextColor(r0)
            boolean r0 = r6 instanceof X.Qeg
            if (r0 == 0) goto L_0x01ee
            r0 = r6
            X.Qeg r0 = (X.Qeg) r0
            r0.setTuxFont(r7)
        L_0x01ee:
            X.B2R r0 = r15.LJIIIZ
            r9 = 2131826595(0x7f1117a3, float:1.9286079E38)
            r8 = 2131826596(0x7f1117a4, float:1.928608E38)
            if (r0 == 0) goto L_0x021d
            java.lang.String r1 = r0.getMaterialName()
            if (r1 == 0) goto L_0x021d
            int r0 = r1.length()
            if (r0 != 0) goto L_0x0452
            X.B2R r0 = r15.LJIIIZ
            if (r0 == 0) goto L_0x021d
            X.B2P r1 = r0.getMaterialType()
            if (r1 == 0) goto L_0x021d
            X.B2P r0 = X.B2P.Gif
            if (r1 != r0) goto L_0x0445
            android.content.Context r0 = r6.getContext()
            java.lang.String r0 = r0.getString(r9)
            r6.setText(r0)
        L_0x021d:
            X.T5D r0 = r15.LJ()
            r0.setVisibility(r5)
            X.T5D r1 = r15.LJ()
            X.40q r0 = X.40q.REFRESH
            r1.setScrollMode(r0)
            android.widget.ImageView r0 = r15.LJIILJJIL()
            r0.setVisibility(r5)
            X.IxE r0 = r15.LJIJ()
            r0.setVisibility(r5)
            X.OQg r0 = r15.LJIIJJI()
            r7 = 8
            r0.setVisibility(r7)
            X.AzH r10 = new X.AzH
            com.ss.android.ugc.aweme.model.library.LibraryDetailParam r0 = r15.LIZLLL()
            java.lang.String r6 = r0.getEnterFrom()
            java.lang.String r1 = r15.LJJJJLI
            com.ss.android.ugc.aweme.model.library.LibraryDetailParam r0 = r15.LIZLLL()
            r10.<init>(r6, r1, r0)
            X.1hK r0 = r15.getActivity()
            if (r0 == 0) goto L_0x0265
            X.B1z r4 = new X.B1z
            kotlin.h.b.n.LIZIZ(r0, r3)
            r4.<init>(r0, r10, r5)
        L_0x0265:
            android.widget.LinearLayout$LayoutParams r6 = new android.widget.LinearLayout$LayoutParams
            r1 = -1
            r0 = -2
            r6.<init>(r1, r0)
            if (r4 == 0) goto L_0x0392
            X.B29 r1 = r15.LJJJJJL
            if (r1 == 0) goto L_0x0375
            X.M12.LIZ(r1)
            X.B2R r0 = r1.getLibraryMaterialInfo()
            if (r0 == 0) goto L_0x0375
            r4.LIZ = r1
            X.B2R r0 = r1.getLibraryMaterialInfo()
            if (r0 != 0) goto L_0x0286
            kotlin.h.b.n.LIZIZ()
        L_0x0286:
            r4.LIZIZ = r0
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x028f
            kotlin.h.b.n.LIZ(r3)
        L_0x028f:
            com.ss.android.ugc.aweme.base.model.UrlModel r0 = r0.getCover()
            if (r0 == 0) goto L_0x029b
            java.lang.String r11 = r0.getUri()
            if (r11 != 0) goto L_0x02a8
        L_0x029b:
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x02a2
            kotlin.h.b.n.LIZ(r3)
        L_0x02a2:
            java.lang.String r11 = r0.getPreview()
            if (r11 == 0) goto L_0x02c9
        L_0x02a8:
            X.HcZ r10 = r4.LIZJ
            if (r10 != 0) goto L_0x02af
            kotlin.h.b.n.LIZ(r3)
        L_0x02af:
            com.ss.android.ugc.aweme.base.model.UrlModel r1 = new com.ss.android.ugc.aweme.base.model.UrlModel
            r1.<init>()
            java.lang.String[] r0 = new java.lang.String[r2]
            r0[r5] = r11
            java.util.ArrayList r0 = X.LeS.LIZLLL(r0)
            r1.setUrlList(r0)
            java.lang.String r0 = android.net.Uri.decode(r11)
            r1.setUri(r0)
            X.OCa.LIZ(r10, r1)
        L_0x02c9:
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x02d0
            kotlin.h.b.n.LIZ(r3)
        L_0x02d0:
            java.lang.String r1 = r0.getMaterialName()
            if (r1 == 0) goto L_0x02ff
            int r0 = r1.length()
            if (r0 != 0) goto L_0x0439
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x02e3
            kotlin.h.b.n.LIZ(r3)
        L_0x02e3:
            X.B2P r1 = r0.getMaterialType()
            if (r1 == 0) goto L_0x02ff
            X.B2P r0 = X.B2P.Gif
            if (r1 != r0) goto L_0x0425
            X.Qeg r1 = r4.LIZLLL
            if (r1 != 0) goto L_0x02f4
            kotlin.h.b.n.LIZ(r3)
        L_0x02f4:
            android.content.Context r0 = r4.getContext()
            java.lang.String r0 = r0.getString(r9)
            r1.setText(r0)
        L_0x02ff:
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x0306
            kotlin.h.b.n.LIZ(r3)
        L_0x0306:
            java.lang.Long r0 = r0.getUsedCount()
            if (r0 == 0) goto L_0x0334
            long r0 = r0.longValue()
            java.lang.String r10 = X.2yN.LIZ(r0)
            X.Qeg r9 = r4.LJFF
            if (r9 != 0) goto L_0x031b
            kotlin.h.b.n.LIZ(r3)
        L_0x031b:
            android.content.Context r0 = r4.getContext()
            kotlin.h.b.n.LIZIZ(r0, r3)
            android.content.res.Resources r8 = r0.getResources()
            r1 = 2131827416(0x7f111ad8, float:1.9287744E38)
            java.lang.Object[] r0 = new java.lang.Object[r2]
            r0[r5] = r10
            java.lang.String r0 = r8.getString(r1, r0)
            r9.setText(r0)
        L_0x0334:
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x033b
            kotlin.h.b.n.LIZ(r3)
        L_0x033b:
            X.B2S r1 = r0.getMaterialProvider()
            if (r1 == 0) goto L_0x0375
            X.B2S r0 = X.B2S.GIPHY
            if (r1 != r0) goto L_0x0419
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x034c
            kotlin.h.b.n.LIZ(r3)
        L_0x034c:
            java.lang.String r0 = r0.getAuthor()
            boolean r0 = android.text.TextUtils.isEmpty(r0)
            if (r0 == 0) goto L_0x03e5
            X.Qeg r7 = r4.LJ
            if (r7 != 0) goto L_0x035d
            kotlin.h.b.n.LIZ(r3)
        L_0x035d:
            android.content.Context r1 = r4.getContext()
            r0 = 2131826583(0x7f111797, float:1.9286054E38)
            java.lang.String r0 = r1.getString(r0)
            r7.setText(r0)
        L_0x036b:
            X.Qeg r0 = r4.LJ
            if (r0 != 0) goto L_0x0372
            kotlin.h.b.n.LIZ(r3)
        L_0x0372:
            r0.setVisibility(r5)
        L_0x0375:
            X.B1z r0 = r15.LJJJJIZL
            if (r0 == 0) goto L_0x03d1
            boolean r0 = kotlin.h.b.n.LIZ(r0, r4)
            r0 = r0 ^ r2
            if (r0 == 0) goto L_0x03d1
            X.3WG r1 = r15.LJIJI()
            X.B1z r0 = r15.LJJJJIZL
            r1.removeView(r0)
            X.3WG r0 = r15.LJIJI()
            r0.addView(r4, r6)
        L_0x0390:
            r15.LJJJJIZL = r4
        L_0x0392:
            boolean r0 = r15.LJJJJL
            if (r0 == 0) goto L_0x03d0
            com.ss.android.ugc.aweme.model.library.LibraryDetailParam r0 = r15.LIZLLL()
            java.lang.String r6 = r0.getEnterFrom()
            com.ss.android.ugc.aweme.model.library.LibraryDetailParam r0 = r15.LIZLLL()
            java.lang.String r4 = r0.getEnterMethod()
            java.lang.String r2 = r15.LJJJJJ
            if (r2 != 0) goto L_0x03ad
            kotlin.h.b.n.LIZ(r3)
        L_0x03ad:
            X.2UX r1 = new X.2UX
            r1.<init>()
            if (r6 == 0) goto L_0x03b9
            java.lang.String r0 = "enter_from"
            r1.LIZ(r0, r6)
        L_0x03b9:
            if (r4 == 0) goto L_0x03c0
            java.lang.String r0 = "enter_method"
            r1.LIZ(r0, r4)
        L_0x03c0:
            if (r2 == 0) goto L_0x03c7
            java.lang.String r0 = "library_material_id"
            r1.LIZ(r0, r2)
        L_0x03c7:
            java.util.Map r1 = r1.LIZ
            java.lang.String r0 = "enter_library_detail_page"
            X.2nK.LIZ(r0, r1)
            r15.LJJJJL = r5
        L_0x03d0:
            return
        L_0x03d1:
            X.B1z r0 = r15.LJJJJIZL
            if (r0 != 0) goto L_0x0390
            X.3WG r0 = r15.LJIJI()
            r0.addView(r4, r6)
            X.B28 r0 = new X.B28
            r0.<init>(r15)
            r4.post(r0)
            goto L_0x0390
        L_0x03e5:
            X.Qeg r8 = r4.LJ
            if (r8 != 0) goto L_0x03ec
            kotlin.h.b.n.LIZ(r3)
        L_0x03ec:
            android.content.Context r1 = r4.getContext()
            r0 = 2131826582(0x7f111796, float:1.9286052E38)
            java.lang.String r7 = r1.getString(r0)
            kotlin.h.b.n.LIZIZ(r7, r3)
            java.lang.Object[] r1 = new java.lang.Object[r2]
            X.B2R r0 = r4.LIZIZ
            if (r0 != 0) goto L_0x0403
            kotlin.h.b.n.LIZ(r3)
        L_0x0403:
            java.lang.String r0 = r0.getAuthor()
            r1[r5] = r0
            java.lang.Object[] r0 = java.util.Arrays.copyOf(r1, r2)
            java.lang.String r0 = X.0HH.LIZ(r7, r0)
            kotlin.h.b.n.LIZIZ(r0, r3)
            r8.setText(r0)
            goto L_0x036b
        L_0x0419:
            X.Qeg r0 = r4.LJ
            if (r0 != 0) goto L_0x0420
            kotlin.h.b.n.LIZ(r3)
        L_0x0420:
            r0.setVisibility(r7)
            goto L_0x0375
        L_0x0425:
            X.Qeg r1 = r4.LIZLLL
            if (r1 != 0) goto L_0x042c
            kotlin.h.b.n.LIZ(r3)
        L_0x042c:
            android.content.Context r0 = r4.getContext()
            java.lang.String r0 = r0.getString(r8)
            r1.setText(r0)
            goto L_0x02ff
        L_0x0439:
            X.Qeg r0 = r4.LIZLLL
            if (r0 != 0) goto L_0x0440
            kotlin.h.b.n.LIZ(r3)
        L_0x0440:
            r0.setText(r1)
            goto L_0x02ff
        L_0x0445:
            android.content.Context r0 = r6.getContext()
            java.lang.String r0 = r0.getString(r8)
            r6.setText(r0)
            goto L_0x021d
        L_0x0452:
            r6.setText(r1)
            goto L_0x021d
        L_0x0457:
            r0 = r4
            goto L_0x0199
        L_0x045a:
            r0 = 2131826593(0x7f1117a1, float:1.9286075E38)
            goto L_0x0181
        L_0x045f:
            r1 = r4
            goto L_0x017a
        L_0x0462:
            android.widget.RelativeLayout r0 = r15.LJIIIIZZ()
            r0.setVisibility(r5)
            goto L_0x01be
        L_0x046b:
            r0 = 0
            goto L_0x010d
        L_0x046e:
            r0 = r4
            goto L_0x0045
        L_0x0471:
            r0 = r4
            goto L_0x0035
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.library.LibraryDetailFragment.LIZ(X.B29):void");
    }

    public <VM1 extends JediViewModel<S1>, S1 extends 5Am, R> R withState(VM1 vm1, LsC<? super S1, ? extends R> lsC) {
        M12.LIZ(vm1, lsC);
        return 5wO.LIZ(vm1, lsC);
    }

    private final void LIZ(View view, LsC<? super View, 2Pr> lsC) {
        view.setOnClickListener(new B26(lsC));
    }

    public final void LIZ(float f, float f2) {
        this.LJJJJLL = C3551BOp.LIZ.LIZ(f, f2, this.LJJJJLL, this);
    }

    public final void LIZ(int i, int i2) {
        boolean z;
        super.LIZ(i, i2);
        Set<Map.Entry> entrySet = ((HashMap) this.LJJJLL.getValue()).entrySet();
        if (entrySet != null) {
            for (Map.Entry entry : entrySet) {
                Object value = entry.getValue();
                n.LIZIZ(value, "");
                View view = (View) value;
                Integer num = (Integer) entry.getKey();
                if (num != null && num.intValue() == i) {
                    z = true;
                } else {
                    z = false;
                }
                view.setSelected(z);
            }
        }
        if (this.LJJIJIL != null) {
            C3444BKm bKm = this.LJJIJIL.get(i);
            C3444BKm bKm2 = bKm;
            n.LIZIZ(bKm2, "");
            if (!bKm2.LJ()) {
                bKm = null;
            }
            C3444BKm bKm3 = bKm;
            if (bKm3 != null) {
                bKm3.LJIIIZ();
            }
        }
    }

    public final void LIZIZ(int i, int i2) {
        int i3;
        super.LIZIZ(i, i2);
        float f = 0.0f;
        if (this.LJJLIIIJ != LJIJI().getBottom()) {
            int bottom = LJIJI().getBottom();
            View view = this.LJJIII;
            n.LIZIZ(view, "");
            float bottom2 = (float) ((bottom - view.getBottom()) - LJI().getHeight());
            this.LJJLI = bottom2;
            float LIZIZ = bottom2 - HeD.LIZIZ(getContext(), 20.0f);
            this.LJJLIIIIJ = LIZIZ;
            if (LIZIZ < 0.0f) {
                this.LJJLIIIIJ = 0.0f;
            }
            this.LJJLIIIJ = LJIJI().getBottom();
        }
        if (i == 0) {
            LJII().setBackground(new ColorDrawable(070.LIZJ(LJII().getContext(), 2131099762)));
        } else {
            LJII().setBackground(new ColorDrawable(070.LIZJ(LJII().getContext(), 2131099659)));
        }
        C2963B1z b1z = this.LJJJJIZL;
        if (b1z != null) {
            i3 = b1z.getAvatarContainerHeight();
        } else {
            i3 = 1;
        }
        float f2 = ((float) i) / ((float) i3);
        if (f2 >= 0.0f) {
            if (f2 > 1.0f) {
                f = 1.0f;
            } else {
                f = f2;
            }
        }
        TextView textView = this.LJJII;
        n.LIZIZ(textView, "");
        textView.setAlpha(f);
        this.LJJJJLL = C3551BOp.LIZ.LIZ(f, this.LJJJJLL, this);
    }

    public void onViewCreated(View view, Bundle bundle) {
        int i;
        int identifier;
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        if (TextUtils.isEmpty(LIZLLL().getId())) {
            1hK activity = getActivity();
            if (activity != null) {
                activity.finish();
                return;
            }
            return;
        }
        Qz3 qz3 = this.LJJIIJZLJL;
        n.LIZIZ(qz3, "");
        qz3.setVisibility(8);
        TextView textView = this.LJJII;
        n.LIZIZ(textView, "");
        textView.setVisibility(0);
        if (MSAdaptionService.LIZJ().LIZJ(getContext())) {
            LJIJ().setVisibility(8);
        }
        LIZ((View) LJIJ(), (LsC<? super View, 2Pr>) new C1807AiB(this));
        Context context = getContext();
        if (context == null || (identifier = context.getResources().getIdentifier("status_bar_height", "dimen", "android")) <= 0) {
            i = 0;
        } else {
            i = context.getResources().getDimensionPixelSize(identifier);
        }
        LJI().getLayoutParams().height = i;
        LJI().setAlpha(1.0f);
        LIZ((View) LJIILJJIL(), (LsC<? super View, 2Pr>) new C01329rc(this));
        LJ().setScrollMode(40q.NONE);
        LJ().setOnRefreshListener(new B2A(this));
        LJIJI().setOnSizeChangedListener(new B22(this));
        DV0.LIZ(this, LJIJJLI(), B2L.LIZ, (DUT) null, new B20(this), (LsC) null, new B21(this), 10);
        LIZ(this, false, 2);
    }

    public final void LIZ(boolean z, boolean z2) {
        LJIIJJI().setVisibility(0);
        getContext();
        if (!LJIL()) {
            3af r1 = new 3af(this);
            r1.LJ(2131827476);
            3af.LIZ(r1);
            LJFF();
            return;
        }
        LJIIJJI().LIZ();
        String id = LIZLLL().getId();
        if (id != null) {
            LJIJJLI().LIZ(id, z2);
        }
        List<C3444BKm> list = this.LJJIJIL;
        if (z && list != null) {
            for (C3444BKm LIZ : list) {
                LIZ.LIZ(false, true);
            }
        }
        if (z2) {
            LJIIJJI().setVisibility(8);
            LIZ(0.0f, -60.0f);
        }
    }

    public <S extends 5Am> 2cN subscribe(JediViewModel<S> jediViewModel, DUT<S> dut, LsD<? super DVU, ? super S, 2Pr> lsD) {
        M12.LIZ(jediViewModel, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, dut, lsD);
    }

    public static /* synthetic */ void LIZ(LibraryDetailFragment libraryDetailFragment, boolean z, int i) {
        if ((i & 1) != 0) {
            z = true;
        }
        libraryDetailFragment.LIZ(z, false);
    }

    public <S extends 5Am, A> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, DUT<DRZ<A>> dut, LsD<? super DVU, ? super A, 2Pr> lsD) {
        M12.LIZ(jediViewModel, phd, dut, lsD);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD);
    }

    public <S extends 5Am, A, B> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, DUT<Cwt<A, B>> dut, LsE<? super DVU, ? super A, ? super B, 2Pr> lsE) {
        M12.LIZ(jediViewModel, phd, phd2, dut, lsE);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, dut, lsE);
    }

    public <S extends 5Am, T> 2cN asyncSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends B8T<? extends T>> phd, DUT<DRZ<B8T<T>>> dut, LsD<? super DVU, ? super Throwable, 2Pr> lsD, LsC<? super DVU, 2Pr> lsC, LsD<? super DVU, ? super T, 2Pr> lsD2) {
        M12.LIZ(jediViewModel, phd, dut);
        return 5wO.LIZ(this, jediViewModel, phd, dut, lsD, lsC, lsD2);
    }

    public <S extends 5Am, A, B, C> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, DUT<DV9<A, B, C>> dut, LsF<? super DVU, ? super A, ? super B, ? super C, 2Pr> lsF) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, dut, lsF);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, dut, lsF);
    }

    public <S extends 5Am, A, B, C, D> 2cN selectSubscribe(JediViewModel<S> jediViewModel, PHD<S, ? extends A> phd, PHD<S, ? extends B> phd2, PHD<S, ? extends C> phd3, PHD<S, ? extends D> phd4, DUT<D4t<A, B, C, D>> dut, Lsh<? super DVU, ? super A, ? super B, ? super C, ? super D, 2Pr> lsh) {
        M12.LIZ(jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
        return 5wO.LIZ(this, jediViewModel, phd, phd2, phd3, phd4, dut, lsh);
    }
}
