package xyz.netfly.ui.vod_info;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import ie.o0;
import java.util.ArrayList;
import oe.e;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import pf.c;
import v3.a;
import xyz.netfly.ui.main.adapter.p;
import xyz.stream.api.entity.CreditsEntity;
import xyz.stream.api.entity.PageInfo;
import xyz.stream.api.entity.VideoEntity;
import xyz.stream.api.q;
import xyz.stream.api.viewmodel.PersonViewModel;
import xyz.stream.utils.event.DislikeEvent;
import xyz.stream.utils.f0;
import xyz.stream.view.BaseActivity;
import xyz.stream.view.CustomImageView;
import xyz.stream.view.GridSpacingItemDecoration;
import xyz.stream.view.UiUtils;
import xyz.stream.view.tvrecyclerview.V7GridLayoutManager;

/* JADX INFO: loaded from: classes3.dex */
public class PersonActivity extends BaseActivity<PersonViewModel, o0> {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final /* synthetic */ int f35655f = 0;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public CreditsEntity f35656b;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public p f35658d;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public PageInfo f35657c = PageInfo.init(15);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final ArrayList f35659e = new ArrayList();

    public static void L(Activity activity, Bundle bundle) {
        Intent intent = new Intent(activity, (Class<?>) PersonActivity.class);
        intent.putExtra("params", bundle);
        intent.addFlags(268435456);
        activity.startActivity(intent);
    }

    public final void K() {
        ((PersonViewModel) this.viewModel).getPersonList(this.f35656b.getPersonId(), this.f35657c.getPage(), this.f35657c.getPageSize());
        ((PersonViewModel) this.viewModel).livePerson.c(this, new e(this, 9));
    }

    @Override // xyz.stream.view.BaseActivity
    public final a getViewBinding() {
        return o0.inflate(getLayoutInflater(), null, false);
    }

    @Override // xyz.stream.view.BaseActivity
    public final void initData() {
        super.initData();
        ((o0) this.binding).f27296d.setAnimation(null);
        this.f35657c = PageInfo.init(15);
        ((o0) this.binding).f27295c.resetNoMoreData();
        K();
    }

    @Override // xyz.stream.view.BaseActivity
    public final void initListener() {
        super.initListener();
        ((o0) this.binding).f27295c.setOnRefreshListener(new c(this));
        ((o0) this.binding).f27295c.setOnLoadMoreListener(new c(this));
        this.f35658d.f35595f = new gf.e(this, 2);
    }

    @Override // xyz.stream.view.BaseActivity
    public final void initView() {
        Bundle bundleExtra = getIntent() != null ? getIntent().getBundleExtra("params") : null;
        if (bundleExtra != null) {
            this.f35656b = (CreditsEntity) bundleExtra.getParcelable("person");
        }
        if (this.f35656b == null) {
            return;
        }
        CustomImageView customImageView = ((o0) this.binding).f27294b;
        q qVarG = q.g();
        String profilePath = this.f35656b.getProfilePath();
        qVarG.getClass();
        customImageView.load(CustomImageView.Request.image(q.f(profilePath)).radius(16).size(300, 450));
        ((o0) this.binding).f27297e.setText(this.f35656b.getName());
        V7GridLayoutManager v7GridLayoutManager = new V7GridLayoutManager(this, 5);
        ((o0) this.binding).f27296d.addItemDecoration(new GridSpacingItemDecoration(5, UiUtils.dp2px(10.0f), true));
        ((o0) this.binding).f27296d.setSelectedItemAtCentered(true);
        ((o0) this.binding).f27296d.setLayoutManager(v7GridLayoutManager);
        p pVar = new p(UiUtils.dp2px(250.0f), this, this.f35659e);
        this.f35658d = pVar;
        ((o0) this.binding).f27296d.setAdapter(pVar);
    }

    @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
    public void onMessageEvent(DislikeEvent dislikeEvent) {
        ArrayList arrayListM = f0.o().m(Integer.class, "sp_dislike_list");
        if (arrayListM.isEmpty()) {
            return;
        }
        ArrayList arrayList = this.f35659e;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            VideoEntity videoEntity = (VideoEntity) arrayList.get(size);
            if (videoEntity != null && arrayListM.contains(Integer.valueOf(videoEntity.getVideoId()))) {
                arrayList.remove(size);
                this.f35658d.notifyItemRemoved(size);
            }
        }
    }
}
