导航菜单

页面标题

页面副标题

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

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

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


package com.luanxingyuan.app.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.luanxingyuan.app.base.AppManager;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseListResponse;
import com.luanxingyuan.app.bean.VipBean;
import com.luanxingyuan.app.bean.VipInfoBean;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.ToastUtil;
import com.luanxingyuan.app.view.recycle.a;
import com.tencent.qcloud.tim.uikit.R;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

public class VipCenterActivity extends BaseActivity {
    com.luanxingyuan.app.view.recycle.a adapter;

    @BindView
    RecyclerView packageRv;

    @BindView
    RecyclerView vipInterestsRv;

    @BindView
    TextView vipPay;

    @BindView
    TextView vipTv;

    class a implements q6.a<VipInfoBean> {
        a() {
        }

        @Override
        public void execute(VipInfoBean vipInfoBean) {
            if (VipCenterActivity.this.isFinishing()) {
                return;
            }
            VipCenterActivity.this.setVipTv(vipInfoBean);
        }
    }

    class b extends com.luanxingyuan.app.view.recycle.a {
        b(a.b... bVarArr) {
            super(bVarArr);
        }

        @Override
        public void d(com.luanxingyuan.app.view.recycle.f fVar, Object obj) {
            f fVar2 = (f) obj;
            ((TextView) fVar.getView(2131297340)).setCompoundDrawablesRelativeWithIntrinsicBounds(0, fVar2.f7317a, 0, 0);
            ((TextView) fVar.getView(2131297340)).setText(fVar2.f7318b);
            ((TextView) fVar.getView(2131297276)).setText(fVar2.f7319c);
        }
    }

    class c extends r6.a<BaseListResponse<VipBean>> {
        c() {
        }

        public void onResponse(BaseListResponse<VipBean> baseListResponse, int i8) {
            List<VipBean> list;
            if (VipCenterActivity.this.isFinishing() || baseListResponse == null || baseListResponse.m_istatus != 1 || (list = baseListResponse.m_object) == null || list.size() <= 0) {
                return;
            }
            list.get(0).isSelected = true;
            VipCenterActivity.this.setVipList(list);
        }
    }

    class d extends com.luanxingyuan.app.view.recycle.a {

        final DecimalFormat f7314d;

        d(a.b[] bVarArr, DecimalFormat decimalFormat) {
            super(bVarArr);
            this.f7314d = decimalFormat;
        }

        @Override
        public void d(com.luanxingyuan.app.view.recycle.f fVar, Object obj) {
            VipBean vipBean = (VipBean) obj;
            if (vipBean.isSelected) {
                VipCenterActivity.this.vipPay.setText(String.format("立即支付¥%s元", this.f7314d.format(vipBean.t_money)));
            }
            fVar.itemView.setSelected(vipBean.isSelected);
            ((TextView) fVar.getView(2131296950)).setText(vipBean.t_setmeal_name);
            ((TextView) fVar.getView(2131297085)).setText(String.format("¥%s", this.f7314d.format(vipBean.t_money)));
            ((TextView) fVar.getView(R.id.gold_tv)).setText(vipBean.t_remarks);
            ((TextView) fVar.getView(2131296594)).setText(vipBean.avgDayMoney);
            fVar.getView(2131297133).setVisibility(vipBean.t_is_recommend != 1 ? 8 : 0);
        }
    }

    class e implements com.luanxingyuan.app.view.recycle.c {
        e() {
        }

        @Override
        public void a(View view, Object obj, int i8) {
            VipBean vipBean = (VipBean) VipCenterActivity.this.adapter.e().get(i8);
            for (VipBean vipBean2 : VipCenterActivity.this.adapter.e()) {
                vipBean2.isSelected = vipBean2 == vipBean;
            }
            VipCenterActivity.this.adapter.notifyDataSetChanged();
        }
    }

    protected static class f {

        public int f7317a;

        public String f7318b;

        public String f7319c;

        public f(int i8, String str, String str2) {
            this.f7317a = i8;
            this.f7318b = str;
            this.f7319c = str2;
        }
    }

    private void getVipList() {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
        hashMap.put("t_vip_type", 0);
        x7.a.h().c(m6.a.I0()).e("param", ParamUtil.getParam(hashMap)).f().c(new c());
    }

    private void refreshVip() {
        AppManager.f().s(new a());
    }

    private void setInterestsRv() {
        b bVar = new b(new a.b(2131493250, f.class));
        this.vipInterestsRv.setLayoutManager(new GridLayoutManager(this.mContext, 3));
        this.vipInterestsRv.setAdapter(bVar);
        bVar.i(getRightsInterests());
    }

    public void setVipList(List<VipBean> list) {
        if (this.adapter == null) {
            d dVar = new d(new a.b[]{new a.b(2131493249, VipBean.class)}, new DecimalFormat("#.##"));
            this.adapter = dVar;
            dVar.j(new e());
            this.adapter.i(list);
            this.packageRv.setLayoutManager(new GridLayoutManager(this.mContext, 3));
            this.packageRv.setAdapter(this.adapter);
        }
    }

    public static void start(Context context, boolean z7) {
        Intent intent = new Intent(context, (Class<?>) VipCenterActivity.class);
        intent.putExtra("svip", z7);
        context.startActivity(intent);
    }

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

    protected List<f> getRightsInterests() {
        return Arrays.asList(new f(2131231668, "开通赠送金币", "开通会员则送金币"), new f(2131231669, "充值另送金币", "充值额外赠送金币"), new f(2131231670, "文字聊天免费", "文字聊天完全免费"), new f(2131231673, "榜单隐身", "排行榜中隐身"), new f(2131231674, "屏蔽飘屏", "屏蔽所有飘屏"), new f(2131231675, "尊贵会员标识", "专属会员标识,女神更喜欢"));
    }

    @Override
    protected boolean isImmersionBarEnabled() {
        return true;
    }

    @OnClick
    public void onClick(View view) {
        com.luanxingyuan.app.view.recycle.a aVar;
        int id = view.getId();
        if (id == 2131296682) {
            finish();
            return;
        }
        if (id != 2131297461 || (aVar = this.adapter) == null || aVar.e() == null) {
            return;
        }
        VipBean vipBean = null;
        Iterator it = this.adapter.e().iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            VipBean vipBean2 = (VipBean) it.next();
            if (vipBean2.isSelected) {
                vipBean = vipBean2;
                break;
            }
        }
        if (vipBean == null) {
            ToastUtil.showToast("请选择VIP");
        } else {
            PayChooserActivity.s(this.mContext, vipBean.t_id);
        }
    }

    @Override
    protected void onContentAdded() {
        needHeader(false);
        com.bumptech.glide.b.x(this.mContext).p(AppManager.f().k().headUrl).p0(new n6.a(this.mContext)).G0((ImageView) findViewById(2131296781));
        setInterestsRv();
        getVipList();
    }

    @Override
    public void onResume() {
        super.onResume();
        refreshVip();
    }

    protected void setVipTv(VipInfoBean vipInfoBean) {
        this.vipTv.setText(" 未开通");
        if (vipInfoBean.t_is_vip == 0) {
            this.vipTv.setText(String.format(" %s到期", vipInfoBean.vipTime.t_end_time));
        }
    }
}