OSDualLiveViewActivity.java 源代码


package liteos.live;

import activity.EditCameraActivity;
import activity.ShareSettingActivity;
import activity.live.fragment.VpAdapter;
import activity.setting.WiFiSettingActivity;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v4.view.ViewPager;
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.Window;
import android.view.WindowManager;
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 bean.QueryHSR;
import com.alipay.sdk.util.i;
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.HiLitosSDK;
import com.hichip.tools.Packet;
import com.huawei.hms.common.internal.RequestManager;
import com.kuaishou.weapon.p0.g;
import com.kwad.sdk.core.response.model.AdVideoPreCacheConfig;
import com.xiaomi.mipush.sdk.Constants;
import common.Constant;
import common.ConstantCommand;
import common.HiDataValue;
import common.MyLiveViewGLMonitor;
import custom.BatteryView;
import custom.HumanRectView;
import custom.MyViewPager;
import custom.SwitchButton;
import custom.WIFIView;
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.Objects;
import java.util.Timer;
import java.util.TimerTask;
import liteos.live.OSDualLiveViewActivity;
import liteos.live.dualfragment.OSDualFirstTabFragment;
import liteos.live.dualfragment.OSDualSecondTabFragment;
import liteos.live.dualfragment.OSDualThirdTabFragment;
import liteos.ossetting.OSSettingActivity;
import main.CameraFragment;
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 org.json.JSONException;
import org.json.JSONObject;
import service.WakeUpDevService;
import utils.AnimationProUtils;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.LiuHaiScreenTools;
import utils.MyToast;
import utils.OrientationWatchDog;
import utils.SharePreUtils;
import utils.ToastUtil;
import utils.WifiUtils;

public class OSDualLiveViewActivity 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_DOWN_DELAY = 32010;
    private static final int MOVE_GUNLOCAL = 32109;
    private static final int MOVE_LEFT = 32107;
    private static final int MOVE_LEFT_DELAY = 32011;
    private static final int MOVE_RIGHT = 32108;
    private static final int MOVE_RIGHT_DELAY = 32012;
    private static final int MOVE_UP = 32105;
    private static final int MOVE_UP_DELAY = 32009;
    private static final int MY_PERMISSION_REQUEST_CODE = 10019;
    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_2IN = 32101;
    private static final int ZOOM_2OUT = 32102;
    private static final int ZOOM_IN = 32103;
    private static final int ZOOM_OUT = 32104;
    private static final String newAddress = "http://iot.juzi1688.cn/dist/#/info?iccid=";
    private static final String oldAddress = "http://m2m.zweitx.com/dist/#/info?iccid=";
    private static final String oldAddressID = "&userId=1476846140417773568";
    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;
    BatteryView batterview;
    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 OSDualFirstTabFragment firstTabFragment;
    private int focus1Num;
    private int focus2Num;
    private int focusGap;
    public ImageView gun_local;
    private HiLitosSDK hiLitosSDK;
    public HumanRectView humanRect2View;
    public HumanRectView humanRectView;
    private boolean isHideNavigation;
    ImageView iv_2placeholder;
    ImageView iv_2placeholder_rotate;
    public ImageView iv_2recording;
    ImageView iv_charge;
    ImageView iv_finger;
    ImageView iv_first_tab;
    ImageView iv_land_more;
    ImageView iv_land_snapshot;
    public ImageView iv_landscape_listen;
    public ImageView iv_landscape_record;
    public ImageView iv_landscape_talk;
    ImageView iv_move_down;
    ImageView iv_move_left;
    ImageView iv_move_pdown;
    ImageView iv_move_pleft;
    ImageView iv_move_pright;
    ImageView iv_move_pup;
    ImageView iv_move_right;
    ImageView iv_move_up;
    ImageView iv_placeholder;
    ImageView iv_placeholder_rotate;
    ImageView iv_playback;
    public ImageView iv_recording;
    ImageView iv_second_tab;
    ImageView iv_setting;
    ImageView iv_signal;
    ImageView iv_third_tab;
    public ImageView iv_tinglight;
    public ImageView iv_ydzz_land;
    public ImageView iv_zoom_in;
    public ImageView iv_zoom_out;
    float lastX;
    float lastY;
    private HiChipDefines.HI_P2P_WHITE_LIGHT_INFO light_info;
    private HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT light_info_ext;
    public LinearLayout ll_2recording;
    LinearLayout ll_4g_signal;
    LinearLayout ll_battery;
    LinearLayout ll_bottom;
    public LinearLayout ll_focus_layout;
    LinearLayout ll_guide;
    LinearLayout ll_key_one;
    LinearLayout ll_key_there;
    LinearLayout ll_key_two;
    LinearLayout ll_land_return;
    public LinearLayout ll_move_layout;
    private LinearLayout ll_pup_content;
    private LinearLayout ll_pup_main;
    public LinearLayout ll_recording;
    LinearLayout ll_signal;
    RelativeLayout lr_uid;
    private TimerTask m2Task;
    private Timer m2Timer;
    private int mCameraVideoQuality;
    public ConstantCommand.HI_P2P_Garden_Lamp_INFO mGarden_lamp_info;
    private boolean mGarden_set_cancel;
    private int mInputMethod;
    ImageView mIv2Loading;
    ImageView mIvLoading;
    public MyLiveViewGLMonitor mMonitor2live;
    public MyLiveViewGLMonitor mMonitorlive;
    protected MyCamera mMyCamera;
    public OrientationWatchDog mOrientationWatchDog;
    private PopupWindow mPopupWindow;
    private int mQuality;
    private TimerTask mTask;
    private Timer mTimer;
    private VpAdapter mVpAdapter;
    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 boolean not_hint;
    public ImageView p1iv_zoom_in;
    public ImageView p1iv_zoom_out;
    public LinearLayout p1ll_focus_layout;
    public ImageView p2iv_zoom_in;
    public ImageView p2iv_zoom_out;
    public LinearLayout p2ll_focus_layout;
    public LinearLayout pl_move_layout;
    private PopupWindow playbackPopupWindow;
    private long pre2HumanTime;
    private long preHumanTime;
    ProgressBar progress2bar;
    ProgressBar progressbar;
    private boolean reGetSignal;
    public String record2File;
    public String recordFile;
    RelativeLayout rl_2monitor;
    ImageView rl_close2monitor;
    RelativeLayout rl_guide_monitor;
    public RelativeLayout rl_landscape_buttom;
    public RelativeLayout rl_landscape_one;
    public RelativeLayout rl_landscape_view;
    RelativeLayout rl_preset_key;
    public LinearLayout root_lock_screen;
    private SeekBar sb_brightness;
    private SeekBar sb_contrast;
    private SeekBar sb_saturation;
    private OSDualSecondTabFragment secondTabFragment;
    private SeekBar seekbar_input;
    private SeekBar seekbar_output;
    private short speed;
    private OSDualThirdTabFragment thirdTabFragment;
    public Timer timer;
    public TimerTask timerTask;
    TextView title_middle;
    RelativeLayout titleview;
    private long touchTimeDown;
    private long touchTimeUp;
    protected HiChipDefines.HI_P2P_SMART_MOTO trackParam;
    public TextView tv_2record_time;
    TextView tv_brand;
    private TextView tv_brightness;
    private TextView tv_contrast;
    TextView tv_focus_mun;
    TextView tv_key_preset;
    TextView tv_know;
    ImageView tv_landscape_video_dualal;
    TextView tv_landscape_video_quality;
    ImageView tv_landscape_video_switch;
    TextView tv_percent;
    TextView tv_percentage;
    TextView tv_percentage2;
    public TextView tv_record_time;
    private TextView tv_saturation;
    TextView tv_signal;
    TextView tv_uid;
    TextView tv_video_quality;
    private int type;
    private PopupWindow videoQualityPopupWindow;
    public MyViewPager viewPager;
    WIFIView wifi_info;
    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;
    boolean isLongPress = false;
    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;
    private List<HumanRect> humanRects = new ArrayList();
    private List<HumanRect> human2Rects = new ArrayList();
    private boolean receiveHumanParams = false;
    public boolean supportZoom = true;
    private double largeMul = 2.0d;
    private int focusNumMax = 200;
    public boolean mselectsecondTab = false;
    double nLenStart = 0.0d;
    private boolean isMove = false;
    private boolean isOntouchGunBall = false;
    public boolean isGunEnlarge = false;
    private float down_x_gunball = 0.0f;
    private float down_y_gunball = 0.0f;
    private boolean misfull = true;
    public boolean mb_gunball = false;
    private boolean isLeft = true;
    private boolean isFirstRevolveLand = false;
    private boolean isReadyPlay = false;
    private boolean isZoomGun = false;
    private int mPercentage = 0;
    public boolean isShowPermissionDialog = false;
    private ViewTreeObserver.OnPreDrawListener lr_uidPre = new ViewTreeObserver.OnPreDrawListener() {
        @Override
        public boolean onPreDraw() {
            int measuredHeight = OSDualLiveViewActivity.this.lr_uid.getMeasuredHeight();
            int measuredWidth = OSDualLiveViewActivity.this.lr_uid.getMeasuredWidth();
            if (measuredWidth <= 0 && measuredHeight <= 0) {
                return true;
            }
            OSDualLiveViewActivity.this.lr_uid.getViewTreeObserver().removeOnPreDrawListener(OSDualLiveViewActivity.this.lr_uidPre);
            DisplayMetrics displayMetrics = new DisplayMetrics();
            OSDualLiveViewActivity.this.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
            int dip2px = (displayMetrics.heightPixels - ((OSDualLiveViewActivity.this.mMonitorHeight * 2) + HiTools.dip2px(OSDualLiveViewActivity.this, 110.0f))) - measuredHeight;
            int dip2px2 = (dip2px - HiTools.dip2px(OSDualLiveViewActivity.this, 20.0f)) / 2;
            int dip2px3 = (displayMetrics.widthPixels - HiTools.dip2px(OSDualLiveViewActivity.this, 80.0f)) / 4;
            HiLog.e("mMonitor2live" + dip2px + "::" + dip2px2 + "::" + dip2px3 + "::" + dip2px3 + "::" + displayMetrics.heightPixels + "::" + measuredWidth + "::" + measuredHeight);
            if (OSDualLiveViewActivity.this.secondTabFragment == null) {
                return true;
            }
            OSDualSecondTabFragment oSDualSecondTabFragment = OSDualLiveViewActivity.this.secondTabFragment;
            if (dip2px2 >= dip2px3) {
                dip2px2 = dip2px3;
            }
            oSDualSecondTabFragment.SetAdapterImgSize(dip2px2);
            return true;
        }
    };
    private Handler mAnimHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i != 1180) {
                if (i != 2128) {
                    return;
                }
                OSDualLiveViewActivity.this.handAnim();
                return;
            }
            OSDualLiveViewActivity.access$1008(OSDualLiveViewActivity.this);
            if (OSDualLiveViewActivity.this.mPercentage >= 100) {
                OSDualLiveViewActivity.this.mAnimHandler.removeMessages(1180);
                return;
            }
            OSDualLiveViewActivity.this.tv_percentage.setText(OSDualLiveViewActivity.this.mPercentage + " %");
            OSDualLiveViewActivity.this.tv_percentage2.setText(OSDualLiveViewActivity.this.mPercentage + " %");
            OSDualLiveViewActivity.this.mAnimHandler.sendEmptyMessageDelayed(1180, 1000L);
        }
    };
    public int isLarge = 0;
    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 (OSDualLiveViewActivity.this.mMonitorlive.getmIsFullScreen() == 1 || OSDualLiveViewActivity.this.mMonitor2live.getmIsFullScreen() == 1) {
                OSDualLiveViewActivity.this.ll_recording.setVisibility(0);
                OSDualLiveViewActivity.this.ll_2recording.setVisibility(4);
            } else {
                OSDualLiveViewActivity.this.ll_recording.setVisibility(0);
                OSDualLiveViewActivity.this.ll_2recording.setVisibility(0);
                HiLogcatUtil.e("ll_2recording.setVisibility(View.VISIBLE)");
            }
            OSDualLiveViewActivity.this.mStartRecordTime += 1000;
            OSDualLiveViewActivity.this.tv_record_time.setText(OSDualLiveViewActivity.this.sdf.format(new Date(OSDualLiveViewActivity.this.mStartRecordTime)));
            OSDualLiveViewActivity.this.tv_2record_time.setText(OSDualLiveViewActivity.this.sdf.format(new Date(OSDualLiveViewActivity.this.mStartRecordTime)));
            OSDualLiveViewActivity.this.mRecHandler.sendEmptyMessageDelayed(110, 1000L);
        }
    };
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == -2147483647) {
                OSDualLiveViewActivity.this.handMsgPlayState(message);
                return;
            }
            if (i == -1879048191) {
                OSDualLiveViewActivity.this.handMsgSessionState(message);
                return;
            }
            if (i == -1879048189) {
                OSDualLiveViewActivity.this.handMsgReceiveIoctrl(message);
                return;
            }
            if (i == 288) {
                OSDualLiveViewActivity oSDualLiveViewActivity = OSDualLiveViewActivity.this;
                MyToast.showToast(oSDualLiveViewActivity, oSDualLiveViewActivity.getString(R.string.failed_recording));
            } else {
                if (i != 2457) {
                    return;
                }
                OSDualLiveViewActivity.this.endRecording();
                OSDualLiveViewActivity oSDualLiveViewActivity2 = OSDualLiveViewActivity.this;
                MyToast.showToast(oSDualLiveViewActivity2, oSDualLiveViewActivity2.getString(R.string.failed_recording));
            }
        }
    };
    private boolean isJumpActivity = false;
    private int mNumGetStart = 0;
    private boolean mIsClickReturn = false;
    public int mFlagPreset = 0;
    private Handler humanRectHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i;
            int i2 = message.what;
            if (i2 == 10010) {
                byte[] bArr = (byte[]) message.obj;
                int i3 = message.arg1;
                HiLogcatUtil.e("==tedu-number", i3 + "");
                i = i3 <= 3 ? i3 : 3;
                OSDualLiveViewActivity.this.human2Rects.clear();
                for (int i4 = 0; i4 < i; i4++) {
                    byte[] bArr2 = new byte[20];
                    int i5 = (i4 * 20) + 8;
                    if (bArr.length - i5 >= 20) {
                        System.arraycopy(bArr, i5, 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, OSDualLiveViewActivity.this.monitor_width, OSDualLiveViewActivity.this.monitor_height);
                        if (humanRect.getRect_height() != 0 && humanRect.getRect_width() != 0) {
                            OSDualLiveViewActivity.this.human2Rects.add(humanRect);
                        }
                    }
                }
                OSDualLiveViewActivity.this.humanRect2View.refreshRect(OSDualLiveViewActivity.this.human2Rects, OSDualLiveViewActivity.this.mMyCamera.getVideoQuality());
                return;
            }
            if (i2 != 10011) {
                return;
            }
            byte[] bArr3 = (byte[]) message.obj;
            int i6 = message.arg1;
            HiLogcatUtil.e("==tedu-number", i6 + "");
            i = i6 <= 3 ? i6 : 3;
            OSDualLiveViewActivity.this.humanRects.clear();
            for (int i7 = 0; i7 < i; i7++) {
                byte[] bArr4 = new byte[20];
                int i8 = (i7 * 20) + 8;
                if (bArr3.length - i8 >= 20) {
                    System.arraycopy(bArr3, i8, bArr4, 0, 20);
                    ConstantCommand.HI_P2P_ALARM_MD hi_p2p_alarm_md2 = new ConstantCommand.HI_P2P_ALARM_MD(bArr4);
                    HumanRect humanRect2 = new HumanRect(hi_p2p_alarm_md2.u32X, hi_p2p_alarm_md2.u32Y, hi_p2p_alarm_md2.u32Width, hi_p2p_alarm_md2.u32Height, OSDualLiveViewActivity.this.monitor_width, OSDualLiveViewActivity.this.monitor_height);
                    if (humanRect2.getRect_height() != 0 && humanRect2.getRect_width() != 0) {
                        OSDualLiveViewActivity.this.humanRects.add(humanRect2);
                    }
                }
            }
            OSDualLiveViewActivity.this.humanRectView.refreshRect(OSDualLiveViewActivity.this.humanRects, OSDualLiveViewActivity.this.mMyCamera.getVideoQuality());
        }
    };
    public Handler mFocusHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i;
            int i2;
            switch (message.what) {
                case OSDualLiveViewActivity.ZOOM_2IN:
                    HiLogcatUtil.i(" ZOOM_IN handleMessage:  focus2Num " + OSDualLiveViewActivity.this.focus2Num);
                    if (OSDualLiveViewActivity.this.focus2Num < OSDualLiveViewActivity.this.focusNumMax) {
                        OSDualLiveViewActivity.this.humanRect2View.cleanRect(false);
                        if (OSDualLiveViewActivity.this.type != 0) {
                            if (OSDualLiveViewActivity.this.type != -1) {
                                if (OSDualLiveViewActivity.this.type == 1) {
                                    if (OSDualLiveViewActivity.this.focus2Num >= 50) {
                                        if (50 >= OSDualLiveViewActivity.this.focus2Num || OSDualLiveViewActivity.this.focus2Num >= 100) {
                                            if (100 < OSDualLiveViewActivity.this.focus2Num) {
                                                i = 150;
                                                if (OSDualLiveViewActivity.this.focus2Num < 150) {
                                                    OSDualLiveViewActivity.this.resetMonitor2Size(true, r1.focusGap);
                                                    OSDualLiveViewActivity.access$4312(OSDualLiveViewActivity.this, 1);
                                                    if (OSDualLiveViewActivity.this.focus2Num < 150) {
                                                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2IN, 10L);
                                                        return;
                                                    }
                                                    return;
                                                }
                                            } else {
                                                i = 150;
                                            }
                                            if (i < OSDualLiveViewActivity.this.focus2Num) {
                                                OSDualLiveViewActivity.this.resetMonitor2Size(true, r1.focusGap);
                                                OSDualLiveViewActivity.access$4312(OSDualLiveViewActivity.this, 1);
                                                if (OSDualLiveViewActivity.this.focus2Num < OSDualLiveViewActivity.this.focusNumMax) {
                                                    OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2IN, 10L);
                                                    return;
                                                }
                                                return;
                                            }
                                            return;
                                        }
                                        OSDualLiveViewActivity.this.resetMonitor2Size(true, r1.focusGap);
                                        OSDualLiveViewActivity.access$4312(OSDualLiveViewActivity.this, 1);
                                        if (OSDualLiveViewActivity.this.focus2Num < 100) {
                                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2IN, 10L);
                                            return;
                                        }
                                        return;
                                    }
                                    OSDualLiveViewActivity.this.resetMonitor2Size(true, r1.focusGap);
                                    OSDualLiveViewActivity.access$4312(OSDualLiveViewActivity.this, 1);
                                    if (OSDualLiveViewActivity.this.focus2Num < 50) {
                                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2IN, 10L);
                                        return;
                                    }
                                    return;
                                }
                                return;
                            }
                            HiLogcatUtil.i("type == -1-->focusNum: " + OSDualLiveViewActivity.this.focus2Num);
                            return;
                        }
                        OSDualLiveViewActivity.this.resetMonitor2Size(true, r1.focusGap);
                        OSDualLiveViewActivity.access$4312(OSDualLiveViewActivity.this, 1);
                        if (OSDualLiveViewActivity.this.focus2Num < OSDualLiveViewActivity.this.focusNumMax) {
                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2IN, 10L);
                            if (OSDualLiveViewActivity.this.focus2Num != OSDualLiveViewActivity.this.focusNumMax - 50 || OSDualLiveViewActivity.this.mMyCamera.getZoomType() == 2) {
                                return;
                            }
                            OSDualLiveViewActivity.this.zoomIn();
                            return;
                        }
                        return;
                    }
                    return;
                case OSDualLiveViewActivity.ZOOM_2OUT:
                    HiLogcatUtil.e("4K", " ZOOM_OUT  handleMessage:  focus1Num " + OSDualLiveViewActivity.this.focus2Num + "\nfocusNumMax=" + OSDualLiveViewActivity.this.focusNumMax + "\ntype=" + OSDualLiveViewActivity.this.type);
                    if (OSDualLiveViewActivity.this.focus2Num <= 0 || OSDualLiveViewActivity.this.focus1Num > OSDualLiveViewActivity.this.focusNumMax) {
                        return;
                    }
                    if (OSDualLiveViewActivity.this.type != 0) {
                        if (OSDualLiveViewActivity.this.type != -1) {
                            if (OSDualLiveViewActivity.this.type == 1) {
                                if (OSDualLiveViewActivity.this.focus2Num >= 50) {
                                    if (50 >= OSDualLiveViewActivity.this.focus2Num || OSDualLiveViewActivity.this.focus2Num >= 100) {
                                        if (100 >= OSDualLiveViewActivity.this.focus2Num || OSDualLiveViewActivity.this.focus2Num >= 150) {
                                            if (150 >= OSDualLiveViewActivity.this.focus2Num || OSDualLiveViewActivity.this.focus2Num >= 200) {
                                                return;
                                            }
                                            OSDualLiveViewActivity.this.resetMonitor2Size(false, r1.focusGap);
                                            OSDualLiveViewActivity.access$4320(OSDualLiveViewActivity.this, 1);
                                            if (OSDualLiveViewActivity.this.focus2Num > 150) {
                                                OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2OUT, 10L);
                                                return;
                                            }
                                            return;
                                        }
                                        OSDualLiveViewActivity.this.resetMonitor2Size(false, r1.focusGap);
                                        OSDualLiveViewActivity.access$4320(OSDualLiveViewActivity.this, 1);
                                        if (OSDualLiveViewActivity.this.focus2Num > 100) {
                                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2OUT, 10L);
                                            return;
                                        }
                                        return;
                                    }
                                    OSDualLiveViewActivity.this.resetMonitor2Size(false, r1.focusGap);
                                    OSDualLiveViewActivity.access$4320(OSDualLiveViewActivity.this, 1);
                                    if (OSDualLiveViewActivity.this.focus2Num > 50) {
                                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2OUT, 10L);
                                        return;
                                    }
                                    return;
                                }
                                OSDualLiveViewActivity.this.resetMonitor2Size(false, r1.focusGap);
                                OSDualLiveViewActivity.access$4320(OSDualLiveViewActivity.this, 1);
                                if (OSDualLiveViewActivity.this.focus2Num > 0) {
                                    OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2OUT, 10L);
                                    return;
                                }
                                return;
                            }
                            return;
                        }
                        HiLogcatUtil.i("zoomOut type == -1-->focusNum: " + OSDualLiveViewActivity.this.focus2Num);
                        return;
                    }
                    OSDualLiveViewActivity.this.resetMonitor2Size(false, r1.focusGap);
                    OSDualLiveViewActivity.access$4320(OSDualLiveViewActivity.this, 1);
                    if (OSDualLiveViewActivity.this.focus2Num > 0) {
                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_2OUT, 10L);
                        if (OSDualLiveViewActivity.this.focus2Num != 50 || OSDualLiveViewActivity.this.mMyCamera.getZoomType() == 2) {
                            return;
                        }
                        OSDualLiveViewActivity.this.zoomOut();
                        return;
                    }
                    return;
                case OSDualLiveViewActivity.ZOOM_IN:
                    HiLogcatUtil.i(" ZOOM_IN handleMessage:  focus1Num " + OSDualLiveViewActivity.this.focus1Num);
                    if (OSDualLiveViewActivity.this.focus1Num < OSDualLiveViewActivity.this.focusNumMax) {
                        OSDualLiveViewActivity.this.isGunEnlarge = true;
                        OSDualLiveViewActivity.this.gun_local.setVisibility(8);
                        if (OSDualLiveViewActivity.this.type != 0) {
                            if (OSDualLiveViewActivity.this.type != -1) {
                                if (OSDualLiveViewActivity.this.type == 1) {
                                    if (OSDualLiveViewActivity.this.focus1Num >= 50) {
                                        if (50 >= OSDualLiveViewActivity.this.focus1Num || OSDualLiveViewActivity.this.focus1Num >= 100) {
                                            if (100 < OSDualLiveViewActivity.this.focus1Num) {
                                                i2 = 150;
                                                if (OSDualLiveViewActivity.this.focus1Num < 150) {
                                                    OSDualLiveViewActivity.this.resetMonitorSize(true, r1.focusGap);
                                                    OSDualLiveViewActivity.access$3612(OSDualLiveViewActivity.this, 1);
                                                    if (OSDualLiveViewActivity.this.focus1Num < 150) {
                                                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_IN, 10L);
                                                        return;
                                                    }
                                                    return;
                                                }
                                            } else {
                                                i2 = 150;
                                            }
                                            if (i2 < OSDualLiveViewActivity.this.focus1Num) {
                                                OSDualLiveViewActivity.this.resetMonitorSize(true, r1.focusGap);
                                                OSDualLiveViewActivity.access$3612(OSDualLiveViewActivity.this, 1);
                                                if (OSDualLiveViewActivity.this.focus1Num < OSDualLiveViewActivity.this.focusNumMax) {
                                                    OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_IN, 10L);
                                                    return;
                                                }
                                                return;
                                            }
                                            return;
                                        }
                                        OSDualLiveViewActivity.this.resetMonitorSize(true, r1.focusGap);
                                        OSDualLiveViewActivity.access$3612(OSDualLiveViewActivity.this, 1);
                                        if (OSDualLiveViewActivity.this.focus1Num < 100) {
                                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_IN, 10L);
                                            return;
                                        }
                                        return;
                                    }
                                    OSDualLiveViewActivity.this.resetMonitorSize(true, r1.focusGap);
                                    OSDualLiveViewActivity.access$3612(OSDualLiveViewActivity.this, 1);
                                    if (OSDualLiveViewActivity.this.focus1Num < 50) {
                                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_IN, 10L);
                                        return;
                                    }
                                    return;
                                }
                                return;
                            }
                            HiLogcatUtil.i("type == -1-->focusNum: " + OSDualLiveViewActivity.this.focus1Num);
                            return;
                        }
                        OSDualLiveViewActivity.this.resetMonitorSize(true, r1.focusGap);
                        OSDualLiveViewActivity.access$3612(OSDualLiveViewActivity.this, 1);
                        if (OSDualLiveViewActivity.this.focus1Num < OSDualLiveViewActivity.this.focusNumMax) {
                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_IN, 10L);
                            if (OSDualLiveViewActivity.this.focus1Num != OSDualLiveViewActivity.this.focusNumMax - 50 || OSDualLiveViewActivity.this.mMyCamera.getZoomType() == 2) {
                                return;
                            }
                            OSDualLiveViewActivity.this.zoomIn();
                            return;
                        }
                        return;
                    }
                    return;
                case OSDualLiveViewActivity.ZOOM_OUT:
                    HiLogcatUtil.e("4K", " ZOOM_OUT  handleMessage:  focus1Num " + OSDualLiveViewActivity.this.focus1Num + "\nfocusNumMax=" + OSDualLiveViewActivity.this.focusNumMax + "\ntype=" + OSDualLiveViewActivity.this.type);
                    if (OSDualLiveViewActivity.this.focus1Num <= 0 || OSDualLiveViewActivity.this.focus1Num > OSDualLiveViewActivity.this.focusNumMax) {
                        return;
                    }
                    if (OSDualLiveViewActivity.this.type != 0) {
                        if (OSDualLiveViewActivity.this.type != -1) {
                            if (OSDualLiveViewActivity.this.type == 1) {
                                if (OSDualLiveViewActivity.this.focus1Num >= 50) {
                                    if (50 >= OSDualLiveViewActivity.this.focus1Num || OSDualLiveViewActivity.this.focus1Num >= 100) {
                                        if (100 >= OSDualLiveViewActivity.this.focus1Num || OSDualLiveViewActivity.this.focus1Num >= 150) {
                                            if (150 < OSDualLiveViewActivity.this.focus1Num && OSDualLiveViewActivity.this.focus1Num < 200) {
                                                OSDualLiveViewActivity.this.resetMonitorSize(false, r1.focusGap);
                                                OSDualLiveViewActivity.access$3620(OSDualLiveViewActivity.this, 1);
                                                if (OSDualLiveViewActivity.this.focus1Num > 150) {
                                                    OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_OUT, 10L);
                                                }
                                            }
                                        } else {
                                            OSDualLiveViewActivity.this.resetMonitorSize(false, r1.focusGap);
                                            OSDualLiveViewActivity.access$3620(OSDualLiveViewActivity.this, 1);
                                            if (OSDualLiveViewActivity.this.focus1Num > 100) {
                                                OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_OUT, 10L);
                                            }
                                        }
                                    } else {
                                        OSDualLiveViewActivity.this.resetMonitorSize(false, r1.focusGap);
                                        OSDualLiveViewActivity.access$3620(OSDualLiveViewActivity.this, 1);
                                        if (OSDualLiveViewActivity.this.focus1Num > 50) {
                                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_OUT, 10L);
                                        }
                                    }
                                } else {
                                    OSDualLiveViewActivity.this.resetMonitorSize(false, r1.focusGap);
                                    OSDualLiveViewActivity.access$3620(OSDualLiveViewActivity.this, 1);
                                    if (OSDualLiveViewActivity.this.focus1Num > 0) {
                                        OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_OUT, 10L);
                                    }
                                }
                            }
                        } else {
                            HiLogcatUtil.i("zoomOut type == -1-->focusNum: " + OSDualLiveViewActivity.this.focus1Num);
                        }
                    } else {
                        OSDualLiveViewActivity.this.resetMonitorSize(false, r1.focusGap);
                        OSDualLiveViewActivity.access$3620(OSDualLiveViewActivity.this, 1);
                        if (OSDualLiveViewActivity.this.focus1Num > 0) {
                            OSDualLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.ZOOM_OUT, 10L);
                            if (OSDualLiveViewActivity.this.focus1Num == 50 && OSDualLiveViewActivity.this.mMyCamera.getZoomType() != 2) {
                                OSDualLiveViewActivity.this.zoomOut();
                            }
                        }
                    }
                    if (OSDualLiveViewActivity.this.focus1Num == 1) {
                        OSDualLiveViewActivity.this.isGunEnlarge = false;
                        if (OSDualLiveViewActivity.this.mb_gunball && OSDualLiveViewActivity.this.getResources().getConfiguration().orientation == 1) {
                            OSDualLiveViewActivity.this.gun_local.setVisibility(0);
                            return;
                        }
                        return;
                    }
                    return;
                default:
                    return;
            }
        }
    };
    public Handler moveHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            HiLogcatUtil.d("moveHandler   ##################isLongPress:" + OSDualLiveViewActivity.this.isLongPress);
            int i = message.what;
            switch (i) {
                case OSDualLiveViewActivity.MOVE_UP_DELAY:
                    HiLogcatUtil.d("MOVE_UP ##################-------------isLongPress =" + OSDualLiveViewActivity.this.isLongPress);
                    if (OSDualLiveViewActivity.this.isLongPress) {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 0, OSDualLiveViewActivity.this.speed, (short) OSDualLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 1, OSDualLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                case OSDualLiveViewActivity.MOVE_DOWN_DELAY:
                    HiLogcatUtil.d("MOVE_DOWN ##################-------------isLongPress =" + OSDualLiveViewActivity.this.isLongPress);
                    if (OSDualLiveViewActivity.this.isLongPress) {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 0, OSDualLiveViewActivity.this.speed, (short) OSDualLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 1, OSDualLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                case OSDualLiveViewActivity.MOVE_LEFT_DELAY:
                    HiLogcatUtil.d("MOVE_LEFT ##################-------------isLongPress =" + OSDualLiveViewActivity.this.isLongPress);
                    if (OSDualLiveViewActivity.this.isLongPress) {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 0, OSDualLiveViewActivity.this.speed, (short) OSDualLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 1, OSDualLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                case OSDualLiveViewActivity.MOVE_RIGHT_DELAY:
                    HiLogcatUtil.d("MOVE_RIGHT ##################-----------isLongPress =" + OSDualLiveViewActivity.this.isLongPress);
                    if (OSDualLiveViewActivity.this.isLongPress) {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 0, OSDualLiveViewActivity.this.speed, (short) OSDualLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 1, OSDualLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                default:
                    switch (i) {
                        case OSDualLiveViewActivity.MOVE_UP:
                            OSDualLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.MOVE_UP_DELAY, 400L);
                            return;
                        case OSDualLiveViewActivity.MOVE_DOWN:
                            OSDualLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.MOVE_DOWN_DELAY, 400L);
                            return;
                        case OSDualLiveViewActivity.MOVE_LEFT:
                            OSDualLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.MOVE_LEFT_DELAY, 400L);
                            return;
                        case OSDualLiveViewActivity.MOVE_RIGHT:
                            OSDualLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSDualLiveViewActivity.MOVE_RIGHT_DELAY, 400L);
                            return;
                        default:
                            return;
                    }
            }
        }
    };
    private ViewTreeObserver.OnPreDrawListener ll_movePre = new ViewTreeObserver.OnPreDrawListener() {
        @Override
        public boolean onPreDraw() {
            int measuredHeight = OSDualLiveViewActivity.this.ll_move_layout.getMeasuredHeight();
            int measuredWidth = OSDualLiveViewActivity.this.ll_move_layout.getMeasuredWidth();
            if (measuredWidth <= 0 && measuredHeight <= 0) {
                return true;
            }
            OSDualLiveViewActivity.this.ll_move_layout.getViewTreeObserver().removeOnPreDrawListener(OSDualLiveViewActivity.this.ll_movePre);
            DisplayMetrics displayMetrics = new DisplayMetrics();
            OSDualLiveViewActivity.this.getWindowManager().getDefaultDisplay().getRealMetrics(displayMetrics);
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) OSDualLiveViewActivity.this.ll_move_layout.getLayoutParams();
            HiLog.e("mMonitor2live" + OSDualLiveViewActivity.this.mMonitor2live.left + "::" + OSDualLiveViewActivity.this.mMonitor2live.bottom + "::" + OSDualLiveViewActivity.this.mMonitor2live.width + "::" + OSDualLiveViewActivity.this.mMonitor2live.height + "::" + layoutParams.leftMargin + "::" + measuredWidth + "::" + measuredHeight);
            layoutParams.setMargins(layoutParams.leftMargin, (((displayMetrics.heightPixels * 2) / 3) - measuredHeight) - HiTools.dip2px(OSDualLiveViewActivity.this, 10.0f), layoutParams.width, layoutParams.height);
            layoutParams.rightMargin = HiTools.dip2px(OSDualLiveViewActivity.this, 10.0f);
            OSDualLiveViewActivity.this.ll_move_layout.setLayoutParams(layoutParams);
            StringBuilder sb = new StringBuilder();
            sb.append("mMonitor2live");
            sb.append(OSDualLiveViewActivity.this.ll_move_layout.getLeft());
            sb.append("::");
            sb.append(OSDualLiveViewActivity.this.ll_move_layout.getBottom());
            sb.append("::");
            sb.append(OSDualLiveViewActivity.this.ll_move_layout.getWidth());
            sb.append("::");
            sb.append(OSDualLiveViewActivity.this.ll_move_layout.getHeight());
            HiLog.e(sb.toString());
            return true;
        }
    };
    private Handler mHandler_lockScreen = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                OSDualLiveViewActivity.this.root_lock_screen.setVisibility(0);
                OSDualLiveViewActivity.this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
            } else {
                OSDualLiveViewActivity.this.root_lock_screen.setVisibility(8);
                OSDualLiveViewActivity.this.mHandler_lockScreen.removeCallbacksAndMessages(null);
            }
        }
    };
    private boolean isNeedFinish = false;
    private boolean isDoPause = true;

    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 onStartTrackingTouch(SeekBar seekBar) {
    }

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

    static int access$1008(OSDualLiveViewActivity oSDualLiveViewActivity) {
        int i = oSDualLiveViewActivity.mPercentage;
        oSDualLiveViewActivity.mPercentage = i + 1;
        return i;
    }

    static int access$3612(OSDualLiveViewActivity oSDualLiveViewActivity, int i) {
        int i2 = oSDualLiveViewActivity.focus1Num + i;
        oSDualLiveViewActivity.focus1Num = i2;
        return i2;
    }

    static int access$3620(OSDualLiveViewActivity oSDualLiveViewActivity, int i) {
        int i2 = oSDualLiveViewActivity.focus1Num - i;
        oSDualLiveViewActivity.focus1Num = i2;
        return i2;
    }

    static int access$4312(OSDualLiveViewActivity oSDualLiveViewActivity, int i) {
        int i2 = oSDualLiveViewActivity.focus2Num + i;
        oSDualLiveViewActivity.focus2Num = i2;
        return i2;
    }

    static int access$4320(OSDualLiveViewActivity oSDualLiveViewActivity, int i) {
        int i2 = oSDualLiveViewActivity.focus2Num - i;
        oSDualLiveViewActivity.focus2Num = i2;
        return i2;
    }

    @Override
    protected void init(Bundle bundle) {
        getWindow().addFlags(128);
        EventBus.getDefault().register(this);
        getIntentData();
        HiTools.mDualvalue = 0;
        HiDataValue.isOrientation = false;
        if (HiTools.cameraWhetherNull(this.mMyCamera, this)) {
            return;
        }
        initViewAndData();
        getDevRunMode();
        initViewPager();
        this.mMyCamera.registerPlayStateListener(this);
        this.mMyCamera.registerIOSessionListener(this);
        setListeners();
        getData();
        OrientationWatchDog orientationWatchDog = new OrientationWatchDog(this);
        this.mOrientationWatchDog = orientationWatchDog;
        orientationWatchDog.setOnOrientationListener(this);
        this.mOrientationWatchDog.startWatch();
    }

    private void getBatteryData() {
        if (this.mMyCamera.appGetCommandFunction(65540)) {
            this.mMyCamera.sendIOCtrl(65540, new byte[0]);
        }
        getSignalOperator();
    }

    private void startLiveShow() {
        if (this.mMyCamera != null) {
            new Thread() {
                @Override
                public void run() {
                    OSDualLiveViewActivity.this.mMyCamera.startLiveShowExt(OSDualLiveViewActivity.this.mMyCamera.getVideoQuality(), 0, OSDualLiveViewActivity.this.mMonitorlive, OSDualLiveViewActivity.this.mMonitor2live);
                }
            }.start();
        }
    }

    private void initViewPager() {
        OSDualFirstTabFragment oSDualFirstTabFragment = new OSDualFirstTabFragment();
        this.firstTabFragment = oSDualFirstTabFragment;
        oSDualFirstTabFragment.setmMyCamera(this.mMyCamera);
        OSDualSecondTabFragment oSDualSecondTabFragment = new OSDualSecondTabFragment();
        this.secondTabFragment = oSDualSecondTabFragment;
        oSDualSecondTabFragment.setCamera(this.mMyCamera);
        final ArrayList arrayList = new ArrayList();
        arrayList.add(this.firstTabFragment);
        arrayList.add(this.secondTabFragment);
        VpAdapter vpAdapter = new VpAdapter(getSupportFragmentManager(), arrayList);
        this.mVpAdapter = vpAdapter;
        this.viewPager.setAdapter(vpAdapter);
        this.viewPager.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                OSDualLiveViewActivity.this.viewPager.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                HiLogcatUtil.e("test", "onGlobalLayout: " + OSDualLiveViewActivity.this.viewPager.getHeight());
                OSDualLiveViewActivity.this.firstTabFragment.initHeight(OSDualLiveViewActivity.this.viewPager.getHeight());
                OSDualLiveViewActivity.this.secondTabFragment.initHeight(OSDualLiveViewActivity.this.viewPager.getHeight());
                OSDualLiveViewActivity.this.setViewWhetherClick(false);
            }
        });
        this.iv_first_tab.setSelected(true);
        this.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrollStateChanged(int i) {
            }

            @Override
            public void onPageScrolled(int i, float f, int i2) {
            }

            @Override
            public void onPageSelected(int i) {
                if (arrayList.size() != 3) {
                    if (arrayList.size() == 2) {
                        if (i == 0) {
                            OSDualLiveViewActivity.this.mselectsecondTab = false;
                            OSDualLiveViewActivity.this.iv_first_tab.setSelected(true);
                            OSDualLiveViewActivity.this.iv_second_tab.setSelected(false);
                            return;
                        } else {
                            if (i == 1) {
                                OSDualLiveViewActivity.this.iv_first_tab.setSelected(false);
                                OSDualLiveViewActivity.this.iv_second_tab.setSelected(true);
                                OSDualLiveViewActivity.this.mselectsecondTab = true;
                                return;
                            }
                            return;
                        }
                    }
                    return;
                }
                if (i == 0) {
                    OSDualLiveViewActivity.this.mselectsecondTab = false;
                    OSDualLiveViewActivity.this.iv_first_tab.setSelected(true);
                    OSDualLiveViewActivity.this.iv_second_tab.setSelected(false);
                    OSDualLiveViewActivity.this.iv_third_tab.setSelected(false);
                    return;
                }
                if (i == 1) {
                    OSDualLiveViewActivity.this.mselectsecondTab = false;
                    OSDualLiveViewActivity.this.iv_first_tab.setSelected(false);
                    OSDualLiveViewActivity.this.iv_second_tab.setSelected(false);
                    OSDualLiveViewActivity.this.iv_third_tab.setSelected(true);
                    return;
                }
                if (i == 2) {
                    OSDualLiveViewActivity.this.iv_first_tab.setSelected(false);
                    OSDualLiveViewActivity.this.iv_second_tab.setSelected(true);
                    OSDualLiveViewActivity.this.mselectsecondTab = true;
                    OSDualLiveViewActivity.this.iv_third_tab.setSelected(false);
                }
            }
        });
        this.viewPager.setCanScroll(false);
    }

    private void getDevRunMode() {
        String currentWifiSSID = WifiUtils.getCurrentWifiSSID(this, false);
        if ((HiTools.isWifiConnected(this) && !TextUtils.isEmpty(currentWifiSSID) && currentWifiSSID.startsWith(HiDataValue.START_WITH_IPCAM)) || HiDataValue.mHi_wifiConnect_Q.startsWith(HiDataValue.START_WITH_IPCAM)) {
            String[] split = currentWifiSSID.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
            String[] split2 = this.mMyCamera.getUid().split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
            if (split.length <= 1 || split2.length <= 1 || !split[1].equals(split2[1])) {
                return;
            }
            HiLitosSDK hiLitosSDK = new HiLitosSDK(new HiLitosSDK.ILitosResult() {
                @Override
                public final void onReceiveLitosResult(String str, int i, int i2, int i3) {
                    OSDualLiveViewActivity.this.lambda$getDevRunMode$0$OSDualLiveViewActivity(str, i, i2, i3);
                }
            });
            this.hiLitosSDK = hiLitosSDK;
            hiLitosSDK.HttpRequest("192.168.55.1", 15555, "/liteos/param.cgi?cmd=getdevinfo", 5, 6);
        }
    }

    public void lambda$getDevRunMode$0$OSDualLiveViewActivity(String str, int i, int i2, int i3) {
        if (!TextUtils.isEmpty(str) && str.split("\r\n").length > 3) {
            try {
                if (new JSONObject(str.split("\r\n")[r1.length - 1]).getJSONObject("devinfo").getString(Constant.MODE).equals("1")) {
                    return;
                }
                setDevRunMode();
                return;
            } catch (JSONException e) {
                e.printStackTrace();
                return;
            }
        }
        setDevRunMode();
    }

    private void setDevRunMode() {
        HiLitosSDK hiLitosSDK = new HiLitosSDK(new HiLitosSDK.ILitosResult() {
            @Override
            public final void onReceiveLitosResult(String str, int i, int i2, int i3) {
                OSDualLiveViewActivity.this.lambda$setDevRunMode$1$OSDualLiveViewActivity(str, i, i2, i3);
            }
        });
        this.hiLitosSDK = hiLitosSDK;
        hiLitosSDK.HttpRequest("192.168.55.1", 15555, "/liteos/param.cgi?cmd=setsysmode&-mode=1&", 5, 5);
    }

    public void lambda$setDevRunMode$1$OSDualLiveViewActivity(String str, int i, int i2, int i3) {
        if (!TextUtils.isEmpty(str) && str.split("\r\n").length > 3) {
            this.mMyCamera.setIsAPRunMode(true);
        } else {
            MyToast.showToast(this, getString(R.string.netword_abnormal));
        }
    }

    public class AnonymousClass4 extends TimerTask {
        AnonymousClass4() {
        }

        @Override
        public void run() {
            OSDualLiveViewActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    OSDualLiveViewActivity.AnonymousClass4.this.lambda$run$0$OSDualLiveViewActivity$4();
                }
            });
        }

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

    private void getData() {
        this.mTimer = new Timer();
        this.mTask = new AnonymousClass4();
        this.m2Timer = new Timer();
        this.m2Task = new AnonymousClass5();
        getSignalOperator();
        getSensor();
    }

    public class AnonymousClass5 extends TimerTask {
        AnonymousClass5() {
        }

        @Override
        public void run() {
            OSDualLiveViewActivity.this.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    OSDualLiveViewActivity.AnonymousClass5.this.lambda$run$0$OSDualLiveViewActivity$5();
                }
            });
        }

        public void lambda$run$0$OSDualLiveViewActivity$5() {
            if (System.currentTimeMillis() - OSDualLiveViewActivity.this.pre2HumanTime > 1000) {
                OSDualLiveViewActivity.this.humanRect2View.cleanRect(false);
            }
        }
    }

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

    public void getSignalOperator() {
        String language = Locale.getDefault().getLanguage();
        String country = Locale.getDefault().getCountry();
        if (language.equals("zh") && country.equals("CN")) {
            if (this.mMyCamera.getIs_4G() && this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_LITE)) {
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_LITE, new byte[0]);
                return;
            }
            return;
        }
        if (this.mMyCamera.getIs_4G() && this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_EXT_LITE)) {
            this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_EXT_LITE, 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.mMonitorlive.setOnTouchListener(this);
        this.mMonitor2live.setOnTouchListener(this);
        this.rl_landscape_view.setOnClickListener(this);
        this.tv_video_quality.setOnClickListener(this);
        this.tv_landscape_video_quality.setOnClickListener(this);
        this.iv_landscape_listen.setOnClickListener(this);
        this.iv_landscape_talk.setOnClickListener(this);
        this.tv_landscape_video_dualal.setOnClickListener(this);
        this.tv_landscape_video_switch.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_ydzz_land.setOnClickListener(this);
        this.iv_playback.setOnClickListener(this);
        this.iv_playback.setClickable(false);
        this.focusGap = this.mMonitorlive.screen_width / 100;
        this.iv_zoom_in.setOnTouchListener(this);
        this.iv_zoom_out.setOnTouchListener(this);
        this.p1iv_zoom_in.setOnTouchListener(this);
        this.p1iv_zoom_out.setOnTouchListener(this);
        this.p2iv_zoom_in.setOnTouchListener(this);
        this.p2iv_zoom_out.setOnTouchListener(this);
        this.iv_move_up.setOnTouchListener(this);
        this.iv_move_down.setOnTouchListener(this);
        this.iv_move_left.setOnTouchListener(this);
        this.iv_move_right.setOnTouchListener(this);
        this.iv_move_pup.setOnTouchListener(this);
        this.iv_move_pdown.setOnTouchListener(this);
        this.iv_move_pleft.setOnTouchListener(this);
        this.iv_move_pright.setOnTouchListener(this);
        this.gun_local.setOnTouchListener(this);
        this.rl_close2monitor.setOnClickListener(this);
        this.root_lock_screen.setOnClickListener(this);
    }

    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 = (int) ((HiTools.getScreenW(this) * 2.2d) / 4.0d);
        HiLogcatUtil.e("initViewAndData" + HiTools.Hi_checkDeviceHasNavigationBar(this) + Constants.COLON_SEPARATOR + HiTools.HicheckDeviceHasNavigationBar(this) + "::" + HiTools.checkDeviceHasNavigationBar(this) + "::" + HiTools.getNavigationBarHeight(this) + i.b + HiTools.getScreenH(this));
        if (HiTools.getScreenH(this) < 1920) {
            this.mMonitorHeight = (int) ((HiTools.getScreenW(this) * 1.8d) / 4.0d);
        }
        this.mMonitorlive.setCamera(this.mMyCamera);
        this.mMonitor2live.setCamera(this.mMyCamera);
        showPlaceLoadingView();
        if (this.mMyCamera.snapshot2 != null) {
            DBlur.source(this, this.mMyCamera.snapshot2).mode(1).radius(2).animAlpha().build().doBlur(new OnBlurListener() {
                @Override
                public void onBlurFailed() {
                }

                @Override
                public void onBlurSuccess(Bitmap bitmap) {
                    OSDualLiveViewActivity.this.iv_2placeholder.setImageBitmap(bitmap);
                }
            });
        } else {
            this.iv_2placeholder.setImageResource(R.mipmap.videoclip);
        }
        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) {
                    OSDualLiveViewActivity.this.iv_placeholder.setImageBitmap(bitmap);
                }
            });
        } else {
            this.iv_placeholder.setImageResource(R.mipmap.videoclip);
        }
        this.title_middle.setText(this.mMyCamera.getNikeName());
        this.mMyCamera.setLiveShowMonitorExt(this.mMonitorlive, this.mMonitor2live);
        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) {
            this.mMyCamera.isFirstEnterLive = false;
        }
        this.ll_guide.setVisibility(this.mMyCamera.isFirstEnterLive ? 0 : 8);
        if (this.mMyCamera.isFirstEnterLive) {
            handAnim();
        }
        this.tv_uid.setText(this.mMyCamera.getUid());
        this.mIsHaveVirtual = HiTools.checkDeviceHasNavigationBar(this);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
        this.mMonitorlive.setLayoutParams(layoutParams);
        this.iv_placeholder.setLayoutParams(layoutParams);
        this.humanRectView.setLayoutParams(layoutParams);
        HiLog.e("" + layoutParams.leftMargin + Constants.COLON_SEPARATOR + layoutParams.topMargin + Constants.COLON_SEPARATOR + layoutParams.rightMargin + Constants.COLON_SEPARATOR + layoutParams.bottomMargin + Constants.COLON_SEPARATOR + layoutParams.width + Constants.COLON_SEPARATOR + layoutParams.height);
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.gun_local.getLayoutParams();
        layoutParams2.setMargins((HiTools.getScreenW(this) / 2) - HiTools.dip2px(this, 25.0f), (this.mMonitorHeight / 2) - HiTools.dip2px(this, 25.0f), 0, 0);
        this.gun_local.setLayoutParams(layoutParams2);
        HiLog.e("" + layoutParams2.leftMargin + Constants.COLON_SEPARATOR + layoutParams2.topMargin + Constants.COLON_SEPARATOR + layoutParams2.rightMargin + Constants.COLON_SEPARATOR + layoutParams2.bottomMargin + Constants.COLON_SEPARATOR + layoutParams2.width + Constants.COLON_SEPARATOR + layoutParams2.height);
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, this.mMonitorHeight);
        layoutParams3.setMargins(0, this.mMonitorHeight + HiTools.dip2px(this, 50.0f), 0, 0);
        this.rl_2monitor.setLayoutParams(layoutParams3);
        RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) this.pl_move_layout.getLayoutParams();
        layoutParams4.setMargins(0, ((this.mMonitorHeight / 2) - (HiTools.dip2px(this, 171.0f) / 2)) + HiTools.dip2px(this, 10.0f), HiTools.dip2px(this, 10.0f), 0);
        this.pl_move_layout.setLayoutParams(layoutParams4);
        RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) this.mMonitor2live.getLayoutParams();
        layoutParams5.setMargins(0, 0, 0, 0);
        this.mMonitor2live.setLayoutParams(layoutParams5);
        this.humanRect2View.setLayoutParams(layoutParams5);
        this.iv_2placeholder.setLayoutParams(layoutParams5);
        initMatrix(HiTools.getScreenW(this), this.mMonitorHeight);
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitorlive;
        myLiveViewGLMonitor.setMatrix(myLiveViewGLMonitor.left, this.mMonitorlive.bottom, this.mMonitorlive.width, this.mMonitorlive.height);
        init2Matrix(HiTools.getScreenW(this), this.mMonitorHeight);
        MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor2live;
        myLiveViewGLMonitor2.setMatrix(myLiveViewGLMonitor2.left, this.mMonitor2live.bottom, this.mMonitor2live.width, this.mMonitor2live.height);
        LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-1, this.mMonitorHeight);
        layoutParams6.topMargin = HiTools.dip2px(this, 45.0f);
        this.rl_guide_monitor.setLayoutParams(layoutParams6);
        this.rl_close2monitor.setVisibility(8);
        if (HiTools.getScreenH(this) * 9 > HiTools.getScreenW(this) * 16) {
            this.iv_tinglight.setVisibility(4);
        } else {
            this.iv_tinglight.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams7 = (RelativeLayout.LayoutParams) this.tv_uid.getLayoutParams();
            layoutParams7.setMargins(0, HiTools.dip2px(this, 3.0f), 0, HiTools.dip2px(this, 3.0f));
            this.tv_uid.setLayoutParams(layoutParams7);
        }
        RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(this.ll_battery.getLayoutParams());
        layoutParams8.setMargins(0, HiTools.dip2px(this, 20.0f), HiTools.dip2px(this, 10.0f), 0);
        layoutParams8.addRule(11);
        this.ll_battery.setLayoutParams(layoutParams8);
        this.lr_uid.getViewTreeObserver().addOnPreDrawListener(this.lr_uidPre);
        this.mMonitor2live.setZOrderMediaOverlay(true);
        HiLogcatUtil.i("  :  " + this.mMonitorlive.left + "  :  " + this.mMonitorlive.bottom + "  :  " + this.mMonitorlive.width + "  :  " + this.mMonitorlive.height);
        HiLogcatUtil.i("  :  " + this.mMonitor2live.left + "  :  " + this.mMonitor2live.bottom + "  :  " + this.mMonitor2live.width + "  :  " + this.mMonitor2live.height);
    }

    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 AnonymousClass9());
    }

    public class AnonymousClass9 extends AnimatorListenerAdapter {
        AnonymousClass9() {
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(OSDualLiveViewActivity.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(OSDualLiveViewActivity.this.iv_finger, "translationY", 0.0f, OSDualLiveViewActivity.this.dis_ver, 0.0f);
                ofFloat.setInterpolator(new AccelerateDecelerateInterpolator());
                ofFloat.setDuration(2000L);
                ofFloat.start();
                ofFloat.addListener(new C03021());
            }

            class C03021 extends AnimatorListenerAdapter {
                C03021() {
                }

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

                class C03031 extends AnimatorListenerAdapter {
                    C03031() {
                    }

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

                    class C03041 extends AnimatorListenerAdapter {
                        C03041() {
                        }

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

                        class C03051 extends AnimatorListenerAdapter {
                            C03051() {
                            }

                            @Override
                            public void onAnimationEnd(Animator animator) {
                                ObjectAnimator ofFloat = ObjectAnimator.ofFloat(OSDualLiveViewActivity.this.iv_finger, "translationY", 0.0f, -OSDualLiveViewActivity.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(OSDualLiveViewActivity.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) {
                                                OSDualLiveViewActivity.this.mAnimHandler.sendEmptyMessage(2128);
                                            }
                                        });
                                    }
                                });
                            }
                        }
                    }
                }
            }
        }
    }

    private void handPercentageView() {
        this.mAnimHandler.removeMessages(1180);
        this.tv_percentage.setText("100 %");
        this.tv_percentage2.setText("100 %");
        this.mAnimHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                OSDualLiveViewActivity.this.tv_percentage.setVisibility(8);
                OSDualLiveViewActivity.this.tv_percentage2.setVisibility(8);
            }
        }, 500L);
    }

    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
    public void onResume() {
        super.onResume();
        if (!this.isDoPause) {
            this.isDoPause = true;
        } else if (this.mMyCamera.getConnectState() != 4) {
            WakeUp();
        } else {
            startLiveShow();
        }
    }

    private void WakeUp() {
        Intent intent = new Intent(this, (Class<?>) WakeUpDevService.class);
        intent.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
        startService(intent);
        this.mAnimHandler.sendEmptyMessageDelayed(1180, 100L);
        this.tv_percentage.setVisibility(0);
        this.tv_percentage2.setVisibility(0);
    }

    @Override
    public void onPause() {
        super.onPause();
        if (this.mHandler_lockScreen != null) {
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
        if (this.isNeedFinish) {
            finish();
        }
    }

    @Override
    public void onDestroy() {
        MyCamera myCamera;
        super.onDestroy();
        EventBus.getDefault().unregister(this);
        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);
        }
        Handler handler5 = this.moveHandler;
        if (handler5 != null) {
            handler5.removeCallbacksAndMessages(null);
        }
        if (this.mRecordingState == 2 && (myCamera = this.mMyCamera) != null) {
            myCamera.stopRecording();
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitorlive;
        if (myLiveViewGLMonitor != null) {
            myLiveViewGLMonitor.FreeMonitor();
            this.mMonitorlive = null;
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor2live;
        if (myLiveViewGLMonitor2 != null) {
            myLiveViewGLMonitor2.FreeMonitor();
            this.mMonitor2live = 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 myCamera3 = this.mMyCamera;
        if (myCamera3 != null) {
            myCamera3.clearMonitor(this.mMonitorlive);
            this.mMyCamera.clearMonitor(this.mMonitor2live);
        }
        if (HiTools.dialogUtilsAgreements != null) {
            HiTools.dialogUtilsAgreements.build().dismiss();
        }
    }

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

    @Override
    public void onBackPressed() {
        if (this.mMonitorlive.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
            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() {
                        OSDualLiveViewActivity.this.lambda$onBackPressed$2$OSDualLiveViewActivity();
                    }
                }, 400L);
            } else {
                setRequestedOrientation(1);
            }
            this.mIsClickReturn = true;
            releaseLockScreen();
            handTalkingBack();
            return;
        }
        super.onBackPressed();
    }

    public void lambda$onBackPressed$2$OSDualLiveViewActivity() {
        setRequestedOrientation(1);
    }

    private void grabRecordSnapshot(String str, int i) {
        Bitmap snapshot_EXT;
        MyCamera myCamera;
        MyCamera myCamera2;
        HiLog.e("grabRecordSnapshot:" + str);
        Bitmap bitmap = null;
        if (str.contains("-01")) {
            if ((HiTools.mDualvalue == 0 || HiTools.mDualvalue == 1) && (myCamera2 = this.mMyCamera) != null) {
                snapshot_EXT = myCamera2.getSnapshot_EXT(1, 640, 352);
                bitmap = snapshot_EXT;
            }
        } else if (str.contains("-02")) {
            if ((HiTools.mDualvalue == 0 || HiTools.mDualvalue == 2) && (myCamera = this.mMyCamera) != null) {
                snapshot_EXT = myCamera.getSnap2shot_EXT(1, 640, 352);
                bitmap = snapshot_EXT;
            }
        } else {
            MyCamera myCamera3 = this.mMyCamera;
            if (myCamera3 != null) {
                snapshot_EXT = myCamera3.getSnapshot_EXT(1, 640, 352);
                bitmap = snapshot_EXT;
            }
        }
        if (bitmap != null) {
            HiLog.e("grabRecordSnapshot:" + str);
            saveRecordSnapshot(bitmap, 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) {
        HiLog.e("" + i + "::" + 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 callbackStateDual(HiCamera hiCamera, int i, int i2, int i3, int i4) {
        HiLogcatUtil.d(" callbackStateDual " + hiCamera.getUid() + ":" + HiTools.mDualvalue + Constants.COLON_SEPARATOR + i + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + i3 + Constants.COLON_SEPARATOR + i4);
        if (HiTools.mDualvalue == 0 || HiTools.mDualvalue == 1) {
            if (i == 2) {
                return;
            }
        } else if (HiTools.mDualvalue == 2 && i == 1) {
            return;
        }
        if (this.mMyCamera != hiCamera) {
            return;
        }
        if (i3 == 3840 && i4 == 2160) {
            this.devIs4K = true;
        } else {
            this.devIs4K = false;
        }
        initDev4kParams();
        Bundle bundle = new Bundle();
        bundle.putInt("Dualdev", i);
        bundle.putInt(a.k, i2);
        bundle.putInt(CSSStylePropertyConstants.WIDTH, i3);
        bundle.putInt(CSSStylePropertyConstants.HEIGHT, i4);
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = HiDataValue.HANDLE_MESSAGE_PLAY_STATE;
        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.mMonitorlive.getmIsFullScreen() == 1) {
            this.largeMul = 2.0d;
            this.focusNumMax = 200;
            while (this.focus1Num > 200) {
                this.mFocusHandler.removeCallbacksAndMessages(null);
                resetMonitorSize(false, this.focusGap);
                this.focus1Num--;
            }
        }
    }

    @Override
    public void callbackRecordState(HiCamera hiCamera, int i, int i2, int i3, String str) {
        HiLog.e("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);
    }

    @Override
    public void callbackRecordStateDual(HiCamera hiCamera, int i, int i2, int i3, int i4, String str) {
        HiLog.e("callbackRecordState-> " + i + "::" + i2 + "::" + i3 + "::" + i4 + "::" + str);
        if (this.mMyCamera != hiCamera) {
            return;
        }
        if (i3 == 3840 && i4 == 2160) {
            this.devIs4K = true;
        } else {
            this.devIs4K = false;
        }
        initDev4kParams();
        Bundle bundle = new Bundle();
        bundle.putInt("Dualdev", i);
        bundle.putInt(a.k, i2);
        bundle.putInt(CSSStylePropertyConstants.WIDTH, i3);
        bundle.putInt(CSSStylePropertyConstants.HEIGHT, i4);
        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.mMonitor2live.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(ConstantCommand.HI_P2P_PTZ_CONTROL, 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(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 1, this.speed, (short) ceil));
            }
            if (rawY > 0.0f && abs2 > 60.0f) {
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, 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(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 1, this.speed, (short) ceil2));
            }
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        HiLog.e(view.getId() + Constants.COLON_SEPARATOR + R.id.rl_landscape_view + Constants.COLON_SEPARATOR + R.id.live_monitor + Constants.COLON_SEPARATOR + R.id.live2_monitor + "::" + R.id.rl_full_screen + "::" + R.id.humanRectView + "::" + R.id.human2RectView + Constants.COLON_SEPARATOR + R.id.iv_move_up + Constants.COLON_SEPARATOR + R.id.iv_move_pup);
        if (this.mMonitorlive == null || this.mMonitor2live == null) {
            return false;
        }
        if ((view.getId() == R.id.live_monitor || view.getId() == R.id.live2_monitor) && ((this.mMonitor2live.getmIsFullScreen() == 1 || this.mMonitorlive.getmIsFullScreen() == 1) && this.rl_landscape_view.getVisibility() == 8)) {
            this.rl_landscape_view.setVisibility(0);
            this.ll_focus_layout.setVisibility(0);
            if (HiTools.mDualvalue == 0) {
                this.rl_close2monitor.setVisibility(0);
            }
            if (this.misfull) {
                this.ll_move_layout.setVisibility(0);
            }
        }
        if (this.mMonitorlive.getmIsFullScreen() == 0 && this.mMonitor2live.getmIsFullScreen() == 0) {
            if (view.getId() == R.id.live2_monitor) {
                if (motionEvent.getPointerCount() == 1) {
                    if (this.mMonitor2live.getmIsFullScreen() == 1 && this.mMonitor2live.getState() == 1 && this.ll_move_layout.getVisibility() == 0) {
                        return false;
                    }
                    if (motionEvent.getAction() == 1) {
                        if (this.pl_move_layout.getVisibility() == 0) {
                            this.pl_move_layout.setVisibility(8);
                            this.p1ll_focus_layout.setVisibility(8);
                            this.p2ll_focus_layout.setVisibility(8);
                        } else {
                            this.pl_move_layout.setVisibility(0);
                            this.p1ll_focus_layout.setVisibility(0);
                            this.p2ll_focus_layout.setVisibility(0);
                        }
                    }
                }
            } else if (view.getId() == R.id.live_monitor && motionEvent.getPointerCount() == 1) {
                this.down_X = motionEvent.getRawX();
                this.down_Y = motionEvent.getRawY();
                if (!this.isOntouchGunBall) {
                    if (Math.abs(this.down_x_gunball - this.down_X) < 1.0f && Math.abs(this.down_y_gunball - this.down_Y) < 1.0f) {
                        this.isOntouchGunBall = true;
                    } else {
                        this.isOntouchGunBall = false;
                    }
                }
                int action = motionEvent.getAction();
                if (action == 0) {
                    this.isMove = false;
                } else if (action != 1) {
                    if (action == 2 && 1 != this.mMonitorlive.getmIsFullScreen() && this.mb_gunball && this.isOntouchGunBall) {
                        this.isMove = true;
                        Hi_MoveGun(motionEvent.getX(), motionEvent.getY(), false);
                    }
                } else if (this.isMove) {
                    this.isOntouchGunBall = false;
                    this.isMove = false;
                    Hi_MoveGun(motionEvent.getX(), motionEvent.getY(), true);
                }
            }
        }
        if (view.getId() == R.id.rl_guide_monitor) {
            handGuideMonitor(motionEvent);
            return true;
        }
        if (view.getId() == R.id.iv_zoom_in || view.getId() == R.id.p1iv_zoom_in || view.getId() == R.id.p2iv_zoom_in) {
            HiLogcatUtil.e("test", "onTouch: " + motionEvent.getAction());
            if (motionEvent.getAction() == 0) {
                OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
                if (orientationWatchDog != null) {
                    orientationWatchDog.setCloseOrientation(true);
                }
                if (view.getId() == R.id.iv_zoom_in) {
                    this.iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus_press);
                } else if (view.getId() == R.id.p1iv_zoom_in) {
                    this.isZoomGun = true;
                    this.p1iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus_press);
                } else if (view.getId() == R.id.p2iv_zoom_in) {
                    this.isZoomGun = false;
                    this.p2iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                this.touchTimeDown = System.currentTimeMillis();
                HiLogcatUtil.e("");
                if (this.mMyCamera.getZoomType() == 2) {
                    if (this.isZoomGun) {
                        if (view.getId() == R.id.iv_zoom_in || view.getId() == R.id.p1iv_zoom_in) {
                            HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                            if (this.mFocusHandler.hasMessages(ZOOM_IN)) {
                                stopZoom(1);
                            }
                            if (!this.mFocusHandler.hasMessages(ZOOM_OUT) && !this.mFocusHandler.hasMessages(ZOOM_IN)) {
                                HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                                this.type = 0;
                                this.mFocusHandler.sendEmptyMessage(ZOOM_IN);
                            }
                        } else {
                            if (this.mFocusHandler.hasMessages(ZOOM_2IN)) {
                                stopZoom(1);
                            }
                            if (!this.mFocusHandler.hasMessages(ZOOM_2OUT) && !this.mFocusHandler.hasMessages(ZOOM_2IN)) {
                                this.type = 0;
                                this.mFocusHandler.sendEmptyMessage(ZOOM_2IN);
                            }
                        }
                    } else {
                        zoomIn();
                    }
                } else if (view.getId() == R.id.iv_zoom_in || view.getId() == R.id.p1iv_zoom_in) {
                    HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                    if (this.mFocusHandler.hasMessages(ZOOM_IN)) {
                        stopZoom(1);
                    }
                    if (this.focus1Num >= this.focusNumMax) {
                        zoomIn();
                    }
                    if (!this.mFocusHandler.hasMessages(ZOOM_OUT) && !this.mFocusHandler.hasMessages(ZOOM_IN)) {
                        HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                        this.type = 0;
                        this.mFocusHandler.sendEmptyMessage(ZOOM_IN);
                    }
                } else {
                    if (this.mFocusHandler.hasMessages(ZOOM_2IN)) {
                        stopZoom(1);
                    }
                    if (this.focus2Num >= this.focusNumMax) {
                        zoomIn();
                    }
                    if (!this.mFocusHandler.hasMessages(ZOOM_2OUT) && !this.mFocusHandler.hasMessages(ZOOM_2IN)) {
                        this.type = 0;
                        this.mFocusHandler.sendEmptyMessage(ZOOM_2IN);
                    }
                }
            } else if (motionEvent.getAction() == 1) {
                OrientationWatchDog orientationWatchDog2 = this.mOrientationWatchDog;
                if (orientationWatchDog2 != null) {
                    orientationWatchDog2.setCloseOrientation(false);
                }
                if (view.getId() == R.id.iv_zoom_in) {
                    this.iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus);
                } else if (view.getId() == R.id.p1iv_zoom_in) {
                    this.isZoomGun = true;
                    this.p1iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus);
                } else if (view.getId() == R.id.p2iv_zoom_in) {
                    this.isZoomGun = false;
                    this.p2iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus);
                }
                this.touchTimeUp = System.currentTimeMillis();
                if (this.mMyCamera.getZoomType() == 2) {
                    if (this.isZoomGun) {
                        if (this.touchTimeUp - this.touchTimeDown < 500) {
                            this.type = 1;
                        } else {
                            this.type = -1;
                        }
                        stopZoom(0);
                    } else {
                        stopZoom();
                    }
                } else {
                    if (this.touchTimeUp - this.touchTimeDown < 500) {
                        this.type = 1;
                    } else {
                        this.type = -1;
                    }
                    stopZoom(0);
                }
            }
            return true;
        }
        if (view.getId() == R.id.iv_zoom_out || view.getId() == R.id.p1iv_zoom_out || view.getId() == R.id.p2iv_zoom_out) {
            if (motionEvent.getAction() == 0) {
                OrientationWatchDog orientationWatchDog3 = this.mOrientationWatchDog;
                if (orientationWatchDog3 != null) {
                    orientationWatchDog3.setCloseOrientation(true);
                }
                if (view.getId() == R.id.iv_zoom_out) {
                    this.iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                if (view.getId() == R.id.p1iv_zoom_out) {
                    this.isZoomGun = true;
                    this.p1iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                if (view.getId() == R.id.p2iv_zoom_out) {
                    this.isZoomGun = false;
                    this.p2iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                this.touchTimeDown = System.currentTimeMillis();
                HiLogcatUtil.e("");
                if (this.mMyCamera.getZoomType() == 2) {
                    if (this.isZoomGun) {
                        if (view.getId() == R.id.iv_zoom_out || view.getId() == R.id.p1iv_zoom_out) {
                            HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                            if (this.mFocusHandler.hasMessages(ZOOM_OUT)) {
                                stopZoom(1);
                            }
                            if (!this.mFocusHandler.hasMessages(ZOOM_OUT) && !this.mFocusHandler.hasMessages(ZOOM_IN)) {
                                HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                                this.type = 0;
                                this.mFocusHandler.sendEmptyMessage(ZOOM_OUT);
                            }
                        } else {
                            if (this.mFocusHandler.hasMessages(ZOOM_2OUT)) {
                                stopZoom(1);
                            }
                            if (!this.mFocusHandler.hasMessages(ZOOM_2OUT) && !this.mFocusHandler.hasMessages(ZOOM_2IN)) {
                                this.type = 0;
                                this.mFocusHandler.sendEmptyMessage(ZOOM_2OUT);
                            }
                        }
                    } else {
                        zoomOut();
                    }
                } else if (view.getId() == R.id.iv_zoom_out || view.getId() == R.id.p1iv_zoom_out) {
                    HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                    if (this.mFocusHandler.hasMessages(ZOOM_OUT)) {
                        stopZoom(1);
                    }
                    if (this.focus1Num <= 0) {
                        zoomOut();
                    }
                    if (!this.mFocusHandler.hasMessages(ZOOM_OUT) && !this.mFocusHandler.hasMessages(ZOOM_IN)) {
                        HiLogcatUtil.e("" + this.focus1Num + Constants.COLON_SEPARATOR + this.focusNumMax);
                        this.type = 0;
                        this.mFocusHandler.sendEmptyMessage(ZOOM_OUT);
                    }
                } else {
                    if (this.mFocusHandler.hasMessages(ZOOM_2OUT)) {
                        stopZoom(1);
                    }
                    if (this.focus2Num <= 0) {
                        zoomOut();
                    }
                    if (!this.mFocusHandler.hasMessages(ZOOM_2OUT) && !this.mFocusHandler.hasMessages(ZOOM_2IN)) {
                        this.type = 0;
                        this.mFocusHandler.sendEmptyMessage(ZOOM_2OUT);
                    }
                }
            } else if (motionEvent.getAction() == 1) {
                OrientationWatchDog orientationWatchDog4 = this.mOrientationWatchDog;
                if (orientationWatchDog4 != null) {
                    orientationWatchDog4.setCloseOrientation(false);
                }
                if (view.getId() == R.id.iv_zoom_out) {
                    this.iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus);
                } else if (view.getId() == R.id.p1iv_zoom_out) {
                    this.p1iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus);
                    this.isZoomGun = true;
                } else if (view.getId() == R.id.p2iv_zoom_out) {
                    this.p2iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus);
                    this.isZoomGun = false;
                }
                this.touchTimeUp = System.currentTimeMillis();
                HiLogcatUtil.e("");
                if (this.mMyCamera.getZoomType() == 2) {
                    if (this.isZoomGun) {
                        if (this.touchTimeUp - this.touchTimeDown < 500) {
                            this.type = 1;
                        } else {
                            this.type = -1;
                        }
                        stopZoom(0);
                    } else {
                        stopZoom();
                    }
                } else {
                    if (this.touchTimeUp - this.touchTimeDown < 500) {
                        this.type = 1;
                    } else {
                        this.type = -1;
                    }
                    stopZoom(0);
                }
            }
            return true;
        }
        if (view.getId() == R.id.iv_move_up || view.getId() == R.id.iv_move_pup) {
            if (motionEvent.getAction() == 0) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_up.setBackgroundResource(R.drawable.shape_button_focus_press);
                    OrientationWatchDog orientationWatchDog5 = this.mOrientationWatchDog;
                    if (orientationWatchDog5 != null) {
                        orientationWatchDog5.setCloseOrientation(false);
                    }
                } else {
                    this.iv_move_pup.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                if (!this.moveHandler.hasMessages(MOVE_UP) && !this.moveHandler.hasMessages(MOVE_DOWN) && !this.moveHandler.hasMessages(MOVE_LEFT) && !this.moveHandler.hasMessages(MOVE_RIGHT)) {
                    HiLogcatUtil.d("onTouch MOVE_UP #########");
                    this.isLongPress = true;
                    this.moveHandler.sendEmptyMessage(MOVE_UP);
                    this.clickTime = System.currentTimeMillis();
                }
            } else if (motionEvent.getAction() == 1) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_up.setBackgroundResource(R.drawable.shape_button_focus);
                    OrientationWatchDog orientationWatchDog6 = this.mOrientationWatchDog;
                    if (orientationWatchDog6 != null) {
                        orientationWatchDog6.setCloseOrientation(false);
                    }
                } else {
                    this.iv_move_pup.setBackgroundResource(R.drawable.shape_button_focus);
                }
                this.moveHandler.removeCallbacksAndMessages(null);
                if (System.currentTimeMillis() - this.clickTime > 300) {
                    this.isLongPress = true;
                    this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, this.speed, (short) this.u32TurnTime));
                } else {
                    this.isLongPress = false;
                    this.moveHandler.sendEmptyMessage(MOVE_UP_DELAY);
                }
                this.clickTime = 0L;
            }
            return true;
        }
        if (view.getId() == R.id.iv_move_down || view.getId() == R.id.iv_move_pdown) {
            if (motionEvent.getAction() == 0) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_down.setBackgroundResource(R.drawable.shape_button_focus_press);
                    OrientationWatchDog orientationWatchDog7 = this.mOrientationWatchDog;
                    if (orientationWatchDog7 != null) {
                        orientationWatchDog7.setCloseOrientation(true);
                    }
                } else {
                    this.iv_move_pdown.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                if (!this.moveHandler.hasMessages(MOVE_UP) && !this.moveHandler.hasMessages(MOVE_DOWN) && !this.moveHandler.hasMessages(MOVE_LEFT) && !this.moveHandler.hasMessages(MOVE_RIGHT)) {
                    HiLogcatUtil.d("onTouch MOVE_DOWN #########");
                    this.isLongPress = true;
                    this.moveHandler.sendEmptyMessage(MOVE_DOWN);
                    this.clickTime = System.currentTimeMillis();
                }
            } else if (motionEvent.getAction() == 1) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_down.setBackgroundResource(R.drawable.shape_button_focus);
                    OrientationWatchDog orientationWatchDog8 = this.mOrientationWatchDog;
                    if (orientationWatchDog8 != null) {
                        orientationWatchDog8.setCloseOrientation(false);
                    }
                } else {
                    this.iv_move_pdown.setBackgroundResource(R.drawable.shape_button_focus);
                }
                this.moveHandler.removeCallbacksAndMessages(null);
                if (System.currentTimeMillis() - this.clickTime > 300) {
                    this.isLongPress = true;
                    this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, this.speed, (short) this.u32TurnTime));
                } else {
                    this.isLongPress = false;
                    this.moveHandler.sendEmptyMessage(MOVE_DOWN_DELAY);
                }
                this.clickTime = 0L;
            }
            return true;
        }
        if (view.getId() == R.id.iv_move_left || view.getId() == R.id.iv_move_pleft) {
            if (motionEvent.getAction() == 0) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_left.setBackgroundResource(R.drawable.shape_button_focus_press);
                    OrientationWatchDog orientationWatchDog9 = this.mOrientationWatchDog;
                    if (orientationWatchDog9 != null) {
                        orientationWatchDog9.setCloseOrientation(true);
                    }
                } else {
                    this.iv_move_pleft.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                if (!this.moveHandler.hasMessages(MOVE_UP) && !this.moveHandler.hasMessages(MOVE_DOWN) && !this.moveHandler.hasMessages(MOVE_LEFT) && !this.moveHandler.hasMessages(MOVE_RIGHT)) {
                    HiLogcatUtil.d("onTouch MOVE_LEFT #########");
                    this.isLongPress = true;
                    this.clickTime = System.currentTimeMillis();
                    this.moveHandler.sendEmptyMessage(MOVE_LEFT);
                }
            } else if (motionEvent.getAction() == 1) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_left.setBackgroundResource(R.drawable.shape_button_focus);
                    OrientationWatchDog orientationWatchDog10 = this.mOrientationWatchDog;
                    if (orientationWatchDog10 != null) {
                        orientationWatchDog10.setCloseOrientation(false);
                    }
                } else {
                    this.iv_move_pleft.setBackgroundResource(R.drawable.shape_button_focus);
                }
                this.moveHandler.removeCallbacksAndMessages(null);
                if (System.currentTimeMillis() - this.clickTime > 300) {
                    this.isLongPress = true;
                    this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, this.speed, (short) this.u32TurnTime));
                } else {
                    this.isLongPress = false;
                    this.moveHandler.sendEmptyMessage(MOVE_LEFT_DELAY);
                }
                this.clickTime = 0L;
            }
            return true;
        }
        if (view.getId() == R.id.iv_move_right || view.getId() == R.id.iv_move_pright) {
            if (motionEvent.getAction() == 0) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_right.setBackgroundResource(R.drawable.shape_button_focus_press);
                    OrientationWatchDog orientationWatchDog11 = this.mOrientationWatchDog;
                    if (orientationWatchDog11 != null) {
                        orientationWatchDog11.setCloseOrientation(true);
                    }
                } else {
                    this.iv_move_pright.setBackgroundResource(R.drawable.shape_button_focus_press);
                }
                if (!this.moveHandler.hasMessages(MOVE_UP) && !this.moveHandler.hasMessages(MOVE_DOWN) && !this.moveHandler.hasMessages(MOVE_LEFT) && !this.moveHandler.hasMessages(MOVE_RIGHT)) {
                    HiLogcatUtil.d("onTouch MOVE_RIGHT #########");
                    this.isLongPress = true;
                    this.moveHandler.sendEmptyMessage(MOVE_RIGHT);
                    this.clickTime = System.currentTimeMillis();
                }
            } else if (motionEvent.getAction() == 1) {
                if (getResources().getConfiguration().orientation == 2) {
                    this.iv_move_right.setBackgroundResource(R.drawable.shape_button_focus);
                    OrientationWatchDog orientationWatchDog12 = this.mOrientationWatchDog;
                    if (orientationWatchDog12 != null) {
                        orientationWatchDog12.setCloseOrientation(false);
                    }
                } else {
                    this.iv_move_pright.setBackgroundResource(R.drawable.shape_button_focus);
                }
                this.moveHandler.removeCallbacksAndMessages(null);
                if (System.currentTimeMillis() - this.clickTime > 300) {
                    this.isLongPress = true;
                    this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, this.speed, (short) this.u32TurnTime));
                } else {
                    this.isLongPress = false;
                    this.moveHandler.sendEmptyMessage(MOVE_RIGHT_DELAY);
                }
                this.clickTime = 0L;
            }
            return true;
        }
        if (view.getId() == R.id.gun_local && !this.isMove) {
            this.down_x_gunball = (int) motionEvent.getRawX();
            this.down_y_gunball = (int) motionEvent.getRawY();
        }
        return false;
    }

    private void Hi_MoveGun(float f, float f2, boolean z) {
        int i;
        if (this.focus1Num == 0 && 1 != this.mMonitorlive.getmIsFullScreen() && this.mb_gunball) {
            int screenW = ((int) (1920.0f * f)) / HiTools.getScreenW(this);
            int i2 = ((int) (1080.0f * f2)) / this.mMonitorHeight;
            if (z) {
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_UNITE_POSITION, ConstantCommand.HI_P2P_UNITE_POSITION.parseContent(screenW, i2));
            }
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.gun_local.getLayoutParams();
            int dip2px = (int) (f - HiTools.dip2px(this, 25.0f));
            int dip2px2 = (int) (f2 - HiTools.dip2px(this, 25.0f));
            if (f <= HiTools.dip2px(this, 25.0f)) {
                dip2px = -HiTools.dip2px(this, 10.0f);
            }
            if (f2 <= HiTools.dip2px(this, 25.0f)) {
                dip2px2 = -HiTools.dip2px(this, 10.0f);
            }
            int i3 = 0;
            if (f + HiTools.dip2px(this, 25.0f) >= HiTools.getScreenW(this)) {
                dip2px = HiTools.getScreenW(this) - HiTools.dip2px(this, 40.0f);
                i = -HiTools.dip2px(this, 10.0f);
            } else {
                i = 0;
            }
            float dip2px3 = f2 + HiTools.dip2px(this, 25.0f);
            int i4 = this.mMonitorHeight;
            if (dip2px3 >= i4) {
                dip2px2 = i4 - HiTools.dip2px(this, 40.0f);
                i3 = -HiTools.dip2px(this, 10.0f);
            }
            layoutParams.setMargins(dip2px, dip2px2, i, i3);
            HiLog.e("HI_P2P_SET_UNITE_POSITION:" + dip2px + Constants.COLON_SEPARATOR + dip2px2 + Constants.COLON_SEPARATOR + i + Constants.COLON_SEPARATOR + i3 + "::" + screenW + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + HiTools.getScreenW(this) + Constants.COLON_SEPARATOR + this.mMonitorHeight);
            this.gun_local.setLayoutParams(layoutParams);
        }
    }

    public void resetMonitorSize(boolean z, double d) {
        double d2;
        int i;
        this.isLarge = z ? 1 : 2;
        if (this.mMonitorlive.getmIsFullScreen() == 0 && this.mMonitor2live.getmIsFullScreen() == 0) {
            this.mMonitorlive.screen_height = this.mMonitorHeight;
            this.mMonitor2live.screen_height = this.mMonitorHeight;
        }
        if (this.mMonitorlive.height == 0 && this.mMonitorlive.width == 0) {
            initMatrix(this.mMonitorlive.screen_width, this.mMonitorlive.screen_height);
        }
        HiLogcatUtil.i("  :  " + this.mMonitorlive.left + "  :  " + this.mMonitorlive.bottom + "  :  " + this.mMonitorlive.width + "  :  " + this.mMonitorlive.height);
        int i2 = (int) (d / 2.0d);
        if (this.mMonitorlive.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
            d2 = d * this.mMonitorlive.screen_height;
            i = this.mMonitorlive.screen_width;
        } else {
            d2 = d * this.mMonitorHeight;
            i = this.mMonitorlive.screen_width;
        }
        int i3 = (int) ((d2 / i) / 2.0d);
        if (!z) {
            this.mMonitorlive.left += i2 / 2;
            this.mMonitorlive.bottom += i3 / 2;
            this.mMonitorlive.width -= i2;
            this.mMonitorlive.height -= i3;
            if (this.mMonitorlive.bottom + this.mMonitorlive.height < this.mMonitorlive.screen_height) {
                MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitorlive;
                myLiveViewGLMonitor.bottom = myLiveViewGLMonitor.screen_height - this.mMonitorlive.height;
            }
            if (this.mMonitorlive.left + this.mMonitorlive.width < this.mMonitorlive.screen_width) {
                MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitorlive;
                myLiveViewGLMonitor2.left = myLiveViewGLMonitor2.screen_width - this.mMonitorlive.width;
            }
        } else if (this.mMonitorlive.width <= this.largeMul * this.mMonitorlive.screen_width && this.mMonitorlive.height <= this.largeMul * this.mMonitorlive.screen_height) {
            this.mMonitorlive.left -= i2 / 2;
            this.mMonitorlive.bottom -= i3 / 2;
            this.mMonitorlive.width += i2;
            this.mMonitorlive.height += i3;
        }
        if (this.mMonitorlive.left > 0 || this.mMonitorlive.width < this.mMonitorlive.screen_width || this.mMonitorlive.height < this.mMonitorlive.screen_height || this.mMonitorlive.bottom > 0) {
            if (this.focus1Num >= 1) {
                if (this.mMonitorlive.left > 0) {
                    this.mMonitorlive.left = 0;
                }
                if (this.mMonitorlive.bottom > 0) {
                    this.mMonitorlive.bottom = 0;
                }
            } else if (this.mMonitorlive.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
                initMatrix(this.mMonitorlive.screen_width, this.mMonitorlive.screen_height);
            } else {
                initMatrix(HiTools.getScreenW(this), this.mMonitorHeight);
            }
        }
        HiLogcatUtil.i("  :  " + this.mMonitorlive.left + "  :  " + this.mMonitorlive.bottom + "  :  " + this.mMonitorlive.width + "  :  " + this.mMonitorlive.height + Constants.COLON_SEPARATOR + this.mMonitorlive.screen_width);
        if (this.mMonitorlive.width > this.mMonitorlive.screen_width) {
            if (this.mMonitorlive.getState() == 0) {
                this.humanRectView.cleanRect(true);
            }
            this.mMonitorlive.setState(1);
        } else {
            if (this.mMonitorlive.getState() == 1) {
                this.humanRectView.cleanRect(false);
            }
            this.mMonitorlive.setState(0);
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor3 = this.mMonitorlive;
        myLiveViewGLMonitor3.setMatrix(myLiveViewGLMonitor3.left, this.mMonitorlive.bottom, this.mMonitorlive.width, this.mMonitorlive.height);
    }

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

    public void resetMonitor2Size(boolean z, double d) {
        double d2;
        int i;
        if (this.mMonitorlive.getmIsFullScreen() == 0 && this.mMonitor2live.getmIsFullScreen() == 0) {
            this.mMonitorlive.screen_height = this.mMonitorHeight;
            this.mMonitor2live.screen_height = this.mMonitorHeight;
        }
        if (this.mMonitor2live.height == 0 && this.mMonitor2live.width == 0) {
            init2Matrix(this.mMonitor2live.screen_width, this.mMonitor2live.screen_height);
        }
        HiLogcatUtil.i("  :  " + this.mMonitor2live.left + "  :  " + this.mMonitor2live.bottom + "  :  " + this.mMonitor2live.width + "  :  " + this.mMonitor2live.height);
        int i2 = (int) (d / 2.0d);
        if (this.mMonitorlive.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
            d2 = d * this.mMonitor2live.screen_height;
            i = this.mMonitor2live.screen_width;
        } else {
            d2 = d * this.mMonitorHeight;
            i = this.mMonitor2live.screen_width;
        }
        int i3 = (int) ((d2 / i) / 2.0d);
        if (!z) {
            this.mMonitor2live.left += i2 / 2;
            this.mMonitor2live.bottom += i3 / 2;
            this.mMonitor2live.width -= i2;
            this.mMonitor2live.height -= i3;
            if (this.mMonitor2live.bottom + this.mMonitor2live.height < this.mMonitor2live.screen_height) {
                MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitor2live;
                myLiveViewGLMonitor.bottom = myLiveViewGLMonitor.screen_height - this.mMonitor2live.height;
            }
            if (this.mMonitor2live.left + this.mMonitor2live.width < this.mMonitor2live.screen_width) {
                MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor2live;
                myLiveViewGLMonitor2.left = myLiveViewGLMonitor2.screen_width - this.mMonitor2live.width;
            }
        } else if (this.mMonitor2live.width <= this.largeMul * this.mMonitor2live.screen_width && this.mMonitor2live.height <= this.largeMul * this.mMonitor2live.screen_height) {
            this.mMonitor2live.left -= i2 / 2;
            this.mMonitor2live.bottom -= i3 / 2;
            this.mMonitor2live.width += i2;
            this.mMonitor2live.height += i3;
        }
        HiLogcatUtil.i("  :  " + this.mMonitor2live.left + "  :  " + this.mMonitor2live.bottom + "  :  " + this.mMonitor2live.width + "  :  " + this.mMonitor2live.height);
        if (this.mMonitor2live.left > 0 || this.mMonitor2live.width < this.mMonitor2live.screen_width || this.mMonitor2live.height < this.mMonitor2live.screen_height || this.mMonitor2live.bottom > 0) {
            if (this.focus2Num >= 1) {
                if (this.mMonitor2live.left > 0) {
                    this.mMonitor2live.left = 0;
                }
                if (this.mMonitor2live.bottom > 0) {
                    this.mMonitor2live.bottom = 0;
                }
            } else if (this.mMonitorlive.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
                init2Matrix(this.mMonitor2live.screen_width, this.mMonitor2live.screen_height);
            } else {
                init2Matrix(HiTools.getScreenW(this), this.mMonitorHeight);
            }
        }
        if (this.mMonitor2live.width > this.mMonitor2live.screen_width) {
            if (this.mMonitor2live.getState() == 0) {
                this.humanRectView.cleanRect(true);
            }
            this.mMonitor2live.setState(1);
        } else {
            if (this.mMonitor2live.getState() == 1) {
                this.humanRectView.cleanRect(false);
            }
            this.mMonitor2live.setState(0);
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor3 = this.mMonitor2live;
        myLiveViewGLMonitor3.setMatrix(myLiveViewGLMonitor3.left, this.mMonitor2live.bottom, this.mMonitor2live.width, this.mMonitor2live.height);
    }

    private void init2Matrix(int i, int i2) {
        this.mMonitor2live.left = 0;
        this.mMonitor2live.bottom = 0;
        this.mMonitor2live.width = i;
        this.mMonitor2live.height = i2;
    }

    public void handMsgSessionState(Message message) {
        MyCamera myCamera;
        int i = message.arg1;
        if (i != 0) {
            if (i == 3) {
                MyToast.showToast(getApplicationContext(), getString(R.string.tips_old_password_is_wrong));
                Handler handler = this.mAnimHandler;
                if (handler != null) {
                    this.mPercentage = 0;
                    handler.removeCallbacksAndMessages(null);
                }
                this.isJumpActivity = true;
                Intent intent = new Intent(this, (Class<?>) EditCameraActivity.class);
                intent.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                intent.putExtra("isFromOsLive", true);
                startActivity(intent);
                return;
            }
            if (i != 4) {
                if (i == 5 && (myCamera = this.mMyCamera) != null) {
                    myCamera.stopLiveShow();
                    this.mMyCamera.disconnect(1);
                    return;
                }
                return;
            }
            EventBus.getDefault().post("reveice login");
            this.progressbar.setVisibility(8);
            this.progress2bar.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() {
                    OSDualLiveViewActivity.this.mMyCamera.startLiveShowExt(OSDualLiveViewActivity.this.mMyCamera.getVideoQuality(), 0, OSDualLiveViewActivity.this.mMonitorlive, OSDualLiveViewActivity.this.mMonitor2live);
                }
            }.start();
            this.mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (OSDualLiveViewActivity.this.mMyCamera.getCameraLevel() == 1) {
                        if (OSDualLiveViewActivity.this.mMyCamera.isBindCurrentAccount() == 2) {
                            OSDualLiveViewActivity oSDualLiveViewActivity = OSDualLiveViewActivity.this;
                            ToastUtil.showShort(oSDualLiveViewActivity, oSDualLiveViewActivity.getString(R.string.isbind_camera));
                            OSDualLiveViewActivity.this.finish();
                            return;
                        } else {
                            if ("admin".equals(OSDualLiveViewActivity.this.mMyCamera.getPassword())) {
                                OSDualLiveViewActivity oSDualLiveViewActivity2 = OSDualLiveViewActivity.this;
                                ToastUtil.showShort(oSDualLiveViewActivity2, oSDualLiveViewActivity2.getString(R.string.psw_hint));
                                OSDualLiveViewActivity.this.finish();
                                return;
                            }
                            return;
                        }
                    }
                    if (OSDualLiveViewActivity.this.mMyCamera.isBindCurrentAccount() == 2) {
                        OSDualLiveViewActivity oSDualLiveViewActivity3 = OSDualLiveViewActivity.this;
                        ToastUtil.showShort(oSDualLiveViewActivity3, oSDualLiveViewActivity3.getString(R.string.share_already_unbind));
                        OSDualLiveViewActivity.this.finish();
                    }
                }
            }, 1000L);
            return;
        }
        if (this.firstTabFragment.iv_listen.isSelected()) {
            this.firstTabFragment.iv_listen.setSelected(false);
        }
        if (this.firstTabFragment.iv_duijiang.isSelected()) {
            this.firstTabFragment.iv_duijiang.setSelected(false);
        }
        if (this.firstTabFragment.iv_record.isSelected()) {
            this.firstTabFragment.iv_record.setSelected(false);
        }
        ImageView imageView = this.iv_landscape_listen;
        if (imageView != null && imageView.isSelected()) {
            this.iv_landscape_listen.setSelected(false);
        }
        ImageView imageView2 = this.iv_landscape_record;
        if (imageView2 != null && imageView2.isSelected()) {
            this.iv_landscape_record.setSelected(false);
        }
        ImageView imageView3 = this.iv_land_snapshot;
        if (imageView3 != null && imageView3.isSelected()) {
            this.iv_land_snapshot.setSelected(false);
        }
        ImageView imageView4 = this.iv_landscape_talk;
        if (imageView4 != null && imageView4.isSelected()) {
            this.iv_landscape_talk.setSelected(false);
        }
        if (this.ll_recording.getVisibility() == 0) {
            this.ll_recording.setVisibility(8);
        }
        if (!this.mMyCamera.misshowgoRecharge && this.mMyCamera.mPreICCIDRecharge == 2) {
            showgoRechargeHint(this.mMyCamera);
            MyCamera myCamera2 = this.mMyCamera;
            if (myCamera2 != null) {
                myCamera2.stopLiveShow();
                if (this.isListening) {
                    this.isListening = false;
                    return;
                }
                return;
            }
            return;
        }
        if (this.iv_placeholder_rotate.getVisibility() == 0) {
            this.mHandler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    OSDualLiveViewActivity.this.lambda$handMsgSessionState$3$OSDualLiveViewActivity();
                }
            }, 10000L);
        } else {
            MyToast.showToast(getApplicationContext(), getString(R.string.netword_abnormal));
            finish();
        }
        showLoadingView();
        MyCamera myCamera3 = this.mMyCamera;
        if (myCamera3 != null) {
            myCamera3.stopLiveShow();
            if (this.isListening) {
                this.isListening = false;
            }
        }
    }

    public void lambda$handMsgSessionState$3$OSDualLiveViewActivity() {
        if (this.mMyCamera.getConnectState() == 4 || this.isJumpActivity) {
            return;
        }
        MyToast.showToast(getApplicationContext(), getString(R.string.netword_abnormal));
        finish();
    }

    private void showgoRechargeHint(final MyCamera myCamera) {
        if (myCamera.misshowgoRecharge) {
            return;
        }
        this.not_hint = false;
        final Dialog dialog = new Dialog(this, R.style.CustomDialog);
        dialog.setCancelable(false);
        View inflate = View.inflate(this, R.layout.dialog_recharge_hint, null);
        TextView textView = (TextView) inflate.findViewById(R.id.rechage_tit);
        final ImageView imageView = (ImageView) inflate.findViewById(R.id.iv);
        TextView textView2 = (TextView) inflate.findViewById(R.id.rechage_name);
        TextView textView3 = (TextView) inflate.findViewById(R.id.rechage_uid);
        if (myCamera.mPreICCIDRecharge == 2) {
            textView.setText(getString(R.string.recharge_hint_meg1));
        }
        textView2.setText(myCamera.getNikeName());
        textView3.setText(myCamera.getUid());
        inflate.findViewById(R.id.ll_not_hint_again).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$showgoRechargeHint$4$OSDualLiveViewActivity(imageView, myCamera, view);
            }
        });
        inflate.findViewById(R.id.tv_know).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$showgoRechargeHint$5$OSDualLiveViewActivity(myCamera, dialog, view);
            }
        });
        inflate.findViewById(R.id.tv_gorecharge).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$showgoRechargeHint$6$OSDualLiveViewActivity(myCamera, dialog, view);
            }
        });
        dialog.addContentView(inflate, new ActionBar.LayoutParams(-1, -2));
        Window window = dialog.getWindow();
        Objects.requireNonNull(window);
        WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.width = (int) (getResources().getDisplayMetrics().widthPixels * 0.85d);
        dialog.getWindow().setAttributes(attributes);
        dialog.show();
    }

    public void lambda$showgoRechargeHint$4$OSDualLiveViewActivity(ImageView imageView, MyCamera myCamera, View view) {
        if (this.not_hint) {
            this.not_hint = false;
            imageView.setImageResource(R.mipmap.checkboc_unselect);
            myCamera.setPreICCIDRecharge(1);
        } else {
            this.not_hint = true;
            imageView.setImageResource(R.mipmap.checkbox_select);
            myCamera.setPreICCIDRecharge(0);
        }
    }

    public void lambda$showgoRechargeHint$5$OSDualLiveViewActivity(MyCamera myCamera, Dialog dialog, View view) {
        myCamera.misshowgoRecharge = true;
        dialog.dismiss();
        finish();
    }

    public void lambda$showgoRechargeHint$6$OSDualLiveViewActivity(MyCamera myCamera, Dialog dialog, View view) {
        Uri parse;
        myCamera.misshowgoRecharge = true;
        dialog.dismiss();
        if (!TextUtils.isEmpty(myCamera.getICCID())) {
            if (myCamera.getPreICCIDType() == 1) {
                parse = Uri.parse(newAddress + myCamera.getICCID());
            } else if (myCamera.getPreICCIDType() == 2 || myCamera.getPreICCIDType() == 3) {
                parse = Uri.parse("https://www.wxkjwlw.com/wechat/cardDetail/" + myCamera.getICCID() + "?platformId=" + myCamera.getPreICCIDOperator() + "&gzhConfigId=77");
            } else {
                parse = Uri.parse(oldAddress + myCamera.getICCID() + oldAddressID);
            }
            startActivity(new Intent("android.intent.action.VIEW", parse));
        }
        finish();
    }

    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.mMonitorlive.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) {
                                if (OSDualLiveViewActivity.this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_UNITE_IPC_IMAGE)) {
                                    final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(OSDualLiveViewActivity.this);
                                    niftyDialogBuilder.withMessageLayoutHWrapW(HiTools.dip2px(OSDualLiveViewActivity.this, 280.0f));
                                    niftyDialogBuilder.withTitle(OSDualLiveViewActivity.this.getString(R.string.restore_param)).withMessage(OSDualLiveViewActivity.this.getString(R.string.hint_restore_param));
                                    niftyDialogBuilder.withButton1Text(OSDualLiveViewActivity.this.getString(R.string.cancel)).withButton2TextColor(OSDualLiveViewActivity.this.getResources().getColor(R.color.colorRed)).withButton2Text(OSDualLiveViewActivity.this.getString(R.string.confirm_restore));
                                    niftyDialogBuilder.setButton1Click(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View view2) {
                                            niftyDialogBuilder.dismiss();
                                        }
                                    });
                                    niftyDialogBuilder.setButton2Click(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View view2) {
                                            niftyDialogBuilder.dismiss();
                                            OSDualLiveViewActivity.this.showLoadingView();
                                            OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_DEF_DISPLAY_PARAM, new byte[0]);
                                        }
                                    });
                                    niftyDialogBuilder.show();
                                    return;
                                }
                                OSDualLiveViewActivity.this.showLoadingView();
                                OSDualLiveViewActivity.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_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.mMonitorlive.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.mMonitorlive.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.mMonitorlive.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case 16790:
                    this.audible_visual_alarm_type = new ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE(byteArray);
                    if (this.mMonitorlive.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_GET_SENSOR:
                    new ConstantCommand.HI_P2P_SENSOR_PARAM(byteArray);
                    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 ConstantCommand.HI_P2P_ALARM_HSR:
                    if (this.receiveHumanParams) {
                        EventBus.getDefault().post(byteArray);
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_ALARM_HSR_UNITI_GUN:
                    if (this.receiveHumanParams) {
                        EventBus.getDefault().post(new QueryHSR(byteArray, ConstantCommand.HI_P2P_ALARM_HSR_UNITI_GUN));
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_ALARM_HSR_UNITI_BALL:
                    if (this.receiveHumanParams) {
                        EventBus.getDefault().post(new QueryHSR(byteArray, ConstantCommand.HI_P2P_ALARM_HSR_UNITI_BALL));
                        return;
                    }
                    return;
                case 65540:
                    ConstantCommand.HI_P2P_S_DEV_STATUS_RESP hi_p2p_s_dev_status_resp = new ConstantCommand.HI_P2P_S_DEV_STATUS_RESP(byteArray);
                    if (hi_p2p_s_dev_status_resp.sChargState == 0) {
                        this.iv_charge.setVisibility(0);
                    } else {
                        this.iv_charge.setVisibility(8);
                    }
                    this.ll_battery.setVisibility(0);
                    this.tv_percent.setText(hi_p2p_s_dev_status_resp.u32BatteryLevel + "%");
                    this.batterview.setPower(hi_p2p_s_dev_status_resp.u32BatteryLevel == 0 ? 0.1f : hi_p2p_s_dev_status_resp.u32BatteryLevel / 100.0f);
                    if (hi_p2p_s_dev_status_resp.u32NetType == 1 && hi_p2p_s_dev_status_resp.sSignalIntensity != -1) {
                        int i2 = hi_p2p_s_dev_status_resp.sSignalIntensity;
                        if (i2 == -1) {
                            this.wifi_info.setWiFiSignal(0);
                        } else if (i2 == 0) {
                            this.wifi_info.setWiFiSignal(2);
                        } else if (i2 == 1) {
                            this.wifi_info.setWiFiSignal(1);
                        } else if (i2 == 2) {
                            this.wifi_info.setWiFiSignal(0);
                        }
                        this.wifi_info.setVisibility(0);
                        return;
                    }
                    this.wifi_info.setVisibility(8);
                    return;
                case ConstantCommand.HI_P2P_GET_SIGNAL_OPERATOR_LITE:
                    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);
                        Log.i("tedu", hi_p2p_s_signal_operator.s32SignalQuality + "");
                        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 i3 = hi_p2p_s_signal_operator.s32OperatorName;
                        if (i3 == 0) {
                            string = getString(R.string.cmcc);
                        } else if (i3 == 1) {
                            string = getString(R.string.cucc);
                        } else if (i3 == 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_LITE:
                    ConstantCommand.HI_P2P_S_SIGNAL_OPERATOR_EXT hi_p2p_s_signal_operator_ext = new ConstantCommand.HI_P2P_S_SIGNAL_OPERATOR_EXT(byteArray);
                    Log.i("tedu", hi_p2p_s_signal_operator_ext.s32ShowSignal + "---" + hi_p2p_s_signal_operator_ext.s32ShowName);
                    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);
                        Log.i("tedu", hi_p2p_s_signal_operator_ext.s32SignalQuality + "");
                        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();
                    Log.e("tedu", 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_PTZ_PRESET_CONTROL:
                    HiLog.e("0x8103 1" + this.mFlagPreset);
                    int i4 = this.mFlagPreset;
                    if (i4 == 1) {
                        MyToast.showToast(this, getString(R.string.tips_preset_set_btn));
                        return;
                    } else {
                        if (i4 != 2 && i4 == 3) {
                            MyToast.showToast(this, getString(R.string.tips_preset_delete_success));
                            return;
                        }
                        return;
                    }
                default:
                    return;
            }
        }
        int i5 = message.arg1;
        if (i5 != 4097) {
            if (i5 == 65540) {
                this.ll_battery.setVisibility(0);
                this.batterview.setPower(0.1f);
                return;
            }
            if (i5 != 65586) {
                return;
            }
            HiLog.e("0x8103 -1" + this.mFlagPreset);
            int i6 = this.mFlagPreset;
            if (i6 == 1) {
                MyToast.showToast(this, getString(R.string.tip_preset_fail));
                return;
            } else {
                if (i6 == 3) {
                    MyToast.showToast(this, getString(R.string.tips_preset_delete_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;
        this.receiveHumanParams = true;
        HiLogcatUtil.e("mIsSwitchResolution:  " + this.mIsSwitchResolution);
        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 handVolume(View view) {
        if (this.audio_attr == null) {
            return;
        }
        this.mPopupWindow = new PopupWindow(view);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setOutsideTouchable(true);
        this.mPopupWindow.setFocusable(true);
        this.mPopupWindow.setWidth(this.mDp_250);
        this.mPopupWindow.setWidth((int) (getResources().getDisplayMetrics().widthPixels * 0.8d));
        this.mPopupWindow.setHeight(-2);
        this.mPopupWindow.setHeight(this.mDp_250);
        this.mPopupWindow.showAtLocation(view, 17, 0, 0);
        if (this.mMyCamera.getChipVersion() == 1) {
            this.maxInputValue = 16;
            this.maxOutputValue = 13;
        }
        ((ImageView) view.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                OSDualLiveViewActivity.this.mPopupWindow.dismiss();
            }
        });
        final SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar_input);
        final SeekBar seekBar2 = (SeekBar) view.findViewById(R.id.seekbar_output);
        final TextView textView = (TextView) view.findViewById(R.id.txt_input_value);
        final TextView textView2 = (TextView) view.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 onStartTrackingTouch(SeekBar seekBar3) {
            }

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

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

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

            @Override
            public void onProgressChanged(SeekBar seekBar3, int i, boolean z) {
                textView2.setText(String.valueOf(seekBar3.getProgress() + 1));
            }
        });
    }

    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() {
                    OSDualLiveViewActivity.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, OSDualLiveViewActivity.this.mDp_250);
                    ofFloat2.setDuration(300L);
                    ofFloat2.start();
                    ofFloat2.addListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animator) {
                            super.onAnimationEnd(animator);
                            OSDualLiveViewActivity.this.ll_pup_content.setVisibility(8);
                            OSDualLiveViewActivity.this.ll_pup_content.removeAllViews();
                            OSDualLiveViewActivity.this.ll_pup_main.setVisibility(0);
                            ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(OSDualLiveViewActivity.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) {
                OSDualLiveViewActivity.this.mirrorChecked = z ? 1 : 0;
                OSDualLiveViewActivity.this.display_param.u32Mirror = OSDualLiveViewActivity.this.mirrorChecked;
                OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, OSDualLiveViewActivity.this.display_param.parseContent());
                OSDualLiveViewActivity.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) {
                OSDualLiveViewActivity.this.filpChecked = z ? 1 : 0;
                OSDualLiveViewActivity.this.display_param.u32Flip = OSDualLiveViewActivity.this.filpChecked;
                OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, OSDualLiveViewActivity.this.display_param.parseContent());
                OSDualLiveViewActivity.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));
                OSDualLiveViewActivity.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));
                OSDualLiveViewActivity.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;
                int i2 = data.getInt("Dualdev");
                HiLogcatUtil.d(" PLAY_STATE_START " + i2);
                this.mMonitorlive.getmIsFullScreen();
                this.firstTabFragment.iv_mvfull.setClickable(true);
                this.iv_playback.setClickable(true);
                getLightModel();
                getBatteryData();
                setViewWhetherClick(true);
                dismissPlaceLoadingView();
                dismissLoadingView();
                handPercentageView();
                if (HiTools.mDualvalue == 0 || HiTools.mDualvalue == 1) {
                    if (HiTools.mDualvalue == 0) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                Bitmap snap2shot_EXT = OSDualLiveViewActivity.this.mMyCamera != null ? OSDualLiveViewActivity.this.mMyCamera.getSnap2shot_EXT(1, 640, 352) : null;
                                if (snap2shot_EXT != null) {
                                    HiTools.saveSnapshot2(snap2shot_EXT, OSDualLiveViewActivity.this.mMyCamera, OSDualLiveViewActivity.this);
                                }
                            }
                        }, 400L);
                    }
                    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(i2);
                    }
                    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.mIsSwitchResolution = false;
                this.receiveHumanParams = true;
                this.viewPager.setCanScroll(true);
                return;
            }
            if (i == 3) {
                int i3 = data.getInt("Dualdev");
                if (TextUtils.isEmpty(string) || this.mRecordingState != 2) {
                    return;
                }
                grabRecordSnapshot(string, i3);
                return;
            }
            if (i == 4) {
                int i4 = data.getInt("Dualdev");
                if (i4 == 1 && !TextUtils.isEmpty(this.recordFile)) {
                    File file = new File(this.recordFile);
                    if (file.length() <= 1024 && file.isFile() && file.exists()) {
                        file.delete();
                    }
                }
                if (i4 != 1 || TextUtils.isEmpty(this.record2File)) {
                    return;
                }
                File file2 = new File(this.record2File);
                if (file2.length() <= 1024 && file2.isFile() && file2.exists()) {
                    file2.delete();
                    return;
                }
                return;
            }
            if (i == 5) {
                this.mRecordingState = 0;
                this.mRecHandler.removeCallbacksAndMessages(null);
                if (!TextUtils.isEmpty(this.recordFile)) {
                    File file3 = new File(this.recordFile);
                    if (file3.length() <= 1024 && file3.isFile() && file3.exists()) {
                        file3.delete();
                    }
                }
                if (TextUtils.isEmpty(this.record2File)) {
                    return;
                }
                File file4 = new File(this.record2File);
                if (file4.length() <= 1024 && file4.isFile() && file4.exists()) {
                    file4.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(OSDualLiveViewActivity.this.mMyCamera.getUid(), OSDualLiveViewActivity.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) {
        HiLog.e(view.getId() + Constants.COLON_SEPARATOR + R.id.rl_landscape_view + Constants.COLON_SEPARATOR + R.id.live_monitor + Constants.COLON_SEPARATOR + R.id.live2_monitor + "::" + R.id.rl_full_screen + "::" + R.id.humanRectView + "::" + R.id.human2RectView);
        int i = 0;
        switch (view.getId()) {
            case R.id.btn_return:
                finish();
                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.mMonitorlive.setVisibility(4);
                return;
            case R.id.iv_land_more:
                handLandMore();
                this.rl_landscape_one.setVisibility(8);
                this.rl_landscape_buttom.setVisibility(8);
                this.ll_focus_layout.setVisibility(8);
                this.ll_move_layout.setVisibility(8);
                return;
            case R.id.iv_land_snapshot:
                if (HiTools.HiPermission(this, this, 1, MY_PERMISSION_REQUEST_CODE)) {
                    return;
                }
                handSnapshot();
                return;
            case R.id.iv_landscape_listen:
                clickListen();
                return;
            case R.id.iv_landscape_record:
                if (HiTools.HiPermission(this, this, 1, MY_PERMISSION_REQUEST_CODE)) {
                    return;
                }
                clickRecording();
                return;
            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)) {
                    return;
                }
                handTalkingNew();
                return;
            case R.id.iv_playback:
                if (checkSupportCloud(this.mMyCamera)) {
                    clickPlayback(this.iv_playback);
                    return;
                } else {
                    if (HiTools.HiPermission(this, this, 1, MY_PERMISSION_REQUEST_CODE)) {
                        return;
                    }
                    jumpSdPlaybackActivity(this.mMyCamera);
                    this.isNeedFinish = true;
                    return;
                }
            case R.id.iv_setting:
                CameraFragment.addCameraCanClick = false;
                if (this.mMyCamera.getConnectState() == 4) {
                    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);
                        finish();
                        return;
                    }
                    Intent intent2 = new Intent(this, (Class<?>) OSSettingActivity.class);
                    intent2.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                    startActivity(intent2);
                    finish();
                    return;
                }
                MyToast.showToast(this, getString(R.string.wait_dev_connect));
                CameraFragment.addCameraCanClick = true;
                return;
            case R.id.iv_tinglight:
            case R.id.rl_close2monitor:
                if (this.mMonitorlive.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
                    if (this.mMonitorlive.getmIsFullScreen() == 1) {
                        HiTools.mDualvalue = 2;
                        this.mMyCamera.setSwtichDualCH(HiTools.mDualvalue);
                        this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualvalue));
                    } else if (this.mMonitor2live.getmIsFullScreen() == 1) {
                        HiTools.mDualvalue = 1;
                        this.mMyCamera.setSwtichDualCH(HiTools.mDualvalue);
                        this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualvalue));
                    }
                    this.rl_2monitor.setVisibility(8);
                    this.mMonitor2live.setVisibility(8);
                    this.tv_landscape_video_switch.setVisibility(8);
                    this.tv_landscape_video_dualal.setVisibility(0);
                    this.rl_close2monitor.setVisibility(4);
                    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.live2_monitor:
                HiLog.e(this.mMonitorlive.getmIsFullScreen() + "::" + this.mMonitor2live.getmIsFullScreen());
                return;
            case R.id.live_monitor:
                HiLog.e(this.mMonitorlive.getmIsFullScreen() + "::" + this.mMonitor2live.getmIsFullScreen());
                return;
            case R.id.ll_land_return:
                if (getResources().getConfiguration().orientation == 2) {
                    this.mIsClickReturn = true;
                    releaseLockScreen();
                    setRequestedOrientation(1);
                    this.isGunEnlarge = false;
                    if (this.mb_gunball && getResources().getConfiguration().orientation == 1) {
                        this.gun_local.setVisibility(0);
                    }
                }
                handTalkingBack();
                return;
            case R.id.rl_landscape_view:
                this.rl_landscape_view.setVisibility(8);
                this.ll_focus_layout.setVisibility(8);
                this.rl_close2monitor.setVisibility(8);
                this.ll_move_layout.setVisibility(8);
                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_dualal:
                if (HiTools.mDualvalue == 1 || HiTools.mDualvalue == 2) {
                    HiTools.mDualvalue = 0;
                    this.mMyCamera.setSwtichDualCH(HiTools.mDualvalue);
                    this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualvalue));
                    this.tv_landscape_video_dualal.setVisibility(8);
                    this.tv_landscape_video_switch.setVisibility(0);
                    this.rl_2monitor.setVisibility(0);
                    this.mMonitorlive.setVisibility(0);
                    this.mMonitor2live.setVisibility(0);
                    if (HiTools.mDualvalue == 0) {
                        this.rl_close2monitor.setVisibility(0);
                        return;
                    }
                    return;
                }
                return;
            case R.id.tv_landscape_video_quality:
                handVideoQuality(this.tv_landscape_video_quality, null, HiTools.dip2px(this, 20.0f));
                return;
            case R.id.tv_landscape_video_switch:
                if (HiTools.mDualvalue == 0) {
                    doswitchview();
                    this.misfull = !this.misfull;
                    return;
                }
                return;
            case R.id.tv_video_quality:
                HiLogcatUtil.e("mIsSwitchResolution:  " + this.mIsSwitchResolution + Constants.COLON_SEPARATOR + this.isTalking + Constants.COLON_SEPARATOR + this.receiveHumanParams);
                if (!this.isTalking && this.receiveHumanParams) {
                    handVideoQuality(this.lr_uid, this.tv_video_quality, HiTools.dip2px(this, 15.0f));
                    return;
                }
                return;
            default:
                return;
        }
    }

    public void clickfull() {
        if (this.receiveHumanParams) {
            if (getResources().getConfiguration().orientation == 1) {
                if (this.isTalking) {
                    return;
                } else {
                    setRequestedOrientation(0);
                }
            } else if (getResources().getConfiguration().orientation == 2) {
                setRequestedOrientation(1);
            }
            this.mMonitorlive.setVisibility(4);
            this.mMonitor2live.setVisibility(4);
            HiTools.mDualvalue = 0;
        }
    }

    private void doswitchview() {
        boolean z = this.misfull;
        if (!z) {
            this.isZoomGun = false;
            this.mMonitorlive.setmIsFullScreen(1);
            this.mMonitor2live.setmIsFullScreen(0);
            this.mMyCamera.setLiveShowMonitorExt(this.mMonitor2live, this.mMonitorlive);
            this.ll_move_layout.setVisibility(0);
        } else if (z) {
            this.isZoomGun = true;
            this.mMonitorlive.setmIsFullScreen(0);
            this.mMonitor2live.setmIsFullScreen(1);
            this.mMyCamera.setLiveShowMonitorExt(this.mMonitorlive, this.mMonitor2live);
            this.ll_move_layout.setVisibility(8);
        }
        this.focus1Num = 0;
        this.focus2Num = 0;
        initMatrix(this.mMonitorlive.screen_width, this.mMonitorlive.screen_height);
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitorlive;
        myLiveViewGLMonitor.setMatrix(myLiveViewGLMonitor.left, this.mMonitorlive.bottom, this.mMonitorlive.width, this.mMonitorlive.height);
    }

    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 (OSDualLiveViewActivity.this.audible_visual_alarm_type == null) {
                    return;
                }
                switch (i2) {
                    case R.id.light_and_sound_auto:
                        OSDualLiveViewActivity.this.audible_visual_alarm_type.u32State = 2;
                        break;
                    case R.id.light_and_sound_close:
                        OSDualLiveViewActivity.this.audible_visual_alarm_type.u32State = 0;
                        break;
                    case R.id.light_and_sound_open:
                        OSDualLiveViewActivity.this.audible_visual_alarm_type.u32State = 1;
                        break;
                }
                OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(16791, OSDualLiveViewActivity.this.audible_visual_alarm_type.parseContent());
            }
        });
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (OSDualLiveViewActivity.this.lightModel == 1) {
                    if (OSDualLiveViewActivity.this.light_info_ext == null) {
                        return;
                    }
                    switch (i2) {
                        case R.id.live_view_ext_btn_auto:
                            OSDualLiveViewActivity.this.light_info_ext.u32State = 2;
                            break;
                        case R.id.live_view_ext_btn_color:
                            OSDualLiveViewActivity.this.light_info_ext.u32State = 1;
                            break;
                        case R.id.live_view_ext_btn_normal:
                            OSDualLiveViewActivity.this.light_info_ext.u32State = 0;
                            break;
                    }
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET_EXT, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT.parseContent(OSDualLiveViewActivity.this.light_info_ext.u32Chn, OSDualLiveViewActivity.this.light_info_ext.u32State));
                    return;
                }
                if (OSDualLiveViewActivity.this.lightModel != 5 || OSDualLiveViewActivity.this.mGarden_lamp_info == null) {
                    return;
                }
                if (OSDualLiveViewActivity.this.mGarden_set_cancel) {
                    OSDualLiveViewActivity.this.mGarden_set_cancel = false;
                    return;
                }
                switch (i2) {
                    case R.id.live_view_ext_btn_auto:
                        OSDualLiveViewActivity.this.msaveGardenstate = 2;
                        break;
                    case R.id.live_view_ext_btn_color:
                        OSDualLiveViewActivity.this.msaveGardenstate = 1;
                        break;
                    case R.id.live_view_ext_btn_normal:
                        OSDualLiveViewActivity.this.msaveGardenstate = 0;
                        break;
                }
                if (OSDualLiveViewActivity.this.mGarden_lamp_info.u32Enable != 1) {
                    OSDualLiveViewActivity.this.mGarden_lamp_info.u32State = OSDualLiveViewActivity.this.msaveGardenstate;
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_Garden_Lamp, OSDualLiveViewActivity.this.mGarden_lamp_info.parseContent());
                    return;
                }
                final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(OSDualLiveViewActivity.this);
                niftyDialogBuilder.withMessageLayoutHWrapW(HiTools.dip2px(OSDualLiveViewActivity.this, 280.0f));
                niftyDialogBuilder.withTitle(OSDualLiveViewActivity.this.getString(R.string.tip_hint)).withMessage(OSDualLiveViewActivity.this.getString(R.string.tipoff_tinglight));
                niftyDialogBuilder.withButton1Text(OSDualLiveViewActivity.this.getString(R.string.cancel)).withButton2Text(OSDualLiveViewActivity.this.getString(R.string.sure));
                niftyDialogBuilder.setButton1Click(new View.OnClickListener() {
                    @Override
                    public void onClick(View view2) {
                        niftyDialogBuilder.dismiss();
                        OSDualLiveViewActivity.this.mGarden_set_cancel = true;
                        ((RadioButton) radioGroup.getChildAt(OSDualLiveViewActivity.this.mGarden_lamp_info.u32State)).setChecked(true);
                    }
                });
                niftyDialogBuilder.setButton2Click(new View.OnClickListener() {
                    @Override
                    public void onClick(View view2) {
                        niftyDialogBuilder.dismiss();
                        MyToast.showToast(OSDualLiveViewActivity.this, OSDualLiveViewActivity.this.getString(R.string.ting_light_off));
                    }
                });
                niftyDialogBuilder.isCancelableOnTouchOutside(false);
                niftyDialogBuilder.show();
            }
        });
        radioGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (OSDualLiveViewActivity.this.light_info == null) {
                    return;
                }
                switch (i2) {
                    case R.id.live_view_nor_btn_close:
                        OSDualLiveViewActivity.this.light_info.u32State = 1;
                        break;
                    case R.id.live_view_nor_btn_open:
                        OSDualLiveViewActivity.this.light_info.u32State = 0;
                        break;
                }
                OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO.parseContent(OSDualLiveViewActivity.this.light_info.u32Chn, OSDualLiveViewActivity.this.light_info.u32State));
            }
        });
        radioGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                if (OSDualLiveViewActivity.this.lightModel != 3 || OSDualLiveViewActivity.this.abs_light == null) {
                    return;
                }
                switch (i2) {
                    case R.id.abs_light_auto:
                        OSDualLiveViewActivity.this.abs_light.s32State = 0;
                        break;
                    case R.id.abs_light_close:
                        OSDualLiveViewActivity.this.abs_light.s32State = 2;
                        break;
                    case R.id.abs_light_open:
                        OSDualLiveViewActivity.this.abs_light.s32State = 1;
                        break;
                }
                OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_ABSOLUTE_LIGHT_TYPE, HiChipDefines.ABSOLUTE_LIGHT_TYPE.parseContent(OSDualLiveViewActivity.this.abs_light.s32State));
            }
        });
    }

    private void handLandMore() {
        View inflate = View.inflate(this, R.layout.pup_landscape_more_dual, 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() {
                OSDualLiveViewActivity.this.lambda$handLandMore$7$OSDualLiveViewActivity();
            }
        });
        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_mirror_flip)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$handLandMore$8$OSDualLiveViewActivity(view);
            }
        });
        ((ImageView) inflate.findViewById(R.id.land_iv_focusing)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$handLandMore$9$OSDualLiveViewActivity(view);
            }
        });
        ((ImageView) inflate.findViewById(R.id.land_iv_preset)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$handLandMore$10$OSDualLiveViewActivity(view);
            }
        });
        ((ImageView) inflate.findViewById(R.id.land_iv_volume)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$handLandMore$11$OSDualLiveViewActivity(view);
            }
        });
        ((ImageView) inflate.findViewById(R.id.iv_txtj_land)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSDualLiveViewActivity.this.lambda$handLandMore$12$OSDualLiveViewActivity(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) {
                OSDualLiveViewActivity.this.lambda$handLandMore$13$OSDualLiveViewActivity(view);
            }
        });
    }

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

    public void lambda$handLandMore$8$OSDualLiveViewActivity(View view) {
        this.mIsTXTJ = false;
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM, null);
    }

    public void lambda$handLandMore$9$OSDualLiveViewActivity(View view) {
        View inflate = View.inflate(this, R.layout.view_land_zoom_focus, null);
        handLandShowContent(inflate);
        handZoomAndFocus(inflate);
    }

    public void lambda$handLandMore$10$OSDualLiveViewActivity(View view) {
        View inflate = View.inflate(this, R.layout.view_land_preset, null);
        handLandShowContent(inflate);
        OSDualLiveViewModel.getInstance().handKeyBoard(this, inflate, this.mMyCamera);
    }

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

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

    public void lambda$handLandMore$13$OSDualLiveViewActivity(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) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 9, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, 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) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 10, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, 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) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 11, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, 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) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 12, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSDualLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
                }
                return false;
            }
        });
    }

    private 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() {
        if (HiTools.mDualvalue == 0 || HiTools.mDualvalue == 1) {
            clickSnapshot();
        }
        if (HiTools.mDualvalue == 0 || HiTools.mDualvalue == 2) {
            clickSnap2shot();
        }
    }

    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 fileNameWithTimeExt = HiTools.getFileNameWithTimeExt(0, this.mMyCamera.getdevDual() ? 1 : 0);
                String str = file.getAbsoluteFile() + "/" + fileNameWithTimeExt;
                MyCamera myCamera = this.mMyCamera;
                Bitmap snapshot = myCamera != null ? myCamera.getSnapshot() : null;
                if (snapshot != null && HiTools.saveImage(str, snapshot)) {
                    SaveToPhone(str, fileNameWithTimeExt);
                    if (HiTools.mDualvalue == 1) {
                        Toast makeText = Toast.makeText(this, getText(R.string.tips_snapshot_success), 0);
                        makeText.show();
                        this.toastList.add(makeText);
                        return;
                    }
                    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);
        }
    }

    public void clickSnap2shot() {
        if (this.mMyCamera != null) {
            if (HiTools.isSDCardValid()) {
                File file = new File(HiDataValue.getPathCameraSnapshot(this.mMyCamera.getUid(), this));
                if (!file.exists()) {
                    file.mkdirs();
                }
                String fileNameWithTimeExt = HiTools.getFileNameWithTimeExt(0, this.mMyCamera.getdevDual() ? 2 : 0);
                String str = file.getAbsoluteFile() + "/" + fileNameWithTimeExt;
                MyCamera myCamera = this.mMyCamera;
                Bitmap snap2shot = myCamera != null ? myCamera.getSnap2shot() : null;
                if (snap2shot != null && HiTools.saveImage(str, snap2shot)) {
                    SaveToPhone(str, fileNameWithTimeExt);
                    if (HiTools.mDualvalue == 0 || HiTools.mDualvalue == 2) {
                        Toast makeText = Toast.makeText(this, getText(R.string.tips_snapshot_success), 0);
                        makeText.show();
                        this.toastList.add(makeText);
                        return;
                    }
                    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(OSDualLiveViewActivity.this.getContentResolver(), str, str2, (String) null);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                OSDualLiveViewActivity.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.firstTabFragment.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.firstTabFragment.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.firstTabFragment.iv_listen.setSelected(true);
                this.isListening = true;
            }
        } else {
            this.mMyCamera.startTalk();
        }
        this.isTalking = !this.isTalking;
        this.firstTabFragment.iv_duijiang.setSelected(this.isTalking);
        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.firstTabFragment.iv_listen.setSelected(true);
                this.isListening = true;
            }
            this.isTalking = !this.isTalking;
            this.firstTabFragment.iv_duijiang.setSelected(this.isTalking);
            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_landscape_listen.setSelected(false);
            this.isListening = !this.isListening;
        }
        boolean z = !this.isTalking;
        this.isTalking = z;
        this.iv_landscape_talk.setSelected(z);
    }

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

    public void endRecording() {
        HiLogcatUtil.e("ll_2recording.setVisibility(View.Gone)");
        this.mRecordingState = 0;
        this.mRecHandler.removeCallbacksAndMessages(null);
        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.firstTabFragment.iv_record.setSelected(false);
        this.iv_landscape_record.setSelected(false);
        this.ll_recording.setVisibility(8);
        this.ll_2recording.setVisibility(8);
        HiLogcatUtil.e("ll_2recording.setVisibility(View.Gone)");
    }

    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();
        AnonymousClass36 anonymousClass36 = new AnonymousClass36(file);
        this.timerTask = anonymousClass36;
        this.timer.schedule(anonymousClass36, 0L, TTAdConstant.AD_MAX_EVENT_TIME);
    }

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

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

        @Override
        public void run() {
            HiLogcatUtil.d("timerTask run()");
            if (OSDualLiveViewActivity.this.mRecordingState == 2) {
                OSDualLiveViewActivity.this.mMyCamera.stopRecording();
            }
            boolean z = OSDualLiveViewActivity.this.mMyCamera.getdevDual();
            OSDualLiveViewActivity.this.recordFile = this.val$cameraFolder.getAbsoluteFile() + "/" + HiTools.getFileNameWithTimeExt(1, z ? 1 : 0);
            int i = OSDualLiveViewActivity.this.mMyCamera.getdevDual() ? 2 : z ? 1 : 0;
            OSDualLiveViewActivity.this.record2File = this.val$cameraFolder.getAbsoluteFile() + "/" + HiTools.getFileNameWithTimeExt(1, i);
            long availableSize = HiTools.getAvailableSize();
            if (availableSize < 100 && availableSize > 0) {
                OSDualLiveViewActivity.this.mHandler.sendEmptyMessage(WiFiSettingActivity.SET_WIFI_END);
                return;
            }
            HiLogcatUtil.d("timerTask run() isFirst: " + this.isFirst);
            if (this.isFirst) {
                OSDualLiveViewActivity.this.mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        OSDualLiveViewActivity.this.mMyCamera.startRecordingExt(OSDualLiveViewActivity.this.recordFile, OSDualLiveViewActivity.this.record2File);
                        AnonymousClass36.this.isFirst = false;
                    }
                });
            } else {
                OSDualLiveViewActivity.this.mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        OSDualLiveViewActivity.this.mMyCamera.startRecordingExt(OSDualLiveViewActivity.this.recordFile, OSDualLiveViewActivity.this.record2File);
                    }
                }, 1000L);
            }
        }
    }

    private void continueRecording(final int i) {
        HiLogcatUtil.d("continueRecording()" + i);
        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 (OSDualLiveViewActivity.this.mRecordingState == 2) {
                    HiLogcatUtil.d("continueRecording stopRecording()");
                    OSDualLiveViewActivity.this.mMyCamera.stopRecording();
                }
                boolean z = OSDualLiveViewActivity.this.mMyCamera.getdevDual();
                OSDualLiveViewActivity.this.recordFile = file.getAbsoluteFile() + "/" + HiTools.getFileNameWithTimeExt(1, z ? 1 : 0);
                int i2 = OSDualLiveViewActivity.this.mMyCamera.getdevDual() ? 2 : z ? 1 : 0;
                OSDualLiveViewActivity.this.record2File = file.getAbsoluteFile() + "/" + HiTools.getFileNameWithTimeExt(1, i2);
                HiLogcatUtil.d("continueRecording run()" + i + OSDualLiveViewActivity.this.recordFile);
                HiLogcatUtil.d("continueRecording run()" + i + OSDualLiveViewActivity.this.record2File);
                long availableSize = HiTools.getAvailableSize();
                if (availableSize >= 100 || availableSize <= 0) {
                    OSDualLiveViewActivity.this.mHandler.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            HiLogcatUtil.d("continueRecording startRecording()");
                            OSDualLiveViewActivity.this.mMyCamera.startRecordingExt(OSDualLiveViewActivity.this.recordFile, OSDualLiveViewActivity.this.record2File);
                        }
                    }, 1000L);
                } else {
                    OSDualLiveViewActivity.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, View view2, int i) {
        MyLiveViewGLMonitor myLiveViewGLMonitor;
        HiLogcatUtil.e("mIsSwitchResolution:  " + this.mIsSwitchResolution);
        if (this.mIsSwitchResolution || (myLiveViewGLMonitor = this.mMonitorlive) == null || this.mMonitor2live == null) {
            return;
        }
        if (myLiveViewGLMonitor.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
            clickRatio((TextView) view);
        } else {
            clickRatiorl((RelativeLayout) view, (TextView) view2, i);
        }
    }

    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) {
        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);
        this.videoQualityPopupWindow.showAtLocation(textView, 0, iArr[0] - (!this.isLeft ? 0 : LiuHaiScreenTools.getNotchHeight(this) - HiTools.dip2px(this, 5.0f)), iArr[1] - HiTools.dip2px(this, 90.0f));
        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) {
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(10010);
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(RequestManager.NOTIFY_CONNECT_SUCCESS);
                OSDualLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                textView2.setSelected(true);
                textView3.setSelected(false);
                OSDualLiveViewActivity.this.switchVideoQuality(0);
            }
        });
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(10010);
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(RequestManager.NOTIFY_CONNECT_SUCCESS);
                OSDualLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                textView3.setSelected(true);
                textView2.setSelected(false);
                OSDualLiveViewActivity.this.switchVideoQuality(1);
            }
        });
    }

    private void clickRatiorl(RelativeLayout relativeLayout, TextView textView, int i) {
        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];
        relativeLayout.getLocationOnScreen(iArr);
        int[] iArr2 = new int[2];
        textView.getLocationOnScreen(iArr2);
        this.videoQualityPopupWindow.showAtLocation(relativeLayout, 0, iArr2[0] - i, iArr[1] - HiTools.dip2px(this, 90.0f));
        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) {
                OSDualLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(10010);
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(RequestManager.NOTIFY_CONNECT_SUCCESS);
                textView2.setSelected(true);
                textView3.setSelected(false);
                OSDualLiveViewActivity.this.switchVideoQuality(0);
            }
        });
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(10010);
                OSDualLiveViewActivity.this.humanRectHandler.removeMessages(RequestManager.NOTIFY_CONNECT_SUCCESS);
                OSDualLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                textView3.setSelected(true);
                textView2.setSelected(false);
                OSDualLiveViewActivity.this.switchVideoQuality(1);
            }
        });
    }

    public void switchVideoQuality(int i) {
        MyCamera myCamera = this.mMyCamera;
        if (myCamera == null || i == myCamera.getVideoQuality()) {
            return;
        }
        this.receiveHumanParams = false;
        this.mIsSwitchResolution = true;
        this.mNumGetStart = 0;
        setViewWhetherClick(false);
        this.firstTabFragment.iv_listen.setSelected(false);
        this.iv_landscape_listen.setSelected(false);
        this.mMyCamera.stopListening();
        this.mIsListenTrans = false;
        this.mVoiceIsTran = false;
        this.isListening = false;
        this.firstTabFragment.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.firstTabFragment.iv_listen.setSelected(false);
            } else {
                this.iv_landscape_listen.setSelected(true);
                this.firstTabFragment.iv_listen.setSelected(true);
            }
        } else if (this.isListening) {
            this.iv_landscape_listen.setSelected(false);
            this.firstTabFragment.iv_listen.setSelected(false);
            this.mMyCamera.stopListening();
            this.mIsListenTrans = false;
            this.mVoiceIsTran = false;
        } else {
            this.iv_landscape_listen.setSelected(true);
            this.firstTabFragment.iv_listen.setSelected(true);
            this.mMyCamera.startListening();
            this.mVoiceIsTran = true;
        }
        if (this.isTalking) {
            this.firstTabFragment.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(OSDualLiveViewActivity.this);
            }
        });
        builder.setNegativeButton(getString(R.string.cancel), (DialogInterface.OnClickListener) null);
        builder.show();
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        if (getResources().getConfiguration().orientation == 1) {
            handPortrait();
            setIsFullScreen(false);
            this.rl_2monitor.setVisibility(0);
            this.mMonitorlive.setVisibility(0);
            this.mMonitor2live.setVisibility(0);
            HiTools.mDualvalue = 0;
            this.mMyCamera.setSwtichDualCH(HiTools.mDualvalue);
            this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualvalue));
        } else {
            handLandScape();
            this.isZoomGun = false;
            this.rl_2monitor.setVisibility(0);
            this.mMonitorlive.setVisibility(0);
            this.mMonitor2live.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();
        }
    }

    private void handPortrait() {
        OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
        if (orientationWatchDog != null) {
            orientationWatchDog.setLockScreen(false);
        }
        this.isFirstRevolveLand = false;
        if (this.mHandler_lockScreen != null) {
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
        showBottomUIMenu();
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mMonitorlive.screen_height = this.mMonitorHeight;
        this.mMonitorlive.screen_width = displayMetrics.widthPixels;
        this.focus1Num = 0;
        this.focus2Num = 0;
        this.pl_move_layout.setVisibility(0);
        this.mMonitorlive.setmIsFullScreen(0);
        this.mMonitor2live.setmIsFullScreen(0);
        getWindow().clearFlags(1024);
        this.mMyCamera.setLiveShowMonitorExt(this.mMonitorlive, this.mMonitor2live);
        this.titleview.setVisibility(0);
        this.ll_bottom.setVisibility(0);
        this.rl_landscape_view.setVisibility(8);
        this.rl_close2monitor.setVisibility(8);
        this.humanRectView.setVisibility(0);
        this.humanRect2View.setVisibility(0);
        this.p1ll_focus_layout.setVisibility(0);
        this.p2ll_focus_layout.setVisibility(0);
        if (this.mb_gunball) {
            this.gun_local.setVisibility(0);
        }
        if (this.mRecordingState == 2) {
            this.ll_recording.setVisibility(0);
            this.ll_2recording.setVisibility(0);
            HiLogcatUtil.e("ll_2recording.setVisibility(View.VISIBLE)");
        }
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), this.mMonitorHeight);
        if (this.mIsClickReturn) {
            layoutParams = new RelativeLayout.LayoutParams(displayMetrics.widthPixels, this.mMonitorHeight);
        }
        this.mMonitorlive.setLayoutParams(layoutParams);
        this.humanRectView.setLayoutParams(layoutParams);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), this.mMonitorHeight);
        if (this.mIsClickReturn) {
            layoutParams2 = new LinearLayout.LayoutParams(displayMetrics.widthPixels, this.mMonitorHeight);
        }
        layoutParams2.setMargins(0, this.mMonitorHeight + HiTools.dip2px(this, 50.0f), 0, 0);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.pl_move_layout.getLayoutParams();
        this.rl_2monitor.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) this.mMonitor2live.getLayoutParams();
        layoutParams4.width = layoutParams2.width;
        layoutParams4.height = layoutParams2.height;
        if (this.mIsHaveVirtual) {
            RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
            if (this.mIsClickReturn) {
                layoutParams5 = new RelativeLayout.LayoutParams(displayMetrics.widthPixels, this.mMonitorHeight);
            }
            this.mMonitorlive.setLayoutParams(layoutParams5);
            this.humanRectView.setLayoutParams(layoutParams5);
            LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-1, this.mMonitorHeight);
            if (this.mIsClickReturn) {
                layoutParams6 = new LinearLayout.LayoutParams(displayMetrics.widthPixels, this.mMonitorHeight);
            }
            layoutParams6.setMargins(0, this.mMonitorHeight + HiTools.dip2px(this, 50.0f), 0, 0);
            this.rl_2monitor.setLayoutParams(layoutParams6);
            layoutParams4.width = layoutParams6.width;
            layoutParams4.height = layoutParams6.height;
        }
        layoutParams4.setMargins(0, 0, 0, 0);
        layoutParams3.setMargins(0, ((this.mMonitorHeight / 2) - (HiTools.dip2px(this, 171.0f) / 2)) + HiTools.dip2px(this, 10.0f), HiTools.dip2px(this, 10.0f), 0);
        this.pl_move_layout.setLayoutParams(layoutParams3);
        this.mMonitor2live.setLayoutParams(layoutParams4);
        this.humanRect2View.setLayoutParams(layoutParams4);
        RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(this.ll_recording.getLayoutParams());
        layoutParams7.setMargins(HiTools.dip2px(this, 12.0f), HiTools.dip2px(this, 5.0f), 0, 0);
        this.ll_recording.setLayoutParams(layoutParams7);
        RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(this.ll_battery.getLayoutParams());
        layoutParams8.setMargins(0, HiTools.dip2px(this, 20.0f), HiTools.dip2px(this, 10.0f), 0);
        layoutParams8.addRule(11);
        this.ll_battery.setLayoutParams(layoutParams8);
        RelativeLayout.LayoutParams layoutParams9 = new RelativeLayout.LayoutParams(this.ll_2recording.getLayoutParams());
        layoutParams9.setMargins(HiTools.dip2px(this, 12.0f), HiTools.dip2px(this, 5.0f), 0, 0);
        this.ll_2recording.setLayoutParams(layoutParams9);
        this.mMonitorlive.setState(0);
        this.humanRectView.cleanRect(false);
        initMatrix(HiTools.getScreenW(this), this.mMonitorHeight);
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitorlive;
        myLiveViewGLMonitor.setMatrix(myLiveViewGLMonitor.left, this.mMonitorlive.bottom, this.mMonitorlive.width, this.mMonitorlive.height);
        this.mMonitor2live.setState(0);
        this.humanRect2View.cleanRect(false);
        init2Matrix(HiTools.getScreenW(this), this.mMonitorHeight);
        MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor2live;
        myLiveViewGLMonitor2.setMatrix(myLiveViewGLMonitor2.left, this.mMonitor2live.bottom, this.mMonitor2live.width, this.mMonitor2live.height);
        HiLogcatUtil.i("  :  " + this.mMonitorlive.left + "  :  " + this.mMonitorlive.bottom + "  :  " + this.mMonitorlive.width + "  :  " + this.mMonitorlive.height);
        HiLogcatUtil.i("  :  " + this.mMonitor2live.left + "  :  " + this.mMonitor2live.bottom + "  :  " + this.mMonitor2live.width + "  :  " + this.mMonitor2live.height);
    }

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

    public void dismissLoadingView() {
        ImageView imageView = this.mIvLoading;
        if (imageView != null && imageView.getVisibility() == 0) {
            this.mIvLoading.clearAnimation();
            this.mIvLoading.setVisibility(8);
        }
        ImageView imageView2 = this.mIv2Loading;
        if (imageView2 == null || imageView2.getVisibility() != 0) {
            return;
        }
        this.mIv2Loading.clearAnimation();
        this.mIv2Loading.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);
        this.iv_2placeholder_rotate.setVisibility(0);
        this.iv_2placeholder_rotate.startAnimation(loadAnimation);
        this.iv_2placeholder.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();
        }
        if (this.iv_2placeholder_rotate.getAlpha() == 1.0f) {
            ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this.iv_2placeholder_rotate, "Alpha", 1.0f, 0.0f);
            ofFloat3.setDuration(500L);
            ofFloat3.start();
        }
        if (this.iv_2placeholder.getAlpha() == 1.0f) {
            ObjectAnimator ofFloat4 = ObjectAnimator.ofFloat(this.iv_2placeholder, "Alpha", 1.0f, 0.0f);
            ofFloat4.setDuration(500L);
            ofFloat4.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;
        }
    }

    public void setViewWhetherClick(boolean z) {
        if (this.firstTabFragment == null || this.secondTabFragment == null) {
            return;
        }
        try {
            this.iv_landscape_listen.setClickable(z);
            this.firstTabFragment.iv_listen.setClickable(z);
            this.iv_landscape_record.setClickable(z);
            this.firstTabFragment.iv_record.setClickable(z);
            this.iv_land_snapshot.setClickable(z);
            this.firstTabFragment.iv_snapshot.setClickable(z);
            this.iv_landscape_talk.setClickable(z);
            this.firstTabFragment.iv_duijiang.setClickable(z);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void receiveHumanParams(byte[] bArr) {
        if (this.preHumanTime == 0) {
            this.mTimer.schedule(this.mTask, 0L, 1000L);
        }
        this.preHumanTime = System.currentTimeMillis();
        if (this.mMonitor2live == null || this.mMonitorlive.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);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void receiveHumanParams(QueryHSR queryHSR) {
        MyLiveViewGLMonitor myLiveViewGLMonitor;
        if (queryHSR == null || queryHSR.gethsrdata() == null || (myLiveViewGLMonitor = this.mMonitorlive) == null || this.mMonitor2live == null || myLiveViewGLMonitor.getmIsFullScreen() == 1 || this.mMonitor2live.getmIsFullScreen() == 1) {
            return;
        }
        ConstantCommand.HI_P2P_SMART_HSR_AREA hi_p2p_smart_hsr_area = new ConstantCommand.HI_P2P_SMART_HSR_AREA(queryHSR.gethsrdata());
        if (hi_p2p_smart_hsr_area.u32Num == 0) {
            return;
        }
        Message message = new Message();
        if (queryHSR.getQueryCode() == 61450) {
            if (this.mMonitorlive.getState() == 1) {
                return;
            }
            if (this.preHumanTime == 0) {
                this.mTimer.schedule(this.mTask, 0L, 1000L);
            }
            this.preHumanTime = System.currentTimeMillis();
            message.what = RequestManager.NOTIFY_CONNECT_SUCCESS;
        }
        if (queryHSR.getQueryCode() == 61451) {
            if (this.mMonitor2live.getState() == 1) {
                return;
            }
            if (this.pre2HumanTime == 0) {
                this.m2Timer.schedule(this.m2Task, 0L, 1000L);
            }
            this.pre2HumanTime = System.currentTimeMillis();
            message.what = 10010;
        }
        message.obj = queryHSR.gethsrdata();
        message.arg1 = hi_p2p_smart_hsr_area.u32Num;
        this.humanRectHandler.sendMessage(message);
    }

    public void zoomIn() {
        HiLogcatUtil.i("zoomIn: ###################");
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, 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(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 10, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
    }

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

    private void stopZoom(int i) {
        HiLogcatUtil.i("stopZoom: ###################--->");
        int i2 = this.focus1Num;
        if (i2 <= 0 || i2 >= this.focusNumMax) {
            if (i == 0) {
                this.iv_zoom_in.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        OSDualLiveViewActivity.this.lambda$stopZoom$14$OSDualLiveViewActivity();
                    }
                }, 60L);
            } else {
                HiLogcatUtil.i("stopZoom: ###################");
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
            }
        }
    }

    public void lambda$stopZoom$14$OSDualLiveViewActivity() {
        HiLogcatUtil.i("stopZoom: ###################");
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
    }

    private void handLandScape() {
        RelativeLayout.LayoutParams layoutParams;
        if (this.secondTabFragment.mPopupWindow != null && this.secondTabFragment.mPopupWindow.isShowing()) {
            this.secondTabFragment.mPopupWindow.dismiss();
        }
        this.misfull = true;
        this.pl_move_layout.setVisibility(8);
        this.isHideNavigation = hideBottomUIMenu();
        this.focus1Num = 0;
        this.focus2Num = 0;
        this.mFocusHandler.removeCallbacksAndMessages(null);
        getWindow().setFlags(1024, 1024);
        this.mMyCamera.setLiveShowMonitorExt(this.mMonitor2live, this.mMonitorlive);
        this.titleview.setVisibility(8);
        this.ll_bottom.setVisibility(8);
        this.rl_landscape_view.setVisibility(8);
        this.ll_move_layout.setVisibility(8);
        this.ll_focus_layout.setVisibility(8);
        this.rl_close2monitor.setVisibility(8);
        this.tv_landscape_video_dualal.setVisibility(8);
        this.tv_landscape_video_switch.setVisibility(0);
        this.humanRectView.setVisibility(0);
        this.gun_local.setVisibility(8);
        this.p1ll_focus_layout.setVisibility(8);
        this.p2ll_focus_layout.setVisibility(8);
        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);
        this.mMonitorlive.setState(0);
        this.mMonitor2live.setState(0);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mMonitorlive.screen_height = displayMetrics.heightPixels;
        this.mMonitorlive.screen_width = displayMetrics.widthPixels;
        new RelativeLayout.LayoutParams(-1, -1);
        if (this.isHideNavigation) {
            layoutParams = new RelativeLayout.LayoutParams(-1, -1);
            this.mMonitorlive.screen_width = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(this);
        } else {
            layoutParams = new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());
            this.mMonitorlive.screen_width = displayMetrics.widthPixels;
        }
        if (HiTools.isAllScreenDevice(this)) {
            this.rl_landscape_view.setLayoutParams(layoutParams);
        }
        this.mMonitorlive.setmIsFullScreen(1);
        this.mMonitor2live.setmIsFullScreen(0);
        this.mMonitorlive.setLayoutParams(layoutParams);
        this.humanRectView.setLayoutParams(layoutParams);
        initMatrix(this.mMonitorlive.screen_width, this.mMonitorlive.screen_height);
        if (this.mRecordingState == 2) {
            this.ll_2recording.setVisibility(8);
            this.ll_recording.setVisibility(0);
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitorlive;
        myLiveViewGLMonitor.setMatrix(myLiveViewGLMonitor.left, this.mMonitorlive.bottom, this.mMonitorlive.width, this.mMonitorlive.height);
        this.humanRectView.cleanRect(false);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.mMonitor2live.getLayoutParams();
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, -1);
        DisplayMetrics displayMetrics2 = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics2);
        HiLog.e("mMonitor2live" + displayMetrics.widthPixels + ":::::" + displayMetrics.heightPixels + "::" + displayMetrics2.widthPixels + ":::::" + displayMetrics2.heightPixels + "::" + this.mMonitorlive.screen_width + "::" + HiTools.isAllScreenDevice(this) + "::" + this.isHideNavigation);
        layoutParams4.leftMargin = (displayMetrics2.widthPixels * 2) / 3;
        layoutParams4.topMargin = (displayMetrics.heightPixels * 2) / 3;
        layoutParams4.rightMargin = 0;
        layoutParams4.width = displayMetrics2.widthPixels / 3;
        int i = displayMetrics.heightPixels / 3;
        layoutParams4.height = i;
        layoutParams3.height = i;
        HiLog.e("mMonitor2live" + layoutParams4.leftMargin + "::" + layoutParams4.topMargin + "::" + layoutParams4.width + "::" + layoutParams4.height);
        this.rl_2monitor.setLayoutParams(layoutParams4);
        layoutParams3.setMargins(0, 0, 0, 0);
        this.mMonitor2live.setLayoutParams(layoutParams3);
        this.humanRect2View.setLayoutParams(layoutParams3);
        this.humanRect2View.cleanRect(false);
        RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) this.rl_close2monitor.getLayoutParams();
        layoutParams5.leftMargin = (displayMetrics2.widthPixels * 2) / 3;
        layoutParams5.topMargin = (displayMetrics.heightPixels * 2) / 3;
        layoutParams4.setMargins(layoutParams4.leftMargin, layoutParams4.topMargin, 0, 0);
        this.rl_close2monitor.setLayoutParams(layoutParams5);
        RelativeLayout.LayoutParams layoutParams6 = new RelativeLayout.LayoutParams(this.ll_2recording.getLayoutParams());
        layoutParams6.setMargins(HiTools.dip2px(this, 20.0f), HiTools.dip2px(this, 55.0f), 0, 0);
        this.ll_2recording.setLayoutParams(layoutParams6);
        RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(this.ll_battery.getLayoutParams());
        layoutParams7.setMargins(0, HiTools.dip2px(this, 25.0f), HiTools.dip2px(this, 15.0f), 0);
        layoutParams7.addRule(11);
        this.ll_battery.setLayoutParams(layoutParams7);
        init2Matrix(layoutParams4.width, layoutParams4.height);
        MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor2live;
        myLiveViewGLMonitor2.setMatrix(myLiveViewGLMonitor2.left, this.mMonitor2live.bottom, this.mMonitor2live.width, this.mMonitor2live.height);
        HiLog.e("mMonitor2live" + this.rl_2monitor.getLeft() + "::" + this.rl_2monitor.getBottom() + "::" + this.rl_2monitor.getWidth() + "::" + this.rl_2monitor.getHeight());
        this.ll_move_layout.getViewTreeObserver().addOnPreDrawListener(this.ll_movePre);
    }

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

    @Override
    public void changedScreenDirection(int i) {
        if (this.isReadyPlay && SharePreUtils.getBoolean(HiDataValue.CACHE, this, "isJumpGuideview_OsDualLive", false)) {
            if (i == 90) {
                this.isLeft = false;
                if (!this.mIsClickReturn) {
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (OSDualLiveViewActivity.this.isLarge == 1) {
                                OSDualLiveViewActivity oSDualLiveViewActivity = OSDualLiveViewActivity.this;
                                oSDualLiveViewActivity.resetMonitorSize(true, oSDualLiveViewActivity.nLenStart);
                            } else if (OSDualLiveViewActivity.this.isLarge == 2) {
                                OSDualLiveViewActivity oSDualLiveViewActivity2 = OSDualLiveViewActivity.this;
                                oSDualLiveViewActivity2.resetMonitorSize(false, oSDualLiveViewActivity2.nLenStart);
                            }
                        }
                    }, 200L);
                }
                if (!this.mIsClickReturn) {
                    setRequestedOrientation(8);
                }
                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;
                if (!this.mIsClickReturn) {
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (OSDualLiveViewActivity.this.isLarge == 1) {
                                OSDualLiveViewActivity oSDualLiveViewActivity = OSDualLiveViewActivity.this;
                                oSDualLiveViewActivity.resetMonitorSize(true, oSDualLiveViewActivity.nLenStart);
                            } else if (OSDualLiveViewActivity.this.isLarge == 2) {
                                OSDualLiveViewActivity oSDualLiveViewActivity2 = OSDualLiveViewActivity.this;
                                oSDualLiveViewActivity2.resetMonitorSize(false, oSDualLiveViewActivity2.nLenStart);
                            }
                        }
                    }, 200L);
                }
                if (!this.mIsClickReturn) {
                    setRequestedOrientation(0);
                }
                if (this.isFirstRevolveLand && !this.mIsClickReturn) {
                    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;
                    }
                }
                return;
            }
            this.mIsClickReturn = false;
            this.isFirstRevolveLand = false;
            this.isGunEnlarge = false;
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    OSDualLiveViewActivity.this.handTalkingBack();
                    if (OSDualLiveViewActivity.this.videoQualityPopupWindow != null && OSDualLiveViewActivity.this.videoQualityPopupWindow.isShowing()) {
                        OSDualLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                    }
                    if (OSDualLiveViewActivity.this.playbackPopupWindow != null && OSDualLiveViewActivity.this.playbackPopupWindow.isShowing()) {
                        OSDualLiveViewActivity.this.playbackPopupWindow.dismiss();
                    }
                    OSDualLiveViewActivity.this.root_lock_screen.setVisibility(8);
                }
            }, 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 || i == 10022) {
            int length2 = iArr.length;
            int i4 = 0;
            while (true) {
                if (i4 >= length2) {
                    break;
                }
                if (iArr[i4] != 0) {
                    z = false;
                    break;
                }
                i4++;
            }
            if (z) {
                return;
            }
            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) {
                OSDualLiveViewActivity oSDualLiveViewActivity = OSDualLiveViewActivity.this;
                oSDualLiveViewActivity.jumpSdPlaybackActivity(oSDualLiveViewActivity.mMyCamera);
                OSDualLiveViewActivity.this.isNeedFinish = true;
            }
        });
        imageView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                OSDualLiveViewActivity oSDualLiveViewActivity = OSDualLiveViewActivity.this;
                oSDualLiveViewActivity.checkCloudStatus(oSDualLiveViewActivity.mMyCamera);
                OSDualLiveViewActivity.this.isNeedFinish = true;
            }
        });
    }

    public void setDoPause(boolean z) {
        this.isDoPause = z;
    }
}