导航菜单

页面标题

页面副标题

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

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

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


package com.luanxingyuan.app.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import cn.jpush.android.api.JThirdPlatFormInterface;
import com.faceunity.wrapper.faceunity;
import com.luanxingyuan.app.base.AppManager;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseListResponse;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.AVChatBean;
import com.luanxingyuan.app.bean.LabelBean;
import com.luanxingyuan.app.util.DensityUtil;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.ToastUtil;
import com.luanxingyuan.app.view.recycle.a;
import com.tencent.qcloud.core.util.IOUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import x8.c0;

public class VideoCommentActivity extends BaseActivity {
    private com.luanxingyuan.app.view.recycle.a adapter;
    private AVChatBean avChatBean;

    @BindView
    TextView costTv;

    @BindView
    ImageView headIv;
    private int mActorId;
    private final List<LabelBean> mLabelBeans = new ArrayList();

    @BindView
    RatingBar mStarRb;

    @BindView
    TextView nickTv;

    @BindView
    RecyclerView recyclerView;

    static class Response extends com.luanxingyuan.app.base.c {
        public String roomTime;
        public String t_handImg;
        public String t_nickName;
        public int t_room_gold;
        public int t_score;

        Response() {
        }
    }

    class a implements q6.a<Response> {

        final AVChatBean f7269a;

        a(AVChatBean aVChatBean) {
            this.f7269a = aVChatBean;
        }

        @Override
        public void execute(Response response) {
            Intent intent = new Intent(AppManager.f(), (Class<?>) VideoCommentActivity.class);
            intent.addFlags(faceunity.FUAITYPE_HUMAN_PROCESSOR_DETECT);
            intent.putExtra(JThirdPlatFormInterface.KEY_DATA, this.f7269a);
            intent.putExtra("data2", response);
            AppManager.f().startActivity(intent);
        }
    }

    class b extends r6.a<BaseResponse<Response>> {

        final q6.a f7270a;

        b(q6.a aVar) {
            this.f7270a = aVar;
        }

        public void onResponse(BaseResponse<Response> baseResponse, int i8) {
            if (baseResponse == null || baseResponse.m_istatus != 1) {
                return;
            }
            this.f7270a.execute(baseResponse.m_object);
        }
    }

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

        @Override
        public void d(com.luanxingyuan.app.view.recycle.f fVar, Object obj) {
            TextView textView = (TextView) fVar.itemView;
            if (obj.getClass() == String.class) {
                textView.setText(obj.toString());
                return;
            }
            LabelBean labelBean = (LabelBean) obj;
            textView.setText(labelBean.t_label_name);
            textView.setBackgroundResource(!labelBean.selected ? 2131230962 : 2131230964);
        }
    }

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

        private void b(boolean z7) {
            for (LabelBean labelBean : VideoCommentActivity.this.mLabelBeans) {
                if (!z7 || labelBean.t_id == -1) {
                    labelBean.selected = false;
                }
            }
        }

        private int c() {
            int i8 = 0;
            for (LabelBean labelBean : VideoCommentActivity.this.mLabelBeans) {
                if (labelBean.selected && labelBean.t_id != -1) {
                    i8++;
                }
            }
            return i8;
        }

        @Override
        public void a(View view, Object obj, int i8) {
            if (obj.getClass() == LabelBean.class) {
                LabelBean labelBean = (LabelBean) obj;
                if (labelBean.t_id == -1) {
                    b(false);
                    labelBean.selected = true;
                    VideoCommentActivity.this.mStarRb.setRating(4.0f);
                } else if (!labelBean.selected && c() >= 3) {
                    ToastUtil.showToast("最多3个好评");
                    return;
                } else {
                    VideoCommentActivity.this.mStarRb.setRating(5.0f);
                    b(true);
                    labelBean.selected = !labelBean.selected;
                }
                VideoCommentActivity.this.adapter.notifyDataSetChanged();
            }
        }
    }

    class e extends GridLayoutManager.c {

        final GridLayoutManager f7273c;

        e(GridLayoutManager gridLayoutManager) {
            this.f7273c = gridLayoutManager;
        }

        @Override
        public int e(int i8) {
            if (VideoCommentActivity.this.adapter.e().get(i8).getClass() == LabelBean.class) {
                return 1;
            }
            return this.f7273c.i();
        }
    }

    class f extends r6.a<BaseListResponse<LabelBean>> {
        f() {
        }

        public void onResponse(BaseListResponse<LabelBean> baseListResponse, int i8) {
            List<LabelBean> list;
            if (VideoCommentActivity.this.isFinishing() || baseListResponse == null || baseListResponse.m_istatus != 1 || (list = baseListResponse.m_object) == null || list.size() <= 0) {
                return;
            }
            VideoCommentActivity.this.mLabelBeans.clear();
            VideoCommentActivity.this.mLabelBeans.addAll(baseListResponse.m_object);
            ArrayList arrayList = new ArrayList();
            arrayList.add("好评");
            arrayList.addAll(VideoCommentActivity.this.mLabelBeans);
            arrayList.add("差评");
            LabelBean labelBean = new LabelBean();
            labelBean.t_label_name = "不满意";
            labelBean.t_id = -1;
            VideoCommentActivity.this.mLabelBeans.add(labelBean);
            arrayList.add(labelBean);
            VideoCommentActivity.this.adapter.i(arrayList);
        }
    }

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

        public void onBefore(c0 c0Var, int i8) {
            super.onBefore(c0Var, i8);
            VideoCommentActivity.this.showLoadingDialog();
        }

        @Override
        public void onError(x8.e eVar, Exception exc, int i8) {
            super.onError(eVar, exc, i8);
            ToastUtil.showToast(VideoCommentActivity.this.getApplicationContext(), 2131820770);
            VideoCommentActivity.this.dismissLoadingDialog();
        }

        public void onResponse(BaseResponse baseResponse, int i8) {
            VideoCommentActivity.this.dismissLoadingDialog();
            if (baseResponse == null || baseResponse.m_istatus != 1) {
                ToastUtil.showToast(VideoCommentActivity.this.getApplicationContext(), 2131820770);
            } else {
                ToastUtil.showToast(VideoCommentActivity.this.getApplicationContext(), 2131820774);
                VideoCommentActivity.this.finish();
            }
        }
    }

    private static void calculateGold(AVChatBean aVChatBean, q6.a<Response> aVar) {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
        hashMap.put("roomId", Integer.valueOf(aVChatBean.roomId));
        hashMap.put("coverUserId", Integer.valueOf(aVChatBean.otherId));
        x7.a.h().c(m6.a.i2()).e("param", ParamUtil.getParam(hashMap)).f().c(new b(aVar));
    }

    private void commentActor() {
        if (this.mLabelBeans.size() == 0) {
            getLabelList();
            ToastUtil.showToast("获取数据中");
            return;
        }
        ArrayList arrayList = new ArrayList();
        for (LabelBean labelBean : this.mLabelBeans) {
            if (labelBean.selected) {
                arrayList.add(labelBean);
            }
        }
        if (arrayList.size() == 0) {
            ToastUtil.showToast("请选择评价");
            return;
        }
        if (((LabelBean) arrayList.get(0)).t_id == -1) {
            arrayList.clear();
        }
        int rating = (int) this.mStarRb.getRating();
        StringBuilder sb = new StringBuilder();
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            sb.append(((LabelBean) it.next()).t_id);
            sb.append(",");
        }
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        hashMap.put("coverCommUserId", Integer.valueOf(this.mActorId));
        hashMap.put("commScore", Integer.valueOf(rating));
        hashMap.put("lables", TextUtils.isEmpty(sb) ? "" : sb.toString());
        x7.a.h().c(m6.a.Z0()).e("param", ParamUtil.getParam(hashMap)).f().c(new g());
    }

    private void getLabelList() {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", Integer.valueOf(this.mActorId));
        hashMap.put("useType", 2);
        x7.a.h().c(m6.a.U()).e("param", ParamUtil.getParam(hashMap)).f().c(new f());
    }

    private void loadImgNick(Response response) {
        this.nickTv.setText(response.t_nickName);
        com.bumptech.glide.b.x(this).p(response.t_handImg).p0(new d3.k()).G0(this.headIv);
        this.costTv.setText(String.format(this.avChatBean.isActor() ? "收益%s金币" : "消费%s金币", Integer.valueOf(response.t_room_gold)));
        this.costTv.append(IOUtils.LINE_SEPARATOR_UNIX);
        this.costTv.append(String.format("通话时长: %s", response.roomTime));
    }

    public static void start(AVChatBean aVChatBean) {
        calculateGold(aVChatBean, new a(aVChatBean));
    }

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

    @OnClick
    public void onClick(View view) {
        int id = view.getId();
        if (id != 2131296536) {
            if (id != 2131297281) {
                return;
            }
            commentActor();
        } else {
            Intent intent = new Intent(getApplicationContext(), (Class<?>) ReportActivity.class);
            intent.putExtra("actor_id", this.mActorId);
            startActivity(intent);
        }
    }

    @Override
    protected void onContentAdded() {
        setTitle(2131821291);
        this.avChatBean = (AVChatBean) getIntent().getSerializableExtra(JThirdPlatFormInterface.KEY_DATA);
        Response response = (Response) getIntent().getSerializableExtra("data2");
        AVChatBean aVChatBean = this.avChatBean;
        if (aVChatBean != null) {
            this.mActorId = aVChatBean.otherId;
        }
        loadImgNick(response);
        c cVar = new c(new a.b(2131493167, LabelBean.class), new a.b(2131493168, String.class));
        this.adapter = cVar;
        cVar.j(new d());
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getBaseContext(), 4);
        gridLayoutManager.r(new e(gridLayoutManager));
        this.recyclerView.addItemDecoration(new com.luanxingyuan.app.view.recycle.e(DensityUtil.dip2px(this.mContext, 6.0f)));
        this.recyclerView.setLayoutManager(gridLayoutManager);
        this.recyclerView.setAdapter(this.adapter);
        getLabelList();
    }
}