导航菜单

页面标题

页面副标题

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

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

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


package com.luanxingyuan.app.activity;

import android.app.Dialog;
import android.graphics.Point;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseListResponse;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.CharSetBean;
import com.luanxingyuan.app.bean.ChargeBean;
import com.luanxingyuan.app.layoutmanager.PickerLayoutManager;
import com.luanxingyuan.app.util.LogUtil;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.ToastUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import k6.m0;

public class SetChargeActivity extends BaseActivity {

    @BindView
    TextView mAudioChatTv;

    @BindView
    TextView mPhoneTv;

    @BindView
    TextView mQQTv;

    @BindView
    TextView mTextChatTv;

    @BindView
    TextView mVideoChatTv;

    @BindView
    TextView mWeChatTv;
    private final int VIDEO = 0;
    private final int TEXT = 1;
    private final int PHONE = 2;
    private final int WE_CHAT = 3;
    private final int AUDIO = 4;
    private final int QQ = 5;
    private String mSelectContent = "";
    private List<CharSetBean> mCharSetBeans = new ArrayList();
    private String[] mVideoStrs = new String[0];
    private String[] mTextStrs = new String[0];
    private String[] mPhoneStrs = new String[0];
    private String[] mWeChatStrs = new String[0];
    private String[] mAudioStrs = new String[0];
    private String[] mQQStrs = new String[0];

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

        public void onResponse(BaseListResponse<CharSetBean> baseListResponse, int i8) {
            List<CharSetBean> list;
            if (baseListResponse == null || baseListResponse.m_istatus != 1 || (list = baseListResponse.m_object) == null || list.size() <= 0) {
                return;
            }
            SetChargeActivity.this.mCharSetBeans = list;
            for (CharSetBean charSetBean : SetChargeActivity.this.mCharSetBeans) {
                int i9 = charSetBean.t_project_type;
                if (i9 == 5) {
                    SetChargeActivity.this.mVideoStrs = charSetBean.t_extract_ratio.split(",");
                } else if (i9 == 6) {
                    SetChargeActivity.this.mTextStrs = charSetBean.t_extract_ratio.split(",");
                } else if (i9 == 7) {
                    SetChargeActivity.this.mPhoneStrs = charSetBean.t_extract_ratio.split(",");
                } else if (i9 == 8) {
                    SetChargeActivity.this.mWeChatStrs = charSetBean.t_extract_ratio.split(",");
                } else if (i9 == 12) {
                    SetChargeActivity.this.mAudioStrs = charSetBean.t_extract_ratio.split(",");
                } else if (i9 == 13) {
                    SetChargeActivity.this.mQQStrs = charSetBean.t_extract_ratio.split(",");
                }
            }
        }
    }

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

        public void onResponse(BaseResponse<ChargeBean> baseResponse, int i8) {
            String string;
            if (SetChargeActivity.this.isFinishing() || baseResponse == null || baseResponse.m_istatus != 1) {
                return;
            }
            ChargeBean chargeBean = baseResponse.m_object;
            if (chargeBean == null) {
                SetChargeActivity.this.mVideoChatTv.setText(SetChargeActivity.this.getResources().getString(2131821472) + SetChargeActivity.this.getResources().getString(2131820891));
                SetChargeActivity.this.mTextChatTv.setText(SetChargeActivity.this.getResources().getString(2131821472) + SetChargeActivity.this.getResources().getString(2131820891));
                SetChargeActivity.this.mPhoneTv.setText(SetChargeActivity.this.getResources().getString(2131821472) + SetChargeActivity.this.getResources().getString(2131820891));
                String str = SetChargeActivity.this.getResources().getString(2131821472) + SetChargeActivity.this.getResources().getString(2131820891);
                SetChargeActivity.this.mWeChatTv.setText(str);
                SetChargeActivity.this.mAudioChatTv.setText(str);
                SetChargeActivity.this.mQQTv.setText(str);
                return;
            }
            SetChargeActivity.this.mVideoChatTv.setText(chargeBean.t_video_gold + SetChargeActivity.this.getResources().getString(2131820891));
            SetChargeActivity.this.mTextChatTv.setText(chargeBean.t_text_gold + SetChargeActivity.this.getResources().getString(2131820891));
            SetChargeActivity.this.mAudioChatTv.setText(chargeBean.t_voice_gold + SetChargeActivity.this.getString(2131820891));
            if (chargeBean.t_phone_gold > 0) {
                SetChargeActivity.this.mPhoneTv.setText(chargeBean.t_phone_gold + SetChargeActivity.this.getResources().getString(2131820891));
            } else {
                SetChargeActivity setChargeActivity = SetChargeActivity.this;
                setChargeActivity.mPhoneTv.setText(setChargeActivity.getResources().getString(2131821149));
            }
            if (chargeBean.t_weixin_gold > 0) {
                SetChargeActivity.this.mWeChatTv.setText(chargeBean.t_weixin_gold + SetChargeActivity.this.getResources().getString(2131820891));
            } else {
                SetChargeActivity setChargeActivity2 = SetChargeActivity.this;
                setChargeActivity2.mWeChatTv.setText(setChargeActivity2.getResources().getString(2131821149));
            }
            SetChargeActivity setChargeActivity3 = SetChargeActivity.this;
            TextView textView = setChargeActivity3.mQQTv;
            if (chargeBean.t_qq_gold > 0) {
                string = chargeBean.t_qq_gold + SetChargeActivity.this.getString(2131820891);
            } else {
                string = setChargeActivity3.getResources().getString(2131821149);
            }
            textView.setText(string);
        }
    }

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

        public void onResponse(BaseResponse baseResponse, int i8) {
            if (baseResponse != null) {
                if (baseResponse.m_istatus != 1) {
                    if (TextUtils.isEmpty(baseResponse.m_strMessage)) {
                        ToastUtil.showToast(SetChargeActivity.this.getApplicationContext(), 2131821305);
                        return;
                    } else {
                        ToastUtil.showToast(SetChargeActivity.this.getApplicationContext(), baseResponse.m_strMessage);
                        return;
                    }
                }
                String str = baseResponse.m_strMessage;
                if (TextUtils.isEmpty(str)) {
                    return;
                }
                ToastUtil.showToast(SetChargeActivity.this.getApplicationContext(), str);
                SetChargeActivity.this.finish();
            }
        }
    }

    class d implements View.OnClickListener {

        final Dialog f6955a;

        d(Dialog dialog) {
            this.f6955a = dialog;
        }

        @Override
        public void onClick(View view) {
            this.f6955a.dismiss();
        }
    }

    class e implements PickerLayoutManager.a {

        final List f6957a;

        e(List list) {
            this.f6957a = list;
        }

        @Override
        public void a(View view, int i8) {
            LogUtil.i("位置: " + i8);
            if (i8 < this.f6957a.size()) {
                SetChargeActivity.this.mSelectContent = (String) this.f6957a.get(i8);
            }
        }
    }

    class f implements View.OnClickListener {

        final int f6959a;

        final Dialog f6960b;

        f(int i8, Dialog dialog) {
            this.f6959a = i8;
            this.f6960b = dialog;
        }

        @Override
        public void onClick(View view) {
            int i8 = this.f6959a;
            if (i8 == 0) {
                if (TextUtils.isEmpty(SetChargeActivity.this.mSelectContent)) {
                    SetChargeActivity setChargeActivity = SetChargeActivity.this;
                    setChargeActivity.mSelectContent = setChargeActivity.mVideoStrs[0];
                }
                SetChargeActivity.this.mVideoChatTv.setText(SetChargeActivity.this.mSelectContent + SetChargeActivity.this.getResources().getString(2131820891));
                SetChargeActivity.this.mSelectContent = "";
            } else if (i8 == 1) {
                if (TextUtils.isEmpty(SetChargeActivity.this.mSelectContent)) {
                    SetChargeActivity setChargeActivity2 = SetChargeActivity.this;
                    setChargeActivity2.mSelectContent = setChargeActivity2.mTextStrs[0];
                }
                SetChargeActivity.this.mTextChatTv.setText(SetChargeActivity.this.mSelectContent + SetChargeActivity.this.getResources().getString(2131820891));
                SetChargeActivity.this.mSelectContent = "";
            } else if (i8 == 2) {
                if (TextUtils.isEmpty(SetChargeActivity.this.mSelectContent) || SetChargeActivity.this.mSelectContent.equals(SetChargeActivity.this.getResources().getString(2131821149))) {
                    SetChargeActivity setChargeActivity3 = SetChargeActivity.this;
                    setChargeActivity3.mSelectContent = setChargeActivity3.getResources().getString(2131821149);
                    SetChargeActivity setChargeActivity4 = SetChargeActivity.this;
                    setChargeActivity4.mPhoneTv.setText(setChargeActivity4.mSelectContent);
                } else {
                    SetChargeActivity.this.mPhoneTv.setText(SetChargeActivity.this.mSelectContent + SetChargeActivity.this.getResources().getString(2131820891));
                }
                SetChargeActivity.this.mSelectContent = "";
            } else if (i8 == 3) {
                if (TextUtils.isEmpty(SetChargeActivity.this.mSelectContent) || SetChargeActivity.this.mSelectContent.equals(SetChargeActivity.this.getResources().getString(2131821149))) {
                    SetChargeActivity setChargeActivity5 = SetChargeActivity.this;
                    setChargeActivity5.mSelectContent = setChargeActivity5.getResources().getString(2131821149);
                    SetChargeActivity setChargeActivity6 = SetChargeActivity.this;
                    setChargeActivity6.mWeChatTv.setText(setChargeActivity6.mSelectContent);
                } else {
                    SetChargeActivity.this.mWeChatTv.setText(SetChargeActivity.this.mSelectContent + SetChargeActivity.this.getResources().getString(2131820891));
                }
                SetChargeActivity.this.mSelectContent = "";
            } else if (i8 == 4) {
                if (TextUtils.isEmpty(SetChargeActivity.this.mSelectContent)) {
                    SetChargeActivity setChargeActivity7 = SetChargeActivity.this;
                    setChargeActivity7.mSelectContent = setChargeActivity7.mAudioStrs[0];
                }
                SetChargeActivity.this.mAudioChatTv.setText(SetChargeActivity.this.mSelectContent + SetChargeActivity.this.getResources().getString(2131820891));
                SetChargeActivity.this.mSelectContent = "";
            } else if (i8 == 5) {
                if (TextUtils.isEmpty(SetChargeActivity.this.mSelectContent) || SetChargeActivity.this.mSelectContent.equals(SetChargeActivity.this.getResources().getString(2131821149))) {
                    SetChargeActivity setChargeActivity8 = SetChargeActivity.this;
                    setChargeActivity8.mSelectContent = setChargeActivity8.getResources().getString(2131821149);
                    SetChargeActivity setChargeActivity9 = SetChargeActivity.this;
                    setChargeActivity9.mQQTv.setText(setChargeActivity9.mSelectContent);
                } else {
                    SetChargeActivity.this.mQQTv.setText(SetChargeActivity.this.mSelectContent + SetChargeActivity.this.getResources().getString(2131820891));
                }
                SetChargeActivity.this.mSelectContent = "";
            }
            this.f6960b.dismiss();
        }
    }

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

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

    private void modifyChargeSet() {
        String str;
        String str2;
        String[] split = this.mVideoChatTv.getText().toString().trim().split(getResources().getString(2131820891));
        String str3 = "";
        String str4 = split.length > 0 ? split[0] : "";
        String[] split2 = this.mAudioChatTv.getText().toString().trim().split(getResources().getString(2131820891));
        String str5 = split2.length > 0 ? split2[0] : "";
        String[] split3 = this.mTextChatTv.getText().toString().trim().split(getResources().getString(2131820891));
        String str6 = split3.length > 0 ? split3[0] : "";
        String trim = this.mPhoneTv.getText().toString().trim();
        if (trim.contains(getResources().getString(2131821149))) {
            str = "0";
        } else {
            String[] split4 = trim.split(getResources().getString(2131820891));
            str = split4.length > 0 ? split4[0] : "";
        }
        String trim2 = this.mWeChatTv.getText().toString().trim();
        if (trim2.contains(getResources().getString(2131821149))) {
            str2 = "0";
        } else {
            String[] split5 = trim2.split(getResources().getString(2131820891));
            str2 = split5.length > 0 ? split5[0] : "";
        }
        String trim3 = this.mQQTv.getText().toString().trim();
        if (trim3.contains(getResources().getString(2131821149))) {
            str3 = "0";
        } else {
            String[] split6 = trim3.split(getResources().getString(2131820891));
            if (split6.length > 0) {
                str3 = split6[0];
            }
        }
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        hashMap.put("t_video_gold", str4);
        hashMap.put("t_text_gold", str6);
        hashMap.put("t_phone_gold", str);
        hashMap.put("t_weixin_gold", str2);
        hashMap.put("t_voice_gold", str5);
        hashMap.put("t_qq_gold", str3);
        x7.a.h().c(m6.a.m1()).e("param", ParamUtil.getParam(hashMap)).f().c(new c());
    }

    private void setDialogView(View view, Dialog dialog, int i8) {
        ((TextView) view.findViewById(2131296454)).setOnClickListener(new d(dialog));
        TextView textView = (TextView) view.findViewById(2131297340);
        ArrayList arrayList = new ArrayList();
        if (i8 == 0) {
            textView.setText(getResources().getString(2131821424) + getResources().getString(2131820892));
            arrayList.addAll(Arrays.asList(this.mVideoStrs));
        } else if (i8 == 1) {
            textView.setText(getResources().getString(2131821369) + getResources().getString(2131820892));
            arrayList.addAll(Arrays.asList(this.mTextStrs));
        } else if (i8 == 2) {
            textView.setText(getResources().getString(2131821280) + getResources().getString(2131820892));
            arrayList.add(0, getResources().getString(2131821149));
            arrayList.addAll(Arrays.asList(this.mPhoneStrs));
        } else if (i8 == 3) {
            textView.setText(getResources().getString(2131821285) + getResources().getString(2131820892));
            arrayList.add(0, getResources().getString(2131821149));
            arrayList.addAll(Arrays.asList(this.mWeChatStrs));
        } else if (i8 == 4) {
            textView.setText(getResources().getString(2131820633) + getResources().getString(2131820892));
            arrayList.addAll(Arrays.asList(this.mAudioStrs));
        } else if (i8 == 5) {
            textView.setText(getResources().getString(2131821281) + getResources().getString(2131820892));
            arrayList.add(0, getResources().getString(2131821149));
            arrayList.addAll(Arrays.asList(this.mQQStrs));
        }
        m0 m0Var = new m0(this);
        RecyclerView recyclerView = (RecyclerView) view.findViewById(2131296562);
        PickerLayoutManager pickerLayoutManager = new PickerLayoutManager(getApplicationContext(), recyclerView, 1, false, 5, 0.4f, true);
        recyclerView.setLayoutManager(pickerLayoutManager);
        recyclerView.setAdapter(m0Var);
        m0Var.b(arrayList);
        pickerLayoutManager.c(new e(arrayList));
        this.mSelectContent = null;
        ((TextView) view.findViewById(2131296538)).setOnClickListener(new f(i8, dialog));
    }

    private void showChargeOptionDialog(int i8) {
        Dialog dialog = new Dialog(this, 2131886281);
        View inflate = LayoutInflater.from(this).inflate(2131493077, (ViewGroup) null);
        setDialogView(inflate, dialog, i8);
        dialog.setContentView(inflate);
        Point point = new Point();
        getWindowManager().getDefaultDisplay().getSize(point);
        Window window = dialog.getWindow();
        if (window != null) {
            window.getAttributes().width = point.x;
            window.setGravity(80);
            window.setWindowAnimations(2131886275);
        }
        dialog.setCanceledOnTouchOutside(false);
        if (isFinishing()) {
            return;
        }
        dialog.show();
    }

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

    @OnClick
    public void onClick(View view) {
        switch (view.getId()) {
            case 2131296379:
                String[] strArr = this.mAudioStrs;
                if (strArr != null && strArr.length > 0) {
                    showChargeOptionDialog(4);
                    break;
                }
                break;
            case 2131297066:
                String[] strArr2 = this.mPhoneStrs;
                if (strArr2 != null && strArr2.length > 0) {
                    showChargeOptionDialog(2);
                    break;
                }
                break;
            case 2131297117:
                String[] strArr3 = this.mQQStrs;
                if (strArr3 != null && strArr3.length > 0) {
                    showChargeOptionDialog(5);
                    break;
                }
                break;
            case 2131297281:
                modifyChargeSet();
                break;
            case 2131297314:
                String[] strArr4 = this.mTextStrs;
                if (strArr4 != null && strArr4.length > 0) {
                    showChargeOptionDialog(1);
                    break;
                }
                break;
            case 2131297423:
                String[] strArr5 = this.mVideoStrs;
                if (strArr5 != null && strArr5.length > 0) {
                    showChargeOptionDialog(0);
                    break;
                }
                break;
            case 2131297471:
                String[] strArr6 = this.mWeChatStrs;
                if (strArr6 != null && strArr6.length > 0) {
                    showChargeOptionDialog(3);
                    break;
                }
                break;
        }
    }

    @Override
    protected void onContentAdded() {
        setTitle(2131821301);
        getAnchorVideoCost();
        getActorSetCharge();
    }
}