导航菜单

页面标题

页面副标题

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

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

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


package com.luanxingyuan.app.activity;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Point;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.SurfaceView;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.OvershootInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.faceunity.wrappe.FURenderer;
import com.faceunity.wrappe.data.FaceBeautyDataFactory;
import com.faceunity.wrappe.data.FaceUnityDataFactory;
import com.faceunity.wrappe.repo.FUDiskFaceBeautyData;
import com.faceunity.wrappe.repo.FaceBeautySource;
import com.faceunity.wrappe.ui.FaceUnityView;
import com.luanxingyuan.app.base.AppManager;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.base.BaseResponse;
import com.luanxingyuan.app.bean.AVChatBean;
import com.luanxingyuan.app.bean.ActorInfoBean;
import com.luanxingyuan.app.bean.AudioUserBean;
import com.luanxingyuan.app.bean.ChargeBean;
import com.luanxingyuan.app.bean.ChatMessageBean;
import com.luanxingyuan.app.bean.CoverUrlBean;
import com.luanxingyuan.app.bean.CustomMessageBean;
import com.luanxingyuan.app.bean.InfoRoomBean;
import com.luanxingyuan.app.bean.LabelBean;
import com.luanxingyuan.app.dialog.p;
import com.luanxingyuan.app.rtc.PreprocessorFaceUnity2;
import com.luanxingyuan.app.rtc.RtcEngineEventHandler;
import com.luanxingyuan.app.rtc.RtcManager;
import com.luanxingyuan.app.socket.SocketMessageManager;
import com.luanxingyuan.app.socket.domain.Mid;
import com.luanxingyuan.app.socket.domain.SocketResponse;
import com.luanxingyuan.app.ttt.QiNiuChecker;
import com.luanxingyuan.app.util.DensityUtil;
import com.luanxingyuan.app.util.DevicesUtil;
import com.luanxingyuan.app.util.LogUtil;
import com.luanxingyuan.app.util.ParamUtil;
import com.luanxingyuan.app.util.SoundRing;
import com.luanxingyuan.app.util.TimeUtil;
import com.luanxingyuan.app.util.ToastUtil;
import com.opensource.svgaplayer.SVGAImageView;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.imsdk.BaseConstants;
import com.tencent.imsdk.TIMConversation;
import com.tencent.imsdk.TIMConversationType;
import com.tencent.imsdk.TIMCustomElem;
import com.tencent.imsdk.TIMElem;
import com.tencent.imsdk.TIMElemType;
import com.tencent.imsdk.TIMManager;
import com.tencent.imsdk.TIMMessage;
import com.tencent.imsdk.TIMMessageListener;
import com.tencent.imsdk.TIMTextElem;
import com.tencent.imsdk.TIMValueCallBack;
import com.tencent.qcloud.tim.uikit.modules.chat.layout.message.ImCustomMessage;
import com.tencent.qcloud.tim.uikit.utils.ScreenUtil;
import d7.i;
import io.agora.rtc2.video.VideoCanvas;
import io.agora.rtc2.video.VideoEncoderConfiguration;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import k6.t0;

public class VideoChatActivity extends BaseActivity implements TIMMessageListener {
    public static boolean isChatting;
    public static String videoHint;

    @BindView
    FrameLayout callingLayout;
    private AVChatBean chatBean;

    @BindView
    View chatLayout;

    @BindView
    TextView hang_up_money;
    private Dialog illegalAlert;

    @BindView
    TextView illegalTv;
    boolean isAddVideoHint;
    private boolean isDisable;
    private View iv_beauty;

    @BindView
    View localCoverView;

    @BindView
    View localIllegalView;

    @BindView
    TextureView localVideoView;

    @BindView
    FrameLayout localView;
    private CountDownTimer mAutoHangUpTimer;

    @BindView
    TextView mCityTv;

    @BindView
    TextView mCloseCameraTv;

    @BindView
    ImageView mCloseMicroIv;

    @BindView
    ImageView mCloseVideoIv;

    @BindView
    LinearLayout mControlLl;
    protected TIMConversation mConversation;

    @BindView
    ImageView mCoverIv;

    @BindView
    TextView mDesTv;

    @BindView
    TextView mFollowTv;

    @BindView
    SVGAImageView mGifSv;

    @BindView
    TextView mGiftDesTv;

    @BindView
    ImageView mGiftHeadIv;

    @BindView
    ImageView mGiftIv;

    @BindView
    LinearLayout mGiftLl;

    @BindView
    TextView mGiftNumberTv;

    @BindView
    TextView mInfoAgeTv;

    @BindView
    ImageView mInfoHeadIv;

    @BindView
    LinearLayout mInfoLl;

    @BindView
    TextView mInfoNickTv;

    @BindView
    TextView mLeftGoldTv;

    @BindView
    ImageView mOtherHeadIv;

    @BindView
    TextView mOtherNameTv;

    @BindView
    RecyclerView mTextListRv;
    private t0 mTextRecyclerAdapter;

    @BindView
    View otherCameraDisable;

    @BindView
    ImageView remoteCloseBtn;

    @BindView
    View remoteCoverView;

    @BindView
    FrameLayout remoteView;
    protected RtcManager rtcManager;
    protected SoundRing soundRing;

    @BindView
    TextView tvVideoHint;
    private Handler mHandler = new Handler(Looper.getMainLooper());
    private long mCurrentSecond = 0;
    private int mSingleTimeSendGiftCount = 0;
    protected boolean mHaveUserJoin = false;
    final int illegalTime = BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH;
    protected final int HANGUP_SYSTEM = 100;
    protected final int HANGUP_DESTROY = 101;
    protected final int HANGUP_TIME_OUT = 102;
    protected final int HANGUP_RTC = 103;
    protected final int HANGUP_LOOP_BREAK = 104;
    protected final int HANGUP_BILLING = 105;
    protected final int HANGUP_CLICK_BREAK = 106;
    protected final int HANGUP_BREAK = 30005;
    protected final int HANGUP_BEAN_SUSPEND = 30006;
    protected final int HANGUP_USER_BREAK = Mid.brokenVIPLineRes;
    protected final int HANGUP_ACTOR_BREAK = Mid.brokenUserLineRes;
    RtcEngineEventHandler rtcEngineEventHandler = new u();
    private Runnable mTimeRunnable = new x();
    private Runnable mGiftRunnable = new i();
    int[] Subscriptions = {Mid.brokenVIPLineRes, Mid.brokenUserLineRes, 30005, 30006, 30010, Mid.invalidChat};
    q6.a<SocketResponse> subscription = new r();

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

        public void onResponse(BaseResponse<AudioUserBean> baseResponse, int i8) {
            if (baseResponse == null || baseResponse.m_istatus != 1 || baseResponse.m_object == null || VideoChatActivity.this.isFinishing()) {
                return;
            }
            VideoChatActivity.this.updateUser(baseResponse.m_object);
        }
    }

    class b extends r6.a<BaseResponse<ActorInfoBean<CoverUrlBean, LabelBean, ChargeBean, InfoRoomBean>>> {
        b() {
        }

        @Override
        public void onError(x8.e eVar, Exception exc, int i8) {
            VideoChatActivity.this.isFinishing();
        }

        public void onResponse(BaseResponse<ActorInfoBean<CoverUrlBean, LabelBean, ChargeBean, InfoRoomBean>> baseResponse, int i8) {
            TextView textView;
            if (baseResponse == null || baseResponse.m_istatus != 1 || (textView = VideoChatActivity.this.hang_up_money) == null) {
                onError(null, null, 0);
                return;
            }
            try {
                textView.setText("视频通话" + String.valueOf(baseResponse.m_object.anchorSetup.get(0).t_video_gold) + "金币/分钟");
            } catch (Exception unused) {
                VideoChatActivity.this.hang_up_money.setVisibility(8);
            }
        }
    }

    class c extends r6.e {
        c() {
        }

        @Override
        public void b(BaseResponse baseResponse, boolean z7) {
            if (VideoChatActivity.this.isFinishing()) {
                return;
            }
            VideoChatActivity.this.setFollow(z7);
        }
    }

    class d implements DialogInterface.OnClickListener {
        d() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i8) {
            VideoChatActivity.this.hangUp(106, AppManager.f().k().t_id);
        }
    }

    class e implements p.e {

        final com.luanxingyuan.app.dialog.p f7195a;

        e(com.luanxingyuan.app.dialog.p pVar) {
            this.f7195a = pVar;
        }

        @Override
        public void a(String str) {
            if (TextUtils.isEmpty(str)) {
                ToastUtil.showToast(2131821196);
            } else {
                VideoChatActivity.this.sendTextMessage(str);
                this.f7195a.dismiss();
            }
        }
    }

    class f extends r6.a<BaseResponse<String>> {

        final q6.a f7197a;

        f(q6.a aVar) {
            this.f7197a = aVar;
        }

        public void onResponse(BaseResponse baseResponse, int i8) {
            q6.a aVar;
            if (baseResponse == null || baseResponse.m_istatus != 1 || (aVar = this.f7197a) == null) {
                return;
            }
            aVar.execute(Boolean.TRUE);
        }
    }

    class g implements Animation.AnimationListener {
        g() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            VideoChatActivity.this.mHandler.postDelayed(VideoChatActivity.this.mGiftRunnable, 3000L);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    }

    class h implements Animation.AnimationListener {
        h() {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (VideoChatActivity.this.mSingleTimeSendGiftCount != 1) {
                VideoChatActivity.this.mGiftLl.setVisibility(8);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationStart(Animation animation) {
        }
    }

    class i implements Runnable {
        i() {
        }

        @Override
        public void run() {
            VideoChatActivity.this.mSingleTimeSendGiftCount = 0;
            VideoChatActivity.this.startGiftOutAnim();
        }
    }

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

        public void onResponse(BaseResponse<Integer> baseResponse, int i8) {
            Integer num;
            if (baseResponse == null || baseResponse.m_istatus != 1 || (num = baseResponse.m_object) == null || num.intValue() == 1) {
                return;
            }
            ToastUtil.showToast("视频已挂断");
            VideoChatActivity.this.hangUp(104, AppManager.f().k().t_id);
        }
    }

    class k implements View.OnClickListener {

        final FaceUnityView f7203a;

        k(FaceUnityView faceUnityView) {
            this.f7203a = faceUnityView;
        }

        @Override
        public void onClick(View view) {
            if (this.f7203a.isShown()) {
                this.f7203a.setVisibility(8);
            } else {
                this.f7203a.setVisibility(0);
            }
        }
    }

    class l implements q6.a<Boolean> {

        class a implements DialogInterface.OnDismissListener {
            a() {
            }

            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                VideoChatActivity.this.illegalAlert = null;
            }
        }

        l() {
        }

        @Override
        public void execute(Boolean bool) {
            if (VideoChatActivity.this.isFinishing()) {
                QiNiuChecker.q().v(null);
                return;
            }
            if (bool.booleanValue()) {
                VideoChatActivity.this.sendMessage(ImCustomMessage.buildIllegalVideo());
                VideoChatActivity.this.IllegalVideo(true);
                if (VideoChatActivity.this.illegalAlert == null) {
                    VideoChatActivity.this.illegalAlert = new com.luanxingyuan.app.dialog.s(((BaseActivity) VideoChatActivity.this).mContext, VideoChatActivity.this.getString(2131820942));
                    VideoChatActivity.this.illegalAlert.setOnDismissListener(new a());
                }
                VideoChatActivity.this.illegalAlert.show();
            }
        }
    }

    class m implements View.OnClickListener {

        final Dialog f7207a;

        m(Dialog dialog) {
            this.f7207a = dialog;
        }

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

    class n implements View.OnClickListener {

        final Dialog f7209a;

        n(Dialog dialog) {
            this.f7209a = dialog;
        }

        @Override
        public void onClick(View view) {
            VideoChatActivity.this.startActivity(new Intent(VideoChatActivity.this.getApplicationContext(), (Class<?>) ChargeActivity.class));
            this.f7209a.dismiss();
        }
    }

    class o implements Runnable {

        final boolean f7211a;

        o(boolean z7) {
            this.f7211a = z7;
        }

        @Override
        public void run() {
            if (VideoChatActivity.this.isFinishing()) {
                return;
            }
            if (this.f7211a) {
                VideoChatActivity.this.localIllegalView.setVisibility(8);
            } else {
                VideoChatActivity.this.remoteCoverView.setTag(null);
                VideoChatActivity.this.remoteCoverView.setVisibility(8);
                VideoChatActivity.this.remoteCloseBtn.setSelected(false);
                VideoChatActivity.this.illegalTv.setText((CharSequence) null);
            }
            if (VideoChatActivity.this.illegalAlert != null) {
                VideoChatActivity.this.illegalAlert.dismiss();
                VideoChatActivity.this.illegalAlert = null;
            }
        }
    }

    class p implements TIMValueCallBack<TIMMessage> {
        p() {
        }

        @Override
        public void onSuccess(TIMMessage tIMMessage) {
            LogUtil.i("TIM SendMsg bitmap");
            VideoChatActivity.this.addNewMessage(tIMMessage, false);
            VideoChatActivity.this.mTextListRv.setVisibility(0);
            VideoChatActivity.this.mTextListRv.scrollToPosition(r3.mTextRecyclerAdapter.getItemCount() - 1);
        }

        @Override
        public void onError(int i8, String str) {
            String str2 = "TIM send message failed. code: " + i8 + " errmsg: " + str;
            LogUtil.i(str2);
            ToastUtil.showToast(VideoChatActivity.this.getApplicationContext(), str2);
            o6.g.C(i8);
        }
    }

    class q implements i.d {
        q() {
        }

        @Override
        public void a(d7.l lVar) {
            if (VideoChatActivity.this.isFinishing()) {
                return;
            }
            VideoChatActivity.this.mGifSv.setImageDrawable(new d7.f(lVar));
            VideoChatActivity.this.mGifSv.s();
        }

        @Override
        public void onError() {
        }
    }

    class r implements q6.a<SocketResponse> {
        r() {
        }

        @Override
        public void execute(SocketResponse socketResponse) {
            int i8 = socketResponse.mid;
            if (i8 == 30005) {
                VideoChatActivity.this.onHangUp(socketResponse.roomId, socketResponse.breakUserId);
            }
            if (i8 == 30006) {
                VideoChatActivity.this.beenShutDown();
                return;
            }
            if (i8 == 30010) {
                VideoChatActivity.this.moneyNotEnough();
                return;
            }
            switch (i8) {
                case Mid.brokenVIPLineRes:
                case Mid.brokenUserLineRes:
                    VideoChatActivity.this.brokenVIPLineRes(socketResponse.roomId, socketResponse.breakUserId, i8);
                    break;
                case Mid.invalidChat:
                    new com.luanxingyuan.app.dialog.s(VideoChatActivity.this, socketResponse.content).show();
                    break;
            }
        }
    }

    class s implements Animator.AnimatorListener {

        final TextView f7216a;

        s(TextView textView) {
            this.f7216a = textView;
        }

        @Override
        public void onAnimationCancel(Animator animator) {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            if (VideoChatActivity.this.isFinishing()) {
                return;
            }
            this.f7216a.setText((CharSequence) null);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }

        @Override
        public void onAnimationStart(Animator animator) {
        }
    }

    class t extends CountDownTimer {
        t(long j8, long j9) {
            super(j8, j9);
        }

        @Override
        public void onFinish() {
            VideoChatActivity.this.countDownFinish();
        }

        @Override
        public void onTick(long j8) {
        }
    }

    class u implements RtcEngineEventHandler {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                ToastUtil.showToast("对方已退出");
                VideoChatActivity.this.hangUp(103, AppManager.f().k().t_id);
            }
        }

        class b implements Runnable {

            final int f7221a;

            b(int i8) {
                this.f7221a = i8;
            }

            @Override
            public void run() {
                VideoChatActivity videoChatActivity = VideoChatActivity.this;
                if (videoChatActivity.mHaveUserJoin || videoChatActivity.mHandler == null) {
                    return;
                }
                VideoChatActivity videoChatActivity2 = VideoChatActivity.this;
                videoChatActivity2.mHaveUserJoin = true;
                videoChatActivity2.mHandler.postDelayed(VideoChatActivity.this.mTimeRunnable, 1000L);
                VideoChatActivity.this.setRemoteVideoView(this.f7221a);
                VideoChatActivity.this.userJoined();
            }
        }

        class c implements Runnable {

            final boolean f7223a;

            c(boolean z7) {
                this.f7223a = z7;
            }

            @Override
            public void run() {
                VideoChatActivity.this.otherCameraDisable.setVisibility(this.f7223a ? 0 : 8);
            }
        }

        u() {
        }

        @Override
        public void onJoinChannelSuccess(String str, int i8, int i9) {
            StringBuilder sb = new StringBuilder();
            sb.append("onJoinChannelSuccess: ");
            sb.append(str);
        }

        @Override
        public void onRemoteVideoStateChanged(int i8, int i9, int i10, int i11) {
            StringBuilder sb = new StringBuilder();
            sb.append(i9);
            sb.append("onRemoteVideoStateChanged: ");
            sb.append(i10);
        }

        @Override
        public void onUserJoined(int i8, int i9) {
            StringBuilder sb = new StringBuilder();
            sb.append("onUserJoined: ");
            sb.append(i8);
            VideoChatActivity.this.runOnUiThread(new b(i8));
        }

        @Override
        public void onUserMuteVideo(int i8, boolean z7) {
            VideoChatActivity.this.runOnUiThread(new c(z7));
        }

        @Override
        public void onUserOffline(int i8, int i9) {
            StringBuilder sb = new StringBuilder();
            sb.append("onUserOffline: ");
            sb.append(i8);
            VideoChatActivity.this.runOnUiThread(new a());
        }
    }

    class v implements Runnable {
        v() {
        }

        @Override
        public void run() {
            FrameLayout frameLayout = VideoChatActivity.this.remoteView;
            if (frameLayout != null) {
                frameLayout.bringToFront();
            }
        }
    }

    class w implements Runnable {
        w() {
        }

        @Override
        public void run() {
            FrameLayout frameLayout = VideoChatActivity.this.localView;
            if (frameLayout != null) {
                frameLayout.bringToFront();
            }
        }
    }

    class x implements Runnable {
        x() {
        }

        @Override
        public void run() {
            if (VideoChatActivity.this.isFinishing() || VideoChatActivity.this.mHandler == null) {
                return;
            }
            VideoChatActivity.this.mCurrentSecond += 1000;
            VideoChatActivity videoChatActivity = VideoChatActivity.this;
            videoChatActivity.mDesTv.setText(TimeUtil.getFormatHMS(videoChatActivity.mCurrentSecond));
            VideoChatActivity.this.mHandler.postDelayed(this, 1000L);
            if ((VideoChatActivity.this.mCurrentSecond / 1000) % 30 == 0) {
                VideoChatActivity.this.getChatState();
            }
            int i8 = ((int) VideoChatActivity.this.mCurrentSecond) / 1000;
            QiNiuChecker.q().o(i8, VideoChatActivity.this.chatBean.getUserId(), VideoChatActivity.this.chatBean.getActorId(), VideoChatActivity.this.chatBean.roomId);
            if (QiNiuChecker.q().m(i8)) {
                VideoChatActivity.this.startAnim();
            }
        }
    }

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

        public void onResponse(BaseResponse baseResponse, int i8) {
            if (baseResponse != null && baseResponse.m_istatus == 1) {
                LogUtil.i("开始计时成功");
                return;
            }
            if (baseResponse == null) {
                ToastUtil.showToast(VideoChatActivity.this.getApplicationContext(), 2131821205);
            } else if (baseResponse.m_istatus == -7) {
                VipAlertActivity.start(VideoChatActivity.this);
            } else if (!TextUtils.isEmpty(baseResponse.m_strMessage)) {
                ToastUtil.showToast(VideoChatActivity.this.getApplicationContext(), baseResponse.m_strMessage);
            }
            VideoChatActivity.this.cancelAutoTimer();
            VideoChatActivity.this.hangUp(105, AppManager.f().k().t_id);
        }
    }

    public void IllegalVideo(boolean z7) {
        View view = this.remoteCoverView;
        if (view != null) {
            if (z7) {
                this.localIllegalView.setVisibility(0);
            } else {
                view.setTag("");
                this.remoteCoverView.setVisibility(0);
                this.remoteCloseBtn.setSelected(true);
                this.illegalTv.setText(2131820941);
            }
            this.illegalTv.postDelayed(new o(z7), 100000L);
        }
    }

    private void QiNiuChecker() {
        String str;
        String str2;
        String str3;
        if (QiNiuChecker.q().t()) {
            String[] r8 = QiNiuChecker.q().r();
            boolean z7 = true;
            if (r8 != null || r8.length > 0) {
                boolean z8 = false;
                for (String str4 : r8) {
                    String[] split = str4.split("-");
                    if (split != null && split.length == 2) {
                        String str5 = split[0];
                        String str6 = split[1];
                        String[] split2 = str5.split(":");
                        String[] split3 = str6.split(":");
                        String str7 = null;
                        if (split2 == null || split2.length != 2) {
                            str = null;
                            str2 = null;
                        } else {
                            str2 = split2[0];
                            str = split2[1];
                        }
                        if (split3 == null || split3.length != 2) {
                            str3 = null;
                        } else {
                            str7 = split3[0];
                            str3 = split3[1];
                        }
                        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str) && !TextUtils.isEmpty(str7) && !TextUtils.isEmpty(str3) && TimeUtil.atTheCurrentTime(Integer.parseInt(str2), Integer.parseInt(str), Integer.parseInt(str7), Integer.parseInt(str3)) && !z8) {
                            z8 = true;
                        }
                    }
                }
                z7 = z8;
            }
            if (z7) {
                File file = new File(getExternalCacheDir().getAbsolutePath(), "鉴黄");
                if (!file.exists()) {
                    file.mkdirs();
                }
                this.rtcManager.rtcEngine().takeSnapshot(0, new File(file, System.currentTimeMillis() + ".jpg").getPath());
            }
        }
    }

    public void addNewMessage(TIMMessage tIMMessage, boolean z7) {
        for (int i8 = 0; i8 < tIMMessage.getElementCount(); i8++) {
            ChatMessageBean chatMessageBean = new ChatMessageBean();
            chatMessageBean.isSelf = tIMMessage.isSelf();
            chatMessageBean.time = tIMMessage.timestamp();
            TIMElem element = tIMMessage.getElement(i8);
            if (element.getType() == TIMElemType.Text) {
                chatMessageBean.type = 0;
                chatMessageBean.textContent = ((TIMTextElem) element).getText();
                this.mTextRecyclerAdapter.a(chatMessageBean);
            } else if (element.getType() == TIMElemType.Custom) {
                String str = new String(((TIMCustomElem) element).getData());
                if (z7) {
                    parseCustomMessage(str);
                }
            }
        }
    }

    private void callingState(boolean z7) {
        if (z7) {
            playMusic();
        } else {
            FrameLayout frameLayout = this.callingLayout;
            if (frameLayout != null) {
                ((ViewGroup) frameLayout.getParent()).removeView(this.callingLayout);
                this.callingLayout = null;
            }
        }
        this.chatLayout.setVisibility(z7 ? 8 : 0);
        initAutoCountTimer();
    }

    private void clickMicro() {
        this.mCloseMicroIv.setSelected(!r0.isSelected());
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            rtcManager.rtcEngine().muteLocalAudioStream(this.mCloseMicroIv.isSelected());
        }
    }

    private void destroy() {
        FURenderer.getInstance().release();
        FaceBeautySource.saveFaceBeautyData2File(new FUDiskFaceBeautyData(), FaceBeautyDataFactory.defaultFaceBeauty, FaceBeautySource.buildFilters());
        if (this.rtcManager == null) {
            return;
        }
        Dialog dialog = this.illegalAlert;
        if (dialog != null) {
            dialog.dismiss();
            this.illegalAlert = null;
        }
        QiNiuChecker.q().v(null);
        destroyRtc();
        SocketMessageManager.get().unsubscribe(this.subscription);
        hangUp(101, AppManager.f().k().t_id);
        stopPlay();
        cancelAutoTimer();
        Handler handler = this.mHandler;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
            this.mHandler = null;
        }
        SVGAImageView sVGAImageView = this.mGifSv;
        if (sVGAImageView != null) {
            sVGAImageView.o();
            this.mGifSv = null;
        }
        o6.g.F(null);
        TIMManager.getInstance().removeMessageListener(this);
        requestBreak(this.chatBean.roomId, null);
        toComment();
        isChatting = false;
    }

    private void destroyRtc() {
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            rtcManager.removeRtcHandler(this.rtcEngineEventHandler);
            this.rtcManager.rtcEngine().leaveChannel();
            this.rtcManager = null;
        }
    }

    private void getActorInfo(int i8) {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
        hashMap.put("coverUserId", Integer.valueOf(i8));
        x7.a.h().a("language", m6.b.f15484u).c(m6.a.r()).e("param", ParamUtil.getParam(hashMap)).f().c(new b());
    }

    public void getChatState() {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        hashMap.put("videoUserId", Integer.valueOf(this.chatBean.getUserId()));
        hashMap.put("videoCoverUserId", Integer.valueOf(this.chatBean.getActorId()));
        hashMap.put("roomId", Integer.valueOf(this.chatBean.roomId));
        x7.a.h().c(m6.a.k2()).e("param", ParamUtil.getParam(hashMap)).f().c(new j());
    }

    private void getOtherData(int i8) {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", Integer.valueOf(AppManager.f().k().t_id));
        hashMap.put("coverUserId", Integer.valueOf(i8));
        x7.a.h().c(m6.a.g2()).e("param", ParamUtil.getParam(hashMap)).f().c(new a());
    }

    private void initAutoCountTimer() {
        cancelAutoTimer();
        if (this.mAutoHangUpTimer == null) {
            t tVar = new t(BaseConstants.DEFAULT_MSG_TIMEOUT, 1000L);
            this.mAutoHangUpTimer = tVar;
            tVar.start();
        }
    }

    private void initIm() {
        if (isFinishing()) {
            return;
        }
        TIMConversation conversation = TIMManager.getInstance().getConversation(TIMConversationType.C2C, String.valueOf(this.chatBean.otherId + 10000));
        this.mConversation = conversation;
        if (conversation != null) {
            TIMManager.getInstance().addMessageListener(this);
        }
    }

    private void initTextChat() {
        this.mTextRecyclerAdapter = new t0(this);
        this.mTextListRv.setLayoutManager(new LinearLayoutManager(this));
        this.mTextListRv.setAdapter(this.mTextRecyclerAdapter);
        if (!TextUtils.isEmpty(videoHint)) {
            this.tvVideoHint.setText(videoHint);
        }
        this.tvVideoHint.setVisibility(TextUtils.isEmpty(videoHint) ? 8 : 0);
        float wHScale = ScreenUtil.getWHScale(this.mContext);
        int dip2px = DensityUtil.dip2px(this.mContext, 92.0f);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(dip2px, (int) (dip2px * wHScale));
        layoutParams.topMargin = DensityUtil.dip2px(this.mContext, 30.0f);
        layoutParams.rightMargin = DensityUtil.dip2px(this.mContext, 10.0f);
        layoutParams.gravity = 8388613;
        this.remoteView.setLayoutParams(layoutParams);
    }

    private void initViewShow() {
        int i8 = 8;
        this.remoteCloseBtn.setVisibility(!this.chatBean.isActor() ? 8 : 0);
        AVChatBean aVChatBean = this.chatBean;
        boolean z7 = aVChatBean.isRequest;
        ImageView imageView = this.mCoverIv;
        if (z7 && !aVChatBean.isActor()) {
            i8 = 0;
        }
        imageView.setVisibility(i8);
        callingState(z7);
    }

    private void parseCustomMessage(String str) {
        CustomMessageBean parseBean;
        if (isFinishing() || (parseBean = CustomMessageBean.parseBean(str)) == null) {
            return;
        }
        if (!"1".equals(parseBean.type)) {
            if (ImCustomMessage.Type_pulp.equals(parseBean.type)) {
                IllegalVideo(false);
            }
        } else {
            LogUtil.i("接收到的礼物: " + parseBean.gift_name);
            startGif(parseBean.gift_gif_url);
            startGiftInAnim(parseBean, false);
        }
    }

    public void sendMessage(TIMElem tIMElem) {
        TIMMessage tIMMessage = new TIMMessage();
        if (tIMMessage.addElement(tIMElem) != 0) {
            ToastUtil.showToast(getApplicationContext(), 2131820826);
            return;
        }
        TIMConversation tIMConversation = this.mConversation;
        if (tIMConversation == null) {
            ToastUtil.showToast(getApplicationContext(), 2131821375);
            initIm();
        } else if (tIMElem != null) {
            tIMConversation.sendMessage(tIMMessage, new p());
        } else {
            ToastUtil.showToast(getApplicationContext(), 2131820826);
        }
    }

    public void sendTextMessage(String str) {
        if (TextUtils.isEmpty(str)) {
            ToastUtil.showToast(getApplicationContext(), 2131821196);
            return;
        }
        String d8 = o6.f.b().d(getApplicationContext(), str);
        TIMTextElem tIMTextElem = new TIMTextElem();
        tIMTextElem.setText(d8);
        sendMessage(tIMTextElem);
    }

    public void setFollow(boolean z7) {
        this.mFollowTv.setSelected(z7);
        this.mFollowTv.setText(z7 ? "已关注" : "关注");
    }

    private void setGoldDialogView(View view, Dialog dialog) {
        ((TextView) view.findViewById(2131296807)).setOnClickListener(new m(dialog));
        ((TextView) view.findViewById(2131296470)).setOnClickListener(new n(dialog));
    }

    private void setNotice() {
        if (!TextUtils.isEmpty(videoHint)) {
            this.tvVideoHint.setText(videoHint);
        }
        this.tvVideoHint.setVisibility(TextUtils.isEmpty(videoHint) ? 8 : 0);
    }

    public void setRemoteVideoView(int i8) {
        this.mControlLl.setVisibility(0);
        this.mCoverIv.setVisibility(8);
        SurfaceView surfaceView = new SurfaceView(getBaseContext());
        surfaceView.setZOrderMediaOverlay(true);
        this.rtcManager.rtcEngine().setupRemoteVideo(new VideoCanvas(surfaceView, 1, i8));
        this.remoteView.addView(surfaceView, 0, new FrameLayout.LayoutParams(-1, -1));
        setNotice();
    }

    private void showGoldJustEnoughDialog() {
        Dialog dialog = new Dialog(this, 2131886280);
        View inflate = LayoutInflater.from(this).inflate(2131493059, (ViewGroup) null);
        setGoldDialogView(inflate, dialog);
        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(17);
        }
        dialog.setCanceledOnTouchOutside(true);
        if (isFinishing()) {
            return;
        }
        dialog.show();
    }

    public static void start(Context context, AVChatBean aVChatBean) {
        Intent intent = new Intent(context, (Class<?>) VideoChatActivity.class);
        intent.putExtra("bean", aVChatBean);
        context.startActivity(intent);
    }

    public void startAnim() {
        if (isFinishing() || TextUtils.isEmpty(QiNiuChecker.q().s())) {
            return;
        }
        TextView textView = (TextView) findViewById(2131296354);
        textView.setText(QiNiuChecker.q().s());
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(textView, "translationX", u3.g.b(AppManager.f()), 0.0f);
        ofFloat.setDuration(1000L);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(textView, "translationX", 0.0f, 0.0f);
        ofFloat2.setDuration(10000L);
        ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(textView, "translationX", 0.0f, -r1);
        ofFloat3.setDuration(1000L);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playSequentially(ofFloat, ofFloat2, ofFloat3);
        animatorSet.addListener(new s(textView));
        animatorSet.start();
    }

    private void startComboAnim(TextView textView) {
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(textView, "scaleX", 1.8f, 1.0f);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(textView, "scaleY", 1.8f, 1.0f);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(300L);
        animatorSet.setInterpolator(new OvershootInterpolator());
        animatorSet.playTogether(ofFloat, ofFloat2);
        animatorSet.start();
    }

    private void startCountTime() {
        if (this.chatBean.countdown) {
            HashMap hashMap = new HashMap();
            hashMap.put("anthorId", Integer.valueOf(this.chatBean.otherId));
            hashMap.put("userId", getUserId());
            hashMap.put("chatType", 1);
            hashMap.put("roomId", Integer.valueOf(this.chatBean.roomId));
            x7.a.h().c(m6.a.w1()).e("param", ParamUtil.getParam(hashMap)).f().c(new y());
        }
    }

    private void startGif(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        try {
            new d7.i(this).y(new URL(str), new q());
        } catch (MalformedURLException e8) {
            e8.printStackTrace();
        }
    }

    private void startGiftInAnim(CustomMessageBean customMessageBean, boolean z7) {
        String trim = this.mGiftDesTv.getText().toString().trim();
        if (!TextUtils.isEmpty(trim) && !trim.contains(customMessageBean.gift_name)) {
            this.mSingleTimeSendGiftCount = 0;
        }
        if (customMessageBean.gift_number == 0) {
            customMessageBean.gift_number = 1;
        }
        this.mSingleTimeSendGiftCount += customMessageBean.gift_number;
        if (this.mGiftLl.getVisibility() == 0) {
            this.mGiftNumberTv.setText(getResources().getString(2131821044) + this.mSingleTimeSendGiftCount);
            this.mHandler.removeCallbacks(this.mGiftRunnable);
            this.mHandler.postDelayed(this.mGiftRunnable, 3000L);
            startComboAnim(this.mGiftNumberTv);
            return;
        }
        this.mGiftDesTv.setText(z7 ? 2131821296 : 2131821298);
        this.mGiftDesTv.append(customMessageBean.gift_name);
        o6.i.i(this, customMessageBean.gift_still_url, this.mGiftIv);
        this.mGiftNumberTv.setText(String.format("x%s", Integer.valueOf(customMessageBean.gift_number)));
        this.mGiftLl.setVisibility(0);
        this.mGiftLl.clearAnimation();
        TranslateAnimation translateAnimation = (TranslateAnimation) AnimationUtils.loadAnimation(getApplicationContext(), 2130771987);
        this.mGiftLl.setAnimation(translateAnimation);
        translateAnimation.start();
        this.mHandler.removeCallbacks(this.mGiftRunnable);
        translateAnimation.setAnimationListener(new g());
    }

    public void startGiftOutAnim() {
        this.mGiftLl.clearAnimation();
        Animation loadAnimation = AnimationUtils.loadAnimation(getApplicationContext(), 2130771988);
        this.mGiftLl.setAnimation(loadAnimation);
        loadAnimation.start();
        loadAnimation.setAnimationListener(new h());
    }

    private void toComment() {
        if (!this.mHaveUserJoin || this.isDisable) {
            return;
        }
        VideoCommentActivity.start(this.chatBean);
    }

    private void toggleBigAndSmall() {
        ViewGroup.LayoutParams layoutParams = this.localView.getLayoutParams();
        ViewGroup.LayoutParams layoutParams2 = this.remoteView.getLayoutParams();
        if (layoutParams.width > layoutParams2.width) {
            this.remoteView.postDelayed(new v(), 200L);
        } else {
            this.localView.postDelayed(new w(), 200L);
        }
        this.remoteView.setLayoutParams(layoutParams);
        this.localView.setLayoutParams(layoutParams2);
    }

    protected void beenShutDown() {
        this.isDisable = true;
        hangUp(30006, AppManager.f().k().t_id);
    }

    protected void brokenVIPLineRes(int i8, int i9, int i10) {
        if (i8 != this.chatBean.roomId) {
            return;
        }
        ToastUtil.showToast(2131820919);
        hangUp(i10, AppManager.f().k().t_id);
    }

    protected void cancelAutoTimer() {
        CountDownTimer countDownTimer = this.mAutoHangUpTimer;
        if (countDownTimer != null) {
            countDownTimer.cancel();
            this.mAutoHangUpTimer = null;
        }
    }

    protected void checkPermission() {
        if (Build.VERSION.SDK_INT >= 23) {
            ArrayList arrayList = new ArrayList();
            if (q.c.a(this, "android.permission.CAMERA") != 0) {
                arrayList.add("android.permission.CAMERA");
            }
            if (q.c.a(this, "android.permission.RECORD_AUDIO") != 0) {
                arrayList.add("android.permission.RECORD_AUDIO");
            }
            if (q.c.a(this, "android.permission.WRITE_EXTERNAL_STORAGE") != 0) {
                arrayList.add("android.permission.WRITE_EXTERNAL_STORAGE");
            }
            if (q.c.a(this, "android.permission.READ_EXTERNAL_STORAGE") != 0) {
                arrayList.add("android.permission.READ_EXTERNAL_STORAGE");
            }
            if (q.c.a(this, "android.permission.ACCESS_COARSE_LOCATION") != 0) {
                arrayList.add("android.permission.ACCESS_COARSE_LOCATION");
            }
            if (q.c.a(this, "android.permission.READ_PHONE_STATE") != 0) {
                arrayList.add("android.permission.READ_PHONE_STATE");
            }
            if (q.c.a(this, "android.permission.SYSTEM_ALERT_WINDOW") != 0) {
                arrayList.add("android.permission.SYSTEM_ALERT_WINDOW");
            }
            if (arrayList.size() > 0) {
                androidx.core.app.c.l(this, (String[]) arrayList.toArray(new String[0]), 100);
            }
        }
    }

    protected void countDownFinish() {
        ToastUtil.showToast(2131821076);
        hangUp(102, AppManager.f().k().t_id);
    }

    @Override
    public void finish() {
        destroy();
        super.finish();
    }

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

    protected SoundRing getSoundRing() {
        return new SoundRing();
    }

    protected void hangUp(int i8, int i9) {
        if (i8 == 100 || i9 == AppManager.f().k().t_id || i9 == this.chatBean.otherId) {
            finish();
        }
    }

    protected void initData(Intent intent) {
        AVChatBean aVChatBean = (AVChatBean) intent.getSerializableExtra("bean");
        this.chatBean = aVChatBean;
        if (aVChatBean == null) {
            return;
        }
        initViewShow();
        getOtherData(this.chatBean.otherId);
        getActorInfo(this.chatBean.otherId);
        initIm();
        initVideo();
    }

    protected void initVideo() {
        VideoEncoderConfiguration videoEncoderConfiguration = new VideoEncoderConfiguration(VideoEncoderConfiguration.VD_960x540, VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_15, 0, VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT);
        videoEncoderConfiguration.degradationPrefer = VideoEncoderConfiguration.DEGRADATION_PREFERENCE.MAINTAIN_FRAMERATE;
        RtcManager rtcManager = RtcManager.get();
        this.rtcManager = rtcManager;
        rtcManager.addRtcHandler(this.rtcEngineEventHandler);
        this.rtcManager.rtcEngine().setVideoEncoderConfiguration(videoEncoderConfiguration);
        this.rtcManager.rtcEngine().setupLocalVideo(new VideoCanvas(this.localVideoView, 1, AppManager.f().k().t_id));
        this.rtcManager.rtcEngine().enableVideo();
        this.rtcManager.rtcEngine().registerVideoFrameObserver(PreprocessorFaceUnity2.getInstance());
        this.rtcManager.rtcEngine().startPreview();
        this.rtcManager.rtcEngine().enableLocalAudio(true);
        this.rtcManager.rtcEngine().enableLocalVideo(true);
        this.rtcManager.rtcEngine().setChannelProfile(1);
        this.rtcManager.rtcEngine().setClientRole(1);
        this.rtcManager.rtcEngine().joinChannel(this.chatBean.sign, this.chatBean.roomId + "", (String) null, AppManager.f().k().t_id);
        if (this.chatBean.closeVideo) {
            switchCamera(true);
        }
    }

    @Override
    protected boolean isImmersionBarEnabled() {
        getWindow().addFlags(8320);
        return true;
    }

    protected void moneyNotEnough() {
        if (isFinishing()) {
            return;
        }
        showGoldJustEnoughDialog();
    }

    @OnClick
    public void onClick(View view) {
        switch (view.getId()) {
            case 2131296464:
                RtcManager rtcManager = this.rtcManager;
                if (rtcManager != null) {
                    rtcManager.rtcEngine().switchCamera();
                    break;
                }
                break;
            case 2131296508:
            case 2131296509:
                switchCamera(!view.isSelected());
                break;
            case 2131296511:
                clickMicro();
                break;
            case 2131296513:
                if (this.remoteCoverView.getTag() == null) {
                    View view2 = this.remoteCoverView;
                    view2.setVisibility(view2.getVisibility() == 8 ? 0 : 8);
                    this.remoteCloseBtn.setSelected(this.remoteCoverView.getVisibility() == 0);
                    break;
                }
                break;
            case 2131296693:
                new c().a(this.chatBean.otherId, !view.isSelected());
                break;
            case 2131296774:
            case 2131296776:
                new AlertDialog.Builder(this.mContext).setMessage("你确定退出聊天吗?").setNegativeButton("狠心挂断", new d()).setPositiveButton("再聊一会", (DialogInterface.OnClickListener) null).create().show();
                break;
            case 2131296909:
            case 2131297150:
            case 2131297310:
                int indexOfChild = ((ViewGroup) view.getParent()).indexOfChild(view);
                if (view.getId() != 2131297310 && indexOfChild != 0) {
                    toggleBigAndSmall();
                    break;
                } else if (this.chatLayout.getVisibility() == 0) {
                    if (this.mControlLl.getVisibility() != 0) {
                        this.mControlLl.setVisibility(0);
                        this.mTextListRv.setVisibility(0);
                        this.tvVideoHint.setAlpha(1.0f);
                        break;
                    } else {
                        this.mControlLl.setVisibility(4);
                        this.mTextListRv.setVisibility(8);
                        this.tvVideoHint.setAlpha(0.2f);
                        break;
                    }
                }
                break;
            case 2131296931:
                com.luanxingyuan.app.dialog.p pVar = new com.luanxingyuan.app.dialog.p();
                pVar.g(new e(pVar));
                pVar.show(getSupportFragmentManager(), "tag");
                break;
            case 2131297159:
                new com.luanxingyuan.app.dialog.m(this.mContext, this.chatBean.otherId).show();
                break;
        }
    }

    @Override
    protected void onContentAdded() {
        FaceBeautyDataFactory.setDefaultFaceBeauty();
        FaceUnityView faceUnityView = (FaceUnityView) findViewById(2131296703);
        FaceUnityDataFactory faceUnityDataFactory = new FaceUnityDataFactory(0);
        faceUnityView.bindDataFactory(faceUnityDataFactory);
        faceUnityDataFactory.bindCurrentRenderer();
        View findViewById = findViewById(2131296862);
        this.iv_beauty = findViewById;
        findViewById.setOnClickListener(new k(faceUnityView));
        isChatting = true;
        this.soundRing = getSoundRing();
        QiNiuChecker.q().n();
        QiNiuChecker.q().v(new l());
        checkPermission();
        needHeader(false);
        initTextChat();
        initData(getIntent());
        TIMManager.getInstance().addMessageListener(this);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        overridePendingTransition(0, 0);
        super.onCreate(bundle);
        SocketMessageManager.get().subscribe(this.subscription, this.Subscriptions);
    }

    @Override
    protected void onDestroy() {
        destroy();
        super.onDestroy();
    }

    protected void onHangUp(int i8, int i9) {
        if (i8 != this.chatBean.roomId) {
            return;
        }
        hangUp(i9 == 0 ? 100 : 30005, i9);
    }

    @Override
    public boolean onKeyDown(int i8, KeyEvent keyEvent) {
        return i8 == 4 || super.onKeyDown(i8, keyEvent);
    }

    @Override
    public boolean onNewMessages(List<TIMMessage> list) {
        if (isFinishing()) {
            return false;
        }
        LogUtil.i("单人聊天页面新消息来了");
        String valueOf = String.valueOf(this.chatBean.otherId + 10000);
        for (TIMMessage tIMMessage : list) {
            TIMConversation conversation = tIMMessage.getConversation();
            if (conversation != null && conversation.getType() == TIMConversationType.C2C && !TextUtils.isEmpty(conversation.getPeer()) && TextUtils.equals(conversation.getPeer(), valueOf)) {
                addNewMessage(tIMMessage, true);
            }
        }
        RecyclerView recyclerView = this.mTextListRv;
        if (recyclerView != null) {
            recyclerView.setVisibility(0);
            this.mTextListRv.scrollToPosition(this.mTextRecyclerAdapter.getItemCount() - 1);
        }
        return true;
    }

    @Override
    protected void onPause() {
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null && rtcManager.rtcEngine() != null) {
            this.rtcManager.rtcEngine().disableVideo();
        }
        PreprocessorFaceUnity2.getInstance().setRenderEnable(false);
        overridePendingTransition(0, 0);
        super.onPause();
    }

    @Override
    protected void onResume() {
        super.onResume();
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null && rtcManager.rtcEngine() != null) {
            this.rtcManager.rtcEngine().enableVideo();
        }
        PreprocessorFaceUnity2.getInstance().setRenderEnable(true);
    }

    protected void onVideoStartSocketHint(String str) {
        if (this.isAddVideoHint || TextUtils.isEmpty(str)) {
            return;
        }
        this.isAddVideoHint = true;
        this.mTextRecyclerAdapter.b(str);
        RecyclerView recyclerView = this.mTextListRv;
        if (recyclerView != null) {
            if (recyclerView.getVisibility() != 0) {
                this.mTextListRv.setVisibility(0);
            }
            this.mTextListRv.scrollToPosition(this.mTextRecyclerAdapter.c());
        }
    }

    protected void playMusic() {
        SoundRing soundRing = this.soundRing;
        if (soundRing != null) {
            soundRing.start();
        }
    }

    protected void requestBreak(int i8, q6.a<Boolean> aVar) {
        HashMap hashMap = new HashMap();
        hashMap.put("userId", getUserId());
        hashMap.put("roomId", Integer.valueOf(i8));
        x7.a.h().c(m6.a.h()).e("param", ParamUtil.getParam(hashMap)).f().c(new f(aVar));
    }

    protected void stopPlay() {
        SoundRing soundRing = this.soundRing;
        if (soundRing != null) {
            soundRing.stop();
        }
    }

    protected void switchCamera(boolean z7) {
        RtcManager rtcManager = this.rtcManager;
        if (rtcManager != null) {
            rtcManager.rtcEngine().muteLocalVideoStream(z7);
            this.localCoverView.setVisibility(z7 ? 0 : 8);
        }
        if (this.callingLayout != null) {
            this.mCloseCameraTv.setSelected(z7);
            this.mCloseCameraTv.setText(z7 ? 2131821102 : 2131821118);
        }
        this.mCloseVideoIv.setSelected(z7);
    }

    protected void updateUser(AudioUserBean audioUserBean) {
        this.mOtherNameTv.setText(audioUserBean.nickName);
        this.mInfoNickTv.setText(audioUserBean.nickName);
        this.mInfoAgeTv.setText(String.format("%s岁", Integer.valueOf(audioUserBean.t_age)));
        String str = audioUserBean.handImg;
        if (TextUtils.isEmpty(str)) {
            this.mOtherHeadIv.setImageResource(2131231010);
            this.mGiftHeadIv.setImageResource(2131231010);
            this.mInfoHeadIv.setImageResource(2131231010);
        } else {
            o6.i.e(this, str, this.mOtherHeadIv, 5, DevicesUtil.dp2px(this, 50.0f), DevicesUtil.dp2px(this, 50.0f));
            o6.i.a(this, str, this.mGiftHeadIv);
            o6.i.a(this, str, this.mInfoHeadIv);
        }
        if (this.chatBean.isActor() && !TextUtils.isEmpty(audioUserBean.balance)) {
            this.mLeftGoldTv.setText(getString(2131820968) + audioUserBean.balance);
            this.mLeftGoldTv.setVisibility(0);
        }
        if (this.chatBean.isRequest) {
            com.bumptech.glide.b.x(this.mContext).p(audioUserBean.t_cover_img).p0(new d3.i()).G0(this.mCoverIv);
        }
        this.mCityTv.setText(audioUserBean.t_city);
        setFollow(audioUserBean.isFollow == 1);
    }

    protected void userJoined() {
        if (this.chatBean.countdown) {
            startCountTime();
        }
        callingState(false);
        cancelAutoTimer();
        stopPlay();
        toggleBigAndSmall();
    }
}