package cf;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import fe.d;
import ie.n0;
import java.util.ArrayList;
import kotlinx.coroutines.y;
import oe.e;
import org.drive_hunter.R;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import xyz.netfly.ads.h;
import xyz.stream.api.entity.PageInfo;
import xyz.stream.api.viewmodel.VideoInfoViewModel;
import xyz.stream.utils.e0;
import xyz.stream.utils.event.RemainingDayEvent;
import xyz.stream.utils.f0;
import xyz.stream.view.BaseFragment;
import xyz.stream.view.GridSpacingItemDecoration;
import xyz.stream.view.UiUtils;
import xyz.stream.view.tvrecyclerview.V7GridLayoutManager;

/* JADX INFO: loaded from: classes3.dex */
public class c extends BaseFragment<VideoInfoViewModel, n0> {
    public static final /* synthetic */ int K0 = 0;
    public a E0;
    public int G0;
    public int H0;
    public final ArrayList F0 = new ArrayList();
    public PageInfo I0 = PageInfo.init(20);
    public boolean J0 = false;

    public final void J() {
        ((VideoInfoViewModel) this.viewModel).getVideoList(requireContext(), Integer.valueOf(this.H0), this.I0.getPage(), this.I0.getPageSize());
        ((VideoInfoViewModel) this.viewModel).liveVideos.c(getViewLifecycleOwner(), new e(this, 4));
    }

    @Override // xyz.stream.view.BaseFragment
    public final void focus() {
        ((n0) this.binding).f27249e.post(new h(this, 23));
    }

    @Override // xyz.stream.view.BaseFragment
    public final v3.a getViewBinding(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        return n0.inflate(layoutInflater, viewGroup, false);
    }

    @Override // xyz.stream.view.BaseFragment
    public final void initData() {
        if (this.E0 == null) {
            return;
        }
        this.I0 = PageInfo.init(20);
        this.F0.clear();
        this.J0 = false;
        a aVar = this.E0;
        aVar.f4989b = false;
        aVar.notifyDataSetChanged();
        this.E0.notifyDataSetChanged();
        UiUtils.showProgressDialog(requireActivity());
        ((n0) this.binding).f27248d.resetNoMoreData();
        J();
    }

    @Override // xyz.stream.view.BaseFragment
    public final void initListener() {
        super.initListener();
        this.E0.setOnItemListener(new f0(this, 26));
        ((n0) this.binding).f27248d.setOnRefreshListener(new b(this));
        ((n0) this.binding).f27248d.setOnLoadMoreListener(new b(this));
    }

    @Override // xyz.stream.view.BaseFragment
    public final void initView() {
        y.S("MyListPage");
        UiUtils.setSvgPicture(((n0) this.binding).f27246b, R.drawable.cloud_no_content, Integer.valueOf(R.color.main_color));
        ((n0) this.binding).f27249e.setLayoutManager(new V7GridLayoutManager(requireContext(), 4));
        ((n0) this.binding).f27249e.addItemDecoration(new GridSpacingItemDecoration(4, 0, false));
        ((n0) this.binding).f27249e.setSelectedItemAtCentered(true);
        ArrayList arrayList = this.F0;
        arrayList.clear();
        Bundle arguments = getArguments();
        if (arguments != null) {
            this.H0 = arguments.getInt("sourceType", 0);
        }
        a aVar = new a(arrayList, requireActivity());
        this.E0 = aVar;
        ((n0) this.binding).f27249e.setAdapter(aVar);
    }

    @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
    public void onMessageEvent(RemainingDayEvent remainingDayEvent) {
        d.b().k(remainingDayEvent);
    }

    @Override // androidx.fragment.app.e0
    public final void onStart() {
        super.onStart();
        d.b().j(this);
        e0.m().p(requireActivity());
    }

    @Override // androidx.fragment.app.e0
    public final void onStop() {
        super.onStop();
        d.b().m(this);
    }
}
