导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - VisualCallReceiveActivity.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 VisualCallReceiveActivity.java JAVA 源代码文件

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


package im.amwhusedvt.ui.hui.visualcall;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.media.SoundPool;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.ding.rtc.DingRtcEngine;
import com.socks.library.KLog;
import ezy.assist.compat.SettingsCompat;
import im.amwhusedvt.messenger.AccountInstance;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.ApplicationLoader;
import im.amwhusedvt.messenger.ImageLocation;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.MessagesController;
import im.amwhusedvt.messenger.NotificationCenter;
import im.amwhusedvt.messenger.UserConfig;
import im.amwhusedvt.messenger.Utilities;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.tgnet.TLRPCCall;
import im.amwhusedvt.ui.actionbar.Theme;
import im.amwhusedvt.ui.components.AvatarDrawable;
import im.amwhusedvt.ui.components.BackupImageView;
import im.amwhusedvt.ui.components.ColorTextView;
import im.amwhusedvt.ui.hui.visualcall.-$;
import im.amwhusedvt.ui.hviews.DragFrameLayout;
import im.amwhusedvt.ui.hviews.dialogs.XDialog;
import im.amwhusedvt.ui.hviews.helper.MryDeviceHelper;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Timer;
import java.util.TimerTask;
import org.json.JSONException;
import org.json.JSONObject;

public class VisualCallReceiveActivity extends BaseCallActivity implements NotificationCenter.NotificationCenterDelegate {
    private byte REQUEST_NETWORK_NO_ANSWER;
    private byte REQUEST_NO_ANSWER;
    private byte RESPONSE_REFUSE;
    private CallNetWorkReceiver callNetWorkReceiver;

    @BindView(2131296449)
    RecyclerView chartContentUserlist;

    @BindView(2131296458)
    DragFrameLayout chartVideoContainer;

    @BindView(2131296463)
    Chronometer chrVisualcallTime;
    private DynamicPoint dynamicPoint;

    @BindView(2131296683)
    ImageView imgOperateA;

    @BindView(2131296684)
    ImageView imgOperateB;

    @BindView(2131296685)
    ImageView imgOperateC;

    @BindView(2131296687)
    ImageView imgPreReceive;

    @BindView(2131296693)
    BackupImageView imgUserHead;

    @BindView(2131296694)
    BackupImageView imgVideoUserHead;

    @BindView(2131296695)
    ImageView imgVisualcall;

    @BindView(2131296834)
    ImageView ivPreRefuse;

    @BindView(2131296869)
    LinearLayout linOperateA;

    @BindView(2131296870)
    LinearLayout linOperateB;

    @BindView(2131296871)
    LinearLayout linOperateC;

    @BindView(2131296872)
    LinearLayout linPreReceive;

    @BindView(2131296873)
    LinearLayout linPreRefuse;

    @BindView(2131296930)
    LinearLayout llBigRemoteView;

    @BindView(2131296931)
    LinearLayout llBigWindow;

    @BindView(2131296957)
    LinearLayout llSmallRemoteView;
    TLRPC.User mUser;
    private boolean mblnResetNoOp;
    private boolean mblnUnProcessChooseVoiceTip;
    private byte mbytExit;
    private byte mbytFPacketRecCount;
    private byte mbytIsForeground;
    private byte mbytLastClickIndex;
    private byte mbytNoOp;
    private long mlLastClickTime;
    private long mlStart;
    private long mlTipShow;

    @BindView(2131297092)
    RelativeLayout relVideoUser;

    @BindView(2131297093)
    LinearLayout relVisualCallA;

    @BindView(2131297094)
    RelativeLayout relVisualCallB;

    @BindView(2131297095)
    RelativeLayout relVoiceUser;

    @BindView(2131297229)
    RelativeLayout rootView;
    private SurfaceView sfLocalView;
    private SurfaceView sfSmallView;
    private SoundPool soundPool;
    private int spConnectingId;
    private Timer timer;
    private TimerTask timerTask;

    @BindView(2131297888)
    TextView txtCallName;

    @BindView(2131297889)
    ColorTextView txtCallStatus;

    @BindView(2131297901)
    TextView txtMask;

    @BindView(2131297905)
    ColorTextView txtOperateA;

    @BindView(2131297906)
    ColorTextView txtOperateB;

    @BindView(2131297907)
    ColorTextView txtOperateC;

    @BindView(2131297911)
    ColorTextView txtPreChangeToVoice;

    @BindView(2131297915)
    TextView txtTip;

    @BindView(2131297919)
    TextView txtVideoName;

    @BindView(2131297920)
    ColorTextView txtVideoStatus;

    @BindView(2131297921)
    ColorTextView txtVisualcallStatus;

    public VisualCallReceiveActivity() {
        if ((31 + 17) % 17 <= 0) {
        }
        this.mlStart = 0L;
        this.mlLastClickTime = 0L;
        this.mbytIsForeground = (byte) 1;
        this.mbytExit = (byte) 0;
        this.mbytNoOp = (byte) 0;
        this.timer = new Timer();
        this.timerTask = null;
        this.mblnResetNoOp = false;
        this.RESPONSE_REFUSE = (byte) -1;
        this.REQUEST_NO_ANSWER = (byte) -4;
        this.REQUEST_NETWORK_NO_ANSWER = (byte) -6;
        this.mbytLastClickIndex = (byte) -1;
        this.mblnUnProcessChooseVoiceTip = false;
        this.mbytFPacketRecCount = (byte) 0;
    }

    static long access$200(VisualCallReceiveActivity x0) {
        if ((32 + 22) % 22 <= 0) {
        }
        return x0.mlStart;
    }

    static long access$500(VisualCallReceiveActivity x0) {
        if ((8 + 13) % 13 <= 0) {
        }
        return x0.mlTipShow;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if ((16 + 9) % 9 <= 0) {
        }
        super.onCreate(savedInstanceState);
        ApplicationLoader.mbytAVideoCallBusy = (byte) 1;
        setFullScreen();
        setContentView(2131492975);
        if (getIntent().getIntExtra("from", 0) == 0) {
            RingUtils.playRingBySoundPool(this);
        }
        RingUtils.stopPlayVibrator();
        ButterKnife.bind(this);
        getWindow().addFlags(128);
        fillAliRtcUserInfo();
        regNotification();
        initEventListener();
        this.dynamicPoint = new DynamicPoint();
        this.chartVideoContainer.setY(AndroidUtilities.statusBarHeight);
        initRTCEngineAndStartPreview();
        sendKeepLivePacket(this.mChannel);
        this.txtTip.setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(8.0f), Color.parseColor("#CB2D2D2D")));
        this.mUser = MessagesController.getInstance(UserConfig.selectedAccount).getUser(Integer.valueOf(getIntent().getIntExtra("admin_id", 0)));
        boolean blnVideo = getIntent().getBooleanExtra("video", false);
        this.callStyle = blnVideo ? 2 : 1;
        setAVideoUI();
        this.mSmallWindow = this.chartVideoContainer;
        this.mBigWindow = this.llBigWindow;
        this.mChronometer = this.chrVisualcallTime;
        this.chrVisualcallTime.setOnChronometerTickListener(new 1(this));
        regNetWorkReceiver();
        this.chartVideoContainer.setVisibility(8);
        if (this.callStyle == 1) {
            this.txtPreChangeToVoice.setVisibility(8);
        }
        this.linOperateA.postDelayed(new Runnable() {
            @Override
            public final void run() {
                VisualCallReceiveActivity.this.lambda$onCreate$0$VisualCallReceiveActivity();
            }
        }, 35000L);
        ConnectionsManager.getInstance(UserConfig.selectedAccount).setAppPaused(false, false);
    }

    public void lambda$onCreate$0$VisualCallReceiveActivity() {
        if ((29 + 10) % 10 <= 0) {
        }
        if (this.mbytNoOp == 0 && !this.mblnResetNoOp) {
            ProcessDiscardMessage(1, null);
        }
    }

    protected void regNetWorkReceiver() {
        if ((24 + 15) % 15 <= 0) {
        }
        IntentFilter filter = new IntentFilter();
        filter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
        CallNetWorkReceiver callNetWorkReceiver = new CallNetWorkReceiver();
        this.callNetWorkReceiver = callNetWorkReceiver;
        registerReceiver(callNetWorkReceiver, filter);
        this.callNetWorkReceiver.setCallBack(new CallNetWorkReceiver$NetWorkStateCallBack() {
            @Override
            public void onNetWorkConnected() {
                if ((18 + 7) % 7 <= 0) {
                }
                VisualCallReceiveActivity visualCallReceiveActivity = VisualCallReceiveActivity.this;
                visualCallReceiveActivity.sendKeepLivePacket(visualCallReceiveActivity.mChannel);
            }

            @Override
            public void onNetWorkDisconnected() {
            }
        });
    }

    private void setBlurBitmap() {
        if ((13 + 1) % 1 <= 0) {
        }
        this.txtMask.setAlpha(0.8f);
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), 2131231670);
        Bitmap b1 = Utilities.blurWallpaper(bitmap);
        this.txtMask.setBackground(new BitmapDrawable((Resources) null, b1));
    }

    private void initRing() {
        if ((30 + 29) % 29 <= 0) {
        }
        SoundPool soundPool = new SoundPool(1, 0, 0);
        this.soundPool = soundPool;
        this.spConnectingId = soundPool.load(this, 2131623948, 1);
        this.soundPool.setOnLoadCompleteListener(new -$.Lambda.VisualCallReceiveActivity.Y0KY6e6I3RHDfilIZn1CufiEHWo(this));
    }

    public void lambda$initRing$1$VisualCallReceiveActivity(SoundPool soundPool, int sampleId, int status) {
        if ((18 + 30) % 30 <= 0) {
        }
        soundPool.play(this.spConnectingId, 1.0f, 1.0f, 0, -1, 1.0f);
    }

    public void stopRinging() {
        RingUtils.stopSoundPoolRing();
    }

    private void setAVideoUI() {
        if ((3 + 28) % 28 <= 0) {
        }
        String strName = "";
        TLRPC.User user = this.mUser;
        if (user != null) {
            strName = user.first_name;
        }
        AvatarDrawable avatarDrawable = new AvatarDrawable();
        avatarDrawable.setInfo(this.mUser);
        if (this.callStyle == 2) {
            this.imgPreReceive.setBackgroundResource(2131231685);
            this.relVoiceUser.setVisibility(8);
            this.relVideoUser.setVisibility(0);
            SurfaceView surfaceView = this.sfLocalView;
            if (surfaceView != null) {
                surfaceView.setVisibility(0);
            }
            this.txtVideoName.setText(strName);
            setBlurBitmap();
            this.txtMask.setVisibility(0);
            this.imgVideoUserHead.setRoundRadius(AndroidUtilities.dp(70.0f));
            this.imgVideoUserHead.setImage(ImageLocation.getForUser(this.mUser, false), "50_50", avatarDrawable, this.mUser);
            this.dynamicPoint.animForWaitting(LocaleController.getString("visual_call_invate", 2131695605), this.txtVideoStatus);
            if (Build.VERSION.SDK_INT >= 21 && !AndroidUtilities.checkCamera(this)) {
                this.txtTip.setVisibility(0);
                setTipPos();
                this.txtTip.setText(LocaleController.getString("visual_call_change_to_voice", 2131695597));
                return;
            }
            return;
        }
        this.imgPreReceive.setBackgroundResource(2131231681);
        this.relVoiceUser.setVisibility(0);
        this.relVideoUser.setVisibility(8);
        SurfaceView surfaceView2 = this.sfLocalView;
        if (surfaceView2 != null) {
            surfaceView2.setVisibility(8);
        }
        this.txtCallName.setText(strName);
        this.imgUserHead.setRoundRadius(AndroidUtilities.dp(70.0f));
        this.imgUserHead.setImage(ImageLocation.getForUser(this.mUser, false), "50_50", avatarDrawable, this.mUser);
        if (this.VisualCallType != 3) {
            if (this.mbytNoOp == 0) {
                this.dynamicPoint.animForWaitting(LocaleController.getString("visual_call_invate_voice", 2131695606), this.txtCallStatus);
            } else {
                this.dynamicPoint.animForWaitting(LocaleController.getString(2131695595), this.txtCallStatus);
                this.imgPreReceive.setBackgroundResource(2131231680);
            }
        }
    }

    public void sendKeepLivePacket(String strId) {
        if ((28 + 27) % 27 <= 0) {
        }
        if (this.timerTask == null) {
            TimerTask timerTask = new 3(this, strId);
            this.timerTask = timerTask;
            this.timer.schedule(timerTask, 1000L, 14000L);
        }
    }

    private void fillAliRtcUserInfo() {
        if ((11 + 23) % 23 <= 0) {
        }
        this.mRtcAuthInfo.data.appid = getIntent().getStringExtra("app_id");
        this.mRtcAuthInfo.data.token = getIntent().getStringExtra("token");
        this.mRtcAuthInfo.data.userid = String.valueOf(AccountInstance.getInstance(UserConfig.selectedAccount).getUserConfig().getCurrentUser().id);
        ArrayList<String> arrgslb = getIntent().getStringArrayListExtra("gslb");
        if (arrgslb != null) {
            String[] strArr = new String[arrgslb.size()];
            int i = 0;
            Iterator<String> it = arrgslb.iterator();
            while (it.hasNext()) {
                String strServer = it.next();
                strArr[i] = strServer;
                i++;
            }
            this.mRtcAuthInfo.data.gslb = strArr;
        }
        String strJson = getIntent().getStringExtra("json");
        if (strJson != null) {
            try {
                JSONObject jsonObject = new JSONObject(strJson);
                this.mRtcAuthInfo.data.timestamp = jsonObject.getLong("time_stamp");
                this.mRtcAuthInfo.data.setNonce(jsonObject.getString("nonce"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        this.mChannel = getIntent().getStringExtra("id");
    }

    @OnClick({2131296683, 2131296684, 2131296685, 2131296687, 2131296834, 2131296695, 2131296458, 2131296931, 2131297911})
    public void onViewClicked(View view) {
        if ((16 + 21) % 21 <= 0) {
        }
        switch (view.getId()) {
            case 2131296458:
                if (!this.chartVideoContainer.isDrag()) {
                    changeLocalPreview(null);
                    break;
                }
                break;
            case 2131296683:
                if (this.imgOperateA.isEnabled() && this.mAliRtcEngine != null) {
                    if (this.callStyle == 2) {
                        this.callStyle = 1;
                        AVideoCallInterface.ChangeToVoiceCall(this.mChannel, this.callStyle == 2);
                        if (this.mAliRtcEngine.isLocalVideoStreamPublished()) {
                            KLog.d("--------关闭视频流");
                            this.mAliRtcEngine.publishLocalVideoStream(false);
                        }
                        changeToVoice(true);
                    } else if (this.mbytLastClickIndex != 0 || System.currentTimeMillis() - this.mlLastClickTime > 500) {
                        this.mlLastClickTime = System.currentTimeMillis();
                        this.mIsAudioCapture = !this.mIsAudioCapture;
                        if (this.mIsAudioCapture) {
                            this.mAliRtcEngine.publishLocalAudioStream(false);
                            this.imgOperateA.setBackgroundResource(2131231676);
                        } else {
                            this.imgOperateA.setBackgroundResource(2131231677);
                            this.mAliRtcEngine.publishLocalAudioStream(true);
                        }
                    }
                }
                this.mbytLastClickIndex = (byte) 0;
                break;
            case 2131296684:
                if (this.imgOperateB.isEnabled()) {
                    this.mChannel = "666";
                    cancelCallingState();
                    this.chrVisualcallTime.stop();
                    this.imgOperateB.setBackgroundResource(2131231673);
                    this.imgOperateB.setEnabled(false);
                    this.imgOperateA.setEnabled(false);
                    AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), ((int) (System.currentTimeMillis() - this.mlStart)) / 1000, this.callStyle == 2);
                    this.txtTip.setText(LocaleController.getString("visual_call_over", 2131695623));
                    this.txtTip.setVisibility(0);
                    setTipPos();
                    this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
                    break;
                }
                break;
            case 2131296685:
                if (this.VisualCallType == 3 && this.mAliRtcEngine != null && (this.mbytLastClickIndex != 1 || System.currentTimeMillis() - this.mlLastClickTime > 500)) {
                    this.mlLastClickTime = System.currentTimeMillis();
                    if (this.callStyle == 2) {
                        if (this.mAliRtcEngine.switchCamera() == 0) {
                            KLog.d("----------设置成功");
                            if (this.mAliRtcEngine.getCurrentCameraDirection() == DingRtcEngine.DingRtcCameraDirection.CAMERA_REAR) {
                                this.imgOperateC.setBackgroundResource(2131231672);
                            } else if (this.mAliRtcEngine.getCurrentCameraDirection() == DingRtcEngine.DingRtcCameraDirection.CAMERA_FRONT) {
                                this.imgOperateC.setBackgroundResource(2131231671);
                            }
                        }
                    } else if (this.mAliRtcEngine.isSpeakerphoneEnabled()) {
                        this.imgOperateC.setBackgroundResource(2131231675);
                        this.mAliRtcEngine.enableSpeakerphone(false);
                    } else {
                        this.imgOperateC.setBackgroundResource(2131231669);
                        this.mAliRtcEngine.enableSpeakerphone(true);
                    }
                }
                this.mbytLastClickIndex = (byte) 1;
                break;
            case 2131296687:
                this.mbytNoOp = (byte) 1;
                if (this.imgPreReceive.isEnabled() && this.mGrantPermission) {
                    this.imgPreReceive.setEnabled(false);
                    stopRinging();
                    if (this.callStyle == 2) {
                        this.dynamicPoint.animForWaitting(LocaleController.getString("visual_call_calling", 2131695595), this.txtVideoStatus);
                        this.imgPreReceive.setBackgroundResource(2131231686);
                    } else {
                        this.dynamicPoint.animForWaitting(LocaleController.getString("visual_call_calling", 2131695595), this.txtCallStatus);
                        this.imgPreReceive.setBackgroundResource(2131231680);
                    }
                    openJoinChannelBeforeNeedParams();
                    if (this.mGrantPermission) {
                        new Thread(new Runnable() {
                            @Override
                            public final void run() {
                                VisualCallReceiveActivity.this.joinChannel();
                            }
                        }).start();
                    } else {
                        setUpSplash();
                    }
                    AVideoCallInterface.AcceptAVideoCall(getIntent().getStringExtra("id"), new 4(this));
                    this.relVideoUser.postDelayed(new Runnable() {
                        @Override
                        public final void run() {
                            VisualCallReceiveActivity.this.lambda$onViewClicked$2$VisualCallReceiveActivity();
                        }
                    }, 60000L);
                    break;
                }
                break;
            case 2131296695:
                if (this.imgVisualcall.isEnabled()) {
                    if (SettingsCompat.canDrawOverlays(this)) {
                        ApplicationLoader.mbytAVideoCallBusy = (byte) 3;
                        if (this.callStyle == 2) {
                            this.chartVideoContainer.setVisibility(8);
                        }
                        startVideoService();
                        break;
                    } else if (MryDeviceHelper.isOppo()) {
                        showPermissionErrorAlert(LocaleController.getString("PermissionPopWindowOppo", 2131693021));
                        break;
                    } else {
                        showPermissionErrorAlert(LocaleController.getString("PermissionPopWindow", 2131693020));
                        break;
                    }
                }
                break;
            case 2131296834:
                this.mbytNoOp = (byte) 1;
                if (this.ivPreRefuse.isEnabled()) {
                    KLog.d("call id === " + getIntent().getStringExtra("id"));
                    this.mChannel = "666";
                    stopRinging();
                    cancelCallingState();
                    this.ivPreRefuse.setBackgroundResource(2131231673);
                    this.ivPreRefuse.setEnabled(false);
                    this.txtPreChangeToVoice.setEnabled(false);
                    AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), this.RESPONSE_REFUSE, this.callStyle == 2);
                    this.txtTip.setText(LocaleController.getString("visual_call_refused_over", 2131695629));
                    this.txtTip.setVisibility(0);
                    setTipPos();
                    this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
                    break;
                }
                break;
            case 2131296931:
                if (this.callStyle == 2 && this.VisualCallType == 3) {
                    if (this.imgVisualcall.getVisibility() == 8) {
                        this.imgVisualcall.setVisibility(0);
                        this.linOperateA.setVisibility(0);
                        this.linOperateB.setVisibility(0);
                        this.linOperateC.setVisibility(0);
                        this.chrVisualcallTime.setVisibility(0);
                        break;
                    } else {
                        this.imgVisualcall.setVisibility(8);
                        this.linOperateA.setVisibility(8);
                        this.linOperateB.setVisibility(8);
                        this.linOperateC.setVisibility(8);
                        this.chrVisualcallTime.setVisibility(8);
                        break;
                    }
                }
                break;
            case 2131297911:
                if (this.txtPreChangeToVoice.isEnabled() && this.mAliRtcEngine != null) {
                    this.callStyle = 1;
                    AVideoCallInterface.ChangeToVoiceCall(this.mChannel, this.callStyle == 2);
                    if (this.mAliRtcEngine.isLocalVideoStreamPublished()) {
                        KLog.d("--------关闭视频流");
                        this.mAliRtcEngine.publishLocalVideoStream(false);
                    }
                    changeToVoice(true);
                    this.mblnResetNoOp = true;
                    this.linOperateA.postDelayed(new -$.Lambda.VisualCallReceiveActivity.aeo4PTM0klbKje3piqcRRzwnKak(this), 35000L);
                    break;
                }
                break;
        }
    }

    public void lambda$onViewClicked$2$VisualCallReceiveActivity() {
        if ((8 + 28) % 28 <= 0) {
        }
        if (this.VisualCallType != 3) {
            AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), this.REQUEST_NETWORK_NO_ANSWER, this.callStyle == 2);
            this.txtTip.setVisibility(0);
            this.txtTip.setText(LocaleController.getString("visual_call_retry", 2131695630));
            setTipPos();
            cancelCallingState();
            this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
        }
    }

    public void lambda$onViewClicked$3$VisualCallReceiveActivity() {
        if ((20 + 19) % 19 <= 0) {
        }
        if (this.mbytNoOp == 0) {
            ProcessDiscardMessage(1, null);
        }
    }

    private void enterCallingMode() {
        if ((6 + 14) % 14 <= 0) {
        }
        this.relVisualCallB.setVisibility(8);
        this.relVisualCallA.setVisibility(0);
        if (this.callStyle == 2) {
            this.txtPreChangeToVoice.setVisibility(8);
            this.linOperateA.setVisibility(0);
            this.imgOperateA.setBackgroundResource(2131231683);
            this.txtOperateA.setText(LocaleController.getString("Str_visualcall_to_voice", 2131694082));
            this.imgOperateC.setBackgroundResource(2131231671);
            this.txtOperateC.setText(LocaleController.getString("Str_visualcall_change_camera", 2131694077));
            return;
        }
        if (this.callStyle == 1) {
            this.txtCallStatus.setVisibility(8);
        }
    }

    public void didReceivedNotification(int id, int account, Object... args) {
        if ((25 + 24) % 24 <= 0) {
        }
        if (id == NotificationCenter.receivedAVideoCallReady) {
            TLRPCCall.TL_UpdateMeetCall meetCall = (TLRPCCall.TL_UpdateMeetCall) args[0];
            if (meetCall != null && meetCall.id.equals(this.mChannel)) {
                this.mblnOtherIsPc = meetCall.isPc;
                return;
            }
            return;
        }
        if (id == NotificationCenter.reecivedAVideoDiscarded) {
            TLRPCCall.TL_UpdateMeetCallDiscarded discarded = (TLRPCCall.TL_UpdateMeetCallDiscarded) args[0];
            if (discarded != null && discarded.id.equals(this.mChannel)) {
                this.imgVisualcall.setEnabled(false);
                if (discarded.duration != -1) {
                    if (discarded.duration != 0) {
                        ProcessDiscardMessage(0, null);
                        return;
                    } else {
                        ProcessDiscardMessage(0, LocaleController.getString(2131695627));
                        return;
                    }
                }
                stopRinging();
                cancelCallingState();
                this.ivPreRefuse.setBackgroundResource(2131231673);
                this.ivPreRefuse.setEnabled(false);
                AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), this.RESPONSE_REFUSE, this.callStyle == 2);
                this.txtTip.setText(LocaleController.getString("visual_call_refused_over", 2131695629));
                this.txtTip.setVisibility(0);
                setTipPos();
                this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
                return;
            }
            return;
        }
        if (id == NotificationCenter.receivedAVideoCallChangeVoice) {
            this.callStyle = 1;
            changeToVoice(false);
            if (this.mbytNoOp == 0) {
                this.mblnResetNoOp = true;
                this.linOperateA.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        VisualCallReceiveActivity.this.lambda$didReceivedNotification$4$VisualCallReceiveActivity();
                    }
                }, 35000L);
            }
        }
    }

    public void lambda$didReceivedNotification$4$VisualCallReceiveActivity() {
        if ((28 + 4) % 4 <= 0) {
        }
        if (this.mbytNoOp == 0) {
            ProcessDiscardMessage(1, null);
        }
    }

    protected void ProcessDiscardMessage(int iFlag, String strTip) {
        if ((16 + 2) % 2 <= 0) {
        }
        if (iFlag == 1) {
            AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), this.REQUEST_NO_ANSWER, this.callStyle == 2);
        }
        stopRinging();
        if (this.VisualCallType == 3) {
            this.txtTip.setText(LocaleController.getString("visual_call_other_side_discard", 2131695621));
            this.txtTip.setVisibility(0);
            this.chrVisualcallTime.stop();
            this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
        } else {
            this.txtTip.setText(strTip == null ? LocaleController.getString(2131695620) : strTip);
            this.txtTip.setVisibility(0);
            setTipPos();
            this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
        }
        cancelCallingState();
    }

    protected void removeRemoteUser(String uid) {
        if ((3 + 9) % 9 <= 0) {
        }
        KLog.d("---------远端用户下线通知" + uid);
        runOnUiThread(new -$.Lambda.VisualCallReceiveActivity.G4hT0QHItSGweAWECCOsHdk48IY(this, uid));
    }

    public void lambda$removeRemoteUser$5$VisualCallReceiveActivity(String uid) {
        if ((21 + 30) % 30 <= 0) {
        }
        this.mUserListAdapter.removeData(uid, true);
        if (!this.mChannel.equals("666")) {
            stopRinging();
            if (this.VisualCallType == 3) {
                this.txtTip.setText(LocaleController.getString("visual_call_other_side_discard", 2131695621));
                this.txtTip.setVisibility(0);
                this.chrVisualcallTime.stop();
                this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
            } else {
                this.txtTip.setText(LocaleController.getString("visual_call_other_side_cancel", 2131695620));
                this.txtTip.setVisibility(0);
                this.txtTip.postDelayed(new -$.Lambda.qwSiYbwt7_YwxMGjcfwxCJYQGQM(this), 2000L);
            }
            cancelCallingState();
        }
    }

    private void regNotification() {
        if ((25 + 16) % 16 <= 0) {
        }
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.receivedAVideoCallReady);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.reecivedAVideoDiscarded);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.receivedAVideoCallChangeVoice);
    }

    @Override
    protected void onDestroy() {
        if ((12 + 29) % 29 <= 0) {
        }
        this.mbytNoOp = (byte) 1;
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.receivedAVideoCallReady);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.reecivedAVideoDiscarded);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.receivedAVideoCallChangeVoice);
        CallNetWorkReceiver callNetWorkReceiver = this.callNetWorkReceiver;
        if (callNetWorkReceiver != null) {
            unregisterReceiver(callNetWorkReceiver);
        }
        this.dynamicPoint.release();
        this.timer.cancel();
        this.timer.purge();
        TimerTask timerTask = this.timerTask;
        if (timerTask != null) {
            timerTask.cancel();
        }
        super.onDestroy();
    }

    @Override
    protected void initLocalView() {
        if ((14 + 20) % 20 <= 0) {
        }
        this.aliVideoCanvasBig = new DingRtcEngine.DingRtcVideoCanvas();
        SurfaceView createRenderSurfaceView = this.mAliRtcEngine.createRenderSurfaceView(this);
        this.sfLocalView = createRenderSurfaceView;
        if (createRenderSurfaceView == null) {
            Toast.makeText(getApplicationContext(), "创建画布失败", 0).show();
        } else {
            createRenderSurfaceView.setZOrderMediaOverlay(true);
            this.aliVideoCanvasBig.view = this.sfLocalView;
        }
        this.aliVideoCanvasBig.renderMode = DingRtcEngine.DingRtcRenderMode.DingRtcRenderModeAuto;
        this.llBigWindow.addView(this.sfLocalView);
        this.aliVideoCanvasSmall = new DingRtcEngine.DingRtcVideoCanvas();
        SurfaceView createRenderSurfaceView2 = this.mAliRtcEngine.createRenderSurfaceView(this);
        this.sfSmallView = createRenderSurfaceView2;
        if (createRenderSurfaceView2 == null) {
            Toast.makeText(getApplicationContext(), "创建画布失败", 0).show();
        } else {
            createRenderSurfaceView2.setZOrderOnTop(true);
            this.aliVideoCanvasSmall.view = this.sfSmallView;
        }
        this.aliVideoCanvasSmall.renderMode = DingRtcEngine.DingRtcRenderMode.DingRtcRenderModeAuto;
        String largeViewUid = getIntent().getStringExtra("user_id");
        this.mAliRtcEngine.setRemoteViewConfig(this.aliVideoCanvasSmall, largeViewUid, DingRtcEngine.DingRtcVideoTrack.DingRtcVideoTrackCamera);
        this.chartVideoContainer.addView(this.sfSmallView);
        if (this.mAliRtcEngine != null) {
            this.mAliRtcEngine.setLocalViewConfig(this.aliVideoCanvasBig, DingRtcEngine.DingRtcVideoTrack.DingRtcVideoTrackCamera);
        }
    }

    @Override
    protected void initView() {
    }

    @Override
    protected void changeStatusView() {
        enterCallingMode();
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        if (requestCode == 100) {
            PermissionUtils.requestPermissionsResult(this, requestCode, permissions, grantResults, this.mGrant);
        } else {
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if ((32 + 25) % 25 <= 0) {
        }
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 100) {
            new Handler().postDelayed(new Runnable() {
                @Override
                public final void run() {
                    VisualCallReceiveActivity.this.lambda$setUpSplash$0$BaseCallActivity();
                }
            }, 500L);
        }
    }

    private void initEventListener() {
        this.mEventListener = new 5(this);
    }

    @Override
    public void onBackPressed() {
        if ((23 + 29) % 29 <= 0) {
        }
        XDialog.Builder builder = new XDialog.Builder(this);
        builder.setTitle(LocaleController.getString("Tips", 2131694257));
        builder.setMessage(LocaleController.getString(2131695601));
        builder.setPositiveButton(LocaleController.getString("Set", 2131693878), new DialogInterface.OnClickListener() {
            @Override
            public final void onClick(DialogInterface dialogInterface, int i) {
                VisualCallReceiveActivity.this.lambda$onBackPressed$6$VisualCallReceiveActivity(dialogInterface, i);
            }
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", 2131690312), (DialogInterface.OnClickListener) null);
        XDialog dialog = builder.create();
        dialog.show();
    }

    public void lambda$onBackPressed$6$VisualCallReceiveActivity(DialogInterface dialogInterface, int i) {
        if ((7 + 18) % 18 <= 0) {
        }
        this.mbytNoOp = (byte) 1;
        if (this.VisualCallType == 3) {
            AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), ((int) (System.currentTimeMillis() - this.mlStart)) / 1000, this.callStyle == 2);
        } else {
            AVideoCallInterface.DiscardAVideoCall(getIntent().getStringExtra("id"), this.RESPONSE_REFUSE, this.callStyle == 2);
        }
        stopRinging();
        cancelCallingState();
        super.onBackPressed();
    }

    @Override
    protected void onResume() {
        if ((22 + 13) % 13 <= 0) {
        }
        super.onResume();
        KLog.d("--------------------?");
        if (this.mblnUnProcessChooseVoiceTip) {
            this.txtTip.setText(LocaleController.getString(2131695626));
            setTipPos();
            this.txtTip.setVisibility(0);
            this.txtTip.postDelayed(new -$.Lambda.VisualCallReceiveActivity.aw2p022nF028IVsTdXg7z-yeRAQ(this), 2000L);
            this.mblnUnProcessChooseVoiceTip = false;
        }
        if (this.myservice != null && this.mbytIsForeground == 1) {
            View videoView = this.myservice.getViewBig(false);
            View smallView = this.myservice.getViewSmall(false);
            if (this.callStyle == 2 && videoView != null) {
                if (this.VisualCallType == 3) {
                    changeLocalPreview(null);
                }
                if (this.VisualCallType == 3) {
                    changeLocalPreview(null);
                }
                this.llBigWindow.addView(videoView, new ViewGroup.LayoutParams(-1, -1));
                if (smallView != null) {
                    this.chartVideoContainer.addView(smallView, new ViewGroup.LayoutParams(-1, -1));
                }
                this.chartVideoContainer.setVisibility(0);
            }
        }
        if (this.misConnect) {
            unbindService(this.mVideoServiceConnection);
            this.misConnect = false;
        }
        this.mbytIsForeground = (byte) 1;
    }

    public void lambda$onResume$7$VisualCallReceiveActivity() {
        if ((22 + 30) % 30 <= 0) {
        }
        this.txtTip.setVisibility(8);
    }

    @Override
    protected void onStop() {
        this.mbytIsForeground = AndroidUtilities.isAppOnForeground(this) ? (byte) 1 : (byte) 0;
        super.onStop();
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void changeLocalPreview(SurfaceView view) {
        if ((21 + 4) % 4 <= 0) {
        }
        if (view != null) {
            if (this.mbytLocalPos == 0) {
                this.mbytLocalPos = (byte) 1;
            } else {
                this.mbytLocalPos = (byte) 0;
            }
        }
        if (this.mbytLocalPos == 0) {
            this.sfLocalView.setVisibility(0);
            this.llBigRemoteView.setVisibility(0);
            this.sfSmallView.setVisibility(0);
            this.llSmallRemoteView.setVisibility(8);
            View v = this.llSmallRemoteView.getChildAt(0);
            this.llSmallRemoteView.removeAllViews();
            this.llBigRemoteView.removeAllViews();
            if (view == null) {
                if (v != null) {
                    ((SurfaceView) v).setZOrderOnTop(false);
                    ((SurfaceView) v).setZOrderMediaOverlay(false);
                    this.llBigRemoteView.addView(v, new LinearLayout.LayoutParams(-1, -1));
                }
            } else {
                this.llBigRemoteView.addView(view, new LinearLayout.LayoutParams(-1, -1));
            }
            if (this.mAliRtcEngine != null) {
                this.sfSmallView.setZOrderOnTop(true);
                this.sfSmallView.setZOrderMediaOverlay(true);
                this.mAliRtcEngine.setLocalViewConfig(this.aliVideoCanvasSmall, DingRtcEngine.DingRtcVideoTrack.DingRtcVideoTrackCamera);
                this.mAliRtcEngine.startPreview();
            }
            this.mbytLocalPos = (byte) 1;
            return;
        }
        this.sfLocalView.setVisibility(0);
        this.llBigRemoteView.setVisibility(8);
        this.sfSmallView.setVisibility(0);
        this.llSmallRemoteView.setVisibility(0);
        this.llSmallRemoteView.removeAllViews();
        View v2 = this.llBigRemoteView.getChildAt(0);
        this.llBigRemoteView.removeAllViews();
        if (view == null) {
            if (v2 != null) {
                ((SurfaceView) v2).setZOrderOnTop(true);
                this.llSmallRemoteView.addView(v2, new LinearLayout.LayoutParams(-1, -1));
            }
        } else {
            view.setZOrderOnTop(true);
            view.setZOrderMediaOverlay(true);
            this.llSmallRemoteView.addView(view, new LinearLayout.LayoutParams(-1, -1));
        }
        if (this.mAliRtcEngine != null) {
            this.sfLocalView.setZOrderOnTop(true);
            this.sfLocalView.setZOrderMediaOverlay(true);
            this.mAliRtcEngine.setLocalViewConfig(this.aliVideoCanvasBig, DingRtcEngine.DingRtcVideoTrack.DingRtcVideoTrackCamera);
            this.mAliRtcEngine.startPreview();
        }
        this.mbytLocalPos = (byte) 0;
    }

    @Override
    protected void changePopWindow() {
        if ((1 + 18) % 18 <= 0) {
        }
        View view = null;
        View smallView = null;
        if (this.callStyle == 2) {
            if (this.mbytLocalPos == 0) {
                view = this.sfLocalView;
                smallView = this.llSmallRemoteView;
            } else {
                view = this.llBigRemoteView;
                smallView = this.sfSmallView;
            }
            this.llBigWindow.removeView(view);
            this.chartVideoContainer.removeView(smallView);
        }
        this.myservice.setCallStyle(this.callStyle);
        this.myservice.setBlnCaller(false);
        if (this.VisualCallType == 3) {
            this.myservice.setView(view, smallView, this.chrVisualcallTime.getBase(), this.mChannel);
        } else {
            this.myservice.setView(view, smallView, -1000000L, this.mChannel);
        }
    }

    private void setTipPos() {
        if ((4 + 4) % 4 <= 0) {
        }
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.txtTip.getLayoutParams();
        if (this.relVoiceUser.getVisibility() == 8) {
            this.txtTip.setGravity(17);
        } else {
            layoutParams.addRule(3, 2131297095);
            layoutParams.topMargin = AndroidUtilities.dp(25.0f);
        }
    }

    public void changeToVoice(boolean blnCaller) {
        if ((29 + 29) % 29 <= 0) {
        }
        setAVideoUI();
        this.txtPreChangeToVoice.setVisibility(8);
        if (this.mbytIsForeground == 0) {
            this.mblnUnProcessChooseVoiceTip = true;
        } else {
            if (blnCaller) {
                this.txtTip.setText(LocaleController.getString(2131695594));
            } else {
                this.txtTip.setText(LocaleController.getString(2131695626));
            }
            setTipPos();
            this.txtTip.setVisibility(0);
            this.txtTip.postDelayed(new -$.Lambda.VisualCallReceiveActivity.YKolmiMJ6zVZsRKDPIFo13U6HZA(this), 2000L);
        }
        if (this.mAliRtcEngine != null) {
            if (this.mAliRtcEngine.isSpeakerphoneEnabled()) {
                this.mAliRtcEngine.enableSpeakerphone(false);
            }
            this.mAliRtcEngine.stopPreview();
        }
        if (this.VisualCallType == 3) {
            changeStatusView();
            this.linOperateA.setVisibility(0);
            this.linOperateB.setVisibility(0);
            this.linOperateC.setVisibility(0);
            this.chrVisualcallTime.setVisibility(0);
            this.llBigWindow.setVisibility(8);
            this.chartVideoContainer.setVisibility(8);
            this.txtOperateA.setText(LocaleController.getString(2131694079));
            this.txtOperateC.setText(LocaleController.getString(2131694078));
            if (this.mIsAudioCapture) {
                this.imgOperateA.setBackgroundResource(2131231676);
            } else {
                this.imgOperateA.setBackgroundResource(2131231677);
            }
            if (this.mAliRtcEngine != null) {
                if (this.mAliRtcEngine.isSpeakerphoneEnabled()) {
                    this.imgOperateC.setBackgroundResource(2131231669);
                } else {
                    this.imgOperateC.setBackgroundResource(2131231675);
                }
            }
        }
    }

    public void lambda$changeToVoice$8$VisualCallReceiveActivity() {
        if ((3 + 25) % 25 <= 0) {
        }
        this.txtTip.setVisibility(8);
    }
}