得物.apk(点击下载) / RecommendTabFragment.java


package com.shizhuang.duapp.modules.community.recommend.fragment;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.ArrayMap;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.MotionEventCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.knightboost.weaver.api.Scope;
import com.knightboost.weaver.api.annotations.Insert;
import com.knightboost.weaver.api.annotations.TargetClass;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.extension.ViewModelLifecycleAwareLazy;
import com.shizhuang.duapp.common.helper.ExposureHelper;
import com.shizhuang.duapp.common.helper.loadmore.LoadMoreHelper;
import com.shizhuang.duapp.common.helper.loadmore.paginate.Paginate;
import com.shizhuang.duapp.common.helper.loadmore.paginate.recycler.RecyclerPaginate;
import com.shizhuang.duapp.common.helper.model.VisitorLoginNodeInfoModel;
import com.shizhuang.duapp.common.recyclerview.adapter.DuListAdapter;
import com.shizhuang.duapp.common.ui.BaseFragment;
import com.shizhuang.duapp.libs.bpm.BM;
import com.shizhuang.duapp.libs.smartlayout.DuSmartLayout;
import com.shizhuang.duapp.libs.smartlayout.listener.OnDuRefreshListener;
import com.shizhuang.duapp.libs.statemanager.ProgressWheel;
import com.shizhuang.duapp.modules.community.home.HomeTrendHelper;
import com.shizhuang.duapp.modules.community.home.viewmodel.HomeTrendViewModel;
import com.shizhuang.duapp.modules.community.recommend.RecommendDecoration;
import com.shizhuang.duapp.modules.community.recommend.adapter.FeedLiveHelper;
import com.shizhuang.duapp.modules.community.recommend.adapter.RecommendTrendAdapter;
import com.shizhuang.duapp.modules.community.recommend.model.Second;
import com.shizhuang.duapp.modules.community.recommend.model.TopStyleModel;
import com.shizhuang.duapp.modules.community.recommend.viewmodel.BmLoggerViewModel;
import com.shizhuang.duapp.modules.community.recommend.viewmodel.TopStyleViewModel;
import com.shizhuang.duapp.modules.du_community_common.controller.FeedVoteController;
import com.shizhuang.duapp.modules.du_community_common.extensions.LifecycleAwareLazy;
import com.shizhuang.duapp.modules.du_community_common.facade.request.DuHttpRequest;
import com.shizhuang.duapp.modules.du_community_common.helper.CommunityCommonDelegate;
import com.shizhuang.duapp.modules.du_community_common.helper.CommunityCommonHelper;
import com.shizhuang.duapp.modules.du_community_common.interfaces.ITrendFragment;
import com.shizhuang.duapp.modules.du_community_common.interfaces.OnTrendClickListener;
import com.shizhuang.duapp.modules.du_community_common.model.CommunityAdvModel;
import com.shizhuang.duapp.modules.du_community_common.model.CommunityFeedContentModel;
import com.shizhuang.duapp.modules.du_community_common.model.CommunityFeedModel;
import com.shizhuang.duapp.modules.du_community_common.model.CommunityListItemModel;
import com.shizhuang.duapp.modules.du_community_common.model.CommunityListModel;
import com.shizhuang.duapp.modules.du_community_common.model.CommunityReasonModel;
import com.shizhuang.duapp.modules.du_community_common.model.FeedDebugTool;
import com.shizhuang.duapp.modules.du_community_common.model.LiveTagModel;
import com.shizhuang.duapp.modules.du_community_common.model.MediaItemModel;
import com.shizhuang.duapp.modules.du_community_common.model.live.LiveCommentateInfo;
import com.shizhuang.duapp.modules.du_community_common.model.live.LiveRoom;
import com.shizhuang.duapp.modules.du_community_common.model.trend.NpsDetailModel;
import com.shizhuang.duapp.modules.du_community_common.model.trend.NpsInfo;
import com.shizhuang.duapp.modules.du_community_common.sensor.SensorCommunityChannel;
import com.shizhuang.duapp.modules.du_community_common.sensor.SensorContentArrangeStyle;
import com.shizhuang.duapp.modules.du_community_common.sensor.SensorRefreshType;
import com.shizhuang.duapp.modules.du_community_common.sensor.SensorSlideIsUp;
import com.shizhuang.duapp.modules.router.ServiceManager;
import com.shizhuang.duapp.preloader.ListUrlLoader;
import com.shizhuang.duapp.preloader.loader.VideoPreLoader;
import com.shizhuang.model.trend.TrendTagModel;
import df.b0;
import df.o0;
import df.p0;
import df.t;
import fd.n;
import fd.r;
import fd.y0;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.MapsKt__MapsJVMKt;
import kotlin.collections.MapsKt__MapsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.PropertyReference0Impl;
import kotlin.jvm.internal.Ref;
import kotlin.jvm.internal.Reflection;
import kotlin.ranges.RangesKt___RangesKt;
import kotlin.reflect.KProperty;
import m30.h;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import r20.j;
import rd.l;
import td.s;
import te1.b;
import te1.e;
import v20.i;
import y20.m;
import zc.k;

@Metadata(bv = {}, d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u00012\u00020\u0002:\u0001\u000fB\u0007¢\u0006\u0004\b\r\u0010\u000eJ\b\u0010\u0004\u001a\u00020\u0003H\u0016J\b\u0010\u0005\u001a\u00020\u0003H\u0016J\u0010\u0010\b\u001a\u00020\u00032\u0006\u0010\u0007\u001a\u00020\u0006H\u0007J\u0010\u0010\n\u001a\u00020\u00032\u0006\u0010\u0007\u001a\u00020\tH\u0007J\u0010\u0010\n\u001a\u00020\u00032\u0006\u0010\u0007\u001a\u00020\u000bH\u0007J\u0010\u0010\n\u001a\u00020\u00032\u0006\u0010\u0007\u001a\u00020\fH\u0007¨\u0006\u001c²\u0006\u001c\u0010\u0013\u001a\u0012\u0012\f\u0012\n \u0012*\u0004\u0018\u00010\u00110\u0011\u0018\u00010\u00108\nXŠ„\u0002²\u0006\u001c\u0010\u0015\u001a\u0012\u0012\f\u0012\n \u0012*\u0004\u0018\u00010\u00140\u0014\u0018\u00010\u00108\nXŠ„\u0002²\u0006\u000e\u0010\u0017\u001a\u0004\u0018\u00010\u00168\nXŠ„\u0002²\u0006\u000e\u0010\u0019\u001a\u0004\u0018\u00010\u00188\nXŠ„\u0002²\u0006\u001c\u0010\u001b\u001a\u0012\u0012\f\u0012\n \u0012*\u0004\u0018\u00010\u001a0\u001a\u0018\u00010\u00108\nXŠ„\u0002²\u0006\u001c\u0010\u0015\u001a\u0012\u0012\f\u0012\n \u0012*\u0004\u0018\u00010\u00140\u0014\u0018\u00010\u00108\nXŠ„\u0002²\u0006\u000e\u0010\u0017\u001a\u0004\u0018\u00010\u00168\nXŠ„\u0002²\u0006\u000e\u0010\u0019\u001a\u0004\u0018\u00010\u00188\nXŠ„\u0002"}, d2 = {"Lcom/shizhuang/duapp/modules/community/recommend/fragment/RecommendTabFragment;", "Lcom/shizhuang/duapp/common/ui/BaseFragment;", "Lcom/shizhuang/duapp/modules/du_community_common/interfaces/ITrendFragment;", "", "onResume", "onPause", "Lzc/e;", "event", "refreshListFromDetail", "Lzc/k;", "onEvent", "Lzc/m;", "Lr20/e;", "<init>", "()V", "a", "Ljava/util/ArrayList;", "", "kotlin.jvm.PlatformType", "positionListWeak", "Lcom/shizhuang/duapp/modules/du_community_common/model/CommunityListItemModel;", "dataListWeak", "Lcom/shizhuang/duapp/modules/community/recommend/model/Second;", "tabTitleWeak", "Lcom/shizhuang/duapp/modules/community/recommend/adapter/RecommendTrendAdapter;", "listDataAdapterWeak", "Lbd/f;", "exposureListWeak", "du_trend_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: RecommendTabFragment.kt */
public final class RecommendTabFragment extends BaseFragment implements ITrendFragment {
    public static final /* synthetic */ KProperty[] U = {Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "positionListWeak", "<v#0>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "dataListWeak", "<v#1>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "tabTitleWeak", "<v#2>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "listDataAdapterWeak", "<v#3>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "exposureListWeak", "<v#4>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "dataListWeak", "<v#5>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "tabTitleWeak", "<v#6>", 0)), Reflection.property0(new PropertyReference0Impl(RecommendTabFragment.class, "listDataAdapterWeak", "<v#7>", 0))};
    @NotNull
    public static final a V = new a(null);
    public static ChangeQuickRedirect changeQuickRedirect;
    public boolean A;
    public boolean B;
    public boolean C = true;
    public final Lazy D = new LifecycleAwareLazy(this, new RecommendTabFragment$$special$$inlined$lazyActivityViewModel$1(this));
    public final Lazy E = new ViewModelLifecycleAwareLazy(this, new RecommendTabFragment$$special$$inlined$duViewModel$1(this));
    public final Lazy F = new ViewModelLifecycleAwareLazy(this, new RecommendTabFragment$$special$$inlined$duActivityViewModel$1(this));
    public final RecommendDecoration G = new RecommendDecoration();
    public final Lazy H = LazyKt__LazyJVMKt.lazy(RecommendTabFragment$feedLiveAnimHelper$2.INSTANCE);
    public int I = 20;
    public String J = "";
    public boolean K;
    public ArrayList<CommunityListItemModel> L = new ArrayList<>();
    public int M;
    public boolean N;
    public int O = 2;
    public final ef.b<CommunityListModel> P = new ef.b<>("RecommendTabFragment", false, true);
    public FeedDebugTool Q;
    public final Lazy R = LazyKt__LazyJVMKt.lazy(RecommendTabFragment$visitorLoginNodeInfo$2.INSTANCE);
    public RecyclerView.OnScrollListener S;
    public HashMap T;
    public boolean b = true;

    /* renamed from: c  reason: collision with root package name */
    public int f11862c;
    public long d = -1;
    public long e = System.currentTimeMillis();
    public int f;

    /* renamed from: g  reason: collision with root package name */
    public boolean f11863g;

    /* renamed from: h  reason: collision with root package name */
    public String f11864h = "";
    public int i = -1;
    public List<CommunityListItemModel> j;
    public LoadMoreHelper k;
    public final ExposureHelper l = new ExposureHelper();
    public RecommendTrendAdapter m;
    public boolean n = true;
    public boolean o;
    public boolean p;

    /* renamed from: q  reason: collision with root package name */
    public boolean f11865q;
    public MotionEvent r;
    public String s = "";
    public String t = "";

    /* renamed from: u  reason: collision with root package name */
    public int f11866u;

    /* renamed from: v  reason: collision with root package name */
    public int f11867v;
    public boolean w;
    public boolean x;
    public boolean y;
    public Second z = new Second(null, null, 0, 0, null, null, 0, null, MotionEventCompat.ACTION_MASK, null);

    public class _boostWeave {
        public static ChangeQuickRedirect changeQuickRedirect;

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onCreate")
        @Keep
        public static void FragmentMethodWeaver_onCreate(RecommendTabFragment recommendTabFragment, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{recommendTabFragment, bundle}, null, changeQuickRedirect, true, 81113, new Class[]{RecommendTabFragment.class, Bundle.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                RecommendTabFragment.d(recommendTabFragment, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (recommendTabFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.community.recommend.fragment.RecommendTabFragment")) {
                    jn.b.f34396a.fragmentOnCreateMethod(recommendTabFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onCreateView")
        @Keep
        public static View FragmentMethodWeaver_onCreateView(@NonNull RecommendTabFragment recommendTabFragment, @Nullable LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, Bundle bundle) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{recommendTabFragment, layoutInflater, viewGroup, bundle}, null, changeQuickRedirect, true, 81115, new Class[]{RecommendTabFragment.class, LayoutInflater.class, ViewGroup.class, Bundle.class}, View.class);
            if (proxy.isSupported) {
                return (View) proxy.result;
            }
            long currentTimeMillis = System.currentTimeMillis();
            View f = RecommendTabFragment.f(recommendTabFragment, layoutInflater, viewGroup, bundle);
            long currentTimeMillis2 = System.currentTimeMillis();
            if (recommendTabFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.community.recommend.fragment.RecommendTabFragment")) {
                jn.b.f34396a.fragmentOnCreateViewMethod(recommendTabFragment, currentTimeMillis, currentTimeMillis2);
            }
            return f;
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onResume")
        @Keep
        public static void FragmentMethodWeaver_onResume(RecommendTabFragment recommendTabFragment) {
            if (!PatchProxy.proxy(new Object[]{recommendTabFragment}, null, changeQuickRedirect, true, 81112, new Class[]{RecommendTabFragment.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                RecommendTabFragment.c(recommendTabFragment);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (recommendTabFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.community.recommend.fragment.RecommendTabFragment")) {
                    jn.b.f34396a.fragmentOnResumeMethod(recommendTabFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onStart")
        @Keep
        public static void FragmentMethodWeaver_onStart(RecommendTabFragment recommendTabFragment) {
            if (!PatchProxy.proxy(new Object[]{recommendTabFragment}, null, changeQuickRedirect, true, 81114, new Class[]{RecommendTabFragment.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                RecommendTabFragment.e(recommendTabFragment);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (recommendTabFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.community.recommend.fragment.RecommendTabFragment")) {
                    jn.b.f34396a.fragmentOnStartMethod(recommendTabFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onViewCreated")
        @Keep
        public static void FragmentMethodWeaver_onViewCreated(@NonNull RecommendTabFragment recommendTabFragment, @Nullable View view, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{recommendTabFragment, view, bundle}, null, changeQuickRedirect, true, 81116, new Class[]{RecommendTabFragment.class, View.class, Bundle.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                RecommendTabFragment.g(recommendTabFragment, view, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (recommendTabFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.community.recommend.fragment.RecommendTabFragment")) {
                    jn.b.f34396a.fragmentOnViewCreatedMethod(recommendTabFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class a {
        public static ChangeQuickRedirect changeQuickRedirect;

        public a(DefaultConstructorMarker defaultConstructorMarker) {
        }

        @NotNull
        public final RecommendTabFragment a(@NotNull Second second, int i) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{second, new Integer(i)}, this, changeQuickRedirect, false, 81111, new Class[]{Second.class, Integer.TYPE}, RecommendTabFragment.class);
            if (proxy.isSupported) {
                return (RecommendTabFragment) proxy.result;
            }
            RecommendTabFragment recommendTabFragment = new RecommendTabFragment();
            Bundle bundle = new Bundle();
            bundle.putString("tabId", second.getCId());
            bundle.putString("name", second.getName());
            bundle.putParcelable("tabTitle", second);
            bundle.putInt("tabPosition", i);
            recommendTabFragment.setArguments(bundle);
            return recommendTabFragment;
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class b extends s<CommunityListModel> {
        public static ChangeQuickRedirect changeQuickRedirect;
        @org.jetbrains.annotations.Nullable
        public Throwable b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ RecommendTabFragment f11870c;
        public final /* synthetic */ long d;
        public final /* synthetic */ boolean e;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public b(RecommendTabFragment recommendTabFragment, long j, boolean z, View view) {
            super(view);
            this.f11870c = recommendTabFragment;
            this.d = j;
            this.e = z;
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.s, td.a
        public void onBzError(@NotNull l<CommunityListModel> lVar) {
            if (!PatchProxy.proxy(new Object[]{lVar}, this, changeQuickRedirect, false, 81121, new Class[]{l.class}, Void.TYPE).isSupported) {
                super.onBzError(lVar);
                this.f11870c.s(lVar, this.e, this.b);
                this.b = null;
            }
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
        public void onLoadCacheSuccess(Object obj) {
            CommunityListModel communityListModel = (CommunityListModel) obj;
            if (!PatchProxy.proxy(new Object[]{communityListModel}, this, changeQuickRedirect, false, 81123, new Class[]{CommunityListModel.class}, Void.TYPE).isSupported) {
                super.onLoadCacheSuccess(communityListModel);
                RecommendTabFragment recommendTabFragment = this.f11870c;
                ChangeQuickRedirect changeQuickRedirect2 = RecommendTabFragment.changeQuickRedirect;
                recommendTabFragment.o(communityListModel, false);
            }
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
        public void onSuccess(Object obj) {
            CommunityListModel communityListModel = (CommunityListModel) obj;
            if (!PatchProxy.proxy(new Object[]{communityListModel}, this, changeQuickRedirect, false, 81120, new Class[]{CommunityListModel.class}, Void.TYPE).isSupported) {
                super.onSuccess(communityListModel);
                if (communityListModel != null && communityListModel.getPreloadCardNum() > 0) {
                    LoadMoreHelper loadMoreHelper = this.f11870c.k;
                    if (loadMoreHelper == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                    }
                    int preloadCardNum = communityListModel.getPreloadCardNum();
                    if (!PatchProxy.proxy(new Object[]{new Integer(preloadCardNum)}, loadMoreHelper, LoadMoreHelper.changeQuickRedirect, false, 5393, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
                        Paginate paginate = loadMoreHelper.d;
                        if (paginate instanceof RecyclerPaginate) {
                            ((RecyclerPaginate) paginate).f7690c = preloadCardNum;
                        }
                    }
                }
                if (this.f11870c.q()) {
                    BM.community().a("community_tab_feed_time", System.currentTimeMillis() - this.d, false);
                    b0.l("isFirstRequest", Boolean.FALSE);
                }
                if (communityListModel == null || communityListModel.getSafeList().isEmpty()) {
                    this.f11870c.s(new l<>(200, "empty list"), this.e, null);
                } else {
                    this.f11870c.p(communityListModel, this.e, false);
                }
            }
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
        public void onThrowable(@org.jetbrains.annotations.Nullable Throwable th2) {
            if (!PatchProxy.proxy(new Object[]{th2}, this, changeQuickRedirect, false, 81122, new Class[]{Throwable.class}, Void.TYPE).isSupported) {
                super.onThrowable(th2);
                this.b = th2;
            }
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class c implements Runnable {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ RecommendTabFragment b;

        public c(RecommendTabFragment recommendTabFragment) {
            this.b = recommendTabFragment;
        }

        public final void run() {
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81128, new Class[0], Void.TYPE).isSupported) {
                this.b.l.f();
                RecommendTabFragment recommendTabFragment = this.b;
                recommendTabFragment.l.d((RecyclerView) recommendTabFragment._$_findCachedViewById(R.id.recyclerView));
            }
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class d implements OnDuRefreshListener {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ RecommendTabFragment b;

        public d(RecommendTabFragment recommendTabFragment) {
            this.b = recommendTabFragment;
        }

        @Override // com.scwang.smartrefresh.layout.listener.OnRefreshListener
        public final void onRefresh(@NotNull RefreshLayout refreshLayout) {
            if (!PatchProxy.proxy(new Object[]{refreshLayout}, this, changeQuickRedirect, false, 81131, new Class[]{RefreshLayout.class}, Void.TYPE).isSupported) {
                RecommendTabFragment recommendTabFragment = this.b;
                if (recommendTabFragment.f11865q) {
                    recommendTabFragment.f11865q = false;
                } else {
                    fd.g.f32262a.c(true);
                }
                RecommendTabFragment recommendTabFragment2 = this.b;
                if (recommendTabFragment2.C) {
                    recommendTabFragment2.u(0);
                    ServiceManager.k().showGrowthRecommendView();
                } else {
                    recommendTabFragment2.C = true;
                }
                this.b.fetchData(true);
                MotionEvent motionEvent = this.b.r;
                if (motionEvent != null) {
                    fd.g gVar = fd.g.f32262a;
                    gVar.c(true);
                    gVar.d("200000", motionEvent, this.b.s, motionEvent, String.valueOf(System.currentTimeMillis()));
                }
                fd.g.f32262a.b(0);
                EventBus.b().f(new j(false));
            }
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class e implements LoadMoreHelper.LoadMoreListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ RecommendTabFragment f11871a;

        public e(RecommendTabFragment recommendTabFragment) {
            this.f11871a = recommendTabFragment;
        }

        @Override // com.shizhuang.duapp.common.helper.loadmore.LoadMoreHelper.LoadMoreListener
        public final void loadData(boolean z) {
            if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 81132, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
                RecommendTabFragment recommendTabFragment = this.f11871a;
                if (recommendTabFragment.K) {
                    recommendTabFragment.K = false;
                } else {
                    recommendTabFragment.fetchData(false);
                }
            }
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class f implements ExposureHelper.OnVisiblePositionListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ RecommendTabFragment f11872a;

        public f(RecommendTabFragment recommendTabFragment) {
            this.f11872a = recommendTabFragment;
        }

        @Override // com.shizhuang.duapp.common.helper.ExposureHelper.OnVisiblePositionListener
        public final void onVisiblePositionCallBack(@NotNull LinkedHashSet<Integer> linkedHashSet) {
            List<CommunityListItemModel> list;
            if (!PatchProxy.proxy(new Object[]{linkedHashSet}, this, changeQuickRedirect, false, 81133, new Class[]{LinkedHashSet.class}, Void.TYPE).isSupported) {
                try {
                    if (this.f11872a.isResumed() && (list = this.f11872a.j) != null) {
                        JSONArray jSONArray = new JSONArray();
                        new JSONArray();
                        int i = 0;
                        for (T t : linkedHashSet) {
                            int i3 = i + 1;
                            if (i < 0) {
                                CollectionsKt__CollectionsKt.throwIndexOverflow();
                            }
                            T t4 = t;
                            if (t4.intValue() < list.size()) {
                                CommunityListItemModel communityListItemModel = list.get(t4.intValue());
                                JSONObject jSONObject = new JSONObject();
                                zy.a aVar = zy.a.f40925a;
                                jSONObject.put("type", aVar.e(communityListItemModel));
                                jSONObject.put("uuid", aVar.d(communityListItemModel));
                                jSONObject.put("position", String.valueOf(t4.intValue() + 1));
                                if (this.f11872a.q()) {
                                    CommunityReasonModel reason = communityListItemModel.getReason();
                                    if (reason != null) {
                                        jSONObject.put("channel", reason.getChannel());
                                        jSONObject.put("newsType", reason.isNewProduct());
                                        h.c(jSONObject, "styleType", String.valueOf(reason.getReasonType()));
                                        h.c(jSONObject, "styleName", reason.getReasonDesc());
                                    }
                                    CommunityAdvModel hupuAdv = communityListItemModel.getHupuAdv();
                                    if (hupuAdv != null) {
                                        jSONObject.put("OperationPosition", String.valueOf(hupuAdv.getOrderBy()));
                                        jSONObject.put("hupuId", String.valueOf(hupuAdv.getAdvId()));
                                    }
                                    jSONObject.put("requestId", communityListItemModel.getRequestId());
                                } else {
                                    CommunityReasonModel reason2 = communityListItemModel.getReason();
                                    if (reason2 != null) {
                                        jSONObject.put("channel", reason2.getChannel());
                                        h.c(jSONObject, "styleType", String.valueOf(reason2.getReasonType()));
                                        h.c(jSONObject, "styleName", reason2.getReasonDesc());
                                    }
                                }
                                if (communityListItemModel.getRoom() != null) {
                                    LiveRoom room = communityListItemModel.getRoom();
                                    List<LiveTagModel> list2 = null;
                                    jSONObject.put("streamId", String.valueOf(room != null ? Integer.valueOf(room.streamLogId) : null));
                                    LiveRoom room2 = communityListItemModel.getRoom();
                                    if (room2 != null) {
                                        list2 = room2.speciallyTags;
                                    }
                                    jSONObject.put("liveinfo", qz.b.a(list2));
                                }
                                String acm = communityListItemModel.getAcm();
                                if (acm != null) {
                                    jSONObject.put("mopid", acm);
                                }
                                jSONObject.put("expoType", String.valueOf(this.f11872a.f11866u));
                                jSONArray.put(jSONObject);
                                if (t4.intValue() >= 8) {
                                    ServiceManager.k().showGrowthRecommendView();
                                }
                                a00.a.f1134a.a(communityListItemModel);
                            }
                            i = i3;
                        }
                        this.f11872a.v(list, linkedHashSet);
                        this.f11872a.f11866u = 0;
                    }
                } catch (JSONException e) {
                    fo.a.g(e, "推荐流曝光埋点crash", new Object[0]);
                }
            }
        }
    }

    /* compiled from: RecommendTabFragment.kt */
    public static final class g extends s<CommunityListModel> {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ RecommendTabFragment b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ String f11873c;
        public final /* synthetic */ l d;
        public final /* synthetic */ Throwable e;
        public final /* synthetic */ boolean f;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public g(RecommendTabFragment recommendTabFragment, String str, l lVar, Throwable th2, boolean z, View view) {
            super(view);
            this.b = recommendTabFragment;
            this.f11873c = str;
            this.d = lVar;
            this.e = th2;
            this.f = z;
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.s, td.a
        public void onBzError(@NotNull l<CommunityListModel> lVar) {
            if (!PatchProxy.proxy(new Object[]{lVar}, this, changeQuickRedirect, false, 81153, new Class[]{l.class}, Void.TYPE).isSupported) {
                super.onBzError(lVar);
                RecommendTabFragment recommendTabFragment = this.b;
                boolean z = this.f;
                if (!PatchProxy.proxy(new Object[]{lVar, new Byte(z ? (byte) 1 : 0)}, recommendTabFragment, RecommendTabFragment.changeQuickRedirect, false, 81076, new Class[]{l.class, Boolean.TYPE}, Void.TYPE).isSupported) {
                    ((ProgressWheel) recommendTabFragment._$_findCachedViewById(R.id.plLoading)).setVisibility(8);
                    BmLoggerViewModel i = recommendTabFragment.i();
                    String name = recommendTabFragment.z.getName();
                    if (name == null) {
                        name = "";
                    }
                    i.uploadFeedLoadError(name, lVar);
                    if (recommendTabFragment.n && z && recommendTabFragment.isResumed()) {
                        ((RecyclerView) recommendTabFragment._$_findCachedViewById(R.id.recyclerView)).post(new wz.e(recommendTabFragment));
                    }
                    if (z) {
                        recommendTabFragment.d = -1;
                    }
                    LoadMoreHelper loadMoreHelper = recommendTabFragment.k;
                    if (loadMoreHelper == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                    }
                    loadMoreHelper.b(recommendTabFragment.f11864h);
                }
            }
        }

        @Override // com.shizhuang.duapp.common.helper.net.facade.IViewHandler, td.a
        public void onSuccess(Object obj) {
            CommunityListModel communityListModel = (CommunityListModel) obj;
            if (!PatchProxy.proxy(new Object[]{communityListModel}, this, changeQuickRedirect, false, 81152, new Class[]{CommunityListModel.class}, Void.TYPE).isSupported) {
                super.onSuccess(communityListModel);
                BM.b community = BM.community();
                Pair[] pairArr = new Pair[6];
                pairArr[0] = TuplesKt.to(PushConstants.WEB_URL, this.f11873c);
                pairArr[1] = TuplesKt.to("response", nd.e.n(communityListModel));
                pairArr[2] = TuplesKt.to("name", String.valueOf(this.d.a()));
                pairArr[3] = TuplesKt.to("detail", this.d.c());
                Throwable th2 = this.e;
                pairArr[4] = TuplesKt.to("throwable_detail", th2 != null ? th2.getMessage() : null);
                pairArr[5] = TuplesKt.to("tab_id", this.b.t);
                community.c("community_recommend_feed_cdn", MapsKt__MapsKt.mapOf(pairArr));
                this.b.p(communityListModel, this.f, true);
            }
        }
    }

    public static void c(RecommendTabFragment recommendTabFragment) {
        if (!PatchProxy.proxy(new Object[0], recommendTabFragment, changeQuickRedirect, false, 81083, new Class[0], Void.TYPE).isSupported) {
            recommendTabFragment.i().setTabCreateTime();
            super.onResume();
            if (!PatchProxy.proxy(new Object[0], recommendTabFragment, changeQuickRedirect, false, 81084, new Class[0], Void.TYPE).isSupported && !recommendTabFragment.f11863g && !recommendTabFragment.N) {
                if (!recommendTabFragment.q()) {
                    ((ProgressWheel) recommendTabFragment._$_findCachedViewById(R.id.plLoading)).setVisibility(0);
                }
                recommendTabFragment.u(2);
                recommendTabFragment.A = true;
                recommendTabFragment.fetchData(true);
            }
            if (!PatchProxy.proxy(new Object[0], recommendTabFragment, changeQuickRedirect, false, 81085, new Class[0], Void.TYPE).isSupported) {
                if (recommendTabFragment.o) {
                    recommendTabFragment.r();
                    recommendTabFragment.o = false;
                } else if (System.currentTimeMillis() - recommendTabFragment.e < 600000 || recommendTabFragment.n) {
                    if (recommendTabFragment.f11863g) {
                        recommendTabFragment.f11866u = 1;
                        recommendTabFragment.f11867v = 1;
                    }
                    if (!recommendTabFragment.A) {
                        ((RecyclerView) recommendTabFragment._$_findCachedViewById(R.id.recyclerView)).post(new wz.d(recommendTabFragment));
                    } else {
                        recommendTabFragment.A = false;
                    }
                } else {
                    recommendTabFragment.r();
                }
                l30.b bVar = l30.b.f34999a;
                ArrayMap arrayMap = new ArrayMap(8);
                arrayMap.put("current_page", "89");
                if (l00.b.b()) {
                    arrayMap.put("visible_to", 4);
                } else {
                    arrayMap.put("community_tab_id", recommendTabFragment.z.getCId());
                    arrayMap.put("community_tab_title", recommendTabFragment.z.getName());
                    arrayMap.put("community_channel_id", SensorCommunityChannel.RECOMMEND.getId());
                    arrayMap.put("is_op", recommendTabFragment.z.getCType() == 2 ? "1" : "0");
                }
                bVar.b("community_pageview", arrayMap);
            }
            recommendTabFragment.f11863g = true;
            if (recommendTabFragment.isLoginStatusChanged() || !recommendTabFragment.isLogin()) {
                recommendTabFragment.n();
            }
        }
    }

    public static void d(RecommendTabFragment recommendTabFragment, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, recommendTabFragment, changeQuickRedirect, false, 81101, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            super.onCreate(bundle);
        }
    }

    public static void e(RecommendTabFragment recommendTabFragment) {
        if (!PatchProxy.proxy(new Object[0], recommendTabFragment, changeQuickRedirect, false, 81103, new Class[0], Void.TYPE).isSupported) {
            super.onStart();
        }
    }

    public static View f(RecommendTabFragment recommendTabFragment, LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{layoutInflater, viewGroup, bundle}, recommendTabFragment, changeQuickRedirect, false, 81105, new Class[]{LayoutInflater.class, ViewGroup.class, Bundle.class}, View.class);
        return proxy.isSupported ? (View) proxy.result : super.onCreateView(layoutInflater, viewGroup, bundle);
    }

    public static void g(RecommendTabFragment recommendTabFragment, View view, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{view, bundle}, recommendTabFragment, changeQuickRedirect, false, 81107, new Class[]{View.class, Bundle.class}, Void.TYPE).isSupported) {
            super.onViewCreated(view, bundle);
        }
    }

    public static final /* synthetic */ RecommendTrendAdapter h(RecommendTabFragment recommendTabFragment) {
        RecommendTrendAdapter recommendTrendAdapter = recommendTabFragment.m;
        if (recommendTrendAdapter == null) {
            Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
        }
        return recommendTrendAdapter;
    }

    public View _$_findCachedViewById(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 81098, new Class[]{Integer.TYPE}, View.class);
        if (proxy.isSupported) {
            return (View) proxy.result;
        }
        if (this.T == null) {
            this.T = new HashMap();
        }
        View view = (View) this.T.get(Integer.valueOf(i3));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i3);
        this.T.put(Integer.valueOf(i3), findViewById);
        return findViewById;
    }

    @Override // com.shizhuang.duapp.modules.du_community_common.interfaces.ITrendFragment
    public void doRefresh(int i3) {
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 81080, new Class[]{Integer.TYPE}, Void.TYPE).isSupported && ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)) != null) {
            ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).scrollToPosition(0);
            this.C = false;
            ((DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)).autoRefresh();
            u(i3);
        }
    }

    public final void fetchData(boolean z4) {
        int i3;
        boolean z5;
        Object[] objArr = {new Byte(z4 ? (byte) 1 : 0)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Boolean.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 81069, new Class[]{cls}, Void.TYPE).isSupported) {
            if (this.b) {
                this.b = false;
                ff.f e6 = ff.f.e();
                String str = "0";
                HashMap n12 = gy.a.n("String1", str);
                PatchProxyResult proxy = PatchProxy.proxy(new Object[]{"RecommendTabFragment"}, e6, ff.f.changeQuickRedirect, false, 9195, new Class[]{String.class}, cls);
                if (proxy.isSupported) {
                    z5 = ((Boolean) proxy.result).booleanValue();
                } else {
                    z5 = e6.f.containsKey("RecommendTabFragment");
                }
                if (z5) {
                    str = "1";
                }
                n12.put("String2", str);
                BM.community().c("community_home_cache", n12);
            }
            this.f11866u = 0;
            this.f11867v = 0;
            if (z4) {
                this.f11864h = "";
                this.w = false;
                this.x = false;
                this.y = false;
                this.l.e();
            }
            this.J = this.f11864h;
            this.d = z4 ? System.currentTimeMillis() : this.d;
            int i12 = (!Intrinsics.areEqual(this.f11864h, "1") || (i3 = this.i) <= -1) ? -1 : i3;
            this.P.setIsEnableWrite(z4);
            HomeTrendHelper.d.e(true);
            uz.a.getRecommendTabFeed(l(), this.f11864h, this.I, i12, false, new b(this, System.currentTimeMillis(), z4, (DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)).withCache((!q() || !z4) ? null : this.P));
            if (z4) {
                m().getTopStyle();
            }
        }
    }

    @Override // com.shizhuang.duapp.common.base.inter.IViewController, com.shizhuang.duapp.common.ui.BaseFragment
    public int getLayout() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81079, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.fragment_hot_list;
    }

    public final BmLoggerViewModel i() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81049, new Class[0], BmLoggerViewModel.class);
        return (BmLoggerViewModel) (proxy.isSupported ? proxy.result : this.D.getValue());
    }

    @Override // com.shizhuang.duapp.common.base.inter.IViewController, com.shizhuang.duapp.common.ui.BaseFragment
    public void initData() {
        CommunityListModel communityListModel;
        Context context;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81057, new Class[0], Void.TYPE).isSupported) {
            ((DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)).setDuRefreshListener(new d(this));
            ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).setLayoutManager(new StaggeredGridLayoutManager(this.O, 1));
            ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).setItemAnimator(null);
            ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).addItemDecoration(this.G);
            RecommendTrendAdapter recommendTrendAdapter = new RecommendTrendAdapter(2, this.z, (AppCompatActivity) getActivity(), this);
            this.m = recommendTrendAdapter;
            recommendTrendAdapter.setHasStableIds(true);
            RecyclerView recyclerView = (RecyclerView) _$_findCachedViewById(R.id.recyclerView);
            RecommendTrendAdapter recommendTrendAdapter2 = this.m;
            if (recommendTrendAdapter2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
            }
            recyclerView.setAdapter(recommendTrendAdapter2);
            CommunityCommonHelper communityCommonHelper = CommunityCommonHelper.f12820a;
            RecyclerView recyclerView2 = (RecyclerView) _$_findCachedViewById(R.id.recyclerView);
            if (!PatchProxy.proxy(new Object[]{recyclerView2}, communityCommonHelper, CommunityCommonHelper.changeQuickRedirect, false, 100729, new Class[]{RecyclerView.class}, Void.TYPE).isSupported) {
                recyclerView2.getRecycledViewPool().setMaxRecycledViews(60, 15);
                recyclerView2.getRecycledViewPool().setMaxRecycledViews(61, 15);
                recyclerView2.getRecycledViewPool().setMaxRecycledViews(62, 15);
                recyclerView2.getRecycledViewPool().setMaxRecycledViews(80, 15);
                recyclerView2.getRecycledViewPool().setMaxRecycledViews(81, 15);
                recyclerView2.getRecycledViewPool().setMaxRecycledViews(83, 15);
            }
            LoadMoreHelper g3 = LoadMoreHelper.g(new e(this), 12);
            this.k = g3;
            if (g3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
            }
            g3.d((RecyclerView) _$_findCachedViewById(R.id.recyclerView));
            LoadMoreHelper loadMoreHelper = this.k;
            if (loadMoreHelper == null) {
                Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
            }
            loadMoreHelper.j("暂时没有更多了");
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81064, new Class[0], Void.TYPE).isSupported) {
                new FeedVoteController(this, (RecyclerView) _$_findCachedViewById(R.id.recyclerView));
            }
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81065, new Class[0], Void.TYPE).isSupported && (context = getContext()) != null) {
                RecommendTrendAdapter recommendTrendAdapter3 = this.m;
                if (recommendTrendAdapter3 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                }
                wz.f fVar = new wz.f(this, context);
                if (!PatchProxy.proxy(new Object[]{fVar}, recommendTrendAdapter3, RecommendTrendAdapter.changeQuickRedirect, false, 80616, new Class[]{OnTrendClickListener.class}, Void.TYPE).isSupported) {
                    recommendTrendAdapter3.f11805c = fVar;
                }
            }
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81068, new Class[0], Void.TYPE).isSupported) {
                ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).addOnScrollListener(new RecommendTabFragment$initRecyclerViewTouch$1(this));
                Context context2 = getContext();
                if (context2 != null) {
                    ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).addOnItemTouchListener(new RecommendTabFragment$initRecyclerViewTouch$$inlined$let$lambda$1(context2, context2, "200000", this));
                }
            }
            this.l.h(new f(this));
            ExposureHelper exposureHelper = this.l;
            if (!PatchProxy.proxy(new Object[]{this}, exposureHelper, ExposureHelper.changeQuickRedirect, false, 4246, new Class[]{LifecycleOwner.class}, Void.TYPE).isSupported && exposureHelper.f7620h != this) {
                exposureHelper.f7620h = this;
                if (exposureHelper.i == null) {
                    exposureHelper.i = new ExposureHelper.PauseStateObserver(exposureHelper);
                }
                getLifecycle().addObserver(exposureHelper.i);
            }
            ExposureHelper exposureHelper2 = this.l;
            RecommendTabFragment$initData$4 recommendTabFragment$initData$4 = new RecommendTabFragment$initData$4(this);
            if (!PatchProxy.proxy(new Object[]{recommendTabFragment$initData$4}, exposureHelper2, ExposureHelper.changeQuickRedirect, false, 4241, new Class[]{ExposureHelper.OnNewVisiblePositionListener.class}, Void.TYPE).isSupported) {
                exposureHelper2.a();
                exposureHelper2.j.e(new r(recommendTabFragment$initData$4, 0));
            }
            ExposureHelper exposureHelper3 = this.l;
            RecommendTabFragment$initData$5 recommendTabFragment$initData$5 = new RecommendTabFragment$initData$5(this);
            if (!PatchProxy.proxy(new Object[]{recommendTabFragment$initData$5}, exposureHelper3, ExposureHelper.changeQuickRedirect, false, 4245, new Class[]{ExposureHelper.PositionAccessTimeListener.class}, Void.TYPE).isSupported) {
                exposureHelper3.a();
                exposureHelper3.j.f(new fd.s(recommendTabFragment$initData$5, 0));
            }
            this.l.i((RecyclerView) _$_findCachedViewById(R.id.recyclerView));
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81056, new Class[0], Void.TYPE).isSupported) {
                b30.c.b.a(String.valueOf(2), this).f((RecyclerView) _$_findCachedViewById(R.id.recyclerView), TuplesKt.to(Integer.valueOf((int) R.layout.du_trend_item_two_feed_image), 8), TuplesKt.to(Integer.valueOf((int) R.layout.du_trend_item_two_feed_video), 8)).l();
            }
            te1.e eVar = new te1.e();
            e.a aVar = te1.e.f38531h;
            te1.e a5 = eVar.e(aVar.d()).a(new b.a(MediaItemModel.class).c("cover").d(new j30.b(0, 1)).b());
            b.a aVar2 = new b.a(LiveRoom.class);
            int d12 = aVar.d();
            int d13 = (int) ((((float) aVar.d()) * 4.0f) / ((float) 3));
            Object[] objArr = {new Integer(d12), new Integer(d13)};
            ChangeQuickRedirect changeQuickRedirect2 = b.a.changeQuickRedirect;
            Class cls = Integer.TYPE;
            PatchProxyResult proxy = PatchProxy.proxy(objArr, aVar2, changeQuickRedirect2, false, 334205, new Class[]{cls, cls}, b.a.class);
            if (proxy.isSupported) {
                aVar2 = (b.a) proxy.result;
            } else {
                aVar2.e = d12;
                aVar2.f = d13;
                aVar2.d = false;
            }
            ListUrlLoader listUrlLoader = new ListUrlLoader(a5.a(aVar2.b()), (RecyclerView) _$_findCachedViewById(R.id.recyclerView), getViewLifecycleOwner(), getContext());
            listUrlLoader.d(32);
            listUrlLoader.e("twoFeed");
            RecyclerView recyclerView3 = (RecyclerView) _$_findCachedViewById(R.id.recyclerView);
            LifecycleOwner viewLifecycleOwner = getViewLifecycleOwner();
            aVar.d();
            Context context3 = recyclerView3.getContext();
            te1.e a12 = new te1.e().a(new b.a(CommunityFeedContentModel.class).d(new j30.d()).b());
            Context applicationContext = context3 != null ? context3.getApplicationContext() : null;
            if (applicationContext != null) {
                a12.f(new VideoPreLoader(applicationContext, 10));
                new ListUrlLoader(a12, recyclerView3, viewLifecycleOwner, context3).d(10);
                new ListUrlLoader(new te1.e().a(new b.a(CommunityFeedContentModel.class).d(new j30.c()).b()), recyclerView3, viewLifecycleOwner, context3).d(10);
                if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81062, new Class[0], Void.TYPE).isSupported && (communityListModel = k().getCacheDataMap().get(this.t)) != null) {
                    this.N = true;
                    o(communityListModel, true);
                }
                n();
                if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81058, new Class[0], Void.TYPE).isSupported) {
                    t(k().getLastTopStyleModel());
                    DuHttpRequest<TopStyleModel> topStyleRequest = m().getTopStyleRequest();
                    LifecycleOwner viewLifecycleOwner2 = getViewLifecycleOwner();
                    v20.j jVar = new v20.j(viewLifecycleOwner2, topStyleRequest.isShowErrorToast(), null);
                    Ref.BooleanRef booleanRef = new Ref.BooleanRef();
                    booleanRef.element = topStyleRequest.getMutableAllStateLiveData().getValue() instanceof DuHttpRequest.b.a;
                    topStyleRequest.getMutableAllStateLiveData().observe(i.f39125a.a(viewLifecycleOwner2), new RecommendTabFragment$initObserve$$inlined$observe$1(topStyleRequest, jVar, booleanRef, this));
                    return;
                }
                return;
            }
            throw new IllegalArgumentException("Required value was null.".toString());
        }
    }

    @Override // com.shizhuang.duapp.common.base.inter.IViewController, com.shizhuang.duapp.common.ui.BaseFragment
    public void initView(@org.jetbrains.annotations.Nullable Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 81054, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            Bundle arguments = getArguments();
            if (arguments != null) {
                this.t = arguments.getString("tabId", "");
                arguments.getString("name");
                Second second = (Second) arguments.getParcelable("tabTitle");
                if (second == null) {
                    second = new Second(null, null, 0, 0, null, null, 0, null, MotionEventCompat.ACTION_MASK, null);
                }
                this.z = second;
                arguments.getInt("tabPosition");
            }
            this.P.setEnableMemoryCache(true);
            this.O = t.f31465a.a(getActivity());
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81055, new Class[0], Void.TYPE).isSupported) {
                int d12 = n.d("blackAndWhite", "community", -1);
                if (q() && d12 > -1) {
                    ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).addOnChildAttachStateChangeListener(new RecommendTabFragment$initBlackWhite$1(this, d12));
                }
            }
        }
    }

    public final FeedLiveHelper j() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81052, new Class[0], FeedLiveHelper.class);
        return (FeedLiveHelper) (proxy.isSupported ? proxy.result : this.H.getValue());
    }

    public final HomeTrendViewModel k() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81051, new Class[0], HomeTrendViewModel.class);
        return (HomeTrendViewModel) (proxy.isSupported ? proxy.result : this.F.getValue());
    }

    public final String l() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81070, new Class[0], String.class);
        if (proxy.isSupported) {
            return (String) proxy.result;
        }
        if (q()) {
            return "";
        }
        return this.t;
    }

    public final TopStyleViewModel m() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81050, new Class[0], TopStyleViewModel.class);
        return (TopStyleViewModel) (proxy.isSupported ? proxy.result : this.E.getValue());
    }

    public final void n() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81061, new Class[0], Void.TYPE).isSupported) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81053, new Class[0], VisitorLoginNodeInfoModel.class);
            VisitorLoginNodeInfoModel visitorLoginNodeInfoModel = (VisitorLoginNodeInfoModel) (proxy.isSupported ? proxy.result : this.R.getValue());
            boolean z4 = true;
            if (visitorLoginNodeInfoModel == null || !visitorLoginNodeInfoModel.isFirstDay()) {
                z4 = false;
            }
            if (z4 && !isLogin()) {
                y0 y0Var = y0.f32302a;
                if (!y0Var.e() && y0Var.f() && this.S == null) {
                    fo.a.u("LoginSceneScrollContent111").i("RecommendTabFragment.addOnScrollListener", new Object[0]);
                    RecommendTabFragment$handleNewUserLoginSceneNode$scrollListener$1 recommendTabFragment$handleNewUserLoginSceneNode$scrollListener$1 = new RecommendTabFragment$handleNewUserLoginSceneNode$scrollListener$1(this);
                    this.S = recommendTabFragment$handleNewUserLoginSceneNode$scrollListener$1;
                    ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).addOnScrollListener(recommendTabFragment$handleNewUserLoginSceneNode$scrollListener$1);
                }
            }
        }
    }

    public final void o(CommunityListModel communityListModel, boolean z4) {
        if (!PatchProxy.proxy(new Object[]{communityListModel, new Byte(z4 ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 81077, new Class[]{CommunityListModel.class, Boolean.TYPE}, Void.TYPE).isSupported) {
            this.Q = communityListModel.getDebugToolBase();
            this.f11864h = communityListModel.getSafeLastId();
            if (!z4) {
                ArrayList<CommunityListItemModel> safeList = communityListModel.getSafeList();
                ArrayList arrayList = new ArrayList();
                int i3 = 0;
                for (T t4 : safeList) {
                    int i12 = i3 + 1;
                    if (i3 < 0) {
                        CollectionsKt__CollectionsKt.throwIndexOverflow();
                    }
                    T t12 = t4;
                    boolean areEqual = Intrinsics.areEqual(zy.a.f40925a.d(t12), "0");
                    if (areEqual) {
                        BM.community().c("community_recommend_exposure_error", MapsKt__MapsKt.mapOf(TuplesKt.to("position", String.valueOf(i3)), TuplesKt.to("source", "cache")));
                    } else {
                        t12.setRequestId(communityListModel.getRequestId());
                    }
                    if (!areEqual) {
                        arrayList.add(t4);
                    }
                    i3 = i12;
                }
                communityListModel.setList(new ArrayList<>(arrayList));
            }
            RecommendTrendAdapter recommendTrendAdapter = this.m;
            if (recommendTrendAdapter == null) {
                Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
            }
            recommendTrendAdapter.setItems(communityListModel.getSafeList());
            j().a((RecyclerView) _$_findCachedViewById(R.id.recyclerView));
            i().uploadTabLoadTime(true);
            BmLoggerViewModel i13 = i();
            String name = this.z.getName();
            if (name == null) {
                name = "";
            }
            i13.uploadFeedLoadTime(true, name);
            RecommendTrendAdapter recommendTrendAdapter2 = this.m;
            if (recommendTrendAdapter2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
            }
            this.j = recommendTrendAdapter2.getList();
            if (z4) {
                LoadMoreHelper loadMoreHelper = this.k;
                if (loadMoreHelper == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                }
                loadMoreHelper.b(this.f11864h);
            }
        }
    }

    @Override // androidx.fragment.app.Fragment
    public void onConfigurationChanged(@NotNull Configuration configuration) {
        if (!PatchProxy.proxy(new Object[]{configuration}, this, changeQuickRedirect, false, 81097, new Class[]{Configuration.class}, Void.TYPE).isSupported) {
            super.onConfigurationChanged(configuration);
            int a5 = t.f31465a.a(getActivity());
            if (this.O != a5) {
                this.O = a5;
                ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).setLayoutManager(new StaggeredGridLayoutManager(this.O, 1));
                RecommendTrendAdapter recommendTrendAdapter = this.m;
                if (recommendTrendAdapter == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                }
                recommendTrendAdapter.notifyDataSetChanged();
            }
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onCreate(Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 81100, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onCreate(this, bundle);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{layoutInflater, viewGroup, bundle}, this, changeQuickRedirect, false, 81104, new Class[]{LayoutInflater.class, ViewGroup.class, Bundle.class}, View.class);
        return proxy.isSupported ? (View) proxy.result : _boostWeave.FragmentMethodWeaver_onCreateView(this, layoutInflater, viewGroup, bundle);
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onDestroyView() {
        HashMap hashMap;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81095, new Class[0], Void.TYPE).isSupported) {
            this.l.c((RecyclerView) _$_findCachedViewById(R.id.recyclerView));
            super.onDestroyView();
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81099, new Class[0], Void.TYPE).isSupported && (hashMap = this.T) != null) {
                hashMap.clear();
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:25:0x0065  */
    /* JADX WARNING: Removed duplicated region for block: B:30:? A[RETURN, SYNTHETIC] */
    @Subscribe(threadMode = ThreadMode.MAIN)
    public final void onEvent(@NotNull k kVar) {
        boolean z4;
        boolean z5 = true;
        if (!PatchProxy.proxy(new Object[]{kVar}, this, changeQuickRedirect, false, 81090, new Class[]{k.class}, Void.TYPE).isSupported) {
            if (kVar.f40641a != 2 || System.currentTimeMillis() - this.e < ((long) 1000)) {
                int i3 = kVar.f40641a;
                if (i3 == 3) {
                    this.p = true;
                } else if (i3 == 4 && q()) {
                    z4 = true;
                    if (!z4) {
                        if (isResumed()) {
                            r();
                            z5 = false;
                        }
                        this.o = z5;
                        return;
                    }
                    return;
                } else if (kVar.f40641a == 5 && q() && isResumed()) {
                    r();
                    o0.b("community_page_gesture_slide", RecommendTabFragment$onEvent$1.INSTANCE);
                }
            } else {
                this.A = true;
            }
            z4 = false;
            if (!z4) {
            }
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, com.shizhuang.duapp.common.base.inter.ILoginState
    public void onLogin() {
        boolean z4 = false;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81093, new Class[0], Void.TYPE).isSupported) {
            super.onLogin();
            if (this.p) {
                this.p = false;
                return;
            }
            if (isResumed()) {
                r();
            } else {
                z4 = true;
            }
            this.o = z4;
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, com.shizhuang.duapp.common.base.inter.ILoginState
    public void onLogout() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81094, new Class[0], Void.TYPE).isSupported) {
            super.onLogout();
            this.o = true;
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onPause() {
        CommunityListItemModel communityListItemModel;
        int i3;
        boolean z4 = false;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81086, new Class[0], Void.TYPE).isSupported) {
            super.onPause();
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81087, new Class[0], Void.TYPE).isSupported) {
                long remainTime = getRemainTime();
                this.e = System.currentTimeMillis();
                this.d = -1;
                this.w = false;
                this.x = false;
                this.y = false;
                if (remainTime != 0) {
                    if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81088, new Class[0], Void.TYPE).isSupported) {
                        LoadMoreHelper loadMoreHelper = this.k;
                        if (loadMoreHelper == null) {
                            Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                        }
                        Class cls = Integer.TYPE;
                        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], loadMoreHelper, LoadMoreHelper.changeQuickRedirect, false, 5390, new Class[0], cls);
                        if (proxy.isSupported) {
                            i3 = ((Integer) proxy.result).intValue();
                        } else {
                            i3 = loadMoreHelper.d.a();
                        }
                        HashMap hashMap = new HashMap();
                        hashMap.put("recommend_loadmore_req_times", String.valueOf(this.f));
                        hashMap.put("recommend_loadmore_appear_times", String.valueOf(i3));
                        if (i3 > 0 || this.f > 0) {
                            BM.b community = BM.community();
                            community.f8605c.set(Float.valueOf(0.1f));
                            community.c("community_recommend_feed_more", MapsKt__MapsKt.mapOf(TuplesKt.to("recommend_loadmore_req_times", String.valueOf(this.f)), TuplesKt.to("recommend_loadmore_appear_times", String.valueOf(i3))));
                        }
                        this.f = 0;
                        LoadMoreHelper loadMoreHelper2 = this.k;
                        if (loadMoreHelper2 == null) {
                            Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                        }
                        if (!PatchProxy.proxy(new Object[]{new Integer(0)}, loadMoreHelper2, LoadMoreHelper.changeQuickRedirect, false, 5391, new Class[]{cls}, Void.TYPE).isSupported) {
                            loadMoreHelper2.d.b(0);
                        }
                    }
                    DecimalFormat decimalFormat = new DecimalFormat("0.000", DecimalFormatSymbols.getInstance(Locale.CHINA));
                    l30.b bVar = l30.b.f34999a;
                    ArrayMap arrayMap = new ArrayMap(8);
                    if ("89".length() > 0) {
                        z4 = true;
                    }
                    if (z4) {
                        arrayMap.put("current_page", "89");
                    }
                    arrayMap.put("community_channel_id", SensorCommunityChannel.RECOMMEND.getId());
                    arrayMap.put("community_tab_id", this.z.getCId());
                    arrayMap.put("community_tab_title", this.z.getName());
                    arrayMap.put("view_duration", decimalFormat.format(Float.valueOf(((float) remainTime) / ((float) 1000))));
                    arrayMap.put("is_op", this.z.getCType() == 2 ? "1" : "0");
                    List<CommunityListItemModel> list = this.j;
                    p0.a(arrayMap, "acm", (list == null || (communityListItemModel = (CommunityListItemModel) CollectionsKt___CollectionsKt.firstOrNull(list)) == null) ? null : communityListItemModel.getAcm());
                    bVar.b("community_duration_pageview", arrayMap);
                }
            }
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onResume() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81082, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onResume(this);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onStart() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81102, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onStart(this);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onViewCreated(View view, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{view, bundle}, this, changeQuickRedirect, false, 81106, new Class[]{View.class, Bundle.class}, Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onViewCreated(this, view, bundle);
        }
    }

    public final void p(@org.jetbrains.annotations.Nullable CommunityListModel communityListModel, boolean z4, boolean z5) {
        NpsDetailModel d12;
        int showPosition;
        Object[] objArr = {communityListModel, new Byte(z4 ? (byte) 1 : 0), new Byte(z5 ? (byte) 1 : 0)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Boolean.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 81072, new Class[]{CommunityListModel.class, cls, cls}, Void.TYPE).isSupported) {
            ((ProgressWheel) _$_findCachedViewById(R.id.plLoading)).setVisibility(8);
            if (communityListModel != null) {
                ArrayList<CommunityListItemModel> list = communityListModel.getList();
                if (list != null) {
                    int i3 = 0;
                    for (T t4 : list) {
                        int i12 = i3 + 1;
                        if (i3 < 0) {
                            CollectionsKt__CollectionsKt.throwIndexOverflow();
                        }
                        t4.setRelativePosition(i12);
                        i3 = i12;
                    }
                }
                this.Q = communityListModel.getDebugToolBase();
                ArrayList<CommunityListItemModel> safeList = communityListModel.getSafeList();
                ArrayList arrayList = new ArrayList();
                int i13 = 0;
                for (T t12 : safeList) {
                    int i14 = i13 + 1;
                    if (i13 < 0) {
                        CollectionsKt__CollectionsKt.throwIndexOverflow();
                    }
                    T t13 = t12;
                    boolean areEqual = Intrinsics.areEqual(zy.a.f40925a.d(t13), "0");
                    boolean z12 = t13.getNpsInfo() != null;
                    if (areEqual) {
                        BM.community().c("community_recommend_exposure_error", MapsKt__MapsJVMKt.mapOf(TuplesKt.to("position", String.valueOf(i13))));
                    } else {
                        t13.setRequestId(communityListModel.getRequestId());
                    }
                    if (!areEqual || z12) {
                        arrayList.add(t12);
                    }
                    i13 = i14;
                }
                communityListModel.setList(new ArrayList<>(arrayList));
                this.f11864h = communityListModel.getSafeLastId();
                this.i = communityListModel.getPage();
                this.M = communityListModel.getCdnLastId();
                if (z4) {
                    ServiceManager.I().clearDewuTabRedDot();
                    if (!PatchProxy.proxy(new Object[]{communityListModel}, this, changeQuickRedirect, false, 81075, new Class[]{CommunityListModel.class}, Void.TYPE).isSupported) {
                        CommunityListModel communityListModel2 = new CommunityListModel(null, null, null, null, null, 0, null, null, 0, 0, 0, 0, null, 0, null, 0, 65535, null);
                        communityListModel2.setLastId(communityListModel.getLastId());
                        communityListModel2.setDebugToolBase(communityListModel.getDebugToolBase());
                        communityListModel2.setPreloadCardNum(communityListModel.getPreloadCardNum());
                        int size = communityListModel.getSafeList().size();
                        if (size > 0) {
                            communityListModel2.getSafeList().addAll(communityListModel.getSafeList().subList(0, RangesKt___RangesKt.coerceAtMost(size, 20)));
                        }
                        k().getCacheDataMap().put(this.t, communityListModel2);
                    }
                    RecommendTrendAdapter recommendTrendAdapter = this.m;
                    if (recommendTrendAdapter == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                    }
                    recommendTrendAdapter.setItems(communityListModel.getSafeList());
                    j().a((RecyclerView) _$_findCachedViewById(R.id.recyclerView));
                } else {
                    this.f++;
                    this.L.clear();
                    this.L.addAll(communityListModel.getSafeList());
                    RecommendTrendAdapter recommendTrendAdapter2 = this.m;
                    if (recommendTrendAdapter2 == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                    }
                    recommendTrendAdapter2.appendItems(communityListModel.getSafeList());
                }
                if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81073, new Class[0], Void.TYPE).isSupported && q()) {
                    m mVar = m.f40182a;
                    mVar.a();
                    if (!b0.h().getBoolean("nps_has_show_key", false) && (d12 = mVar.d()) != null && (Intrinsics.areEqual(d12.getShowType(), "1") || Intrinsics.areEqual(d12.getShowType(), PushConstants.PUSH_FLYME_3_CHANGE_VERSION_START))) {
                        if (!PatchProxy.proxy(new Object[]{d12}, this, changeQuickRedirect, false, 81074, new Class[]{NpsDetailModel.class}, Void.TYPE).isSupported && !mVar.c() && (showPosition = d12.getShowPosition()) > 0) {
                            int i15 = showPosition - 1;
                            RecommendTrendAdapter recommendTrendAdapter3 = this.m;
                            if (recommendTrendAdapter3 == null) {
                                Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                            }
                            if (i15 <= recommendTrendAdapter3.getList().size()) {
                                CommunityListItemModel b2 = mVar.b();
                                if (b2 != null) {
                                    RecommendTrendAdapter recommendTrendAdapter4 = this.m;
                                    if (recommendTrendAdapter4 == null) {
                                        Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                                    }
                                    recommendTrendAdapter4.getList().add(i15, b2);
                                    mVar.g(true);
                                }
                                RecommendTrendAdapter recommendTrendAdapter5 = this.m;
                                if (recommendTrendAdapter5 == null) {
                                    Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                                }
                                recommendTrendAdapter5.notifyDataSetChanged();
                            }
                        }
                    }
                }
                i().uploadTabLoadTime(false);
                BmLoggerViewModel i16 = i();
                String name = this.z.getName();
                if (name == null) {
                    name = "";
                }
                i16.uploadFeedLoadTime(false, name);
                ((DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)).finishRefresh();
                if (z5) {
                    LoadMoreHelper loadMoreHelper = this.k;
                    if (loadMoreHelper == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                    }
                    loadMoreHelper.b(String.valueOf(this.M));
                } else {
                    LoadMoreHelper loadMoreHelper2 = this.k;
                    if (loadMoreHelper2 == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("loadMoreHelper");
                    }
                    loadMoreHelper2.b(this.f11864h);
                }
                RecommendTrendAdapter recommendTrendAdapter6 = this.m;
                if (recommendTrendAdapter6 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                }
                this.j = recommendTrendAdapter6.getList();
                if (z4 && isResumed()) {
                    ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).post(new c(this));
                }
                this.n = false;
            }
        }
    }

    public final boolean q() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81071, new Class[0], Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        if (!Intrinsics.areEqual(this.t, "200000") && this.t.length() != 0) {
            return false;
        }
        return true;
    }

    public final void r() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 81081, new Class[0], Void.TYPE).isSupported) {
            this.l.g(false);
            ((RecyclerView) _$_findCachedViewById(R.id.recyclerView)).scrollToPosition(0);
            this.l.f();
            this.l.g(true);
            this.n = true;
            u(2);
            fetchData(true);
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public final void refreshListFromDetail(@NotNull zc.e eVar) {
        int i3 = 0;
        if (!PatchProxy.proxy(new Object[]{eVar}, this, changeQuickRedirect, false, 81089, new Class[]{zc.e.class}, Void.TYPE).isSupported) {
            CommunityCommonDelegate communityCommonDelegate = CommunityCommonDelegate.f12815a;
            RecommendTrendAdapter recommendTrendAdapter = this.m;
            if (recommendTrendAdapter == null) {
                Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
            }
            if (!PatchProxy.proxy(new Object[]{recommendTrendAdapter, eVar, new Byte((byte) 0)}, communityCommonDelegate, CommunityCommonDelegate.changeQuickRedirect, false, 100677, new Class[]{DuListAdapter.class, zc.e.class, Boolean.TYPE}, Void.TYPE).isSupported) {
                if (eVar.c()) {
                    ArrayList list = recommendTrendAdapter.getList();
                    if (!ei.a.c(list)) {
                        int size = list.size();
                        while (i3 < size) {
                            CommunityFeedModel feed = ((CommunityListItemModel) list.get(i3)).getFeed();
                            if (feed == null || !Intrinsics.areEqual(feed.getContent().getContentId(), eVar.b())) {
                                i3++;
                            } else {
                                list.remove(i3);
                                recommendTrendAdapter.notifyDataSetChanged();
                                return;
                            }
                        }
                        return;
                    }
                    return;
                }
                ArrayList list2 = recommendTrendAdapter.getList();
                int size2 = list2.size();
                while (i3 < size2) {
                    CommunityFeedModel feed2 = ((CommunityListItemModel) list2.get(i3)).getFeed();
                    if (feed2 != null && Intrinsics.areEqual(feed2.getContent().getContentId(), eVar.b())) {
                        if (eVar.e() > -1) {
                            feed2.getSafeCounter().setReplyNum(eVar.e());
                        }
                        if (eVar.d() > -1) {
                            feed2.getSafeCounter().setLightNum(eVar.d());
                        }
                        if (eVar.f() > -1) {
                            feed2.getSafeCounter().setShareNum(eVar.f());
                        }
                        if (eVar.a() > -1) {
                            feed2.getSafeCounter().setCollectNum(eVar.a());
                        }
                        if (eVar.i() > -1) {
                            feed2.getSafeInteract().setFollow(eVar.i());
                        }
                        if (eVar.j() > -1) {
                            feed2.getSafeInteract().setLight(eVar.j());
                        }
                        if (eVar.h() > -1) {
                            feed2.getSafeInteract().setCollect(eVar.h());
                        }
                        recommendTrendAdapter.notifyItemChanged(i3);
                    }
                    i3++;
                }
            }
        }
    }

    public final void s(@NotNull l<CommunityListModel> lVar, boolean z4, @org.jetbrains.annotations.Nullable Throwable th2) {
        String str;
        if (!PatchProxy.proxy(new Object[]{lVar, new Byte(z4 ? (byte) 1 : 0), th2}, this, changeQuickRedirect, false, 81078, new Class[]{l.class, Boolean.TYPE, Throwable.class}, Void.TYPE).isSupported) {
            long currentTimeMillis = System.currentTimeMillis() / 3600000;
            if (q()) {
                StringBuilder h12 = a.f.h("https://community.dewu.com/recommend/08a151e15e01f333ce9b11b97fb9083e.");
                h12.append(this.M);
                h12.append("?v=");
                h12.append(currentTimeMillis);
                str = h12.toString();
            } else {
                StringBuilder h13 = a.f.h("https://community.dewu.com/recommend/fd87a5fdaa7b98862408ff6d7d853488.");
                h13.append(this.t);
                h13.append('.');
                h13.append(this.M);
                h13.append("?v=");
                h13.append(currentTimeMillis);
                str = h13.toString();
            }
            uz.a.getCdnRecommendData(this.M, currentTimeMillis, l(), new g(this, str, lVar, th2, z4, (DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)));
        }
    }

    public final void t(TopStyleModel topStyleModel) {
        if (!PatchProxy.proxy(new Object[]{topStyleModel}, this, changeQuickRedirect, false, 81059, new Class[]{TopStyleModel.class}, Void.TYPE).isSupported) {
            if (topStyleModel != null) {
                ((DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)).setPrimaryColor(topStyleModel.getTabGradientColorInt());
                if (q()) {
                    this.G.a(Integer.valueOf(topStyleModel.getTabGradientColorInt()));
                    return;
                }
                return;
            }
            ((DuSmartLayout) _$_findCachedViewById(R.id.refreshLayout)).setPrimaryColor(getResources().getColor(R.color.color_f8fafc));
            if (q()) {
                this.G.a(null);
            }
        }
    }

    public final void u(int i3) {
        String str;
        boolean z4 = false;
        if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 81096, new Class[]{Integer.TYPE}, Void.TYPE).isSupported) {
            l30.b bVar = l30.b.f34999a;
            ArrayMap arrayMap = new ArrayMap(8);
            if ("89".length() > 0) {
                arrayMap.put("current_page", "89");
            }
            if ("".length() > 0) {
                z4 = true;
            }
            if (z4) {
                arrayMap.put("block_type", "");
            }
            if (i3 == 0) {
                str = SensorRefreshType.TYPE_PULL.getType();
            } else if (i3 == 1) {
                str = SensorRefreshType.TYPE_CLICK_BOTTOM_TAB.getType();
            } else if (i3 == 2) {
                str = SensorRefreshType.TYPE_AUTO.getType();
            } else if (i3 != 3) {
                str = SensorRefreshType.TYPE_PULL.getType();
            } else {
                str = SensorRefreshType.TYPE_CLICK_TOP_TAB.getType();
            }
            arrayMap.put("community_tab_id", this.t);
            arrayMap.put("community_tab_title", this.z.getName());
            arrayMap.put("community_channel_id", SensorCommunityChannel.RECOMMEND.getId());
            arrayMap.put("refresh_type", str);
            bVar.b("community_page_refresh_click", arrayMap);
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:63:0x01d6, code lost:
        if ((r5 != null ? r5.commentInfo : null) != null) goto L_0x01da;
     */
    /* JADX WARNING: Removed duplicated region for block: B:52:0x0198  */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x01bd  */
    /* JADX WARNING: Removed duplicated region for block: B:56:0x01bf  */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x01cb  */
    /* JADX WARNING: Removed duplicated region for block: B:74:0x01fa  */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x021a  */
    /* JADX WARNING: Removed duplicated region for block: B:80:0x022c  */
    /* JADX WARNING: Removed duplicated region for block: B:98:0x0246 A[SYNTHETIC] */
    public final void v(List<CommunityListItemModel> list, LinkedHashSet<Integer> linkedHashSet) {
        boolean z4;
        RecommendTabFragment recommendTabFragment;
        Object obj;
        Iterator<T> it2;
        NpsInfo npsInfo;
        CommunityReasonModel reason;
        TrendTagModel tag;
        LiveCommentateInfo liveCommentateInfo;
        int commentateId;
        List<CommunityListItemModel> list2 = list;
        if (!PatchProxy.proxy(new Object[]{list2, linkedHashSet}, this, changeQuickRedirect, false, 81063, new Class[]{List.class, LinkedHashSet.class}, Void.TYPE).isSupported) {
            sz.a aVar = sz.a.f38301a;
            int i3 = this.f11866u;
            Second second = this.z;
            boolean z5 = this.y;
            if (PatchProxy.proxy(new Object[]{list2, linkedHashSet, new Integer(i3), second, new Byte(z5 ? (byte) 1 : 0)}, aVar, sz.a.changeQuickRedirect, false, 80534, new Class[]{List.class, LinkedHashSet.class, Integer.TYPE, Second.class, Boolean.TYPE}, Void.TYPE).isSupported) {
                recommendTabFragment = this;
                z4 = false;
            } else {
                JSONArray jSONArray = new JSONArray();
                JSONArray jSONArray2 = new JSONArray();
                Iterator<T> it3 = linkedHashSet.iterator();
                int i12 = 0;
                while (true) {
                    obj = "";
                    if (!it3.hasNext()) {
                        break;
                    }
                    T next = it3.next();
                    int i13 = i12 + 1;
                    if (i12 < 0) {
                        CollectionsKt__CollectionsKt.throwIndexOverflow();
                    }
                    int intValue = next.intValue();
                    if (intValue >= list.size()) {
                        it2 = it3;
                    } else {
                        CommunityListItemModel communityListItemModel = list2.get(intValue);
                        JSONObject jSONObject = new JSONObject();
                        Integer coverBuriedPoint = communityListItemModel.getCoverBuriedPoint();
                        String str = null;
                        h.c(jSONObject, "content_cover_type", coverBuriedPoint != null ? String.valueOf(coverBuriedPoint.intValue()) : null);
                        zy.a aVar2 = zy.a.f40925a;
                        jSONObject.put("author_id", aVar2.f(communityListItemModel));
                        jSONObject.put("author_name", aVar2.g(communityListItemModel));
                        jSONObject.put("content_id", aVar2.h(communityListItemModel));
                        jSONObject.put("content_type", aVar2.k(communityListItemModel));
                        jSONObject.put("position", String.valueOf(intValue + 1));
                        LiveRoom room = communityListItemModel.getRoom();
                        if (room == null) {
                            CommunityReasonModel reason2 = communityListItemModel.getReason();
                            it2 = it3;
                            if (reason2 != null) {
                                jSONObject.put("algorithm_channel_id", reason2.getChannel());
                                Object reasonDesc = reason2.getReasonDesc();
                                if (reasonDesc != null) {
                                    obj = reasonDesc;
                                }
                                jSONObject.put("recommend_tag", obj);
                                jSONObject.put("recommend_tag_type", String.valueOf(reason2.getReasonType()));
                            }
                        } else {
                            it2 = it3;
                            CommunityReasonModel reason3 = communityListItemModel.getReason();
                            jSONObject.put("algorithm_channel_id", reason3 != null ? reason3.getChannel() : null);
                            List<LiveTagModel> list3 = room.speciallyTags;
                            if (list3 != null) {
                                qz.b bVar = qz.b.f37569a;
                                ArrayList arrayList = new ArrayList();
                                for (Iterator<T> it4 = list3.iterator(); it4.hasNext(); it4 = it4) {
                                    T next2 = it4.next();
                                    if (!(next2.type == 4)) {
                                        arrayList.add(next2);
                                    }
                                }
                                String b2 = bVar.b((LiveTagModel) CollectionsKt___CollectionsKt.firstOrNull((List) arrayList));
                                if (b2.length() > 0) {
                                    jSONObject.put("recommend_tag", b2);
                                    jSONObject.put("recommend_tag_type", "5");
                                }
                                npsInfo = communityListItemModel.getNpsInfo();
                                if (npsInfo != null) {
                                    jSONObject.put("content_url", npsInfo.getJumpUrl());
                                }
                                jSONObject.put("algorithm_request_id", communityListItemModel.getRequestId());
                                jSONObject.put("is_bargains_rush", communityListItemModel.isBargainsRush());
                                Object obj2 = "1";
                                jSONObject.put("is_brand_entrance", communityListItemModel.getBrandInfo() == null ? obj2 : "0");
                                if (communityListItemModel.getRoom() != null) {
                                    LiveRoom room2 = communityListItemModel.getRoom();
                                }
                                obj2 = "0";
                                jSONObject.put("is_recall_spu", obj2);
                                LiveRoom room3 = communityListItemModel.getRoom();
                                if (!(room3 == null || (liveCommentateInfo = room3.commentInfo) == null || (commentateId = liveCommentateInfo.getCommentateId()) <= 0)) {
                                    jSONObject.put("expound_id", commentateId);
                                }
                                reason = communityListItemModel.getReason();
                                if (reason != null) {
                                    str = reason.getChannel();
                                }
                                jSONObject.put("is_op", Intrinsics.areEqual(str, "LOP") ? 1 : 0);
                                h.c(jSONObject, "acm", communityListItemModel.getAcm());
                                if (communityListItemModel.getRelativePosition() != 0) {
                                    jSONObject.put("relative_position", communityListItemModel.getRelativePosition());
                                }
                                jSONArray.put(jSONObject);
                                tag = communityListItemModel.getTag();
                                if (tag == null) {
                                    JSONObject jSONObject2 = new JSONObject();
                                    jSONObject2.put("label_id", tag.tagId);
                                    int i14 = tag.relatedActivity;
                                    if (i14 > 0) {
                                        jSONObject2.put("activity_id", i14);
                                    }
                                    Unit unit = Unit.INSTANCE;
                                    jSONArray2.put(jSONObject2);
                                }
                            }
                        }
                        npsInfo = communityListItemModel.getNpsInfo();
                        if (npsInfo != null) {
                        }
                        jSONObject.put("algorithm_request_id", communityListItemModel.getRequestId());
                        jSONObject.put("is_bargains_rush", communityListItemModel.isBargainsRush());
                        Object obj22 = "1";
                        jSONObject.put("is_brand_entrance", communityListItemModel.getBrandInfo() == null ? obj22 : "0");
                        if (communityListItemModel.getRoom() != null) {
                        }
                        obj22 = "0";
                        jSONObject.put("is_recall_spu", obj22);
                        LiveRoom room32 = communityListItemModel.getRoom();
                        jSONObject.put("expound_id", commentateId);
                        reason = communityListItemModel.getReason();
                        if (reason != null) {
                        }
                        jSONObject.put("is_op", Intrinsics.areEqual(str, "LOP") ? 1 : 0);
                        h.c(jSONObject, "acm", communityListItemModel.getAcm());
                        if (communityListItemModel.getRelativePosition() != 0) {
                        }
                        jSONArray.put(jSONObject);
                        tag = communityListItemModel.getTag();
                        if (tag == null) {
                        }
                    }
                    list2 = list;
                    it3 = it2;
                    i12 = i13;
                }
                ArrayMap arrayMap = new ArrayMap(8);
                arrayMap.put("current_page", "89");
                arrayMap.put("block_type", "137");
                arrayMap.put("community_exposure_type", Integer.valueOf(i3));
                arrayMap.put("community_tab_id", second.getCId());
                arrayMap.put("community_tab_title", second.getName());
                SensorCommunityChannel sensorCommunityChannel = SensorCommunityChannel.RECOMMEND;
                arrayMap.put("community_channel_id", sensorCommunityChannel.getId());
                arrayMap.put("community_content_info_list", jSONArray.toString());
                SensorContentArrangeStyle sensorContentArrangeStyle = SensorContentArrangeStyle.TWO_LINE;
                arrayMap.put("content_arrange_style", sensorContentArrangeStyle.getType());
                arrayMap.put("is_up", (z5 ? SensorSlideIsUp.SLIDE_UP : SensorSlideIsUp.SLIDE_DOWN).getType());
                l30.b bVar2 = l30.b.f34999a;
                bVar2.b("community_content_exposure", arrayMap);
                if (jSONArray2.length() > 0) {
                    ArrayMap arrayMap2 = new ArrayMap(8);
                    arrayMap2.put("current_page", "89");
                    arrayMap2.put("block_type", "137");
                    h.b(arrayMap2, "associated_content_id", obj);
                    h.b(arrayMap2, "associated_content_type", obj);
                    h.b(arrayMap2, "community_tab_title", second.getName());
                    h.b(arrayMap2, "community_channel_id", sensorCommunityChannel.getId());
                    h.b(arrayMap2, "community_content_info_list", jSONArray2.toString());
                    h.b(arrayMap2, "content_arrange_style", sensorContentArrangeStyle.getType());
                    bVar2.b("community_label_exposure", arrayMap2);
                }
                z4 = false;
                recommendTabFragment = this;
            }
            recommendTabFragment.y = z4;
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public final void onEvent(@NotNull zc.m mVar) {
        if (!PatchProxy.proxy(new Object[]{mVar}, this, changeQuickRedirect, false, 81091, new Class[]{zc.m.class}, Void.TYPE).isSupported) {
            this.f11865q = true;
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public final void onEvent(@NotNull r20.e eVar) {
        NpsDetailModel d12;
        if (!PatchProxy.proxy(new Object[]{eVar}, this, changeQuickRedirect, false, 81092, new Class[]{r20.e.class}, Void.TYPE).isSupported && q() && eVar.f37610a == 2) {
            m mVar = m.f40182a;
            if (mVar.c() && (d12 = mVar.d()) != null) {
                RecommendTrendAdapter recommendTrendAdapter = this.m;
                if (recommendTrendAdapter == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                }
                recommendTrendAdapter.getList().remove(d12.getShowPosition() - 1);
                mVar.g(false);
            }
            CommunityListItemModel b2 = mVar.b();
            if (b2 != null) {
                int i3 = eVar.b + 1;
                RecommendTrendAdapter recommendTrendAdapter2 = this.m;
                if (recommendTrendAdapter2 == null) {
                    Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                }
                if (i3 <= recommendTrendAdapter2.getList().size()) {
                    RecommendTrendAdapter recommendTrendAdapter3 = this.m;
                    if (recommendTrendAdapter3 == null) {
                        Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
                    }
                    recommendTrendAdapter3.getList().add(eVar.b + 1, b2);
                }
            }
            RecommendTrendAdapter recommendTrendAdapter4 = this.m;
            if (recommendTrendAdapter4 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("listDataAdapter");
            }
            recommendTrendAdapter4.notifyDataSetChanged();
        }
    }
}