SpliceLiveViewActivity.java 源代码


package activity.live;

import activity.CustomView.SpliceImageView;
import activity.ShareSettingActivity;
import activity.live.SpliceLiveViewActivity;
import activity.setting.SettingActivity;
import activity.setting.WiFiSettingActivity;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
import base.HiLandScapeActivity;
import bean.HumanRect;
import bean.MyCamera;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.dasu.blur.DBlur;
import com.dasu.blur.OnBlurListener;
import com.heytap.mcssdk.a.a;
import com.hichip.base.HiLog;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.callback.ICameraPlayStateCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.hichip.tools.Packet;
import com.kuaishou.weapon.p0.g;
import com.kwad.sdk.core.response.model.AdVideoPreCacheConfig;
import com.xiaomi.mipush.sdk.Constants;
import common.ConstantCommand;
import common.HiDataValue;
import common.MyLiveViewGLMonitor;
import common.SpliceViewGLMonitor;
import custom.HumanRectView;
import custom.SwitchButton;
import custom.dialog.NiftyDialogBuilder;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
import org.apache.poi.ss.util.CellUtil;
import org.apache.poi.xwpf.converter.xhtml.internal.styles.CSSStylePropertyConstants;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import utils.AnimationProUtils;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.LiuHaiScreenTools;
import utils.MyToast;
import utils.OrientationWatchDog;
import utils.SharePreUtils;
import utils.ToastUtil;

public class SpliceLiveViewActivity extends HiLandScapeActivity implements ICameraIOSessionCallback, ICameraPlayStateCallback, View.OnTouchListener, View.OnClickListener, SeekBar.OnSeekBarChangeListener, OrientationWatchDog.OnOrientationListener {
    private static final int FLING_MIN_DISTANCE = 60;
    private static final int MOVE_DOWN = 32106;
    private static final int MOVE_LEFT = 32107;
    private static final int MOVE_RIGHT = 32108;
    private static final int MOVE_UP = 32105;
    private static final int MY_PERMISSION_REQUEST_CODE = 10020;
    public static final int RECORDING_STATUS_ING = 2;
    public static final int RECORDING_STATUS_LOADING = 1;
    public static final int RECORDING_STATUS_NONE = 0;
    private static final int ZOOM_IN = 32103;
    private static final int ZOOM_OUT = 32104;
    private HiChipDefines.ABSOLUTE_LIGHT_TYPE abs_light;
    private float action_down_x;
    private float action_down_y;
    private ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE audible_visual_alarm_type;
    private HiChipDefines.HI_P2P_S_AUDIO_ATTR audio_attr;
    ImageView btn_return;
    private long clickTime;
    private boolean devIs4K;
    private float dis_hor;
    private float dis_ver;
    private float down_X;
    private float down_Y;
    protected int filpChecked;
    private int focusGap;
    private int focusNum;
    public HumanRectView humanRectView;
    private boolean isHideNavigation;
    public ImageView iv_duijiang;
    ImageView iv_finger;
    public ImageView iv_full_screen;
    ImageView iv_land_more;
    ImageView iv_land_snapshot;
    public ImageView iv_landscape_listen;
    public ImageView iv_landscape_record;
    public ImageView iv_landscape_talk;
    public ImageView iv_listen;
    ImageView iv_placeholder;
    ImageView iv_placeholder_rotate;
    public ImageView iv_playback;
    public ImageView iv_record;
    public ImageView iv_recording;
    ImageView iv_setting;
    ImageView iv_signal;
    public ImageView iv_snapshot;
    public ImageView iv_ydzz_land;
    float lastX;
    float lastY;
    private HiChipDefines.HI_P2P_WHITE_LIGHT_INFO light_info;
    private HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT light_info_ext;
    LinearLayout ll_4g_signal;
    LinearLayout ll_bottom;
    LinearLayout ll_guide;
    LinearLayout ll_key_one;
    LinearLayout ll_key_there;
    LinearLayout ll_key_two;
    LinearLayout ll_land_return;
    private LinearLayout ll_pup_content;
    private LinearLayout ll_pup_main;
    public LinearLayout ll_recording;
    LinearLayout ll_signal;
    private int mCameraVideoQuality;
    public ConstantCommand.HI_P2P_Garden_Lamp_INFO mGarden_lamp_info;
    private boolean mGarden_set_cancel;
    private int mInputMethod;
    ImageView mIvLoading2;
    protected MyCamera mMyCamera;
    public OrientationWatchDog mOrientationWatchDog;
    private PopupWindow mPopupWindow;
    private int mQuality;
    public SpliceViewGLMonitor mSplice1Monitor;
    public SpliceViewGLMonitor mSplice2Monitor;
    private TimerTask mTask;
    private Timer mTimer;
    protected int mirrorChecked;
    private int monitor_height;
    private int monitor_width;
    int moveX;
    int moveY;
    float move_x;
    float move_y;
    private int msaveGardenstate;
    private long oldClickTime;
    private PopupWindow playbackPopupWindow;
    private long preHumanTime;
    ProgressBar progressbar;
    private boolean reGetSignal;
    public String recordFile;
    public RelativeLayout rl_2ms;
    RelativeLayout rl_guide_monitor;
    public RelativeLayout rl_landscape_buttom;
    public RelativeLayout rl_landscape_one;
    public RelativeLayout rl_landscape_view;
    RelativeLayout rl_preset_key;
    public RelativeLayout rl_wrap;
    public LinearLayout root_lock_screen;
    private SeekBar sb_brightness;
    private SeekBar sb_contrast;
    private SeekBar sb_saturation;
    private SeekBar seekbar_input;
    private SeekBar seekbar_output;
    private short speed;
    SpliceImageView spliceimageview;
    public Timer timer;
    public TimerTask timerTask;
    TextView title_middle;
    RelativeLayout titleview;
    private long touchTimeDown;
    private long touchTimeUp;
    protected HiChipDefines.HI_P2P_SMART_MOTO trackParam;
    TextView tv_brand;
    private TextView tv_brightness;
    private TextView tv_contrast;
    TextView tv_focus_mun;
    public TextView tv_focus_mun_p;
    TextView tv_key_preset;
    TextView tv_know;
    TextView tv_landscape_video_quality;
    public TextView tv_record_time;
    private TextView tv_saturation;
    TextView tv_signal;
    TextView tv_video_quality;
    private int type;
    private PopupWindow videoQualityPopupWindow;
    int xlenOld;
    int ylenOld;
    public int mRecordingState = 0;
    public boolean isListening = false;
    public boolean isTalking = false;
    HiChipDefines.HI_P2P_S_DISPLAY display_param = null;
    private int maxInputValue = 100;
    private int maxOutputValue = 100;
    private boolean mIsHaveVirtual = false;
    private int mDp_250 = 0;
    private boolean mIsSwitchResolution = false;
    public boolean mVoiceIsTran = false;
    private int lightModel = 0;
    private int u32TurnTime = 40;
    private int u32TurnTime_sleep = AdVideoPreCacheConfig.DEFAULT_PRE_CACHE_SIZE;
    private boolean mIsTXTJ = false;
    public boolean mIsHaveTrack = false;
    private List<Toast> toastList = new ArrayList();
    public boolean mIsListenTrans = false;
    public int mMonitorHeight = 0;
    public int isLarge = 0;
    private List<HumanRect> humanRects = new ArrayList();
    private boolean receiveHumanParams = false;
    public boolean supportZoom = false;
    private double largeMul = 12.0d;
    private int focusNumMax = 200;
    public boolean mselectsecondTab = false;
    private boolean misImageMove = false;
    private boolean misFirstshow = true;
    private boolean isLeft = true;
    private boolean isFirstRevolveLand = false;
    private boolean isReadyPlay = false;
    public boolean isShowPermissionDialog = false;
    private int mLiuHaiHeight = 0;
    public int savemonmaxleft = 0;
    public int savemonmaxbottom = 0;
    public int savemonmaxwidth = 0;
    public int savemonmaxheight = 0;
    private Handler mAnimHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == 1872) {
                SpliceLiveViewActivity.this.HiSetMon();
                return;
            }
            if (i == 2128) {
                SpliceLiveViewActivity.this.handAnim();
                return;
            }
            if (i != 2384) {
                return;
            }
            HiLogcatUtil.e("initViewAndData" + SpliceLiveViewActivity.this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.mMonitorHeight);
            SpliceLiveViewActivity.this.mSplice1Monitor.setMatrix(SpliceLiveViewActivity.this.mSplice1Monitor.left, SpliceLiveViewActivity.this.mSplice1Monitor.bottom, SpliceLiveViewActivity.this.mSplice1Monitor.width, SpliceLiveViewActivity.this.mSplice1Monitor.height);
            if (!SpliceLiveViewActivity.this.misImageMove && 1 != SpliceLiveViewActivity.this.mSplice1Monitor.getmIsFullScreen()) {
                SpliceLiveViewActivity.this.spliceimageview.MoveRect(SpliceLiveViewActivity.this.mSplice1Monitor.left, SpliceLiveViewActivity.this.mSplice1Monitor.bottom, SpliceLiveViewActivity.this.mSplice1Monitor.width, SpliceLiveViewActivity.this.mSplice1Monitor.height, SpliceLiveViewActivity.this.mSplice1Monitor.screen_width, SpliceLiveViewActivity.this.mSplice1Monitor.screen_height, SpliceLiveViewActivity.this.mMonitorHeight);
            }
            SpliceLiveViewActivity.this.misImageMove = false;
        }
    };
    double nLenStart = 0.0d;
    public boolean mIsOnpause = false;
    public long mStartRecordTime = 0;
    private SimpleDateFormat sdf = new SimpleDateFormat("mm:ss", Locale.getDefault());
    public Handler mRecHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what != 110) {
                return;
            }
            if (SpliceLiveViewActivity.this.iv_recording.getVisibility() == 4) {
                SpliceLiveViewActivity.this.iv_recording.setVisibility(0);
            } else {
                SpliceLiveViewActivity.this.iv_recording.setVisibility(4);
            }
            SpliceLiveViewActivity.this.mStartRecordTime += 1000;
            SpliceLiveViewActivity.this.tv_record_time.setText(SpliceLiveViewActivity.this.sdf.format(new Date(SpliceLiveViewActivity.this.mStartRecordTime)));
            SpliceLiveViewActivity.this.mRecHandler.sendEmptyMessageDelayed(110, 1000L);
        }
    };
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == -2147483647) {
                SpliceLiveViewActivity.this.handMsgPlayState(message);
                return;
            }
            if (i == -1879048191) {
                SpliceLiveViewActivity.this.handMsgSessionState(message);
                return;
            }
            if (i == -1879048189) {
                SpliceLiveViewActivity.this.handMsgReceiveIoctrl(message);
                return;
            }
            if (i == 288) {
                SpliceLiveViewActivity spliceLiveViewActivity = SpliceLiveViewActivity.this;
                MyToast.showToast(spliceLiveViewActivity, spliceLiveViewActivity.getString(R.string.failed_recording));
                return;
            }
            if (i == 2457) {
                SpliceLiveViewActivity.this.endRecording();
                SpliceLiveViewActivity spliceLiveViewActivity2 = SpliceLiveViewActivity.this;
                MyToast.showToast(spliceLiveViewActivity2, spliceLiveViewActivity2.getString(R.string.failed_recording));
            } else {
                if (i != 4133) {
                    return;
                }
                SpliceLiveViewActivity.this.mSplice1Monitor.setVisibility(0);
                SpliceLiveViewActivity.this.mSplice2Monitor.setVisibility(8);
                SpliceLiveViewActivity.this.rl_wrap.setVisibility(8);
                SpliceLiveViewActivity.this.iv_full_screen.setVisibility(8);
            }
        }
    };
    private boolean mIsClickReturn = false;
    public int mFlagPreset = 0;
    private Handler humanRectHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == 10010 && SpliceLiveViewActivity.this.mSplice1Monitor != null) {
                byte[] bArr = (byte[]) message.obj;
                int i = message.arg1;
                HiLogcatUtil.e(i + "::" + SpliceLiveViewActivity.this.mSplice1Monitor.getmIsFullScreen() + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + ((int) ((SpliceLiveViewActivity.this.mMonitorHeight * 9.0d) / 32.0d)) + Constants.COLON_SEPARATOR + ((int) ((SpliceLiveViewActivity.this.mSplice1Monitor.screen_width * 9.0d) / 32.0d)));
                if (i > 3) {
                    i = 3;
                }
                SpliceLiveViewActivity.this.humanRects.clear();
                if (SpliceLiveViewActivity.this.mSplice1Monitor.height > ((int) ((SpliceLiveViewActivity.this.mSplice1Monitor.screen_width * 9.0d) / 32.0d))) {
                    return;
                }
                for (int i2 = 0; i2 < i; i2++) {
                    byte[] bArr2 = new byte[20];
                    int i3 = (i2 * 20) + 8;
                    if (bArr.length - i3 >= 20) {
                        System.arraycopy(bArr, i3, bArr2, 0, 20);
                        ConstantCommand.HI_P2P_ALARM_MD hi_p2p_alarm_md = new ConstantCommand.HI_P2P_ALARM_MD(bArr2);
                        HumanRect humanRect = new HumanRect(hi_p2p_alarm_md.u32X, hi_p2p_alarm_md.u32Y, hi_p2p_alarm_md.u32Width, hi_p2p_alarm_md.u32Height, SpliceLiveViewActivity.this.monitor_width, (int) ((SpliceLiveViewActivity.this.monitor_width * 9.0d) / 32.0d));
                        if (humanRect.getRect_height() != 0 && humanRect.getRect_width() != 0) {
                            SpliceLiveViewActivity.this.humanRects.add(humanRect);
                        }
                    }
                }
                SpliceLiveViewActivity.this.humanRectView.refreshRect(SpliceLiveViewActivity.this.humanRects, SpliceLiveViewActivity.this.mMyCamera.getVideoQuality());
            }
        }
    };
    public Handler mFocusHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i != SpliceLiveViewActivity.ZOOM_IN) {
                if (i != SpliceLiveViewActivity.ZOOM_OUT) {
                    return;
                }
                Log.e("4K", " ZOOM_OUT  handleMessage:  focusNum " + SpliceLiveViewActivity.this.focusNum + "\nfocusNumMax=" + SpliceLiveViewActivity.this.focusNumMax + "\ntype=" + SpliceLiveViewActivity.this.type);
                if (SpliceLiveViewActivity.this.focusNum <= 0 || SpliceLiveViewActivity.this.focusNum > SpliceLiveViewActivity.this.focusNumMax) {
                    return;
                }
                if (SpliceLiveViewActivity.this.type != 0) {
                    if (SpliceLiveViewActivity.this.type != -1) {
                        if (SpliceLiveViewActivity.this.type == 1) {
                            if (SpliceLiveViewActivity.this.focusNum >= 50) {
                                if (50 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 100) {
                                    if (100 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 150) {
                                        if (150 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 200) {
                                            if (SpliceLiveViewActivity.this.devIs4K) {
                                                if (200 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 250) {
                                                    if (250 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 300) {
                                                        return;
                                                    }
                                                    SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                                                    SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                                                    if (SpliceLiveViewActivity.this.focusNum > 250) {
                                                        SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                                                        return;
                                                    }
                                                    return;
                                                }
                                                SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                                                SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                                                if (SpliceLiveViewActivity.this.focusNum > 200) {
                                                    SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                                                    return;
                                                }
                                                return;
                                            }
                                            return;
                                        }
                                        SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                                        SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                                        if (SpliceLiveViewActivity.this.focusNum > 150) {
                                            SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                                            return;
                                        }
                                        return;
                                    }
                                    SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                                    SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                                    if (SpliceLiveViewActivity.this.focusNum > 100) {
                                        SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                                        return;
                                    }
                                    return;
                                }
                                SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                                SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                                if (SpliceLiveViewActivity.this.focusNum > 50) {
                                    SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                                    return;
                                }
                                return;
                            }
                            SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                            SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                            if (SpliceLiveViewActivity.this.focusNum > 0) {
                                SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                                return;
                            }
                            return;
                        }
                        return;
                    }
                    HiLogcatUtil.i("zoomOut type == -1-->focusNum: " + SpliceLiveViewActivity.this.focusNum);
                    return;
                }
                SpliceLiveViewActivity.this.resetMonitorSize(false, r15.focusGap);
                SpliceLiveViewActivity.access$3120(SpliceLiveViewActivity.this, 1);
                if (SpliceLiveViewActivity.this.focusNum > 0) {
                    SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_OUT, 10L);
                    if (SpliceLiveViewActivity.this.focusNum != 50 || SpliceLiveViewActivity.this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SENSOR)) {
                        return;
                    }
                    SpliceLiveViewActivity.this.zoomOut();
                    return;
                }
                return;
            }
            HiLogcatUtil.i(" ZOOM_IN handleMessage:  focusNum " + SpliceLiveViewActivity.this.focusNum);
            if (SpliceLiveViewActivity.this.focusNum < SpliceLiveViewActivity.this.focusNumMax) {
                if (SpliceLiveViewActivity.this.type != 0) {
                    if (SpliceLiveViewActivity.this.type != -1) {
                        if (SpliceLiveViewActivity.this.type == 1) {
                            if (SpliceLiveViewActivity.this.focusNum >= 50) {
                                if (50 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 100) {
                                    if (100 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 150) {
                                        if (SpliceLiveViewActivity.this.devIs4K) {
                                            if (150 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 200) {
                                                if (200 >= SpliceLiveViewActivity.this.focusNum || SpliceLiveViewActivity.this.focusNum >= 250) {
                                                    if (250 < SpliceLiveViewActivity.this.focusNum) {
                                                        SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                                                        SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                                                        if (SpliceLiveViewActivity.this.focusNum < SpliceLiveViewActivity.this.focusNumMax) {
                                                            SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                                            return;
                                                        }
                                                        return;
                                                    }
                                                    return;
                                                }
                                                SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                                                SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                                                if (SpliceLiveViewActivity.this.focusNum < 250) {
                                                    SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                                    return;
                                                }
                                                return;
                                            }
                                            SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                                            SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                                            if (SpliceLiveViewActivity.this.focusNum < 200) {
                                                SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                                return;
                                            }
                                            return;
                                        }
                                        if (150 < SpliceLiveViewActivity.this.focusNum) {
                                            SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                                            SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                                            if (SpliceLiveViewActivity.this.focusNum < SpliceLiveViewActivity.this.focusNumMax) {
                                                SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                                return;
                                            }
                                            return;
                                        }
                                        return;
                                    }
                                    SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                                    SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                                    if (SpliceLiveViewActivity.this.focusNum < 150) {
                                        SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                        return;
                                    }
                                    return;
                                }
                                SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                                SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                                if (SpliceLiveViewActivity.this.focusNum < 100) {
                                    SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                    return;
                                }
                                return;
                            }
                            SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                            SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                            if (SpliceLiveViewActivity.this.focusNum < 50) {
                                SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                                return;
                            }
                            return;
                        }
                        return;
                    }
                    HiLogcatUtil.i("type == -1-->focusNum: " + SpliceLiveViewActivity.this.focusNum);
                    return;
                }
                SpliceLiveViewActivity.this.resetMonitorSize(true, r15.focusGap);
                SpliceLiveViewActivity.access$3112(SpliceLiveViewActivity.this, 1);
                if (SpliceLiveViewActivity.this.focusNum < SpliceLiveViewActivity.this.focusNumMax) {
                    SpliceLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(SpliceLiveViewActivity.ZOOM_IN, 10L);
                    if (SpliceLiveViewActivity.this.focusNum != SpliceLiveViewActivity.this.focusNumMax - 50 || SpliceLiveViewActivity.this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SENSOR)) {
                        return;
                    }
                    SpliceLiveViewActivity.this.zoomIn();
                }
            }
        }
    };
    private int ll_bottonh = 0;
    private ViewTreeObserver.OnPreDrawListener ll_bottomPre = new ViewTreeObserver.OnPreDrawListener() {
        @Override
        public boolean onPreDraw() {
            int measuredHeight = SpliceLiveViewActivity.this.ll_bottom.getMeasuredHeight();
            int measuredWidth = SpliceLiveViewActivity.this.ll_bottom.getMeasuredWidth();
            if (measuredWidth > 0 || measuredHeight > 0) {
                SpliceLiveViewActivity.this.ll_bottom.getViewTreeObserver().removeOnPreDrawListener(SpliceLiveViewActivity.this.ll_bottomPre);
                SpliceLiveViewActivity.this.ll_bottonh = measuredHeight;
                HiLogcatUtil.e("mMonitor2live" + measuredWidth + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.ll_bottonh + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.ll_bottom.getLeft() + "::" + SpliceLiveViewActivity.this.ll_bottom.getTop() + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.ll_bottom.getBottom() + "::" + SpliceLiveViewActivity.this.ll_bottom.getWidth() + "::" + SpliceLiveViewActivity.this.ll_bottom.getHeight());
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) SpliceLiveViewActivity.this.ll_bottom.getLayoutParams();
                layoutParams.height = HiTools.dip2px(SpliceLiveViewActivity.this, 130.0f);
                SpliceLiveViewActivity.this.ll_bottonh = layoutParams.height;
                SpliceLiveViewActivity.this.ll_bottom.setLayoutParams(layoutParams);
                HiLogcatUtil.e("mMonitor2live" + measuredWidth + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.ll_bottonh + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.ll_bottom.getLeft() + "::" + SpliceLiveViewActivity.this.ll_bottom.getTop() + Constants.COLON_SEPARATOR + SpliceLiveViewActivity.this.ll_bottom.getBottom() + "::" + SpliceLiveViewActivity.this.ll_bottom.getWidth() + "::" + SpliceLiveViewActivity.this.ll_bottom.getHeight());
                if (SpliceLiveViewActivity.this.mAnimHandler != null) {
                    SpliceLiveViewActivity.this.mAnimHandler.sendEmptyMessageDelayed(1872, 0L);
                }
            }
            return true;
        }
    };
    private Handler mHandler_lockScreen = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                SpliceLiveViewActivity.this.root_lock_screen.setVisibility(0);
                SpliceLiveViewActivity.this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
            } else {
                SpliceLiveViewActivity.this.root_lock_screen.setVisibility(8);
                SpliceLiveViewActivity.this.mHandler_lockScreen.removeCallbacksAndMessages(null);
            }
        }
    };
    private boolean isNeedFinish = false;

    private void setIsFullScreen(boolean z) {
    }

    @Override
    public void callbackPlayUTC(HiCamera hiCamera, int i) {
    }

    @Override
    public void callbackPlayUTC2(HiCamera hiCamera, int i, int i2) {
    }

    @Override
    public void callbackPlayUTC2Dual(HiCamera hiCamera, int i, int i2, int i3) {
    }

    @Override
    public void callbackPlayUTCDual(HiCamera hiCamera, int i, int i2) {
    }

    @Override
    public void callbackRecordStateDual(HiCamera hiCamera, int i, int i2, int i3, int i4, String str) {
    }

    @Override
    public void callbackStateDual(HiCamera hiCamera, int i, int i2, int i3, int i4) {
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    @Override
    protected int setLayoutId() {
        return R.layout.activity_splicelive_view;
    }

    static int access$3112(SpliceLiveViewActivity spliceLiveViewActivity, int i) {
        int i2 = spliceLiveViewActivity.focusNum + i;
        spliceLiveViewActivity.focusNum = i2;
        return i2;
    }

    static int access$3120(SpliceLiveViewActivity spliceLiveViewActivity, int i) {
        int i2 = spliceLiveViewActivity.focusNum - i;
        spliceLiveViewActivity.focusNum = i2;
        return i2;
    }

    @Override
    protected void init(Bundle bundle) {
        getWindow().addFlags(128);
        EventBus.getDefault().register(this);
        getIntentData();
        if (HiTools.cameraWhetherNull(this.mMyCamera, this)) {
            return;
        }
        HiDataValue.isOrientation = false;
        initViewAndData();
        startLiveShow();
        getLightModel();
        setListeners();
        getData();
        this.rl_wrap.setVisibility(4);
        this.iv_full_screen.setVisibility(4);
        if (Build.VERSION.SDK_INT < 29) {
            this.largeMul = 4.0d;
        } else if (Build.VERSION.SDK_INT < 30) {
            this.largeMul = 6.0d;
        }
        this.misFirstshow = true;
        OrientationWatchDog orientationWatchDog = new OrientationWatchDog(this);
        this.mOrientationWatchDog = orientationWatchDog;
        orientationWatchDog.setOnOrientationListener(this);
        this.mOrientationWatchDog.startWatch();
    }

    private void startLiveShow() {
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.unregisterIOSessionListener();
            this.mMyCamera.registerPlayStateListener(this);
            this.mMyCamera.registerIOSessionListener(this);
            new Thread() {
                @Override
                public void run() {
                    SpliceLiveViewActivity.this.mMyCamera.startLiveShow(SpliceLiveViewActivity.this.mMyCamera.getVideoQuality(), SpliceLiveViewActivity.this.mSplice1Monitor);
                    SpliceLiveViewActivity.this.mMyCamera.setLiveSpliceShowMonitor(true, SpliceLiveViewActivity.this.mSplice2Monitor);
                }
            }.start();
        }
    }

    public class AnonymousClass2 extends TimerTask {
        AnonymousClass2() {
        }

        @Override
        public void run() {
            SpliceLiveViewActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    SpliceLiveViewActivity.AnonymousClass2.this.lambda$run$0$SpliceLiveViewActivity$2();
                }
            });
        }

        public void lambda$run$0$SpliceLiveViewActivity$2() {
            if (System.currentTimeMillis() - SpliceLiveViewActivity.this.preHumanTime > 1000) {
                SpliceLiveViewActivity.this.humanRectView.cleanRect(false);
            }
        }
    }

    private void getData() {
        this.mTimer = new Timer();
        this.mTask = new AnonymousClass2();
        getSignalOperator();
        getSensor();
    }

    private void getSensor() {
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SENSOR)) {
            this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SENSOR, null);
        }
    }

    public void getSignalOperator() {
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_SUPPORT_4G) || this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_SUPPORT_5G)) {
            String language = Locale.getDefault().getLanguage();
            String country = Locale.getDefault().getCountry();
            if (language.equals("zh") && country.equals("CN")) {
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR, new byte[0]);
            } else {
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_EXT, new byte[0]);
            }
        }
    }

    private void handIsSup_DEV_INFO_EXT() {
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_DEV_INFO_EXT)) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DEV_INFO_EXT, new byte[0]);
        } else {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DEV_INFO, new byte[0]);
        }
    }

    private void getLightModel() {
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_ABSOLUTE_LIGHT_TYPE)) {
            this.lightModel = 3;
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_WHITE_LIGHT_GET_EXT)) {
            this.lightModel = 1;
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_WHITE_LIGHT_GET)) {
            this.lightModel = 2;
        }
        if (this.mMyCamera.appGetCommandFunction(16790)) {
            this.lightModel = 4;
        }
        boolean appGetCommandFunction = this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_Garden_Lamp);
        HiLog.e(this.mMyCamera.getUid() + "HI_P2P_Garden_Lamp:" + appGetCommandFunction);
        if (appGetCommandFunction) {
            this.lightModel = 3;
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_Garden_Lamp)) {
            this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_Garden_Lamp, null);
            this.lightModel = 5;
        }
    }

    private void getLightParams() {
        int i = this.lightModel;
        if (i == 1) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_GET_EXT, null);
            return;
        }
        if (i == 2) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_GET, null);
            return;
        }
        if (i == 3) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_ABSOLUTE_LIGHT_TYPE, null);
        } else if (i == 4) {
            this.mMyCamera.sendIOCtrl(16790, null);
        } else {
            if (i != 5) {
                return;
            }
            this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_Garden_Lamp, null);
        }
    }

    private void setListeners() {
        this.mSplice1Monitor.setOnTouchListener(this);
        this.mSplice2Monitor.setOnTouchListener(this);
        this.tv_video_quality.setOnClickListener(this);
        this.iv_landscape_listen.setOnClickListener(this);
        this.iv_landscape_talk.setOnClickListener(this);
        this.tv_landscape_video_quality.setOnClickListener(this);
        this.btn_return.setOnClickListener(this);
        this.iv_setting.setOnClickListener(this);
        this.tv_know.setOnClickListener(this);
        this.rl_guide_monitor.setOnTouchListener(this);
        this.ll_land_return.setOnClickListener(this);
        this.iv_land_more.setOnClickListener(this);
        this.iv_landscape_record.setOnClickListener(this);
        this.iv_land_snapshot.setOnClickListener(this);
        this.iv_full_screen.setOnClickListener(this);
        this.iv_full_screen.setClickable(false);
        this.iv_ydzz_land.setOnClickListener(this);
        this.iv_playback.setOnClickListener(this);
        this.iv_playback.setClickable(false);
        this.iv_listen.setOnClickListener(this);
        this.iv_record.setOnClickListener(this);
        this.iv_snapshot.setOnClickListener(this);
        this.iv_duijiang.setOnTouchListener(this);
        this.root_lock_screen.setOnClickListener(this);
        this.focusGap = this.mSplice1Monitor.screen_width / 100;
        this.spliceimageview.setTopbarClickListener(new SpliceImageView.topbarClickListener() {
            @Override
            public void TouchMove(Rect rect) {
                SpliceLiveViewActivity.this.misImageMove = true;
                if (rect.left > 0 && rect.left < SpliceLiveViewActivity.this.spliceimageview.mainSteamWidth) {
                    SpliceLiveViewActivity.this.mSplice1Monitor.left = -((int) (((rect.left * SpliceLiveViewActivity.this.mSplice1Monitor.width) * 1.0d) / SpliceLiveViewActivity.this.spliceimageview.mainSteamWidth));
                }
                if (SpliceLiveViewActivity.this.mSplice1Monitor.height >= SpliceLiveViewActivity.this.mSplice1Monitor.screen_width && rect.bottom > 0 && rect.bottom < SpliceLiveViewActivity.this.spliceimageview.mainSteamHeight) {
                    SpliceLiveViewActivity.this.mSplice1Monitor.bottom = (int) (((((rect.top * SpliceLiveViewActivity.this.mSplice1Monitor.height) * 1.0d) / SpliceLiveViewActivity.this.spliceimageview.mainSteamHeight) - SpliceLiveViewActivity.this.mSplice1Monitor.height) + SpliceLiveViewActivity.this.mMonitorHeight);
                }
                if (SpliceLiveViewActivity.this.mSplice1Monitor.height >= SpliceLiveViewActivity.this.mSplice1Monitor.screen_width && rect.top <= 3) {
                    SpliceLiveViewActivity.this.mSplice1Monitor.bottom = (-SpliceLiveViewActivity.this.mSplice1Monitor.height) + SpliceLiveViewActivity.this.mMonitorHeight;
                }
                if (rect.left <= 3) {
                    SpliceLiveViewActivity.this.mSplice1Monitor.left = 0;
                }
                if (rect.right >= SpliceLiveViewActivity.this.spliceimageview.mainSteamWidth - 3) {
                    SpliceLiveViewActivity.this.mSplice1Monitor.left = (-SpliceLiveViewActivity.this.mSplice1Monitor.width) + SpliceLiveViewActivity.this.mSplice1Monitor.screen_width;
                }
                if (SpliceLiveViewActivity.this.mSplice1Monitor.height >= SpliceLiveViewActivity.this.mSplice1Monitor.screen_width && rect.bottom >= SpliceLiveViewActivity.this.spliceimageview.mainSteamHeight - 3) {
                    SpliceLiveViewActivity.this.mSplice1Monitor.bottom = 0;
                }
                HiLogcatUtil.e(rect.left + "::" + rect.top + "::" + rect.right + ":bottom:" + rect.bottom + "::" + SpliceLiveViewActivity.this.spliceimageview.mainSteamWidth + "::" + SpliceLiveViewActivity.this.spliceimageview.mainSteamHeight + ":Monitor:" + SpliceLiveViewActivity.this.mSplice1Monitor.left + "::" + SpliceLiveViewActivity.this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + 0);
                if (SpliceLiveViewActivity.this.mAnimHandler != null) {
                    SpliceLiveViewActivity.this.mAnimHandler.sendEmptyMessageDelayed(2384, 0L);
                }
            }
        });
    }

    private void getIntentData() {
        String stringExtra = getIntent().getStringExtra(HiDataValue.EXTRAS_KEY_UID);
        Iterator<MyCamera> it = HiDataValue.CameraList.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            MyCamera next = it.next();
            if (!TextUtils.isEmpty(next.getUid()) && next.getUid().equalsIgnoreCase(stringExtra)) {
                this.mMyCamera = next;
                break;
            }
        }
        this.mCameraVideoQuality = this.mMyCamera.getVideoQuality();
        if (this.mMyCamera.getChipVersion() == 1) {
            if (this.mMyCamera.getDeviceType() == 3) {
                this.speed = (short) 58;
                return;
            } else {
                this.speed = (short) 25;
                return;
            }
        }
        this.speed = (short) 58;
    }

    private void initViewAndData() {
        this.mDp_250 = HiTools.dip2px(this, 250.0f);
        this.mMonitorHeight = HiTools.getScreenW(this);
        this.mSplice1Monitor.setCamera(this.mMyCamera);
        this.mSplice1Monitor.mMonitorHeight = this.mMonitorHeight;
        showPlaceLoadingView();
        if (this.mMyCamera.snapshot != null) {
            if (this.mMyCamera.snapshot != null) {
                DBlur.source(this, this.mMyCamera.snapshot).mode(1).radius(2).animAlpha().build().doBlur(new OnBlurListener() {
                    @Override
                    public void onBlurFailed() {
                    }

                    @Override
                    public void onBlurSuccess(Bitmap bitmap) {
                        SpliceLiveViewActivity.this.iv_placeholder.setImageBitmap(bitmap);
                    }
                });
            }
        } else {
            this.iv_placeholder.setImageResource(R.mipmap.videoclip);
        }
        this.title_middle.setText(this.mMyCamera.getNikeName());
        this.mMyCamera.setLiveShowMonitor(this.mSplice1Monitor);
        this.tv_video_quality.setText(this.mCameraVideoQuality == 0 ? getString(R.string.high_definition) : getString(R.string.fluent));
        this.tv_landscape_video_quality.setText(this.mCameraVideoQuality == 0 ? getString(R.string.high_definition) : getString(R.string.fluent));
        if (this.mMyCamera.isFirstEnterLive) {
            handAnim();
        }
        this.mIsHaveVirtual = HiTools.checkDeviceHasNavigationBar(this);
        this.rl_2ms.setVisibility(8);
        this.focusGap = this.mSplice1Monitor.screen_width / 100;
        HiDataValue.mSpliceminwidth = (int) ((HiTools.getScreenW(this) * 3.0d) / 5.0d);
        HiDataValue.mSpliceminheight = (int) ((((HiTools.getScreenW(this) * 3.0d) / 5.0d) * 9.0d) / 32.0d);
        this.spliceimageview.getMainSteam(this, HiDataValue.mSpliceminwidth, HiDataValue.mSpliceminheight);
        handSensiArea();
        this.ll_bottom.getViewTreeObserver().addOnPreDrawListener(this.ll_bottomPre);
        this.mSplice2Monitor.setZOrderMediaOverlay(true);
    }

    public void handAnim() {
        this.dis_hor = HiTools.dip2px(this, 140.0f);
        this.dis_ver = HiTools.dip2px(this, 80.0f);
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.iv_finger, "translationX", 0.0f, this.dis_hor, 0.0f);
        ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
        ofFloat.setDuration(2000L);
        ofFloat.start();
        ofFloat.addListener(new AnonymousClass5());
    }

    public class AnonymousClass5 extends AnimatorListenerAdapter {
        AnonymousClass5() {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, CellUtil.ROTATION, 0.0f, 90.0f);
            ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
            ofFloat.setDuration(1000L);
            ofFloat.start();
            ofFloat.addListener(new AnonymousClass1());
        }

        class AnonymousClass1 extends AnimatorListenerAdapter {
            AnonymousClass1() {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                ObjectAnimator ofFloat = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, "translationY", 0.0f, SpliceLiveViewActivity.this.dis_ver, 0.0f);
                ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                ofFloat.setDuration(2000L);
                ofFloat.start();
                ofFloat.addListener(new C00201());
            }

            class C00201 extends AnimatorListenerAdapter {
                C00201() {
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    ObjectAnimator ofFloat = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, CellUtil.ROTATION, 90.0f, 180.0f);
                    ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                    ofFloat.setDuration(1000L);
                    ofFloat.start();
                    ofFloat.addListener(new C00211());
                }

                class C00211 extends AnimatorListenerAdapter {
                    C00211() {
                    }

                    @Override
                    public void onAnimationEnd(Animator animator) {
                        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, "translationX", 0.0f, -SpliceLiveViewActivity.this.dis_hor, 0.0f);
                        ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                        ofFloat.setDuration(2000L);
                        ofFloat.start();
                        ofFloat.addListener(new C00221());
                    }

                    class C00221 extends AnimatorListenerAdapter {
                        C00221() {
                        }

                        @Override
                        public void onAnimationEnd(Animator animator) {
                            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, CellUtil.ROTATION, 180.0f, 270.0f);
                            ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                            ofFloat.setDuration(1000L);
                            ofFloat.start();
                            ofFloat.addListener(new C00231());
                        }

                        class C00231 extends AnimatorListenerAdapter {
                            C00231() {
                            }

                            @Override
                            public void onAnimationEnd(Animator animator) {
                                ObjectAnimator ofFloat = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, "translationY", 0.0f, -SpliceLiveViewActivity.this.dis_ver, 0.0f);
                                ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                                ofFloat.setDuration(2000L);
                                ofFloat.start();
                                ofFloat.addListener(new AnimatorListenerAdapter() {
                                    @Override
                                    public void onAnimationEnd(Animator animator2) {
                                        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.iv_finger, CellUtil.ROTATION, 270.0f, 360.0f);
                                        ofFloat2.setInterpolator(new AccelerateDecelerateInterpolator());
                                        ofFloat2.setDuration(1000L);
                                        ofFloat2.start();
                                        ofFloat2.addListener(new AnimatorListenerAdapter() {
                                            @Override
                                            public void onAnimationEnd(Animator animator3) {
                                                SpliceLiveViewActivity.this.mAnimHandler.sendEmptyMessage(2128);
                                            }
                                        });
                                    }
                                });
                            }
                        }
                    }
                }
            }
        }
    }

    private void cancelToast(List<Toast> list) {
        if (list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                if (list.get(i) != null) {
                    list.get(i).cancel();
                }
            }
        }
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        this.mIsOnpause = false;
        HiLogcatUtil.e("HiDataValue.isOrientation" + HiDataValue.isOrientation);
        if (HiDataValue.isOrientation) {
            if (this.isLeft) {
                setRequestedOrientation(0);
                return;
            } else {
                setRequestedOrientation(8);
                return;
            }
        }
        setRequestedOrientation(1);
    }

    @Override
    public void onResume() {
        super.onResume();
        this.mIsOnpause = false;
    }

    @Override
    public void onPause() {
        MyCamera myCamera;
        super.onPause();
        if (this.mIsOnpause) {
            return;
        }
        cancelToast(this.toastList);
        this.receiveHumanParams = false;
        this.mVoiceIsTran = false;
        Timer timer = this.timer;
        if (timer != null) {
            timer.cancel();
            this.timer = null;
        }
        TimerTask timerTask = this.timerTask;
        if (timerTask != null) {
            timerTask.cancel();
            this.timerTask = null;
        }
        MyCamera myCamera2 = this.mMyCamera;
        if (myCamera2 != null) {
            myCamera2.stopLiveShow();
            this.mMyCamera.unregisterPlayStateListener(this);
            this.mMyCamera.unregisterIOSessionListener(this);
        }
        Handler handler = this.mAnimHandler;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
        Handler handler2 = this.mHandler;
        if (handler2 != null) {
            handler2.removeCallbacksAndMessages(null);
        }
        Handler handler3 = this.mRecHandler;
        if (handler3 != null) {
            handler3.removeCallbacksAndMessages(null);
        }
        Handler handler4 = this.mFocusHandler;
        if (handler4 != null) {
            handler4.removeCallbacksAndMessages(null);
        }
        if (this.mRecordingState == 2 && (myCamera = this.mMyCamera) != null) {
            myCamera.stopRecording();
        }
        if (this.mSplice1Monitor != null) {
            HiLogcatUtil.v("FreeMonitor");
            this.mSplice1Monitor.FreeMonitor();
            this.mSplice1Monitor = null;
        }
        if (this.mSplice2Monitor != null) {
            HiLogcatUtil.v("FreeMonitor");
            this.mSplice2Monitor.FreeMonitor();
            this.mSplice2Monitor = null;
        }
        finish();
    }

    @Override
    public void onBackPressed() {
        HiLogcatUtil.v(new String[0]);
        if (this.mSplice1Monitor.getmIsFullScreen() == 0) {
            super.onBackPressed();
            return;
        }
        PopupWindow popupWindow = this.mPopupWindow;
        if (popupWindow != null && popupWindow.isShowing()) {
            this.mPopupWindow.dismiss();
        }
        Handler handler = this.mHandler;
        if (handler != null) {
            handler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    SpliceLiveViewActivity.this.lambda$onBackPressed$0$SpliceLiveViewActivity();
                }
            }, 400L);
        } else {
            setRequestedOrientation(1);
        }
        this.mIsClickReturn = true;
        releaseLockScreen();
        handTalkingBack();
    }

    public void lambda$onBackPressed$0$SpliceLiveViewActivity() {
        setRequestedOrientation(1);
    }

    private void grabRecordSnapshot(String str) {
        MyCamera myCamera = this.mMyCamera;
        Bitmap snapshot_EXT = myCamera != null ? myCamera.getSnapshot_EXT(1, 640, 352) : null;
        if (snapshot_EXT != null) {
            saveRecordSnapshot(snapshot_EXT, str);
        }
    }

    @Override
    public void receiveSessionState(HiCamera hiCamera, int i) {
        if (this.mMyCamera != hiCamera) {
            return;
        }
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_SESSION_STATE;
        obtainMessage.arg1 = i;
        obtainMessage.obj = hiCamera;
        this.mHandler.sendMessage(obtainMessage);
    }

    @Override
    public void receiveIOCtrlData(HiCamera hiCamera, int i, byte[] bArr, int i2) {
        if (hiCamera != this.mMyCamera) {
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putByteArray("data", bArr);
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL;
        obtainMessage.obj = hiCamera;
        obtainMessage.arg1 = i;
        obtainMessage.arg2 = i2;
        obtainMessage.setData(bundle);
        this.mHandler.sendMessage(obtainMessage);
    }

    @Override
    public void callbackState(HiCamera hiCamera, int i, int i2, int i3) {
        if (this.mMyCamera != hiCamera) {
            return;
        }
        if (i2 == 3840 && i3 == 2160) {
            this.devIs4K = true;
        } else {
            this.devIs4K = false;
        }
        initDev4kParams();
        Bundle bundle = new Bundle();
        bundle.putInt(a.k, i);
        bundle.putInt(CSSStylePropertyConstants.WIDTH, i2);
        bundle.putInt(CSSStylePropertyConstants.HEIGHT, i3);
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_PLAY_STATE;
        obtainMessage.setData(bundle);
        this.mHandler.sendMessage(obtainMessage);
    }

    private void initDev4kParams() {
        if (this.devIs4K) {
            this.largeMul = 2.5d;
            this.focusNumMax = 300;
        } else if (this.mSplice1Monitor.getmIsFullScreen() == 1) {
            this.largeMul = 2.0d;
            this.focusNumMax = 200;
            while (this.focusNum > 200) {
                this.mFocusHandler.removeCallbacksAndMessages(null);
                resetMonitorSize(false, this.focusGap);
                this.focusNum--;
            }
        }
    }

    @Override
    public void callbackRecordState(HiCamera hiCamera, int i, int i2, int i3, String str) {
        HiLogcatUtil.d("callbackRecordState-> " + str);
        if (this.mMyCamera != hiCamera) {
            return;
        }
        if (i2 == 3840 && i3 == 2160) {
            this.devIs4K = true;
        } else {
            this.devIs4K = false;
        }
        initDev4kParams();
        Bundle bundle = new Bundle();
        bundle.putInt(a.k, i);
        bundle.putInt(CSSStylePropertyConstants.WIDTH, i2);
        bundle.putInt(CSSStylePropertyConstants.HEIGHT, i3);
        bundle.putString(TTDownloadField.TT_FILE_NAME, str);
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_PLAY_STATE;
        obtainMessage.setData(bundle);
        this.mHandler.sendMessage(obtainMessage);
    }

    private void handGuideMonitor(MotionEvent motionEvent) {
        if (motionEvent.getPointerCount() == 1) {
            int action = motionEvent.getAction();
            if (action == 0) {
                this.down_X = motionEvent.getRawX();
                this.down_Y = motionEvent.getRawY();
            } else {
                if (action != 1) {
                    return;
                }
                handCloudStep(motionEvent);
                this.ll_guide.setVisibility(8);
                SharePreUtils.putBoolean(HiDataValue.CACHE, this, this.mMyCamera.getUid() + "isFirstEnterLive", false);
            }
        }
    }

    private void handCloudStep(MotionEvent motionEvent) {
        int i;
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        if (this.isHideNavigation) {
            i = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(this);
        } else {
            i = displayMetrics.widthPixels;
        }
        if (this.mSplice1Monitor.getState() == 0) {
            float rawX = motionEvent.getRawX() - this.down_X;
            float rawY = motionEvent.getRawY() - this.down_Y;
            float abs = Math.abs(rawX);
            float abs2 = Math.abs(rawY);
            float f = i / 2;
            int ceil = (int) Math.ceil((abs / f) * 100.0f);
            int ceil2 = (int) Math.ceil((abs2 / f) * 100.0f);
            if (ceil > 100) {
                ceil = 100;
            }
            if (ceil2 > 100) {
                ceil2 = 100;
            }
            if (this.mMyCamera.getChipVersion() != 1) {
                ceil *= 2;
                ceil2 *= 2;
            }
            if (rawX > 0.0f && abs > 60.0f) {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 1, this.speed, (short) ceil));
            } else if (rawX < 0.0f && abs > 60.0f) {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 1, this.speed, (short) ceil));
            }
            if (rawY > 0.0f && abs2 > 60.0f) {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 1, this.speed, (short) ceil2));
            } else {
                if (rawY >= 0.0f || abs2 <= 60.0f) {
                    return;
                }
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 1, this.speed, (short) ceil2));
            }
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        if (view.getId() == R.id.live_monitor) {
            int pointerCount = motionEvent.getPointerCount();
            if ((motionEvent.getAction() & 255) == 5 && 2 == pointerCount) {
                if (this.supportZoom) {
                    return false;
                }
                this.mSplice1Monitor.setTouchMove(2);
                for (int i = 0; i < pointerCount; i++) {
                    new Point((int) motionEvent.getX(i), (int) motionEvent.getY(i));
                }
                this.xlenOld = Math.abs(((int) motionEvent.getX(0)) - ((int) motionEvent.getX(1)));
                int abs = Math.abs(((int) motionEvent.getY(0)) - ((int) motionEvent.getY(1)));
                this.ylenOld = abs;
                int i2 = this.xlenOld;
                this.nLenStart = Math.sqrt((i2 * i2) + (abs * abs));
            } else {
                if ((motionEvent.getAction() & 255) == 2 && 2 == pointerCount) {
                    if (this.supportZoom) {
                        return false;
                    }
                    SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
                    if (spliceViewGLMonitor != null) {
                        spliceViewGLMonitor.setTouchMove(2);
                    }
                    for (int i3 = 0; i3 < pointerCount; i3++) {
                        new Point((int) motionEvent.getX(i3), (int) motionEvent.getY(i3));
                    }
                    int abs2 = Math.abs(((int) motionEvent.getX(0)) - ((int) motionEvent.getX(1)));
                    int abs3 = Math.abs(((int) motionEvent.getY(0)) - ((int) motionEvent.getY(1)));
                    int abs4 = Math.abs(abs2 - this.xlenOld);
                    int abs5 = Math.abs(abs3 - this.ylenOld);
                    double d = abs2;
                    double d2 = abs3;
                    double sqrt = Math.sqrt((d * d) + (d2 * d2));
                    HiLogcatUtil.v("" + abs4 + "::" + abs5 + "::" + sqrt + "::" + this.nLenStart + "::" + this.focusNum + "::" + this.mSplice1Monitor.screen_width + "::" + this.mSplice1Monitor.screen_height);
                    if (abs4 < 20 && abs5 < 20) {
                        return false;
                    }
                    if (sqrt > this.nLenStart) {
                        resetMonitorSize(true, sqrt);
                    } else {
                        resetMonitorSize(false, sqrt);
                    }
                    this.xlenOld = abs2;
                    this.ylenOld = abs3;
                    this.nLenStart = sqrt;
                    return true;
                }
                if (pointerCount == 1) {
                    int action = motionEvent.getAction();
                    if (action == 0) {
                        this.down_X = motionEvent.getRawX();
                        this.down_Y = motionEvent.getRawY();
                        this.action_down_x = motionEvent.getRawX();
                        float rawY = motionEvent.getRawY();
                        this.action_down_y = rawY;
                        this.lastX = this.action_down_x;
                        this.lastY = rawY;
                        this.mSplice1Monitor.setTouchMove(0);
                    } else if (action != 1) {
                        if (action == 2 && this.mSplice1Monitor.getTouchMove() == 0) {
                            this.move_x = motionEvent.getRawX();
                            this.move_y = motionEvent.getRawY();
                            if (1 != this.mSplice1Monitor.getmIsFullScreen()) {
                                this.spliceimageview.MoveRect(this.mSplice1Monitor.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height, this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height, this.mMonitorHeight);
                            }
                        }
                    } else if (this.mSplice1Monitor.getTouchMove() == 0 && this.mSplice1Monitor.getState() == 0) {
                        float rawX = motionEvent.getRawX();
                        float rawY2 = motionEvent.getRawY();
                        float f = rawX - this.down_X;
                        float f2 = rawY2 - this.down_Y;
                        if (Math.abs(f) >= HiTools.dip2px(this, 2.0f) || Math.abs(f2) >= HiTools.dip2px(this, 2.0f)) {
                            if (f > 0.0f && Math.abs(f) > Math.abs(f2)) {
                                int abs6 = (int) ((Math.abs(f) / (this.mSplice1Monitor.screen_width / 2)) * 100.0f);
                                if (abs6 > 100) {
                                    abs6 = 100;
                                }
                                if (abs6 <= 0) {
                                    abs6 = 1;
                                }
                                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 1, this.speed, (short) abs6));
                            }
                            if (f < 0.0f && Math.abs(f) > Math.abs(f2)) {
                                int abs7 = (int) ((Math.abs(f) / (this.mSplice1Monitor.screen_width / 2)) * 100.0f);
                                if (abs7 > 100) {
                                    abs7 = 100;
                                }
                                if (abs7 <= 0) {
                                    abs7 = 1;
                                }
                                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 1, this.speed, (short) abs7));
                            }
                            if (f2 > 0.0f && Math.abs(f2) > Math.abs(f)) {
                                int abs8 = (int) ((Math.abs(f2) / (this.mSplice1Monitor.screen_width / 2)) * 100.0f);
                                if (abs8 > 100) {
                                    abs8 = 100;
                                }
                                if (abs8 <= 0) {
                                    abs8 = 1;
                                }
                                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 1, this.speed, (short) abs8));
                            }
                            if (f2 < 0.0f && Math.abs(f2) > Math.abs(f)) {
                                int abs9 = (int) ((Math.abs(f2) / (this.mSplice1Monitor.screen_width / 2)) * 100.0f);
                                int i4 = abs9 <= 100 ? abs9 : 100;
                                if (i4 <= 0) {
                                    i4 = 1;
                                }
                                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 1, this.speed, (short) i4));
                            }
                        }
                    }
                }
            }
        } else {
            if (view.getId() == R.id.rl_guide_monitor) {
                handGuideMonitor(motionEvent);
                return true;
            }
            if (view.getId() == R.id.iv_duijiang) {
                if (!this.iv_duijiang.isClickable()) {
                    return true;
                }
                int action2 = motionEvent.getAction();
                if (action2 == 0) {
                    HiTools.Hi_OpenOrientation(this);
                    if (System.currentTimeMillis() - this.oldClickTime >= 1000) {
                        if (HiTools.HiPermission(this, this, 2, MY_PERMISSION_REQUEST_CODE)) {
                            this.mIsOnpause = true;
                            return true;
                        }
                        this.oldClickTime = System.currentTimeMillis();
                        if (this.mRecordingState == 2) {
                            if (this.isListening) {
                                this.mMyCamera.PausePlayAudio();
                                this.iv_listen.setSelected(false);
                                this.iv_landscape_listen.setSelected(false);
                                this.isListening = !this.isListening;
                                this.mIsListenTrans = true;
                            }
                        } else if (this.isListening) {
                            this.mMyCamera.stopListening();
                            this.mVoiceIsTran = false;
                            this.iv_listen.setSelected(false);
                            this.iv_landscape_listen.setSelected(false);
                            this.isListening = !this.isListening;
                            this.mIsListenTrans = true;
                        }
                        this.mMyCamera.startTalk();
                        this.isTalking = true;
                        this.iv_duijiang.setSelected(true);
                        this.iv_landscape_talk.setSelected(this.isTalking);
                        setViewClickable(false);
                    }
                } else if (action2 == 1) {
                    HiTools.Hi_CloseOrientation(this);
                    if (System.currentTimeMillis() - this.oldClickTime < 500) {
                        ToastUtil.showCenter(this, R.string.tips_press_intercom, 1000);
                    }
                    if (this.mRecordingState == 2) {
                        if (this.isListening) {
                            this.mMyCamera.PausePlayAudio();
                            this.iv_listen.setSelected(false);
                            this.iv_landscape_listen.setSelected(false);
                            this.isListening = !this.isListening;
                            this.mIsListenTrans = true;
                        }
                    } else if (this.isListening) {
                        this.mMyCamera.stopListening();
                        this.mVoiceIsTran = false;
                        this.iv_listen.setSelected(false);
                        this.iv_landscape_listen.setSelected(false);
                        this.isListening = !this.isListening;
                        this.mIsListenTrans = true;
                    }
                    this.mMyCamera.stopTalk();
                    if (this.mIsListenTrans && !this.isListening) {
                        if (this.mVoiceIsTran) {
                            this.mMyCamera.ResumePlayAudio();
                        } else {
                            this.mMyCamera.startListening();
                            this.mVoiceIsTran = true;
                        }
                        this.iv_landscape_listen.setSelected(true);
                        this.iv_listen.setSelected(true);
                        this.isListening = true;
                    }
                    this.isTalking = false;
                    this.iv_duijiang.setSelected(false);
                    this.iv_landscape_talk.setSelected(this.isTalking);
                    setViewClickable(true);
                }
            }
        }
        return false;
    }

    private void setViewClickable(boolean z) {
        this.iv_listen.setClickable(z);
        this.iv_record.setClickable(z);
        this.iv_snapshot.setClickable(z);
    }

    public void resetMonitorSize(boolean z, double d) {
        int i;
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        if (spliceViewGLMonitor == null) {
            return;
        }
        this.isLarge = z ? 1 : 2;
        if (spliceViewGLMonitor.getmIsFullScreen() == 0) {
            this.mSplice1Monitor.screen_height = this.mMonitorHeight;
        }
        HiLogcatUtil.v("1initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        if (this.mSplice1Monitor.height == 0 && this.mSplice1Monitor.width == 0) {
            initMatrix(this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height);
        }
        int i2 = (int) (d / 2.0d);
        this.moveX = i2;
        this.moveY = (int) ((i2 * 9.0d) / 32.0d);
        if (z) {
            if (1 == this.mSplice1Monitor.getmIsFullScreen()) {
                if (this.mSplice1Monitor.width <= this.largeMul * this.mSplice1Monitor.screen_width && this.mSplice1Monitor.height <= ((this.largeMul * this.mSplice1Monitor.screen_width) * 9.0d) / 32.0d) {
                    this.mSplice1Monitor.left -= this.moveX / 2;
                    this.mSplice1Monitor.bottom -= this.moveY / 2;
                    this.mSplice1Monitor.width += this.moveX;
                    this.mSplice1Monitor.height += this.moveY;
                }
            } else if (this.mSplice1Monitor.width <= this.mSplice1Monitor.screen_width * this.largeMul && this.mSplice1Monitor.height <= ((this.largeMul * this.mSplice1Monitor.screen_width) * 9.0d) / 32.0d) {
                this.mSplice1Monitor.left -= this.moveX / 2;
                this.mSplice1Monitor.bottom -= this.moveY / 2;
                this.mSplice1Monitor.width += this.moveX;
                this.mSplice1Monitor.height += this.moveY;
            }
        } else {
            if (this.mSplice1Monitor.width > this.mSplice1Monitor.screen_width && this.mSplice1Monitor.left == 0 && this.mSplice1Monitor.bottom >= 0 && this.mSplice1Monitor.height > (this.mSplice1Monitor.screen_width * 9.0d) / 32.0d) {
                this.mSplice1Monitor.bottom -= this.moveY / 2;
                this.mSplice1Monitor.width -= this.moveX;
                this.mSplice1Monitor.height -= this.moveY;
                if (this.mSplice1Monitor.height <= (this.mSplice1Monitor.screen_width * 9.0d) / 32.0d) {
                    this.mSplice1Monitor.height = (int) ((r1.screen_width * 9.0d) / 32.0d);
                }
                if (this.mSplice1Monitor.width <= this.mSplice1Monitor.screen_width) {
                    SpliceViewGLMonitor spliceViewGLMonitor2 = this.mSplice1Monitor;
                    spliceViewGLMonitor2.width = spliceViewGLMonitor2.screen_width;
                }
                if (this.mSplice1Monitor.bottom >= ((int) (this.mMonitorHeight - (((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d) / 2.0d)))) {
                    this.mSplice1Monitor.bottom = (int) (this.mMonitorHeight - (((r1.screen_width * 9.0d) / 32.0d) / 2.0d));
                }
            } else {
                this.mSplice1Monitor.left += this.moveX / 2;
                this.mSplice1Monitor.bottom += this.moveY / 2;
                this.mSplice1Monitor.width -= this.moveX;
                this.mSplice1Monitor.height -= this.moveY;
            }
            HiLogcatUtil.v("2initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
            if (1 == this.mSplice1Monitor.getmIsFullScreen()) {
                if (this.mSplice1Monitor.bottom + this.mSplice1Monitor.height < this.mSplice1Monitor.screen_height) {
                    SpliceViewGLMonitor spliceViewGLMonitor3 = this.mSplice1Monitor;
                    spliceViewGLMonitor3.bottom = (spliceViewGLMonitor3.screen_height - this.mSplice1Monitor.height) / 2;
                }
                if (this.mSplice1Monitor.left + this.mSplice1Monitor.width < this.mSplice1Monitor.screen_width) {
                    SpliceViewGLMonitor spliceViewGLMonitor4 = this.mSplice1Monitor;
                    spliceViewGLMonitor4.left = spliceViewGLMonitor4.screen_width - this.mSplice1Monitor.width;
                }
            } else {
                if (this.mSplice1Monitor.bottom + this.mSplice1Monitor.height < (this.mSplice1Monitor.screen_width * 9.0d) / 32.0d) {
                    this.mSplice1Monitor.bottom = (int) (((r1.screen_width * 9.0d) / 32.0d) - this.mSplice1Monitor.height);
                }
                if (this.mSplice1Monitor.left + this.mSplice1Monitor.width < this.mSplice1Monitor.screen_width) {
                    SpliceViewGLMonitor spliceViewGLMonitor5 = this.mSplice1Monitor;
                    spliceViewGLMonitor5.left = spliceViewGLMonitor5.screen_width - this.mSplice1Monitor.width;
                }
            }
        }
        HiLogcatUtil.v("3initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        if (1 == this.mSplice1Monitor.getmIsFullScreen()) {
            if (this.mSplice1Monitor.left > 0 || this.mSplice1Monitor.width < this.mSplice1Monitor.screen_width) {
                if (this.mSplice1Monitor.left >= 0 && this.mSplice1Monitor.width > this.mSplice1Monitor.screen_width) {
                    this.mSplice1Monitor.left = 0;
                }
                if (this.mSplice1Monitor.width <= this.mSplice1Monitor.screen_width || this.mSplice1Monitor.height <= ((int) ((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d))) {
                    initMatrix(this.mSplice1Monitor.screen_width, (int) ((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d));
                }
                SpliceViewGLMonitor spliceViewGLMonitor6 = this.mSplice1Monitor;
                spliceViewGLMonitor6.bottom = (spliceViewGLMonitor6.screen_height - this.mSplice1Monitor.height) / 2;
            }
        } else {
            if (this.mSplice1Monitor.left > 0 || this.mSplice1Monitor.width < this.mSplice1Monitor.screen_width || this.mSplice1Monitor.height < (this.mSplice1Monitor.screen_width * 9.0d) / 32.0d) {
                if (this.mSplice1Monitor.left >= 0 && this.mSplice1Monitor.width > this.mSplice1Monitor.screen_width) {
                    this.mSplice1Monitor.left = 0;
                }
                if (this.mSplice1Monitor.width <= this.mSplice1Monitor.screen_width || this.mSplice1Monitor.height <= ((int) ((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d))) {
                    initMatrix(this.mSplice1Monitor.screen_width, (int) ((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d));
                }
            }
            SpliceViewGLMonitor spliceViewGLMonitor7 = this.mSplice1Monitor;
            spliceViewGLMonitor7.bottom = (this.mMonitorHeight - spliceViewGLMonitor7.height) / 2;
        }
        if (this.mSplice1Monitor.width > this.mSplice1Monitor.screen_width) {
            if (this.mSplice1Monitor.getState() == 0) {
                i = 1;
                this.humanRectView.cleanRect(true);
            } else {
                i = 1;
            }
            this.mSplice1Monitor.setState(i);
        } else {
            i = 1;
            if (this.mSplice1Monitor.getState() == 1) {
                this.humanRectView.cleanRect(false);
            }
            this.mSplice1Monitor.setState(0);
        }
        String[] strArr = new String[i];
        strArr[0] = "4initViewAndData" + this.moveX + Constants.COLON_SEPARATOR + this.moveY + "::" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight + Constants.COLON_SEPARATOR + this.mSplice1Monitor.getState();
        HiLogcatUtil.v(strArr);
        SpliceViewGLMonitor spliceViewGLMonitor8 = this.mSplice1Monitor;
        spliceViewGLMonitor8.setMatrix(spliceViewGLMonitor8.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
        if (1 != this.mSplice1Monitor.getmIsFullScreen()) {
            this.spliceimageview.MoveRect(this.mSplice1Monitor.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height, this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height, this.mMonitorHeight);
        }
    }

    private void initMatrix(int i, int i2) {
        HiTools.getMyGrandpaStackTrace();
        this.mSplice1Monitor.left = 0;
        this.mSplice1Monitor.bottom = 0;
        this.mSplice1Monitor.width = i;
        this.mSplice1Monitor.height = i2;
    }

    public void handMsgSessionState(Message message) {
        MyCamera myCamera;
        int i = message.arg1;
        if (i == 0) {
            MyToast.showToast(getApplicationContext(), getString(R.string.netword_abnormal));
            finish();
            showLoadingView();
            MyCamera myCamera2 = this.mMyCamera;
            if (myCamera2 != null) {
                myCamera2.stopLiveShow();
                if (this.isListening) {
                    this.isListening = false;
                    return;
                }
                return;
            }
            return;
        }
        if (i != 4) {
            if (i == 5 && (myCamera = this.mMyCamera) != null) {
                myCamera.stopLiveShow();
                this.mMyCamera.disconnect(1);
                return;
            }
            return;
        }
        this.progressbar.setVisibility(8);
        if (this.mCameraVideoQuality != this.mMyCamera.getVideoQuality()) {
            this.mMyCamera.stopRecording();
            Timer timer = this.timer;
            if (timer != null) {
                timer.cancel();
                this.timer = null;
            }
            TimerTask timerTask = this.timerTask;
            if (timerTask != null) {
                timerTask.cancel();
                this.timerTask = null;
            }
        }
        new Thread() {
            @Override
            public void run() {
                SpliceLiveViewActivity.this.mMyCamera.startLiveShow(SpliceLiveViewActivity.this.mMyCamera.getVideoQuality(), SpliceLiveViewActivity.this.mSplice1Monitor);
            }
        }.start();
    }

    public void handMsgReceiveIoctrl(Message message) {
        LinearLayout linearLayout;
        String string;
        if (message.arg2 == 0) {
            byte[] byteArray = message.getData().getByteArray("data");
            switch (message.arg1) {
                case 4097:
                    this.monitor_width = Packet.byteArrayToInt_Little(byteArray, 4);
                    int byteArrayToInt_Little = Packet.byteArrayToInt_Little(byteArray, 8);
                    this.monitor_height = byteArrayToInt_Little;
                    int i = this.monitor_width;
                    if (i <= 0 || byteArrayToInt_Little <= 0 || i > 5000 || byteArrayToInt_Little > 5000) {
                        finish();
                        MyToast.showToast(this, getString(R.string.tips_open_video_fail));
                        return;
                    }
                    return;
                case HiChipDefines.HI_P2P_GET_DISPLAY_PARAM:
                    this.display_param = new HiChipDefines.HI_P2P_S_DISPLAY(byteArray);
                    if (this.mSplice1Monitor.getmIsFullScreen() != 1 || this.ll_pup_main == null || (linearLayout = this.ll_pup_content) == null) {
                        return;
                    }
                    if (this.mIsTXTJ) {
                        if (linearLayout.getChildCount() > 0) {
                            SeekBar seekBar = this.sb_brightness;
                            if (seekBar != null) {
                                seekBar.setProgress(this.display_param.u32Brightness);
                            }
                            TextView textView = this.tv_brightness;
                            if (textView != null) {
                                textView.setText(this.display_param.u32Brightness + "");
                            }
                            SeekBar seekBar2 = this.sb_contrast;
                            if (seekBar2 != null) {
                                seekBar2.setProgress(this.display_param.u32Contrast);
                            }
                            TextView textView2 = this.tv_contrast;
                            if (textView2 != null) {
                                textView2.setText(this.display_param.u32Contrast + "");
                            }
                            SeekBar seekBar3 = this.sb_saturation;
                            if (seekBar3 != null) {
                                seekBar3.setProgress(this.display_param.u32Saturation);
                            }
                            TextView textView3 = this.tv_saturation;
                            if (textView3 != null) {
                                textView3.setText(this.display_param.u32Saturation + "");
                                return;
                            }
                            return;
                        }
                        View inflate = View.inflate(this, R.layout.view_land_txtj, null);
                        handLandShowContent(inflate);
                        SeekBar seekBar4 = (SeekBar) inflate.findViewById(R.id.sb_brightness);
                        this.sb_brightness = seekBar4;
                        seekBar4.setMax(this.mMyCamera.brightness);
                        this.sb_brightness.setProgress(this.display_param.u32Brightness);
                        this.sb_brightness.setOnSeekBarChangeListener(this);
                        TextView textView4 = (TextView) inflate.findViewById(R.id.tv_brightness);
                        this.tv_brightness = textView4;
                        textView4.setText(this.display_param.u32Brightness + "");
                        SeekBar seekBar5 = (SeekBar) inflate.findViewById(R.id.sb_contrast);
                        this.sb_contrast = seekBar5;
                        seekBar5.setMax(this.mMyCamera.contrast);
                        this.sb_contrast.setProgress(this.display_param.u32Contrast);
                        this.sb_contrast.setOnSeekBarChangeListener(this);
                        TextView textView5 = (TextView) inflate.findViewById(R.id.tv_contrast);
                        this.tv_contrast = textView5;
                        textView5.setText(this.display_param.u32Contrast + "");
                        SeekBar seekBar6 = (SeekBar) inflate.findViewById(R.id.sb_saturation);
                        this.sb_saturation = seekBar6;
                        seekBar6.setMax(this.mMyCamera.saturation);
                        this.sb_saturation.setProgress(this.display_param.u32Saturation);
                        this.sb_saturation.setOnSeekBarChangeListener(this);
                        TextView textView6 = (TextView) inflate.findViewById(R.id.tv_saturation);
                        this.tv_saturation = textView6;
                        textView6.setText(this.display_param.u32Saturation + "");
                        ((TextView) inflate.findViewById(R.id.tv_restore_default)).setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View view) {
                                SpliceLiveViewActivity.this.showLoadingView();
                                SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_DEF_DISPLAY_PARAM, new byte[0]);
                            }
                        });
                        return;
                    }
                    View inflate2 = View.inflate(this, R.layout.view_land_mirror_flip, null);
                    handLandShowContent(inflate2);
                    handMirrorFlip(inflate2);
                    return;
                case HiChipDefines.HI_P2P_SET_DISPLAY_PARAM:
                    dismissLoadingView();
                    return;
                case HiChipDefines.HI_P2P_GET_AUDIO_ATTR:
                    HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr = new HiChipDefines.HI_P2P_S_AUDIO_ATTR(byteArray);
                    this.audio_attr = hi_p2p_s_audio_attr;
                    if (hi_p2p_s_audio_attr.u32InMode == 0) {
                        this.mInputMethod = 0;
                    } else if (this.audio_attr.u32InMode == 1) {
                        this.mInputMethod = 1;
                    }
                    if (this.mSplice1Monitor.getmIsFullScreen() == 1) {
                        View inflate3 = View.inflate(this, R.layout.view_land_volume, null);
                        handLandShowContent(inflate3);
                        if (this.mMyCamera.getChipVersion() == 1) {
                            this.maxInputValue = 16;
                            this.maxOutputValue = 13;
                        }
                        this.seekbar_input = (SeekBar) inflate3.findViewById(R.id.seekbar_input);
                        final TextView textView7 = (TextView) inflate3.findViewById(R.id.txt_input_value);
                        HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr2 = this.audio_attr;
                        if (hi_p2p_s_audio_attr2 != null) {
                            this.seekbar_input.setProgress(hi_p2p_s_audio_attr2.u32InVol - 1);
                            textView7.setText(String.valueOf(this.audio_attr.u32InVol));
                        }
                        this.seekbar_input.setMax(this.maxInputValue - 1);
                        this.seekbar_input.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                            @Override
                            public void onStartTrackingTouch(SeekBar seekBar7) {
                            }

                            @Override
                            public void onProgressChanged(SeekBar seekBar7, int i2, boolean z) {
                                textView7.setText(String.valueOf(seekBar7.getProgress() + 1));
                            }

                            @Override
                            public void onStopTrackingTouch(SeekBar seekBar7) {
                                SpliceLiveViewActivity.this.sendToDevice();
                            }
                        });
                        this.seekbar_output = (SeekBar) inflate3.findViewById(R.id.seekbar_output);
                        final TextView textView8 = (TextView) inflate3.findViewById(R.id.txt_output_value);
                        HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr3 = this.audio_attr;
                        if (hi_p2p_s_audio_attr3 != null) {
                            this.seekbar_output.setProgress(hi_p2p_s_audio_attr3.u32OutVol - 1);
                            textView8.setText(String.valueOf(this.audio_attr.u32OutVol));
                        }
                        this.seekbar_output.setMax(this.maxOutputValue - 1);
                        this.seekbar_output.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                            @Override
                            public void onStartTrackingTouch(SeekBar seekBar7) {
                            }

                            @Override
                            public void onProgressChanged(SeekBar seekBar7, int i2, boolean z) {
                                textView8.setText(String.valueOf(seekBar7.getProgress() + 1));
                            }

                            @Override
                            public void onStopTrackingTouch(SeekBar seekBar7) {
                                SpliceLiveViewActivity.this.sendToDevice();
                            }
                        });
                        return;
                    }
                    View.inflate(this, R.layout.view_volume, null);
                    return;
                case HiChipDefines.HI_P2P_SET_AUDIO_ATTR:
                    dismissLoadingView();
                    return;
                case HiChipDefines.HI_P2P_DEF_DISPLAY_PARAM:
                    dismissLoadingView();
                    this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM, new byte[0]);
                    return;
                case HiChipDefines.HI_P2P_GET_DEV_INFO_EXT:
                    HiChipDefines.HI_P2P_GET_DEV_INFO_EXT hi_p2p_get_dev_info_ext = new HiChipDefines.HI_P2P_GET_DEV_INFO_EXT(byteArray);
                    if (hi_p2p_get_dev_info_ext.sUserNum < 1) {
                        hi_p2p_get_dev_info_ext.sUserNum = 1;
                        return;
                    }
                    return;
                case HiChipDefines.HI_P2P_WHITE_LIGHT_GET:
                    if (this.lightModel != 2) {
                        return;
                    }
                    this.light_info = new HiChipDefines.HI_P2P_WHITE_LIGHT_INFO(byteArray);
                    if (this.mSplice1Monitor.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case HiChipDefines.HI_P2P_WHITE_LIGHT_GET_EXT:
                    if (this.lightModel != 1) {
                        return;
                    }
                    this.light_info_ext = new HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT(byteArray);
                    if (this.mSplice1Monitor.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case HiChipDefines.HI_P2P_GET_SMART_MOTO:
                    HiChipDefines.HI_P2P_SMART_MOTO hi_p2p_smart_moto = new HiChipDefines.HI_P2P_SMART_MOTO(byteArray);
                    this.trackParam = hi_p2p_smart_moto;
                    this.iv_ydzz_land.setSelected(hi_p2p_smart_moto.bSmartTrack != 0);
                    return;
                case HiChipDefines.HI_P2P_GET_ABSOLUTE_LIGHT_TYPE:
                    if (this.lightModel != 3) {
                        return;
                    }
                    this.abs_light = new HiChipDefines.ABSOLUTE_LIGHT_TYPE(byteArray);
                    if (this.mSplice1Monitor.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case 16790:
                    this.audible_visual_alarm_type = new ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE(byteArray);
                    if (this.mSplice1Monitor.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR:
                    ConstantCommand.HI_P2P_S_SIGNAL_OPERATOR hi_p2p_s_signal_operator = new ConstantCommand.HI_P2P_S_SIGNAL_OPERATOR(byteArray);
                    if (hi_p2p_s_signal_operator.s32ShowSignal == 1 || hi_p2p_s_signal_operator.s32ShowName == 1) {
                        this.ll_4g_signal.setVisibility(0);
                    } else {
                        this.ll_4g_signal.setVisibility(8);
                    }
                    if (hi_p2p_s_signal_operator.s32ShowSignal == 1 && hi_p2p_s_signal_operator.s32SignalQuality > 0) {
                        this.ll_signal.setVisibility(0);
                        if (hi_p2p_s_signal_operator.s32SignalQuality >= 0 && hi_p2p_s_signal_operator.s32SignalQuality <= 40) {
                            this.iv_signal.setImageResource(R.mipmap.signal_2);
                        } else if (hi_p2p_s_signal_operator.s32SignalQuality > 40 && hi_p2p_s_signal_operator.s32SignalQuality <= 60) {
                            this.iv_signal.setImageResource(R.mipmap.signal_3);
                        } else if (hi_p2p_s_signal_operator.s32SignalQuality > 60 && hi_p2p_s_signal_operator.s32SignalQuality <= 80) {
                            this.iv_signal.setImageResource(R.mipmap.signal_4);
                        } else {
                            this.iv_signal.setImageResource(R.mipmap.signal_5);
                        }
                    }
                    if (hi_p2p_s_signal_operator.s32ShowName == 1) {
                        this.tv_brand.setVisibility(0);
                        int i2 = hi_p2p_s_signal_operator.s32OperatorName;
                        if (i2 == 0) {
                            string = getString(R.string.cmcc);
                        } else if (i2 == 1) {
                            string = getString(R.string.cucc);
                        } else if (i2 == 2) {
                            string = getString(R.string.ctcc);
                        } else {
                            string = getString(R.string.none);
                            getOneMoreTime();
                        }
                        this.tv_brand.setText(string);
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_EXT:
                    ConstantCommand.HI_P2P_S_SIGNAL_OPERATOR_EXT hi_p2p_s_signal_operator_ext = new ConstantCommand.HI_P2P_S_SIGNAL_OPERATOR_EXT(byteArray);
                    if (hi_p2p_s_signal_operator_ext.s32ShowSignal == 1 || hi_p2p_s_signal_operator_ext.s32ShowName == 1) {
                        this.ll_4g_signal.setVisibility(0);
                    } else {
                        this.ll_4g_signal.setVisibility(8);
                    }
                    if (hi_p2p_s_signal_operator_ext.s32ShowSignal == 1 && hi_p2p_s_signal_operator_ext.s32SignalQuality > 0) {
                        this.ll_signal.setVisibility(0);
                        if (hi_p2p_s_signal_operator_ext.s32SignalQuality >= 0 && hi_p2p_s_signal_operator_ext.s32SignalQuality <= 40) {
                            this.iv_signal.setImageResource(R.mipmap.signal_2);
                        } else if (hi_p2p_s_signal_operator_ext.s32SignalQuality > 40 && hi_p2p_s_signal_operator_ext.s32SignalQuality <= 60) {
                            this.iv_signal.setImageResource(R.mipmap.signal_3);
                        } else if (hi_p2p_s_signal_operator_ext.s32SignalQuality > 60 && hi_p2p_s_signal_operator_ext.s32SignalQuality <= 80) {
                            this.iv_signal.setImageResource(R.mipmap.signal_4);
                        } else {
                            this.iv_signal.setImageResource(R.mipmap.signal_5);
                        }
                    }
                    String trim = new String(hi_p2p_s_signal_operator_ext.s32OperatorName).trim();
                    if (trim.equals("") || TextUtils.isEmpty(trim)) {
                        trim = "unknown";
                    }
                    this.tv_brand.setVisibility(0);
                    this.tv_brand.setText(trim);
                    if (trim.equals("unknown")) {
                        getOneMoreTime();
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_GET_SENSOR:
                    new ConstantCommand.HI_P2P_SENSOR_PARAM(byteArray);
                    return;
                case ConstantCommand.HI_P2P_GET_Garden_Lamp:
                    this.mGarden_lamp_info = new ConstantCommand.HI_P2P_Garden_Lamp_INFO(byteArray);
                    HiLog.e("HI_P2P_GET_Garden_Lamp" + this.mMyCamera.getUid() + "" + this.mGarden_lamp_info.u32Enable + ":::" + this.mGarden_lamp_info.u32State);
                    int i3 = this.mGarden_lamp_info.u32Enable;
                    if (this.lightModel == 5 && this.mSplice1Monitor.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case HiChipDefines.HI_P2P_GET_DEV_INFO:
                    HiChipDefines.HI_P2P_S_DEV_INFO hi_p2p_s_dev_info = new HiChipDefines.HI_P2P_S_DEV_INFO(byteArray);
                    if (hi_p2p_s_dev_info.sUserNum < 1) {
                        hi_p2p_s_dev_info.sUserNum = 1;
                        return;
                    }
                    return;
                case HiChipDefines.HI_P2P_SET_PTZ_PRESET:
                    HiLog.e("0x8103 1" + this.mFlagPreset);
                    if (this.mFlagPreset == 1) {
                        MyToast.showToast(this, getString(R.string.tips_preset_set_btn));
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_ALARM_HSR:
                    if (this.receiveHumanParams) {
                        EventBus.getDefault().post(byteArray);
                        return;
                    }
                    return;
                default:
                    return;
            }
        }
        int i4 = message.arg1;
        if (i4 != 4097) {
            if (i4 == 12550) {
                dismissLoadingView();
                return;
            }
            if (i4 != 33027) {
                return;
            }
            HiLog.e("0x8103 -1" + this.mFlagPreset);
            if (this.mFlagPreset == 1) {
                MyToast.showToast(this, getString(R.string.tip_preset_fail));
                return;
            }
            return;
        }
        HiLogcatUtil.e("HI_P2P_START_LIVE ERROR ");
        HiLogcatUtil.d("mQuality: " + this.mQuality);
        HiLogcatUtil.d("mMyCamera.getVideoQuality(): " + this.mMyCamera.getVideoQuality());
        HiLogcatUtil.e("#########################  APP RECEIVE HI_P2P_START_LIVE ERROR ##############################");
        this.mIsSwitchResolution = false;
        setViewWhetherClick(true);
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null && myCamera.getVideoQuality() != this.mQuality) {
            this.mQuality = this.mMyCamera.getVideoQuality();
            MyCamera myCamera2 = this.mMyCamera;
            myCamera2.ChangeStream(myCamera2.getVideoQuality());
        } else {
            Toast.makeText(getApplicationContext(), getString(R.string.tips_open_video_fail), 0).show();
            finish();
        }
    }

    private void getOneMoreTime() {
        if (this.reGetSignal) {
            return;
        }
        this.reGetSignal = true;
        Handler handler = this.mHandler;
        if (handler != null) {
            handler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    SpliceLiveViewActivity.this.getSignalOperator();
                }
            }, 10000L);
        }
    }

    private void handLandShowContent(final View view) {
        this.ll_pup_main.setVisibility(8);
        this.ll_pup_content.setVisibility(0);
        this.ll_pup_content.removeAllViews();
        this.ll_pup_content.addView(view, new LinearLayout.LayoutParams(-1, -1));
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "translationX", this.mDp_250, 0.0f);
        ofFloat.setDuration(300L);
        ofFloat.start();
        LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll_land_mirror_flip);
        if (linearLayout != null) {
            linearLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view2) {
                    ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(view, "translationX", 0.0f, SpliceLiveViewActivity.this.mDp_250);
                    ofFloat2.setDuration(300L);
                    ofFloat2.start();
                    ofFloat2.addListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animator) {
                            super.onAnimationEnd(animator);
                            SpliceLiveViewActivity.this.ll_pup_content.setVisibility(8);
                            SpliceLiveViewActivity.this.ll_pup_content.removeAllViews();
                            SpliceLiveViewActivity.this.ll_pup_main.setVisibility(0);
                            ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(SpliceLiveViewActivity.this.ll_pup_main, "Alpha", 0.0f, 1.0f);
                            ofFloat3.setDuration(200L);
                            ofFloat3.start();
                        }
                    });
                }
            });
        }
    }

    private void handMirrorFlip(View view) {
        if (this.display_param == null) {
            return;
        }
        SwitchButton switchButton = (SwitchButton) view.findViewById(R.id.switch_btn_mirror);
        switchButton.setChecked(this.display_param.u32Mirror == 1);
        switchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                SpliceLiveViewActivity.this.mirrorChecked = z ? 1 : 0;
                SpliceLiveViewActivity.this.display_param.u32Mirror = SpliceLiveViewActivity.this.mirrorChecked;
                SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, SpliceLiveViewActivity.this.display_param.parseContent());
                SpliceLiveViewActivity.this.showLoadingView();
            }
        });
        SwitchButton switchButton2 = (SwitchButton) view.findViewById(R.id.switch_btn_flip);
        switchButton2.setChecked(this.display_param.u32Flip == 1);
        switchButton2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                SpliceLiveViewActivity.this.filpChecked = z ? 1 : 0;
                SpliceLiveViewActivity.this.display_param.u32Flip = SpliceLiveViewActivity.this.filpChecked;
                SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, SpliceLiveViewActivity.this.display_param.parseContent());
                SpliceLiveViewActivity.this.showLoadingView();
            }
        });
    }

    private void clickVolume(ImageView imageView) {
        if (this.audio_attr == null) {
            return;
        }
        View inflate = View.inflate(this, R.layout.view_volume, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setOutsideTouchable(true);
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setWidth(this.mDp_250);
        this.mPopupWindow.setHeight(-2);
        int[] iArr = new int[2];
        imageView.getLocationOnScreen(iArr);
        int dip2px = HiTools.dip2px(this, 130.0f);
        this.mPopupWindow.showAtLocation(imageView, 0, iArr[0] - HiTools.dip2px(this, 95.0f), iArr[1] - dip2px);
        final SeekBar seekBar = (SeekBar) inflate.findViewById(R.id.seekbar_input);
        final SeekBar seekBar2 = (SeekBar) inflate.findViewById(R.id.seekbar_output);
        final TextView textView = (TextView) inflate.findViewById(R.id.txt_input_value);
        final TextView textView2 = (TextView) inflate.findViewById(R.id.txt_output_value);
        if (seekBar == null) {
            return;
        }
        seekBar.setProgress(this.audio_attr.u32InVol - 1);
        textView.setText(String.valueOf(this.audio_attr.u32InVol));
        seekBar2.setProgress(this.audio_attr.u32OutVol - 1);
        textView2.setText(String.valueOf(this.audio_attr.u32OutVol));
        if (this.mMyCamera.getChipVersion() == 1) {
            this.maxInputValue = 16;
            this.maxOutputValue = 13;
        }
        seekBar.setMax(this.maxInputValue - 1);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar3, int i, boolean z) {
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar3) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar3) {
                textView.setText(String.valueOf(seekBar3.getProgress() + 1));
                SpliceLiveViewActivity.this.sendToDevice(seekBar, seekBar2);
            }
        });
        seekBar2.setMax(this.maxOutputValue - 1);
        seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar3, int i, boolean z) {
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar3) {
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar3) {
                textView2.setText(String.valueOf(seekBar3.getProgress() + 1));
                SpliceLiveViewActivity.this.sendToDevice(seekBar, seekBar2);
            }
        });
    }

    public void sendToDevice(SeekBar seekBar, SeekBar seekBar2) {
        if (this.audio_attr == null) {
            return;
        }
        int progress = seekBar.getProgress() + 1;
        int progress2 = seekBar2.getProgress() + 1;
        showLoadingView();
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_AUDIO_ATTR, HiChipDefines.HI_P2P_S_AUDIO_ATTR.parseContent(0, this.audio_attr.u32Enable, this.audio_attr.u32Stream, this.audio_attr.u32AudioType, this.mInputMethod, (!this.mMyCamera.isIs88VoiceDev() || progress <= 88) ? progress : 88, progress2));
    }

    public void handMsgPlayState(Message message) {
        Bundle data = message.getData();
        int i = data.getInt(a.k);
        String string = data.getString(TTDownloadField.TT_FILE_NAME);
        if (i != -5 && i != -4) {
            if (i == 0) {
                this.isReadyPlay = true;
                HiLogcatUtil.d(" PLAY_STATE_START ");
                if (this.mSplice1Monitor.getmIsFullScreen() == 0) {
                    this.rl_wrap.setVisibility(0);
                    this.iv_full_screen.setVisibility(0);
                }
                this.iv_full_screen.setClickable(true);
                this.iv_playback.setClickable(true);
                setViewWhetherClick(true);
                dismissPlaceLoadingView();
                dismissLoadingView();
                MyCamera myCamera = this.mMyCamera;
                Bitmap snapshot_EXT = myCamera != null ? myCamera.getSnapshot_EXT(1, 640, 352) : null;
                if (snapshot_EXT != null) {
                    HiTools.saveSnapshot(snapshot_EXT, this.mMyCamera, this);
                }
                HiLogcatUtil.d("mIsSwitchResolution: " + this.mIsSwitchResolution);
                if (this.mMyCamera != null && this.mIsSwitchResolution) {
                    if (this.mRecordingState == 2) {
                        this.mStartRecordTime = 0L;
                        Timer timer = this.timer;
                        if (timer != null) {
                            timer.cancel();
                            this.timer = null;
                        }
                        TimerTask timerTask = this.timerTask;
                        if (timerTask != null) {
                            timerTask.cancel();
                            this.timerTask = null;
                        }
                        continueRecording();
                    }
                    this.mMyCamera.setVideoQuality(this.mQuality);
                    this.tv_video_quality.setText(this.mQuality == 0 ? getString(R.string.high_definition) : getString(R.string.fluent));
                    this.tv_landscape_video_quality.setText(this.mQuality == 0 ? getString(R.string.high_definition) : getString(R.string.fluent));
                    this.mMyCamera.updateInDatabase(this);
                }
                this.receiveHumanParams = true;
                this.mIsSwitchResolution = false;
                this.rl_2ms.setVisibility(0);
                if (this.misFirstshow) {
                    SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
                    spliceViewGLMonitor.height = spliceViewGLMonitor.screen_width / 2;
                    SpliceViewGLMonitor spliceViewGLMonitor2 = this.mSplice1Monitor;
                    spliceViewGLMonitor2.width = (spliceViewGLMonitor2.screen_width / this.mSplice1Monitor.height) * this.mSplice1Monitor.screen_width;
                    this.mSplice1Monitor.left = 0;
                    SpliceViewGLMonitor spliceViewGLMonitor3 = this.mSplice1Monitor;
                    spliceViewGLMonitor3.bottom = (this.mMonitorHeight - spliceViewGLMonitor3.height) / 2;
                    HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
                    SpliceViewGLMonitor spliceViewGLMonitor4 = this.mSplice1Monitor;
                    spliceViewGLMonitor4.setMatrix(spliceViewGLMonitor4.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
                    if (1 != this.mSplice1Monitor.getmIsFullScreen()) {
                        this.spliceimageview.MoveRect(this.mSplice1Monitor.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height, this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height, this.mMonitorHeight);
                    }
                    Handler handler = this.mAnimHandler;
                    if (handler != null) {
                        handler.sendEmptyMessageDelayed(2384, 200L);
                    }
                    this.misFirstshow = false;
                    return;
                }
                return;
            }
            if (i == 3) {
                if (TextUtils.isEmpty(string) || this.mRecordingState != 2) {
                    return;
                }
                grabRecordSnapshot(string);
                return;
            }
            if (i == 4) {
                if (TextUtils.isEmpty(this.recordFile)) {
                    return;
                }
                File file = new File(this.recordFile);
                if (file.length() <= 1024 && file.isFile() && file.exists()) {
                    file.delete();
                    return;
                }
                return;
            }
            if (i == 5) {
                this.mRecordingState = 0;
                this.mRecHandler.removeCallbacksAndMessages(null);
                if (TextUtils.isEmpty(this.recordFile)) {
                    return;
                }
                File file2 = new File(this.recordFile);
                if (file2.length() <= 1024 && file2.isFile() && file2.exists()) {
                    file2.delete();
                    return;
                }
                return;
            }
            if (i != 6) {
                return;
            }
        }
        HiLogcatUtil.d(" PLAY_STATE_DISPLAY_ERROR  OR OTHER");
        finish();
        MyToast.showToast(this, getString(R.string.video_exception));
    }

    private void saveRecordSnapshot(final Bitmap bitmap, final String str) {
        new AsyncTask<Void, Void, Void>() {
            @Override
            public void onPostExecute(Void r1) {
            }

            @Override
            public Void doInBackground(Void... voidArr) {
                if (!Environment.getExternalStorageState().equals("mounted")) {
                    return null;
                }
                File file = new File(HiDataValue.getPathCameraLocalRecordSnapShot(SpliceLiveViewActivity.this.mMyCamera.getUid(), SpliceLiveViewActivity.this));
                if (!file.exists()) {
                    file.mkdirs();
                }
                if (TextUtils.isEmpty(str)) {
                    return null;
                }
                String[] split = new File(str).getName().split("\\.");
                HiTools.saveBitmap(bitmap, file.getAbsolutePath() + "/" + split[0]);
                return null;
            }
        }.execute(new Void[0]);
    }

    @Override
    public void onClick(View view) {
        int i = 0;
        switch (view.getId()) {
            case R.id.btn_return:
                finish();
                return;
            case R.id.iv_duijiang:
            case R.id.iv_landscape_talk:
                if (getResources().getConfiguration().orientation == 2) {
                    HiDataValue.isOrientation = true;
                } else {
                    HiDataValue.isOrientation = false;
                }
                HiLogcatUtil.e("HiDataValue.isOrientation" + HiDataValue.isOrientation);
                if (HiTools.HiPermission(this, this, 2, MY_PERMISSION_REQUEST_CODE)) {
                    this.mIsOnpause = true;
                    return;
                } else {
                    handTalkingNew();
                    return;
                }
            case R.id.iv_full_screen:
                this.mIsClickReturn = false;
                if (getResources().getConfiguration().orientation == 1) {
                    if (this.isTalking) {
                        return;
                    } else {
                        setRequestedOrientation(0);
                    }
                } else if (getResources().getConfiguration().orientation == 2) {
                    setRequestedOrientation(1);
                }
                this.mSplice1Monitor.setVisibility(4);
                this.mSplice2Monitor.setVisibility(4);
                return;
            case R.id.iv_land_more:
                handLandMore();
                this.rl_landscape_one.setVisibility(8);
                this.rl_landscape_buttom.setVisibility(8);
                return;
            case R.id.iv_land_snapshot:
            case R.id.iv_snapshot:
                if (HiTools.HiPermission(this, this, 1, MY_PERMISSION_REQUEST_CODE)) {
                    this.mIsOnpause = true;
                    return;
                } else {
                    handSnapshot();
                    return;
                }
            case R.id.iv_landscape_listen:
            case R.id.iv_listen:
                clickListen();
                return;
            case R.id.iv_landscape_record:
            case R.id.iv_record:
                if (HiTools.HiPermission(this, this, 1, MY_PERMISSION_REQUEST_CODE)) {
                    this.mIsOnpause = true;
                    return;
                } else {
                    clickRecording();
                    return;
                }
            case R.id.iv_playback:
                if (checkSupportCloud(this.mMyCamera)) {
                    clickPlayback(this.iv_playback);
                    return;
                } else {
                    jumpSdPlaybackActivity(this.mMyCamera);
                    this.isNeedFinish = true;
                    return;
                }
            case R.id.iv_setting:
                if (this.isTalking && getResources().getConfiguration().orientation == 1) {
                    return;
                }
                if (this.mMyCamera.getCameraLevel() == 20) {
                    Intent intent = new Intent(this, (Class<?>) ShareSettingActivity.class);
                    intent.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                    startActivity(intent);
                    return;
                } else {
                    Intent intent2 = new Intent(this, (Class<?>) SettingActivity.class);
                    intent2.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                    startActivity(intent2);
                    return;
                }
            case R.id.iv_tinglight:
                HiLog.e("" + this.mMyCamera.getUid() + "iv_tinglight");
                ConstantCommand.HI_P2P_Garden_Lamp_INFO hI_P2P_Garden_Lamp_INFO = this.mGarden_lamp_info;
                if (hI_P2P_Garden_Lamp_INFO != null) {
                    if (hI_P2P_Garden_Lamp_INFO.u32Enable == 1) {
                        this.mGarden_lamp_info.u32Enable = 0;
                        MyToast.showToast(this, getString(R.string.ting_light_off));
                    } else {
                        this.mGarden_lamp_info.u32Enable = 1;
                        MyToast.showToast(this, getString(R.string.ting_light_on));
                    }
                    this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_Garden_Lamp, this.mGarden_lamp_info.parseContent());
                    return;
                }
                return;
            case R.id.iv_ydzz_land:
                if (this.iv_ydzz_land.isSelected()) {
                    this.iv_ydzz_land.setSelected(false);
                    MyToast.showToast(this, getString(R.string.tracking_close));
                } else {
                    this.iv_ydzz_land.setSelected(true);
                    MyToast.showToast(this, getString(R.string.tracking_open));
                    i = 1;
                }
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_SMART_MOTO, HiChipDefines.HI_P2P_SMART_MOTO.parseContent(i));
                return;
            case R.id.ll_land_return:
                if (getResources().getConfiguration().orientation == 2) {
                    this.mIsClickReturn = true;
                    releaseLockScreen();
                    setRequestedOrientation(1);
                }
                handTalkingBack();
                return;
            case R.id.root_lock_screen:
                OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
                if (orientationWatchDog != null) {
                    orientationWatchDog.setLockScreen(true);
                }
                this.root_lock_screen.setVisibility(8);
                this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                return;
            case R.id.tv_know:
                Handler handler = this.mHandler;
                if (handler != null) {
                    handler.removeCallbacksAndMessages(null);
                }
                this.ll_guide.setVisibility(8);
                SharePreUtils.putBoolean(HiDataValue.CACHE, this, this.mMyCamera.getUid() + "isFirstEnterLive", false);
                return;
            case R.id.tv_landscape_video_quality:
                handVideoQuality(this.tv_landscape_video_quality, true);
                return;
            case R.id.tv_video_quality:
                if (this.isTalking) {
                    return;
                }
                handVideoQuality(this.tv_video_quality, false);
                return;
            default:
                return;
        }
    }

    private void handWork(View view) {
        final RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.live_view_ext_layout);
        RadioGroup radioGroup2 = (RadioGroup) view.findViewById(R.id.live_view_nor_layout);
        RadioGroup radioGroup3 = (RadioGroup) view.findViewById(R.id.live_view_abs_light_layout);
        RadioGroup radioGroup4 = (RadioGroup) view.findViewById(R.id.live_view_light_and_sound);
        RadioButton[] radioButtonArr = {(RadioButton) view.findViewById(R.id.live_view_ext_btn_normal), (RadioButton) view.findViewById(R.id.live_view_ext_btn_color), (RadioButton) view.findViewById(R.id.live_view_ext_btn_auto)};
        RadioButton[] radioButtonArr2 = {(RadioButton) view.findViewById(R.id.live_view_nor_btn_open), (RadioButton) view.findViewById(R.id.live_view_nor_btn_close)};
        RadioButton[] radioButtonArr3 = {(RadioButton) view.findViewById(R.id.light_and_sound_close), (RadioButton) view.findViewById(R.id.light_and_sound_open), (RadioButton) view.findViewById(R.id.light_and_sound_auto)};
        int i = this.lightModel;
        if (i == 2) {
            radioGroup.setVisibility(8);
            radioGroup3.setVisibility(8);
            radioGroup2.setVisibility(0);
            radioGroup4.setVisibility(8);
            HiChipDefines.HI_P2P_WHITE_LIGHT_INFO hi_p2p_white_light_info = this.light_info;
            if (hi_p2p_white_light_info != null && hi_p2p_white_light_info.u32State < 2) {
                radioButtonArr2[this.light_info.u32State].setChecked(true);
            }
        } else if (i == 1 || i == 5) {
            radioGroup.setVisibility(0);
            radioGroup2.setVisibility(8);
            radioGroup3.setVisibility(8);
            radioGroup4.setVisibility(8);
            ConstantCommand.HI_P2P_Garden_Lamp_INFO hI_P2P_Garden_Lamp_INFO = this.mGarden_lamp_info;
            if (hI_P2P_Garden_Lamp_INFO != null && hI_P2P_Garden_Lamp_INFO.u32State < 3) {
                ((RadioButton) radioGroup.getChildAt(this.mGarden_lamp_info.u32State)).setChecked(true);
            }
            HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT hi_p2p_white_light_info_ext = this.light_info_ext;
            if (hi_p2p_white_light_info_ext != null && hi_p2p_white_light_info_ext.u32State < 3) {
                radioButtonArr[this.light_info_ext.u32State].setChecked(true);
            }
        } else if (i == 3) {
            radioGroup3.setVisibility(0);
            radioGroup.setVisibility(8);
            radioGroup2.setVisibility(8);
            radioGroup4.setVisibility(8);
            HiChipDefines.ABSOLUTE_LIGHT_TYPE absolute_light_type = this.abs_light;
            if (absolute_light_type != null && absolute_light_type.s32State < 3) {
                ((RadioButton) radioGroup3.getChildAt(this.abs_light.s32State)).setChecked(true);
            }
        } else {
            radioGroup3.setVisibility(8);
            radioGroup.setVisibility(8);
            radioGroup2.setVisibility(8);
            radioGroup4.setVisibility(0);
            ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE hi_p2p_s_audible_visual_alarm_type = this.audible_visual_alarm_type;
            if (hi_p2p_s_audible_visual_alarm_type != null && hi_p2p_s_audible_visual_alarm_type.u32State < 3) {
                radioButtonArr3[this.audible_visual_alarm_type.u32State].setChecked(true);
            }
        }
        radioGroup4.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (SpliceLiveViewActivity.this.audible_visual_alarm_type == null) {
                    return;
                }
                switch (i2) {
                    case R.id.light_and_sound_auto:
                        SpliceLiveViewActivity.this.audible_visual_alarm_type.u32State = 2;
                        break;
                    case R.id.light_and_sound_close:
                        SpliceLiveViewActivity.this.audible_visual_alarm_type.u32State = 0;
                        break;
                    case R.id.light_and_sound_open:
                        SpliceLiveViewActivity.this.audible_visual_alarm_type.u32State = 1;
                        break;
                }
                SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(16791, SpliceLiveViewActivity.this.audible_visual_alarm_type.parseContent());
            }
        });
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (SpliceLiveViewActivity.this.lightModel == 1) {
                    if (SpliceLiveViewActivity.this.light_info_ext == null) {
                        return;
                    }
                    switch (i2) {
                        case R.id.live_view_ext_btn_auto:
                            SpliceLiveViewActivity.this.light_info_ext.u32State = 2;
                            break;
                        case R.id.live_view_ext_btn_color:
                            SpliceLiveViewActivity.this.light_info_ext.u32State = 1;
                            break;
                        case R.id.live_view_ext_btn_normal:
                            SpliceLiveViewActivity.this.light_info_ext.u32State = 0;
                            break;
                    }
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET_EXT, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT.parseContent(SpliceLiveViewActivity.this.light_info_ext.u32Chn, SpliceLiveViewActivity.this.light_info_ext.u32State));
                    return;
                }
                if (SpliceLiveViewActivity.this.lightModel != 5 || SpliceLiveViewActivity.this.mGarden_lamp_info == null) {
                    return;
                }
                if (SpliceLiveViewActivity.this.mGarden_set_cancel) {
                    SpliceLiveViewActivity.this.mGarden_set_cancel = false;
                    return;
                }
                switch (i2) {
                    case R.id.live_view_ext_btn_auto:
                        SpliceLiveViewActivity.this.msaveGardenstate = 2;
                        break;
                    case R.id.live_view_ext_btn_color:
                        SpliceLiveViewActivity.this.msaveGardenstate = 1;
                        break;
                    case R.id.live_view_ext_btn_normal:
                        SpliceLiveViewActivity.this.msaveGardenstate = 0;
                        break;
                }
                if (SpliceLiveViewActivity.this.mGarden_lamp_info.u32Enable != 1) {
                    SpliceLiveViewActivity.this.mGarden_lamp_info.u32State = SpliceLiveViewActivity.this.msaveGardenstate;
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_Garden_Lamp, SpliceLiveViewActivity.this.mGarden_lamp_info.parseContent());
                    return;
                }
                final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(SpliceLiveViewActivity.this);
                niftyDialogBuilder.withMessageLayoutHWrapW(HiTools.dip2px(SpliceLiveViewActivity.this, 280.0f));
                niftyDialogBuilder.withTitle(SpliceLiveViewActivity.this.getString(R.string.tip_hint)).withMessage(SpliceLiveViewActivity.this.getString(R.string.tipoff_tinglight));
                niftyDialogBuilder.withButton1Text(SpliceLiveViewActivity.this.getString(R.string.cancel)).withButton2Text(SpliceLiveViewActivity.this.getString(R.string.sure));
                niftyDialogBuilder.setButton1Click(new View.OnClickListener() {
                    @Override
                    public void onClick(View view2) {
                        niftyDialogBuilder.dismiss();
                        SpliceLiveViewActivity.this.mGarden_set_cancel = true;
                        ((RadioButton) radioGroup.getChildAt(SpliceLiveViewActivity.this.mGarden_lamp_info.u32State)).setChecked(true);
                    }
                });
                niftyDialogBuilder.setButton2Click(new View.OnClickListener() {
                    @Override
                    public void onClick(View view2) {
                        niftyDialogBuilder.dismiss();
                        MyToast.showToast(SpliceLiveViewActivity.this, SpliceLiveViewActivity.this.getString(R.string.ting_light_off));
                        SpliceLiveViewActivity.this.mGarden_lamp_info.u32Enable = 0;
                        SpliceLiveViewActivity.this.mGarden_lamp_info.u32State = SpliceLiveViewActivity.this.msaveGardenstate;
                        SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_Garden_Lamp, SpliceLiveViewActivity.this.mGarden_lamp_info.parseContent());
                    }
                });
                niftyDialogBuilder.isCancelableOnTouchOutside(false);
                niftyDialogBuilder.show();
            }
        });
        radioGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (SpliceLiveViewActivity.this.light_info == null) {
                    return;
                }
                switch (i2) {
                    case R.id.live_view_nor_btn_close:
                        SpliceLiveViewActivity.this.light_info.u32State = 1;
                        break;
                    case R.id.live_view_nor_btn_open:
                        SpliceLiveViewActivity.this.light_info.u32State = 0;
                        break;
                }
                SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO.parseContent(SpliceLiveViewActivity.this.light_info.u32Chn, SpliceLiveViewActivity.this.light_info.u32State));
            }
        });
        radioGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (SpliceLiveViewActivity.this.lightModel != 3 || SpliceLiveViewActivity.this.abs_light == null) {
                    return;
                }
                switch (i2) {
                    case R.id.abs_light_auto:
                        SpliceLiveViewActivity.this.abs_light.s32State = 0;
                        break;
                    case R.id.abs_light_close:
                        SpliceLiveViewActivity.this.abs_light.s32State = 2;
                        break;
                    case R.id.abs_light_open:
                        SpliceLiveViewActivity.this.abs_light.s32State = 1;
                        break;
                }
                SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_ABSOLUTE_LIGHT_TYPE, HiChipDefines.ABSOLUTE_LIGHT_TYPE.parseContent(SpliceLiveViewActivity.this.abs_light.s32State));
            }
        });
    }

    private void handLandMore() {
        View inflate = View.inflate(this, R.layout.pup_splicelandscape_more, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setOutsideTouchable(true);
        this.mPopupWindow.setHeight(-1);
        this.mPopupWindow.setWidth(this.mDp_250);
        this.mPopupWindow.setAnimationStyle(R.style.AnimTopRight);
        this.mPopupWindow.showAtLocation(inflate, 17, getWindowManager().getDefaultDisplay().getWidth(), 0);
        AnimationProUtils.alpha1To0(this.rl_landscape_view, 300);
        this.mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public final void onDismiss() {
                SpliceLiveViewActivity.this.lambda$handLandMore$1$SpliceLiveViewActivity();
            }
        });
        this.ll_pup_content = (LinearLayout) inflate.findViewById(R.id.ll_pup_content);
        this.ll_pup_main = (LinearLayout) inflate.findViewById(R.id.ll_pup_main);
        ((ImageView) inflate.findViewById(R.id.land_iv_volume)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SpliceLiveViewActivity.this.lambda$handLandMore$2$SpliceLiveViewActivity(view);
            }
        });
        ((ImageView) inflate.findViewById(R.id.iv_txtj_land)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SpliceLiveViewActivity.this.lambda$handLandMore$3$SpliceLiveViewActivity(view);
            }
        });
        ImageView imageView = (ImageView) inflate.findViewById(R.id.iv_night_mode_land);
        LinearLayout linearLayout = (LinearLayout) inflate.findViewById(R.id.ll_night_mode_land);
        TextView textView = (TextView) inflate.findViewById(R.id.tv_name);
        linearLayout.setVisibility(this.lightModel == 0 ? 8 : 0);
        if (this.lightModel == 4) {
            textView.setText(R.string.light_and_sound_alarm);
        } else if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_Garden_Lamp)) {
            textView.setText(R.string.gardenlight);
            imageView.setImageResource(R.mipmap.tyd_land);
        } else if (this.lightModel == 5) {
            textView.setText(R.string.night_model);
            linearLayout.setVisibility(0);
        }
        HiLog.e("lightModel:" + this.lightModel + "::" + linearLayout.getVisibility() + "::" + ((Object) textView.getText()));
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SpliceLiveViewActivity.this.lambda$handLandMore$4$SpliceLiveViewActivity(view);
            }
        });
    }

    public void lambda$handLandMore$1$SpliceLiveViewActivity() {
        AnimationProUtils.alpha0To1(this.rl_landscape_view, 300);
    }

    public void lambda$handLandMore$2$SpliceLiveViewActivity(View view) {
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_AUDIO_ATTR, null);
    }

    public void lambda$handLandMore$3$SpliceLiveViewActivity(View view) {
        this.mIsTXTJ = true;
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM, null);
    }

    public void lambda$handLandMore$4$SpliceLiveViewActivity(View view) {
        getLightParams();
    }

    private void showPupLight() {
        View inflate = View.inflate(this, R.layout.view_land_night_model, null);
        TextView textView = (TextView) inflate.findViewById(R.id.title);
        if (this.lightModel == 4) {
            textView.setText(R.string.light_and_sound_alarm);
        } else if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_Garden_Lamp)) {
            textView.setText(R.string.gardenlight);
        }
        handLandShowContent(inflate);
        handWork(inflate);
    }

    private void handZoomAndFocus(View view) {
        if (view == null) {
            return;
        }
        ((TextView) view.findViewById(R.id.tv_zoomin)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                if (motionEvent.getAction() == 0) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 9, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                }
                return false;
            }
        });
        ((TextView) view.findViewById(R.id.tv_zoomout)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                if (motionEvent.getAction() == 0) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 10, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                }
                return false;
            }
        });
        ((TextView) view.findViewById(R.id.tv_focusin)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                if (motionEvent.getAction() == 0) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 11, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                }
                return false;
            }
        });
        ((TextView) view.findViewById(R.id.tv_focusout)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                if (motionEvent.getAction() == 0) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 12, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    SpliceLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                }
                return false;
            }
        });
    }

    public void sendToDevice() {
        if (this.audio_attr == null) {
            return;
        }
        int progress = this.seekbar_input.getProgress() + 1;
        int progress2 = this.seekbar_output.getProgress() + 1;
        showLoadingView();
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_AUDIO_ATTR, HiChipDefines.HI_P2P_S_AUDIO_ATTR.parseContent(0, this.audio_attr.u32Enable, this.audio_attr.u32Stream, this.audio_attr.u32AudioType, this.mInputMethod, (!this.mMyCamera.isIs88VoiceDev() || progress <= 88) ? progress : 88, progress2));
    }

    private void FitVirtualKeyView() {
        this.rl_preset_key.setLayoutParams(new LinearLayout.LayoutParams(-1, HiTools.dip2px(this, 210.0f)));
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(HiTools.dip2px(this, 135.0f), -2);
        layoutParams.setMargins(0, 0, 0, 0);
        layoutParams.gravity = 1;
        this.tv_key_preset.setLayoutParams(layoutParams);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, HiTools.dip2px(this, 30.0f));
        layoutParams2.setMargins(HiTools.dip2px(this, 10.0f), HiTools.dip2px(this, 10.0f), HiTools.dip2px(this, 10.0f), 0);
        this.ll_key_one.setLayoutParams(layoutParams2);
        this.ll_key_two.setLayoutParams(layoutParams2);
        this.ll_key_there.setLayoutParams(layoutParams2);
    }

    private void handSnapshot() {
        clickSnapshot();
    }

    public void clickSnapshot() {
        if (this.mMyCamera != null) {
            if (HiTools.isSDCardValid()) {
                File file = new File(HiDataValue.getPathCameraSnapshot(this.mMyCamera.getUid(), this));
                if (!file.exists()) {
                    file.mkdirs();
                }
                String fileNameWithTime = HiTools.getFileNameWithTime(0);
                String str = file.getAbsoluteFile() + "/" + fileNameWithTime;
                MyCamera myCamera = this.mMyCamera;
                Bitmap snapshot = myCamera != null ? myCamera.getSnapshot() : null;
                if (snapshot != null && HiTools.saveImage(str, snapshot)) {
                    SaveToPhone(str, fileNameWithTime);
                    Toast makeText = Toast.makeText(this, getText(R.string.tips_snapshot_success), 0);
                    makeText.show();
                    this.toastList.add(makeText);
                    return;
                }
                Toast makeText2 = Toast.makeText(this, getText(R.string.tips_snapshot_failed), 0);
                makeText2.show();
                this.toastList.add(makeText2);
                return;
            }
            Toast makeText3 = Toast.makeText(this, getText(R.string.tips_no_sdcard).toString(), 0);
            makeText3.show();
            this.toastList.add(makeText3);
        }
    }

    private void SaveToPhone(final String str, final String str2) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    MediaStore.Images.Media.insertImage(SpliceLiveViewActivity.this.getContentResolver(), str, str2, (String) null);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                SpliceLiveViewActivity.this.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.parse("file://" + str)));
            }
        }).start();
    }

    private void handTalkingNew() {
        if (this.mRecordingState == 2) {
            if (this.isListening) {
                this.mMyCamera.PausePlayAudio();
                this.iv_listen.setSelected(false);
                this.iv_landscape_listen.setSelected(false);
                this.isListening = !this.isListening;
                this.mIsListenTrans = true;
            }
        } else if (this.isListening) {
            this.mMyCamera.stopListening();
            this.mVoiceIsTran = false;
            this.iv_listen.setSelected(false);
            this.iv_landscape_listen.setSelected(false);
            this.isListening = !this.isListening;
            this.mIsListenTrans = true;
        }
        if (this.isTalking) {
            this.mMyCamera.stopTalk();
            if (this.mIsListenTrans && !this.isListening) {
                if (this.mVoiceIsTran) {
                    this.mMyCamera.ResumePlayAudio();
                } else {
                    this.mMyCamera.startListening();
                    this.mVoiceIsTran = true;
                }
                this.iv_landscape_listen.setSelected(true);
                this.iv_listen.setSelected(true);
                this.isListening = true;
            }
        } else {
            this.mMyCamera.startTalk();
        }
        boolean z = !this.isTalking;
        this.isTalking = z;
        this.iv_duijiang.setSelected(z);
        this.iv_landscape_talk.setSelected(this.isTalking);
    }

    public void handTalkingBack() {
        if (this.isTalking) {
            this.mMyCamera.stopTalk();
            if (this.mIsListenTrans && !this.isListening) {
                if (this.mVoiceIsTran) {
                    this.mMyCamera.ResumePlayAudio();
                } else {
                    this.mMyCamera.startListening();
                    this.mVoiceIsTran = true;
                }
                this.iv_landscape_listen.setSelected(true);
                this.iv_listen.setSelected(true);
                this.isListening = true;
            }
            boolean z = !this.isTalking;
            this.isTalking = z;
            this.iv_duijiang.setSelected(z);
            this.iv_landscape_talk.setSelected(this.isTalking);
        }
    }

    private void handTalking() {
        if (this.mRecordingState == 2) {
            this.mMyCamera.PausePlayAudio();
        } else {
            this.mMyCamera.stopListening();
            this.mVoiceIsTran = false;
        }
        if (this.isTalking) {
            this.mMyCamera.stopTalk();
        } else {
            this.mMyCamera.startTalk();
        }
        if (this.isListening) {
            this.mMyCamera.PausePlayAudio();
            this.iv_listen.setSelected(false);
            this.iv_landscape_listen.setSelected(false);
            this.isListening = !this.isListening;
        }
        boolean z = !this.isTalking;
        this.isTalking = z;
        this.iv_duijiang.setSelected(z);
        this.iv_landscape_talk.setSelected(this.isTalking);
    }

    private void clickRecording() {
        int i = this.mRecordingState;
        if (i != 0) {
            if (i == 2) {
                endRecording();
                return;
            }
            return;
        }
        this.mRecordingState = 2;
        TimerRecording();
        this.iv_landscape_record.setSelected(true);
        this.iv_record.setSelected(true);
        this.mStartRecordTime = 0L;
        this.ll_recording.setVisibility(0);
        this.iv_recording.setVisibility(0);
        this.mRecHandler.sendEmptyMessage(110);
    }

    public void endRecording() {
        this.mRecordingState = 0;
        if (this.mVoiceIsTran && !this.iv_landscape_listen.isSelected()) {
            this.mMyCamera.stopListening();
            this.mVoiceIsTran = false;
        }
        this.mMyCamera.stopRecording();
        Timer timer = this.timer;
        if (timer != null) {
            timer.cancel();
            this.timer = null;
        }
        TimerTask timerTask = this.timerTask;
        if (timerTask != null) {
            timerTask.cancel();
            this.timerTask = null;
        }
        this.iv_landscape_record.setSelected(false);
        this.iv_record.setSelected(false);
        this.ll_recording.setVisibility(4);
        this.iv_recording.setVisibility(4);
        this.mRecHandler.removeCallbacksAndMessages(null);
    }

    public void TimerRecording() {
        HiLogcatUtil.d("TimerRecording()");
        Timer timer = this.timer;
        if (timer != null) {
            timer.cancel();
            this.timer = null;
        }
        TimerTask timerTask = this.timerTask;
        if (timerTask != null) {
            timerTask.cancel();
            this.timerTask = null;
        }
        File file = new File(HiDataValue.getPathCameraVideoLocalRecord(this.mMyCamera.getUid(), this));
        if (!file.exists()) {
            file.mkdirs();
        }
        this.timer = new Timer();
        AnonymousClass28 anonymousClass28 = new AnonymousClass28(file);
        this.timerTask = anonymousClass28;
        this.timer.schedule(anonymousClass28, 0L, TTAdConstant.AD_MAX_EVENT_TIME);
    }

    public class AnonymousClass28 extends TimerTask {
        boolean isFirst = true;
        final File val$cameraFolder;

        AnonymousClass28(File file) {
            this.val$cameraFolder = file;
        }

        @Override
        public void run() {
            HiLogcatUtil.d("timerTask run()");
            if (SpliceLiveViewActivity.this.mRecordingState == 2) {
                SpliceLiveViewActivity.this.mMyCamera.stopRecording();
            }
            SpliceLiveViewActivity.this.recordFile = this.val$cameraFolder.getAbsoluteFile() + "/" + HiTools.getFileNameWithTime(1);
            long availableSize = HiTools.getAvailableSize();
            if (availableSize < 100 && availableSize > 0) {
                SpliceLiveViewActivity.this.mHandler.sendEmptyMessage(WiFiSettingActivity.SET_WIFI_END);
                return;
            }
            HiLogcatUtil.d("timerTask run() isFirst: " + this.isFirst);
            if (this.isFirst) {
                SpliceLiveViewActivity.this.mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        SpliceLiveViewActivity.this.mMyCamera.startRecording(SpliceLiveViewActivity.this.recordFile);
                        AnonymousClass28.this.isFirst = false;
                    }
                });
            } else {
                SpliceLiveViewActivity.this.mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        SpliceLiveViewActivity.this.mMyCamera.startRecording(SpliceLiveViewActivity.this.recordFile);
                    }
                }, 1000L);
            }
        }
    }

    private void continueRecording() {
        HiLogcatUtil.d("continueRecording()");
        Timer timer = this.timer;
        if (timer != null) {
            timer.cancel();
            this.timer = null;
        }
        TimerTask timerTask = this.timerTask;
        if (timerTask != null) {
            timerTask.cancel();
            this.timerTask = null;
        }
        final File file = new File(HiDataValue.getPathCameraVideoLocalRecord(this.mMyCamera.getUid(), this));
        if (!file.exists()) {
            file.mkdirs();
        }
        this.timer = new Timer();
        TimerTask timerTask2 = new TimerTask() {
            @Override
            public void run() {
                HiLogcatUtil.d("continueRecording run()");
                if (SpliceLiveViewActivity.this.mRecordingState == 2) {
                    HiLogcatUtil.d("continueRecording stopRecording()");
                    SpliceLiveViewActivity.this.mMyCamera.stopRecording();
                }
                SpliceLiveViewActivity.this.recordFile = file.getAbsoluteFile() + "/" + HiTools.getFileNameWithTime(1);
                long availableSize = HiTools.getAvailableSize();
                if (availableSize >= 100 || availableSize <= 0) {
                    SpliceLiveViewActivity.this.mHandler.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            HiLogcatUtil.d("continueRecording startRecording()");
                            SpliceLiveViewActivity.this.mMyCamera.startRecording(SpliceLiveViewActivity.this.recordFile);
                        }
                    }, 1000L);
                } else {
                    SpliceLiveViewActivity.this.mHandler.sendEmptyMessage(WiFiSettingActivity.SET_WIFI_END);
                }
            }
        };
        this.timerTask = timerTask2;
        this.timer.schedule(timerTask2, TTAdConstant.AD_MAX_EVENT_TIME, TTAdConstant.AD_MAX_EVENT_TIME);
    }

    private void handVideoQuality(View view, boolean z) {
        if (this.mIsSwitchResolution) {
            return;
        }
        clickRatio((TextView) view, z);
    }

    private void handListening(ImageView imageView) {
        if (HiDataValue.ANDROID_VERSION >= 23 && (!HiTools.checkPermission(this, "android.permission.RECORD_AUDIO") || !HiTools.checkPermission(this, g.j))) {
            showAlertDialog();
        } else {
            clickListen();
        }
    }

    private void clickRatio(TextView textView, boolean z) {
        int dip2px;
        View inflate = getLayoutInflater().inflate(R.layout.popview_resolution_ratio, (ViewGroup) null, false);
        this.videoQualityPopupWindow = new PopupWindow(inflate);
        this.videoQualityPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.videoQualityPopupWindow.setOutsideTouchable(true);
        this.videoQualityPopupWindow.setFocusable(false);
        this.videoQualityPopupWindow.setWidth(-2);
        this.videoQualityPopupWindow.setHeight(-2);
        int[] iArr = new int[2];
        textView.getLocationOnScreen(iArr);
        int dip2px2 = HiTools.dip2px(this, 90.0f);
        if (z) {
            dip2px = !this.isLeft ? 0 : LiuHaiScreenTools.getNotchHeight(this) - HiTools.dip2px(this, 5.0f);
        } else {
            dip2px = HiTools.dip2px(this, 15.0f);
        }
        this.videoQualityPopupWindow.showAtLocation(textView, 0, iArr[0] - dip2px, iArr[1] - dip2px2);
        final TextView textView2 = (TextView) inflate.findViewById(R.id.ratio_high);
        final TextView textView3 = (TextView) inflate.findViewById(R.id.ratio_fluent);
        int videoQuality = this.mMyCamera.getVideoQuality();
        if (videoQuality == 0) {
            textView2.setSelected(true);
            textView3.setSelected(false);
        } else if (videoQuality == 1) {
            textView2.setSelected(false);
            textView3.setSelected(true);
        }
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SpliceLiveViewActivity.this.receiveHumanParams = false;
                SpliceLiveViewActivity.this.humanRectHandler.removeMessages(10010);
                SpliceLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                textView2.setSelected(true);
                textView3.setSelected(false);
                SpliceLiveViewActivity.this.switchVideoQuality(0);
            }
        });
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SpliceLiveViewActivity.this.receiveHumanParams = false;
                SpliceLiveViewActivity.this.humanRectHandler.removeMessages(10010);
                SpliceLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                textView3.setSelected(true);
                textView2.setSelected(false);
                SpliceLiveViewActivity.this.switchVideoQuality(1);
            }
        });
    }

    public void switchVideoQuality(int i) {
        MyCamera myCamera = this.mMyCamera;
        if (myCamera == null || i == myCamera.getVideoQuality()) {
            return;
        }
        this.mIsSwitchResolution = true;
        setViewWhetherClick(false);
        this.iv_listen.setSelected(false);
        this.iv_landscape_listen.setSelected(false);
        this.mMyCamera.stopListening();
        this.mIsListenTrans = false;
        this.mVoiceIsTran = false;
        this.isListening = false;
        this.iv_duijiang.setSelected(false);
        this.iv_landscape_talk.setSelected(false);
        if (this.isTalking) {
            this.mMyCamera.stopTalk();
            this.isTalking = false;
        }
        this.mQuality = i;
        HiLogcatUtil.d("ChangeStream->quality: " + i);
        this.mMyCamera.ChangeStream(i);
    }

    private void clickListen() {
        if (this.mRecordingState == 2) {
            if (this.mVoiceIsTran) {
                this.mMyCamera.PausePlayAudio();
                this.mIsListenTrans = false;
                if (this.isListening) {
                    this.mMyCamera.PausePlayAudio();
                    this.mIsListenTrans = false;
                } else {
                    this.mMyCamera.ResumePlayAudio();
                }
            } else {
                this.mMyCamera.stopRecording();
                this.mMyCamera.startListening();
                this.mVoiceIsTran = true;
                TimerRecording();
                this.mStartRecordTime = 0L;
            }
            if (this.isListening) {
                this.iv_landscape_listen.setSelected(false);
                this.iv_listen.setSelected(false);
            } else {
                this.iv_landscape_listen.setSelected(true);
                this.iv_listen.setSelected(true);
            }
        } else if (this.isListening) {
            this.iv_landscape_listen.setSelected(false);
            this.iv_listen.setSelected(false);
            this.mMyCamera.stopListening();
            this.mIsListenTrans = false;
            this.mVoiceIsTran = false;
        } else {
            this.iv_landscape_listen.setSelected(true);
            this.iv_listen.setSelected(true);
            this.mMyCamera.startListening();
            this.mVoiceIsTran = true;
        }
        if (this.isTalking) {
            this.iv_duijiang.setSelected(false);
            this.iv_landscape_talk.setSelected(false);
            this.mMyCamera.stopTalk();
            this.isTalking = !this.isTalking;
        }
        this.isListening = !this.isListening;
    }

    private void showAlertDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(getString(R.string.tips_no_permission));
        builder.setPositiveButton(getString(R.string.setting), new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                HiTools.toSelfSetting(SpliceLiveViewActivity.this);
            }
        });
        builder.setNegativeButton(getString(R.string.cancel), (DialogInterface.OnClickListener) null);
        builder.show();
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        HiLogcatUtil.e(new String[0]);
        super.onConfigurationChanged(configuration);
        if (getResources().getConfiguration().orientation == 1) {
            handPortrait();
            setIsFullScreen(false);
            this.mSplice1Monitor.setVisibility(0);
            this.mSplice2Monitor.setVisibility(0);
        } else {
            handLandScape();
            this.mSplice1Monitor.setVisibility(0);
            PopupWindow popupWindow = this.videoQualityPopupWindow;
            if (popupWindow != null && popupWindow.isShowing()) {
                this.videoQualityPopupWindow.dismiss();
            }
            PopupWindow popupWindow2 = this.playbackPopupWindow;
            if (popupWindow2 != null && popupWindow2.isShowing()) {
                this.playbackPopupWindow.dismiss();
            }
            setIsFullScreen(true);
        }
        if (this.isShowPermissionDialog) {
            HiTools.dialogUtilsAgreements.build().show();
        }
    }

    public void handLandScape() {
        RelativeLayout.LayoutParams layoutParams;
        this.isHideNavigation = hideBottomUIMenu();
        this.mSplice1Monitor.setmIsFullScreen(1);
        int i = 0;
        this.focusNum = 0;
        this.largeMul = 6.0d;
        if (Build.VERSION.SDK_INT < 29) {
            this.largeMul = 3.0d;
        } else if (Build.VERSION.SDK_INT < 30) {
            this.largeMul = 3.0d;
        }
        this.mFocusHandler.removeCallbacksAndMessages(null);
        getWindow().setFlags(1024, 1024);
        this.titleview.setVisibility(8);
        this.ll_bottom.setVisibility(8);
        this.rl_wrap.setVisibility(8);
        this.iv_full_screen.setVisibility(8);
        this.rl_2ms.setVisibility(8);
        this.rl_landscape_view.setVisibility(0);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(this.ll_recording.getLayoutParams());
        layoutParams2.setMargins(HiTools.dip2px(this, 20.0f), HiTools.dip2px(this, 55.0f), 0, 0);
        this.ll_recording.setLayoutParams(layoutParams2);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mSplice1Monitor.screen_height = displayMetrics.heightPixels;
        if (this.isHideNavigation) {
            layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            this.mSplice1Monitor.screen_width = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(this);
        } else {
            layoutParams = new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());
            this.mSplice1Monitor.screen_width = displayMetrics.widthPixels;
        }
        this.mSplice1Monitor.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, -1);
        layoutParams3.topMargin = (int) ((this.mSplice1Monitor.screen_height - ((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d)) / 2.0d);
        layoutParams3.height = (int) ((this.mSplice1Monitor.screen_width * 9.0d) / 32.0d);
        this.humanRectView.setLayoutParams(layoutParams3);
        this.humanRectView.cleanRect(false);
        initMatrix(this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height);
        this.mSplice1Monitor.setState(0);
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.screen_height + Constants.COLON_SEPARATOR + this.mSplice1Monitor.screen_width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        spliceViewGLMonitor.width = spliceViewGLMonitor.screen_width;
        SpliceViewGLMonitor spliceViewGLMonitor2 = this.mSplice1Monitor;
        spliceViewGLMonitor2.height = (int) ((((double) spliceViewGLMonitor2.screen_width) * 9.0d) / 32.0d);
        this.mSplice1Monitor.left = 0;
        SpliceViewGLMonitor spliceViewGLMonitor3 = this.mSplice1Monitor;
        spliceViewGLMonitor3.bottom = (spliceViewGLMonitor3.screen_height - this.mSplice1Monitor.height) / 2;
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor4 = this.mSplice1Monitor;
        spliceViewGLMonitor4.setMatrix(spliceViewGLMonitor4.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
        this.mAnimHandler.sendEmptyMessageDelayed(2384, 200L);
        if (!this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SENSOR)) {
            return;
        }
        int i2 = this.focusGap;
        this.moveX = i2 / 2;
        this.moveY = ((i2 * this.mSplice1Monitor.screen_height) / this.mSplice1Monitor.screen_width) / 2;
        this.savemonmaxleft = 0;
        this.savemonmaxbottom = this.mSplice1Monitor.bottom;
        this.savemonmaxwidth = this.mSplice1Monitor.width;
        this.savemonmaxheight = this.mSplice1Monitor.height;
        while (true) {
            int i3 = i + 1;
            if (i >= 200) {
                HiLog.e("send:" + this.savemonmaxleft + "::" + this.savemonmaxbottom + "::" + this.savemonmaxwidth + "::" + this.savemonmaxheight + "::" + this.mSplice1Monitor.screen_width + "::" + this.mSplice1Monitor.screen_height + "::" + this.largeMul);
                return;
            }
            if (this.savemonmaxwidth <= this.largeMul * this.mSplice1Monitor.screen_width && this.savemonmaxheight <= this.largeMul * this.mSplice1Monitor.screen_height) {
                int i4 = this.savemonmaxleft;
                int i5 = this.moveX;
                this.savemonmaxleft = i4 - (i5 / 2);
                int i6 = this.savemonmaxbottom;
                int i7 = this.moveY;
                this.savemonmaxbottom = i6 - (i7 / 2);
                this.savemonmaxwidth += i5;
                this.savemonmaxheight += i7;
            }
            i = i3;
        }
    }

    public void RestoreLandMonitor() {
        RelativeLayout.LayoutParams layoutParams;
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mSplice1Monitor.screen_height = displayMetrics.heightPixels;
        if (this.isHideNavigation) {
            layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            this.mSplice1Monitor.screen_width = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(this);
        } else {
            layoutParams = new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());
            this.mSplice1Monitor.screen_width = displayMetrics.widthPixels;
        }
        if (HiTools.isAllScreenDevice(this)) {
            layoutParams.setMarginEnd(HiTools.dip2px(this, 15.0f));
            this.rl_landscape_view.setLayoutParams(layoutParams);
            this.mSplice1Monitor.screen_width -= HiTools.dip2px(this, 15.0f);
        }
        this.mSplice1Monitor.setLayoutParams(layoutParams);
        this.humanRectView.setLayoutParams(layoutParams);
        initMatrix(this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height);
        this.mSplice1Monitor.setState(0);
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.screen_height + Constants.COLON_SEPARATOR + this.mSplice1Monitor.screen_width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        spliceViewGLMonitor.setMatrix(spliceViewGLMonitor.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
    }

    private void handPortrait() {
        OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
        if (orientationWatchDog != null) {
            orientationWatchDog.setLockScreen(false);
        }
        if (this.mHandler_lockScreen != null) {
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
        showBottomUIMenu();
        this.mSplice1Monitor.setmIsFullScreen(0);
        getWindow().clearFlags(1024);
        this.largeMul = 12.0d;
        if (Build.VERSION.SDK_INT < 29) {
            this.largeMul = 4.0d;
        } else if (Build.VERSION.SDK_INT < 30) {
            this.largeMul = 6.0d;
        }
        this.titleview.setVisibility(0);
        this.ll_bottom.setVisibility(0);
        this.rl_wrap.setVisibility(0);
        this.iv_full_screen.setVisibility(0);
        this.rl_2ms.setVisibility(0);
        this.rl_landscape_view.setVisibility(8);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), this.mMonitorHeight);
        this.mSplice1Monitor.setLayoutParams(layoutParams);
        this.humanRectView.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, HiTools.dip2px(this, 36.0f));
        layoutParams2.setMargins(10, this.mMonitorHeight - HiTools.dip2px(this, 10.0f), 10, 3);
        this.rl_wrap.setLayoutParams(layoutParams2);
        layoutParams2.setMargins(0, this.mMonitorHeight - HiTools.dip2px(this, 100.0f), HiTools.dip2px(this, 10.0f), 8);
        this.rl_2ms.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(this.rl_2ms.getLayoutParams());
        layoutParams3.setMargins(HiTools.getScreenW(this) / 5, this.mMonitorHeight - ((int) ((((HiTools.getScreenW(this) * 3.0d) / 5.0d) * 9.0d) / 32.0d)), HiTools.getScreenW(this) / 5, 8);
        this.rl_2ms.setLayoutParams(layoutParams3);
        RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(this.mSplice2Monitor.getLayoutParams());
        RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(this.spliceimageview.getLayoutParams());
        int screenW = (int) ((HiTools.getScreenW(this) * 3.0d) / 5.0d);
        layoutParams4.width = screenW;
        layoutParams5.width = screenW;
        int screenW2 = (int) ((((HiTools.getScreenW(this) * 3.0d) / 5.0d) * 9.0d) / 32.0d);
        layoutParams4.height = screenW2;
        layoutParams5.height = screenW2;
        this.mSplice2Monitor.setLayoutParams(layoutParams4);
        this.spliceimageview.setLayoutParams(layoutParams5);
        if (this.mIsHaveVirtual) {
            RelativeLayout.LayoutParams layoutParams6 = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
            this.mSplice1Monitor.setLayoutParams(layoutParams6);
            this.humanRectView.setLayoutParams(layoutParams6);
            this.iv_placeholder.setLayoutParams(layoutParams6);
            RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(-1, HiTools.dip2px(this, 36.0f));
            layoutParams7.setMargins(10, this.mMonitorHeight - HiTools.dip2px(this, 10.0f), 10, 3);
            this.rl_wrap.setLayoutParams(layoutParams7);
        }
        RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(this.ll_recording.getLayoutParams());
        layoutParams8.setMargins(HiTools.dip2px(this, 12.0f), HiTools.dip2px(this, 5.0f), 0, 0);
        this.ll_recording.setLayoutParams(layoutParams8);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mSplice1Monitor.screen_height = displayMetrics.heightPixels;
        this.mSplice1Monitor.screen_width = displayMetrics.widthPixels;
        initMatrix(this.mSplice1Monitor.screen_width, this.mMonitorHeight);
        this.mSplice1Monitor.setState(0);
        this.humanRectView.cleanRect(false);
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.screen_height + Constants.COLON_SEPARATOR + this.mSplice1Monitor.screen_width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        this.mSplice1Monitor.setState(1);
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        spliceViewGLMonitor.height = spliceViewGLMonitor.screen_width / 2;
        SpliceViewGLMonitor spliceViewGLMonitor2 = this.mSplice1Monitor;
        spliceViewGLMonitor2.width = (spliceViewGLMonitor2.screen_width / this.mSplice1Monitor.height) * this.mSplice1Monitor.screen_width;
        this.mSplice1Monitor.left = 0;
        SpliceViewGLMonitor spliceViewGLMonitor3 = this.mSplice1Monitor;
        spliceViewGLMonitor3.bottom = (this.mMonitorHeight - spliceViewGLMonitor3.height) / 2;
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor4 = this.mSplice1Monitor;
        spliceViewGLMonitor4.setMatrix(spliceViewGLMonitor4.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
        this.mAnimHandler.sendEmptyMessageDelayed(2384, 200L);
        HiSetMon();
        if (1 != this.mSplice1Monitor.getmIsFullScreen()) {
            this.spliceimageview.MoveRect(this.mSplice1Monitor.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height, this.mSplice1Monitor.screen_width, this.mSplice1Monitor.screen_height, this.mMonitorHeight);
        }
    }

    public void RestorePortMonitor() {
        HiLog.e("" + this.mMonitorHeight);
        this.mSplice1Monitor.setLayoutParams(new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), this.mMonitorHeight));
        if (this.mIsHaveVirtual) {
            this.mSplice1Monitor.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mMonitorHeight));
        }
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mSplice1Monitor.screen_height = this.mMonitorHeight;
        this.mSplice1Monitor.screen_width = displayMetrics.widthPixels;
        initMatrix(this.mSplice1Monitor.screen_width, this.mMonitorHeight);
        this.mSplice1Monitor.setState(0);
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.screen_height + Constants.COLON_SEPARATOR + this.mSplice1Monitor.screen_width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        spliceViewGLMonitor.setMatrix(spliceViewGLMonitor.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
    }

    public void showLoadingView() {
        ImageView imageView = this.mIvLoading2;
        if (imageView == null || imageView.getVisibility() != 8) {
            return;
        }
        Animation loadAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate);
        this.mIvLoading2.setVisibility(0);
        this.mIvLoading2.startAnimation(loadAnimation);
    }

    public void dismissLoadingView() {
        ImageView imageView = this.mIvLoading2;
        if (imageView == null || imageView.getVisibility() != 0) {
            return;
        }
        this.mIvLoading2.clearAnimation();
        this.mIvLoading2.setVisibility(8);
    }

    public void showPlaceLoadingView() {
        Animation loadAnimation = AnimationUtils.loadAnimation(this, R.anim.rotate);
        this.iv_placeholder_rotate.setVisibility(0);
        this.iv_placeholder_rotate.startAnimation(loadAnimation);
        this.iv_placeholder.setVisibility(0);
    }

    public void dismissPlaceLoadingView() {
        if (this.iv_placeholder_rotate.getAlpha() == 1.0f) {
            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.iv_placeholder_rotate, "Alpha", 1.0f, 0.0f);
            ofFloat.setDuration(500L);
            ofFloat.start();
        }
        if (this.iv_placeholder.getAlpha() == 1.0f) {
            ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.iv_placeholder, "Alpha", 1.0f, 0.0f);
            ofFloat2.setDuration(500L);
            ofFloat2.start();
        }
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
        switch (seekBar.getId()) {
            case R.id.sb_brightness:
                TextView textView = this.tv_brightness;
                if (textView != null) {
                    textView.setText(seekBar.getProgress() + "");
                    return;
                }
                return;
            case R.id.sb_contrast:
                TextView textView2 = this.tv_contrast;
                if (textView2 != null) {
                    textView2.setText(seekBar.getProgress() + "");
                    return;
                }
                return;
            case R.id.sb_saturation:
                TextView textView3 = this.tv_saturation;
                if (textView3 != null) {
                    textView3.setText(seekBar.getProgress() + "");
                    return;
                }
                return;
            default:
                return;
        }
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
        switch (seekBar.getId()) {
            case R.id.sb_brightness:
                this.display_param.u32Brightness = seekBar.getProgress();
                showLoadingView();
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, this.display_param.parseContent());
                return;
            case R.id.sb_contrast:
                this.display_param.u32Contrast = seekBar.getProgress();
                showLoadingView();
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, this.display_param.parseContent());
                return;
            case R.id.sb_saturation:
                this.display_param.u32Saturation = seekBar.getProgress();
                showLoadingView();
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, this.display_param.parseContent());
                return;
            default:
                return;
        }
    }

    private void setViewWhetherClick(boolean z) {
        try {
            this.iv_landscape_listen.setClickable(z);
            this.iv_listen.setClickable(z);
            this.iv_landscape_record.setClickable(z);
            this.iv_record.setClickable(z);
            this.iv_land_snapshot.setClickable(z);
            this.iv_snapshot.setClickable(z);
            this.iv_landscape_talk.setClickable(z);
            this.iv_duijiang.setClickable(z);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        HiLogcatUtil.v(new String[0]);
        EventBus.getDefault().unregister(this);
        this.mTimer.cancel();
        this.mTimer = null;
        this.mTask = null;
        if (this.mHandler_lockScreen != null) {
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
        OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
        if (orientationWatchDog != null) {
            orientationWatchDog.stopWatch();
        }
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.clearMonitor(this.mSplice1Monitor);
            this.mMyCamera.clearMonitor(this.mSplice2Monitor);
        }
        if (HiTools.dialogUtilsAgreements != null) {
            HiTools.dialogUtilsAgreements.build().dismiss();
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void receiveHumanParams(byte[] bArr) {
        if (this.preHumanTime == 0) {
            this.mTimer.schedule(this.mTask, 0L, 1000L);
        }
        this.preHumanTime = System.currentTimeMillis();
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        if (spliceViewGLMonitor == null || spliceViewGLMonitor.getState() == 1) {
            return;
        }
        ConstantCommand.HI_P2P_SMART_HSR_AREA hi_p2p_smart_hsr_area = new ConstantCommand.HI_P2P_SMART_HSR_AREA(bArr);
        if (hi_p2p_smart_hsr_area.u32Num == 0) {
            return;
        }
        Message message = new Message();
        message.what = 10010;
        message.obj = bArr;
        message.arg1 = hi_p2p_smart_hsr_area.u32Num;
        this.humanRectHandler.sendMessage(message);
    }

    public void zoomIn() {
        HiLogcatUtil.i("zoomIn: ###################");
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 9, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
    }

    public void zoomOut() {
        HiLogcatUtil.i("zoomOut: ###################");
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 10, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
    }

    private void stopZoom() {
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
    }

    private void handSensiArea() {
        int i = HiDataValue.mSpliceminwidth;
        int i2 = HiDataValue.mSpliceminheight;
        this.spliceimageview.mMinFloatHeight = (int) ((r2.getHeight() * 1.0d) / 5.0d);
        this.spliceimageview.mMinFloatWidth = (int) ((r2.getWidth() * 1.0d) / 5.0d);
        this.spliceimageview.setDrawable(i, i2, 0, 0);
    }

    public void HiSetMon() {
        int i;
        int i2;
        HiLogcatUtil.e("initViewAndData" + HiTools.Hi_checkDeviceHasNavigationBar(this) + Constants.COLON_SEPARATOR + HiTools.HicheckDeviceHasNavigationBar(this) + "::" + HiTools.checkDeviceHasNavigationBar(this) + "::" + HiTools.getNavigationBarHeight(this));
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
        DisplayMetrics displayMetrics2 = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics2);
        HiLogcatUtil.e("initViewAndData" + displayMetrics.widthPixels + Constants.COLON_SEPARATOR + displayMetrics.heightPixels + Constants.COLON_SEPARATOR + displayMetrics2.widthPixels + Constants.COLON_SEPARATOR + displayMetrics2.heightPixels);
        if (HiTools.HicheckDeviceHasNavigationBar(this) && !HiTools.Hi_checkDeviceHasNavigationBar(this)) {
            i = displayMetrics.widthPixels;
            int i3 = displayMetrics.heightPixels;
            if (LiuHaiScreenTools.hasNotch(this) && this.mLiuHaiHeight == 0) {
                this.mLiuHaiHeight = LiuHaiScreenTools.getNotchHeight(this);
            }
            i2 = i3 - this.mLiuHaiHeight;
        } else {
            int i4 = displayMetrics2.widthPixels;
            int i5 = displayMetrics2.heightPixels;
            if (HiTools.HicheckDeviceHasNavigationBar(this)) {
                HiTools.Hi_checkDeviceHasNavigationBar(this);
            }
            i = i4;
            i2 = i5;
        }
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
        int dip2px = ((i2 - HiTools.dip2px(this, 45.0f)) - this.ll_bottonh) - this.mMonitorHeight;
        if (LiuHaiScreenTools.hasNotch(this)) {
            dip2px -= LiuHaiScreenTools.getNotchHeight(this);
        }
        int i6 = dip2px / 2;
        layoutParams.topMargin = i6;
        HiLogcatUtil.e("initViewAndData" + this.ll_bottonh + Constants.COLON_SEPARATOR + this.ll_bottom.getTop() + Constants.COLON_SEPARATOR + this.mMonitorHeight + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + HiTools.dip2px(this, 45.0f) + Constants.COLON_SEPARATOR + layoutParams.topMargin);
        this.mSplice1Monitor.setLayoutParams(layoutParams);
        this.iv_placeholder.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams2.topMargin = (this.mMonitorHeight + i6) - HiTools.dip2px(this, 31.0f);
        layoutParams2.addRule(11);
        layoutParams2.rightMargin = HiTools.dip2px(this, 3.0f);
        this.iv_full_screen.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
        layoutParams3.topMargin = i6 + ((this.mMonitorHeight - ((int) ((((double) this.mSplice1Monitor.screen_width) * 9.0d) / 32.0d))) / 2);
        layoutParams3.height = (int) ((((double) this.mSplice1Monitor.screen_width) * 9.0d) / 32.0d);
        this.humanRectView.setLayoutParams(layoutParams3);
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, this.mMonitorHeight);
        layoutParams4.topMargin = HiTools.dip2px(this, 45.0f);
        this.rl_guide_monitor.setLayoutParams(layoutParams4);
        RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-1, HiTools.dip2px(this, 36.0f));
        layoutParams5.setMargins(10, this.mMonitorHeight - HiTools.dip2px(this, 10.0f), 10, 3);
        layoutParams5.topMargin = (i2 - HiTools.dip2px(this, 45.0f)) - this.ll_bottonh;
        this.rl_wrap.setLayoutParams(layoutParams5);
        RelativeLayout.LayoutParams layoutParams6 = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams6.setMargins(HiTools.getScreenW(this) / 5, this.mMonitorHeight - ((int) ((((HiTools.getScreenW(this) * 3.0d) / 5.0d) * 9.0d) / 32.0d)), HiTools.getScreenW(this) / 5, 8);
        layoutParams6.topMargin = ((i2 - HiTools.dip2px(this, 50.0f)) - ((int) ((((HiTools.getScreenW(this) * 3.0d) / 5.0d) * 9.0d) / 32.0d))) - this.ll_bottonh;
        this.rl_2ms.setLayoutParams(layoutParams6);
        RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(this.mSplice2Monitor.getLayoutParams());
        RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(this.spliceimageview.getLayoutParams());
        int screenW = (int) ((HiTools.getScreenW(this) * 3.0d) / 5.0d);
        layoutParams7.width = screenW;
        layoutParams8.width = screenW;
        int screenW2 = (int) ((((HiTools.getScreenW(this) * 3.0d) / 5.0d) * 9.0d) / 32.0d);
        layoutParams7.height = screenW2;
        layoutParams8.height = screenW2;
        this.mSplice2Monitor.setLayoutParams(layoutParams7);
        this.spliceimageview.setLayoutParams(layoutParams8);
        HiLogcatUtil.e("initViewAndData" + layoutParams6.leftMargin + Constants.COLON_SEPARATOR + layoutParams6.topMargin + Constants.COLON_SEPARATOR + layoutParams6.rightMargin + Constants.COLON_SEPARATOR + layoutParams6.bottomMargin + Constants.COLON_SEPARATOR + layoutParams6.width + Constants.COLON_SEPARATOR + layoutParams6.height);
        this.mSplice1Monitor.screen_height = i2;
        this.mSplice1Monitor.screen_width = i;
        initMatrix(this.mSplice1Monitor.screen_width, this.mMonitorHeight);
        this.mSplice1Monitor.setState(0);
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.screen_height + Constants.COLON_SEPARATOR + this.mSplice1Monitor.screen_width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.screen_height + Constants.COLON_SEPARATOR + this.mSplice1Monitor.screen_width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor = this.mSplice1Monitor;
        spliceViewGLMonitor.height = spliceViewGLMonitor.screen_width / 2;
        SpliceViewGLMonitor spliceViewGLMonitor2 = this.mSplice1Monitor;
        spliceViewGLMonitor2.width = (spliceViewGLMonitor2.screen_width / this.mSplice1Monitor.height) * this.mSplice1Monitor.screen_width;
        this.mSplice1Monitor.left = 0;
        SpliceViewGLMonitor spliceViewGLMonitor3 = this.mSplice1Monitor;
        spliceViewGLMonitor3.bottom = (this.mMonitorHeight - spliceViewGLMonitor3.height) / 2;
        if (this.mSplice1Monitor.width > this.mSplice1Monitor.screen_width) {
            if (this.mSplice1Monitor.getState() == 0) {
                this.humanRectView.cleanRect(true);
            }
            this.mSplice1Monitor.setState(1);
        } else {
            if (this.mSplice1Monitor.getState() == 1) {
                this.humanRectView.cleanRect(false);
            }
            this.mSplice1Monitor.setState(0);
        }
        HiLogcatUtil.e("initViewAndData" + this.mSplice1Monitor.left + Constants.COLON_SEPARATOR + this.mSplice1Monitor.bottom + Constants.COLON_SEPARATOR + this.mSplice1Monitor.width + Constants.COLON_SEPARATOR + this.mSplice1Monitor.height + Constants.COLON_SEPARATOR + this.mMonitorHeight);
        SpliceViewGLMonitor spliceViewGLMonitor4 = this.mSplice1Monitor;
        spliceViewGLMonitor4.setMatrix(spliceViewGLMonitor4.left, this.mSplice1Monitor.bottom, this.mSplice1Monitor.width, this.mSplice1Monitor.height);
    }

    public void releaseLockScreen() {
        OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
        if (orientationWatchDog != null) {
            orientationWatchDog.setLockScreen(false);
        }
        this.root_lock_screen.setVisibility(8);
        this.mHandler_lockScreen.removeCallbacksAndMessages(null);
    }

    @Override
    public void changedScreenDirection(int i) {
        if (this.isReadyPlay) {
            if (i == 90) {
                this.isLeft = false;
                PopupWindow popupWindow = this.videoQualityPopupWindow;
                if (popupWindow != null && popupWindow.isShowing()) {
                    this.videoQualityPopupWindow.dismiss();
                }
                PopupWindow popupWindow2 = this.playbackPopupWindow;
                if (popupWindow2 != null && popupWindow2.isShowing()) {
                    this.playbackPopupWindow.dismiss();
                }
                if (!this.mIsClickReturn) {
                    setIsFullScreen(true);
                    setRequestedOrientation(8);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            SpliceLiveViewActivity.this.handLandScape();
                        }
                    }, 200L);
                    this.mHandler.sendEmptyMessageDelayed(4133, 500L);
                }
                if (!this.isFirstRevolveLand) {
                    this.isFirstRevolveLand = true;
                }
                if (this.mIsClickReturn) {
                    return;
                }
                if (this.root_lock_screen.getVisibility() == 0) {
                    this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                    this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
                    return;
                } else {
                    this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                    this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
                    return;
                }
            }
            if (i == 270) {
                this.isLeft = true;
                PopupWindow popupWindow3 = this.videoQualityPopupWindow;
                if (popupWindow3 != null && popupWindow3.isShowing()) {
                    this.videoQualityPopupWindow.dismiss();
                }
                PopupWindow popupWindow4 = this.playbackPopupWindow;
                if (popupWindow4 != null && popupWindow4.isShowing()) {
                    this.playbackPopupWindow.dismiss();
                }
                if (!this.mIsClickReturn) {
                    setIsFullScreen(true);
                    setRequestedOrientation(0);
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            SpliceLiveViewActivity.this.handLandScape();
                        }
                    }, 200L);
                    this.mHandler.sendEmptyMessageDelayed(4133, 500L);
                }
                if (!this.isFirstRevolveLand) {
                    this.isFirstRevolveLand = true;
                    return;
                }
                if (this.mIsClickReturn) {
                    return;
                }
                if (this.root_lock_screen.getVisibility() == 0) {
                    this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                    this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
                    return;
                } else {
                    this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                    this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
                    return;
                }
            }
            this.mIsClickReturn = false;
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    SpliceLiveViewActivity.this.handTalkingBack();
                    if (SpliceLiveViewActivity.this.videoQualityPopupWindow != null && SpliceLiveViewActivity.this.videoQualityPopupWindow.isShowing()) {
                        SpliceLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                    }
                    if (SpliceLiveViewActivity.this.playbackPopupWindow != null && SpliceLiveViewActivity.this.playbackPopupWindow.isShowing()) {
                        SpliceLiveViewActivity.this.playbackPopupWindow.dismiss();
                    }
                    if (SpliceLiveViewActivity.this.mPopupWindow != null && SpliceLiveViewActivity.this.mPopupWindow.isShowing()) {
                        SpliceLiveViewActivity.this.mPopupWindow.dismiss();
                    }
                    SpliceLiveViewActivity.this.root_lock_screen.setVisibility(8);
                    SpliceLiveViewActivity.this.mSplice2Monitor.setVisibility(0);
                }
            }, 20L);
            setRequestedOrientation(1);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
    }

    @Override
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        boolean z = true;
        HiLogcatUtil.e("" + i);
        int length = strArr.length;
        for (int i2 = 0; i2 < length; i2++) {
            HiLogcatUtil.e(strArr.length + Constants.COLON_SEPARATOR + strArr[i2]);
        }
        for (int i3 : iArr) {
            HiLogcatUtil.e(iArr.length + Constants.COLON_SEPARATOR + i3);
        }
        if (i == MY_PERMISSION_REQUEST_CODE) {
            int length2 = iArr.length;
            int i4 = 0;
            while (true) {
                if (i4 >= length2) {
                    break;
                }
                if (iArr[i4] != 0) {
                    z = false;
                    break;
                }
                i4++;
            }
            if (z) {
                return;
            }
            this.mIsOnpause = false;
            HiTools.Hi_GoToSetting(strArr, this, this);
        }
    }

    private void clickPlayback(ImageView imageView) {
        this.isNeedFinish = false;
        View inflate = getLayoutInflater().inflate(R.layout.popview_resolution_playback, (ViewGroup) null, false);
        this.playbackPopupWindow = new PopupWindow(inflate);
        this.playbackPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.playbackPopupWindow.setOutsideTouchable(true);
        this.playbackPopupWindow.setFocusable(false);
        this.playbackPopupWindow.setWidth(-2);
        this.playbackPopupWindow.setHeight(-2);
        int[] iArr = new int[2];
        imageView.getLocationOnScreen(iArr);
        int dip2px = HiTools.dip2px(this, 90.0f);
        this.playbackPopupWindow.showAtLocation(imageView, 0, iArr[0] - HiTools.dip2px(this, 15.0f), iArr[1] - dip2px);
        ImageView imageView2 = (ImageView) inflate.findViewById(R.id.playback_sd);
        ImageView imageView3 = (ImageView) inflate.findViewById(R.id.playback_cloud);
        imageView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SpliceLiveViewActivity spliceLiveViewActivity = SpliceLiveViewActivity.this;
                spliceLiveViewActivity.jumpSdPlaybackActivity(spliceLiveViewActivity.mMyCamera);
                SpliceLiveViewActivity.this.isNeedFinish = true;
            }
        });
        imageView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SpliceLiveViewActivity spliceLiveViewActivity = SpliceLiveViewActivity.this;
                spliceLiveViewActivity.checkCloudStatus(spliceLiveViewActivity.mMyCamera);
                SpliceLiveViewActivity.this.isNeedFinish = true;
            }
        });
    }
}