导航菜单

页面标题

页面副标题

新暖心缘 v8.1.1 - MyActorActivity.java 源代码

正在查看: 新暖心缘 v8.1.1 应用的 MyActorActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.luanxingyuan.app.activity;

import android.view.View;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.CompanyBean;
import com.luanxingyuan.app.bean.GuildCountBean;
import com.luanxingyuan.app.bean.PageBean;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.ToastUtil;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import k6.c0;

public class MyActorActivity extends BaseActivity {
    private c0 mAdapter;

    @BindView
    RecyclerView mContentRv;
    private int mCurrentPage = 1;
    private List<CompanyBean> mFocusBeans = new ArrayList();

    @BindView
    TextView mGoldTv;

    @BindView
    TextView mNumberTv;

    @BindView
    SmartRefreshLayout mRefreshLayout;

    class a extends r6.a<BaseResponse<GuildCountBean>> {
        a() {
        }

        public void onResponse(BaseResponse<GuildCountBean> baseResponse, int i8) {
            GuildCountBean guildCountBean;
            if (baseResponse == null || baseResponse.m_istatus != 1 || (guildCountBean = baseResponse.m_object) == null) {
                return;
            }
            MyActorActivity.this.mNumberTv.setText(String.valueOf(guildCountBean.anchorCount));
            MyActorActivity.this.mGoldTv.setText(String.valueOf(guildCountBean.totalGold));
        }
    }

    class b extends r6.a<BaseResponse<PageBean<CompanyBean>>> {

        final boolean f6571a;

        final m7.i f6572b;

        b(boolean z7, m7.i iVar) {
            this.f6571a = z7;
            this.f6572b = iVar;
        }

        public void onResponse(BaseResponse<PageBean<CompanyBean>> baseResponse, int i8) {
            if (MyActorActivity.this.isFinishing()) {
                return;
            }
            if (baseResponse == null || baseResponse.m_istatus != 1) {
                ToastUtil.showToast(MyActorActivity.this.getApplicationContext(), 2131821363);
                if (this.f6571a) {
                    this.f6572b.d();
                    return;
                } else {
                    this.f6572b.a();
                    return;
                }
            }
            PageBean<CompanyBean> pageBean = baseResponse.m_object;
            if (pageBean == null) {
                ToastUtil.showToast(MyActorActivity.this.getApplicationContext(), 2131821363);
                if (this.f6571a) {
                    this.f6572b.d();
                    return;
                } else {
                    this.f6572b.a();
                    return;
                }
            }
            List<CompanyBean> list = pageBean.data;
            if (list != null) {
                int size = list.size();
                if (this.f6571a) {
                    MyActorActivity.this.mCurrentPage = 1;
                    MyActorActivity.this.mFocusBeans.clear();
                    MyActorActivity.this.mFocusBeans.addAll(list);
                    MyActorActivity.this.mAdapter.b(MyActorActivity.this.mFocusBeans);
                    if (MyActorActivity.this.mFocusBeans.size() > 0) {
                        MyActorActivity.this.mRefreshLayout.Q(true);
                    } else {
                        MyActorActivity.this.mRefreshLayout.Q(false);
                    }
                    this.f6572b.d();
                    if (size >= 10) {
                        this.f6572b.f(true);
                    }
                } else {
                    MyActorActivity.access$008(MyActorActivity.this);
                    MyActorActivity.this.mFocusBeans.addAll(list);
                    MyActorActivity.this.mAdapter.b(MyActorActivity.this.mFocusBeans);
                    if (size >= 10) {
                        this.f6572b.a();
                    }
                }
                if (size < 10) {
                    this.f6572b.c();
                }
            }
        }
    }

    class c implements s7.d {
        c() {
        }

        @Override
        public void d(m7.i iVar) {
            MyActorActivity.this.getMyActor(iVar, true, 1);
        }
    }

    class d implements s7.b {
        d() {
        }

        @Override
        public void c(m7.i iVar) {
            MyActorActivity myActorActivity = MyActorActivity.this;
            myActorActivity.getMyActor(iVar, false, myActorActivity.mCurrentPage + 1);
        }
    }

    static int access$008(MyActorActivity myActorActivity) {
        int i8 = myActorActivity.mCurrentPage;
        myActorActivity.mCurrentPage = i8 + 1;
        return i8;
    }

    private void getGuildCount() {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        x7.a.h().c(m6.a.N()).e("param", ParamUtil.getParam(hashMap)).f().c(new a());
    }

    public void getMyActor(m7.i iVar, boolean z7, int i8) {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        hashMap.put("page", String.valueOf(i8));
        x7.a.h().c(m6.a.E()).e("param", ParamUtil.getParam(hashMap)).f().c(new b(z7, iVar));
    }

    private void initRecycler() {
        this.mRefreshLayout.T(new c());
        this.mRefreshLayout.S(new d());
        this.mContentRv.setLayoutManager(new LinearLayoutManager(this));
        c0 c0Var = new c0(this);
        this.mAdapter = c0Var;
        this.mContentRv.setAdapter(c0Var);
    }

    @Override
    protected View getContentView() {
        return inflate(2131492936);
    }

    @Override
    protected int getStatusBarColor() {
        return getResources().getColor(2131099903);
    }

    @OnClick
    public void onClick(View view) {
        if (view.getId() != 2131296386) {
            return;
        }
        finish();
    }

    @Override
    protected void onContentAdded() {
        needHeader(false);
        initRecycler();
        getGuildCount();
        getMyActor(this.mRefreshLayout, true, 1);
    }
}