OSLiveViewActivity.java 源代码


package liteos.live;

import activity.AllAdapter.FunAdapter;
import activity.EditCameraActivity;
import activity.ShareSettingActivity;
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.Point;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.provider.Settings;
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.AdapterView;
import android.widget.CompoundButton;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
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.HiFragment;
import base.HiLandScapeActivity;
import bean.LiveFunBean;
import bean.LowElectricBean;
import bean.MyCamera;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.dasu.blur.DBlur;
import com.dasu.blur.OnBlurListener;
import com.heytap.mcssdk.a.a;
import com.hichip.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.HiSearchSDK;
import com.hichip.tools.Packet;
import com.kuaishou.weapon.p0.g;
import com.kwad.sdk.core.response.model.AdVideoPreCacheConfig;
import com.xiaomi.mipush.sdk.Constants;
import common.Constant;
import common.ConstantCommand;
import common.HiDataValue;
import common.MyLiveViewGLMonitor;
import custom.BatteryView;
import custom.FloatingWindow;
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.fragment.OSFirstTabFragment;
import liteos.live.fragment.OSSecondTabFragment;
import liteos.live.fragment.OSThirdTabFragment;
import liteos.live.fragment.OSVpAdapter;
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.DialogUtilsCamHiPro;
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 OSLiveViewActivity 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_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 = 10040;
    public static final int RECORDING_STATUS_ING = 2;
    public static final int RECORDING_STATUS_LOADING = 1;
    public static final int RECORDING_STATUS_NONE = 0;
    private static final int ZOOM_IN = 32103;
    private static final int ZOOM_OUT = 32104;
    private 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 int PictureRealHeight;
    private int PictureRealWidth;
    private HiChipDefines.ABSOLUTE_LIGHT_TYPE abs_light;
    private float action_down_x;
    private float action_down_y;
    private HiChipDefines.HI_P2P_S_AUDIO_ATTR audio_attr;
    BatteryView batterview;
    public ImageView btn_floating_window;
    ImageView btn_return;
    private long clickTime;
    private float dis_hor;
    private float dis_ver;
    private float down_X;
    private float down_Y;
    protected int filpChecked;
    private int focusGap;
    private int focusNum;
    private HiLitosSDK hiLitosSDK;
    private HiSearchSDK hiSearchSDK;
    private ConstantCommand.HI_P2P_S_INFRARED_PARMA infrared_param;
    private boolean isSupportLightSelect;
    private boolean isSupportPTZTest;
    ImageView iv_charge;
    ImageView iv_finger;
    ImageView iv_first_tab;
    public ImageView iv_full_screen;
    ImageView iv_land_more;
    ImageView iv_land_snapshot;
    public ImageView iv_landscape_listen;
    public ImageView iv_landscape_record;
    public ImageView iv_landscape_talk;
    ImageView iv_move_down;
    ImageView iv_move_left;
    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_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;
    private ConstantCommand.HI_P2P_S_LIGHTS lights_params;
    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;
    private int mCameraVideoQuality;
    private FloatingWindow mFloatingWindow;
    private int mInputMethod;
    ImageView mIvLoading2;
    public MyLiveViewGLMonitor mMonitor;
    protected MyCamera mMyCamera;
    public OrientationWatchDog mOrientationWatchDog;
    private PopupWindow mPopupWindow;
    private int mQuality;
    private OSVpAdapter mVpAdapter;
    protected int mirrorChecked;
    private ConstantCommand.HI_P2P_S_IMAGR_MODE_INFO model_info;
    int moveX;
    int moveY;
    float move_x;
    float move_y;
    private boolean not_hint;
    private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener;
    private OSFirstTabFragment osFirstTabFragment;
    private OSSecondTabFragment osSecondTabFragment;
    private OSThirdTabFragment osThirdTabFragment;
    private PopupWindow playbackPopupWindow;
    ProgressBar progressbar;
    private boolean reGetSignal;
    public String recordFile;
    RelativeLayout rl_guide_monitor;
    public RelativeLayout rl_landscape_buttom;
    public RelativeLayout rl_landscape_one;
    public RelativeLayout rl_landscape_view;
    RelativeLayout rl_preset_key;
    RelativeLayout rl_viewPager;
    public RelativeLayout rl_wrap;
    public LinearLayout root_lock_screen;
    private SeekBar sb_brightness;
    private SeekBar sb_contrast;
    private SeekBar sb_saturation;
    private ConstantCommand.HI_P2P_S_SCENE_MODE_PARAM scan_params;
    private SeekBar seekbar_input;
    private SeekBar seekbar_output;
    public boolean supportZoom;
    public Timer timer;
    public TimerTask timerTask;
    TextView title_middle;
    RelativeLayout titleview;
    private long touchTimeDown;
    private long touchTimeUp;
    protected HiChipDefines.HI_P2P_SMART_MOTO trackParam;
    TextView tv_brand;
    private TextView tv_brightness;
    TextView tv_connect_num;
    private TextView tv_contrast;
    TextView tv_focus_mun;
    public TextView tv_focus_mun_p;
    TextView tv_key_preset;
    TextView tv_know;
    TextView tv_landscape_video_adaption;
    TextView tv_landscape_video_quality;
    TextView tv_percent;
    TextView tv_percentage;
    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;
    private int video_height;
    private int video_width;
    public MyViewPager viewPager;
    private ConstantCommand.HI_P2P_S_WDR_PARMA wdr_param;
    WIFIView wifi_info;
    int xlenOld;
    int ylenOld;
    public int mRecordingState = 0;
    private int mPictureSize = 0;
    public boolean isListening = false;
    public boolean isTalking = false;
    ConstantCommand.HI_P2P_S_DISPLAY_INFO 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;
    public int lightModel = 0;
    private boolean mIsTXTJ = false;
    public boolean mIsHaveTrack = false;
    private List<Toast> toastList = new ArrayList();
    public boolean mIsListenTrans = false;
    private int mPercentage = 0;
    public int mMonitorHeight = 0;
    private List<Integer> hmsz_fuc_num = new ArrayList();
    private ArrayList<HiFragment> fragments = new ArrayList<>();
    private int largeMul = 2;
    private short speed = 58;
    boolean isLongPress = false;
    private int u32TurnTime = 40;
    private int u32TurnTime_sleep = AdVideoPreCacheConfig.DEFAULT_PRE_CACHE_SIZE;
    private boolean isLeft = true;
    private boolean isFirstRevolveLand = false;
    private boolean isReadyPlay = false;
    public boolean isShowPermissionDialog = false;
    private Handler mAnimHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i != 1180) {
                if (i != 2128) {
                    return;
                }
                OSLiveViewActivity.this.handAnim();
                return;
            }
            OSLiveViewActivity.access$908(OSLiveViewActivity.this);
            if (OSLiveViewActivity.this.mPercentage >= 100) {
                OSLiveViewActivity.this.mAnimHandler.removeMessages(1180);
                return;
            }
            OSLiveViewActivity.this.tv_percentage.setText(OSLiveViewActivity.this.mPercentage + " %");
            OSLiveViewActivity.this.mAnimHandler.sendEmptyMessageDelayed(1180, 1000L);
        }
    };
    double nLenStart = 0.0d;
    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 (OSLiveViewActivity.this.iv_recording.getVisibility() == 4) {
                OSLiveViewActivity.this.iv_recording.setVisibility(0);
            } else {
                OSLiveViewActivity.this.iv_recording.setVisibility(4);
            }
            OSLiveViewActivity.this.mStartRecordTime += 1000;
            Log.e("==rec", "rec: ");
            OSLiveViewActivity.this.tv_record_time.setText(OSLiveViewActivity.this.sdf.format(new Date(OSLiveViewActivity.this.mStartRecordTime)));
            OSLiveViewActivity.this.mRecHandler.sendEmptyMessageDelayed(110, 1000L);
        }
    };
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == -2147483647) {
                OSLiveViewActivity.this.handMsgPlayState(message);
                return;
            }
            if (i == -1879048191) {
                OSLiveViewActivity.this.handMsgSessionState(message);
                return;
            }
            if (i == -1879048189) {
                OSLiveViewActivity.this.handMsgReceiveIoctrl(message);
                return;
            }
            if (i == 288) {
                OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                MyToast.showToast(oSLiveViewActivity, oSLiveViewActivity.getString(R.string.failed_recording));
            } else if (i == 666) {
                OSLiveViewActivity.this.WakeUp();
            } else {
                if (i != 2457) {
                    return;
                }
                OSLiveViewActivity.this.endRecording();
                OSLiveViewActivity oSLiveViewActivity2 = OSLiveViewActivity.this;
                MyToast.showToast(oSLiveViewActivity2, oSLiveViewActivity2.getString(R.string.failed_recording));
            }
        }
    };
    private boolean mIsClickReturn = false;
    List<LiveFunBean> functionList = new ArrayList();
    public int mFlagPreset = 0;
    PopupWindow mPictureSizePopupWindow = null;
    public Handler mFocusHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == OSLiveViewActivity.ZOOM_IN) {
                HiLogcatUtil.i(" ZOOM_IN handleMessage:  focusNum " + OSLiveViewActivity.this.focusNum);
                if (OSLiveViewActivity.this.focusNum < 200) {
                    if (OSLiveViewActivity.this.type != 0) {
                        if (OSLiveViewActivity.this.type != -1) {
                            if (OSLiveViewActivity.this.type == 1) {
                                if (OSLiveViewActivity.this.focusNum >= 50) {
                                    if (50 >= OSLiveViewActivity.this.focusNum || OSLiveViewActivity.this.focusNum >= 100) {
                                        if (100 >= OSLiveViewActivity.this.focusNum || OSLiveViewActivity.this.focusNum >= 150) {
                                            if (150 < OSLiveViewActivity.this.focusNum) {
                                                OSLiveViewActivity.this.resetMonitorSize(true, r13.focusGap);
                                                OSLiveViewActivity.access$3612(OSLiveViewActivity.this, 1);
                                                if (OSLiveViewActivity.this.focusNum < 200) {
                                                    OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_IN, 10L);
                                                    return;
                                                }
                                                return;
                                            }
                                            return;
                                        }
                                        OSLiveViewActivity.this.resetMonitorSize(true, r13.focusGap);
                                        OSLiveViewActivity.access$3612(OSLiveViewActivity.this, 1);
                                        if (OSLiveViewActivity.this.focusNum < 150) {
                                            OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_IN, 10L);
                                            return;
                                        }
                                        return;
                                    }
                                    OSLiveViewActivity.this.resetMonitorSize(true, r13.focusGap);
                                    OSLiveViewActivity.access$3612(OSLiveViewActivity.this, 1);
                                    if (OSLiveViewActivity.this.focusNum < 100) {
                                        OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_IN, 10L);
                                        return;
                                    }
                                    return;
                                }
                                OSLiveViewActivity.this.resetMonitorSize(true, r13.focusGap);
                                OSLiveViewActivity.access$3612(OSLiveViewActivity.this, 1);
                                if (OSLiveViewActivity.this.focusNum < 50) {
                                    OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_IN, 10L);
                                    return;
                                }
                                return;
                            }
                            return;
                        }
                        HiLogcatUtil.i("type == -1-->focusNum: " + OSLiveViewActivity.this.focusNum);
                        return;
                    }
                    OSLiveViewActivity.this.resetMonitorSize(true, r13.focusGap);
                    OSLiveViewActivity.access$3612(OSLiveViewActivity.this, 1);
                    if (OSLiveViewActivity.this.focusNum < 200) {
                        OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_IN, 10L);
                        if (OSLiveViewActivity.this.focusNum == 150) {
                            OSLiveViewActivity.this.zoomIn();
                            return;
                        }
                        return;
                    }
                    return;
                }
                return;
            }
            if (i != OSLiveViewActivity.ZOOM_OUT) {
                return;
            }
            HiLogcatUtil.i(" ZOOM_OUT  handleMessage:  focusNum " + OSLiveViewActivity.this.focusNum);
            if (OSLiveViewActivity.this.focusNum <= 0 || OSLiveViewActivity.this.focusNum > 200) {
                return;
            }
            if (OSLiveViewActivity.this.type != 0) {
                if (OSLiveViewActivity.this.type != -1) {
                    if (OSLiveViewActivity.this.type == 1) {
                        if (OSLiveViewActivity.this.focusNum >= 50) {
                            if (50 >= OSLiveViewActivity.this.focusNum || OSLiveViewActivity.this.focusNum >= 100) {
                                if (100 >= OSLiveViewActivity.this.focusNum || OSLiveViewActivity.this.focusNum >= 150) {
                                    if (150 >= OSLiveViewActivity.this.focusNum || OSLiveViewActivity.this.focusNum >= 200) {
                                        return;
                                    }
                                    OSLiveViewActivity.this.resetMonitorSize(false, r13.focusGap);
                                    OSLiveViewActivity.access$3620(OSLiveViewActivity.this, 1);
                                    if (OSLiveViewActivity.this.focusNum > 150) {
                                        OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_OUT, 10L);
                                        return;
                                    }
                                    return;
                                }
                                OSLiveViewActivity.this.resetMonitorSize(false, r13.focusGap);
                                OSLiveViewActivity.access$3620(OSLiveViewActivity.this, 1);
                                if (OSLiveViewActivity.this.focusNum > 100) {
                                    OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_OUT, 10L);
                                    return;
                                }
                                return;
                            }
                            OSLiveViewActivity.this.resetMonitorSize(false, r13.focusGap);
                            OSLiveViewActivity.access$3620(OSLiveViewActivity.this, 1);
                            if (OSLiveViewActivity.this.focusNum > 50) {
                                OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_OUT, 10L);
                                return;
                            }
                            return;
                        }
                        OSLiveViewActivity.this.resetMonitorSize(false, r13.focusGap);
                        OSLiveViewActivity.access$3620(OSLiveViewActivity.this, 1);
                        if (OSLiveViewActivity.this.focusNum > 0) {
                            OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_OUT, 10L);
                            return;
                        }
                        return;
                    }
                    return;
                }
                HiLogcatUtil.i("zoomOut type == -1-->focusNum: " + OSLiveViewActivity.this.focusNum);
                return;
            }
            OSLiveViewActivity.this.resetMonitorSize(false, r13.focusGap);
            OSLiveViewActivity.access$3620(OSLiveViewActivity.this, 1);
            if (OSLiveViewActivity.this.focusNum > 0) {
                OSLiveViewActivity.this.mFocusHandler.sendEmptyMessageDelayed(OSLiveViewActivity.ZOOM_OUT, 10L);
                if (OSLiveViewActivity.this.focusNum == 50) {
                    OSLiveViewActivity.this.zoomOut();
                }
            }
        }
    };
    public Handler moveHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            HiLogcatUtil.d("moveHandler   ##################isLongPress:" + OSLiveViewActivity.this.isLongPress);
            int i = message.what;
            switch (i) {
                case OSLiveViewActivity.MOVE_UP_DELAY:
                    HiLogcatUtil.d("MOVE_UP ##################-------------isLongPress =" + OSLiveViewActivity.this.isLongPress);
                    if (OSLiveViewActivity.this.isLongPress) {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 0, OSLiveViewActivity.this.speed, (short) OSLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 1, OSLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                case OSLiveViewActivity.MOVE_DOWN_DELAY:
                    HiLogcatUtil.d("MOVE_DOWN ##################-------------isLongPress =" + OSLiveViewActivity.this.isLongPress);
                    if (OSLiveViewActivity.this.isLongPress) {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 0, OSLiveViewActivity.this.speed, (short) OSLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 1, OSLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                case OSLiveViewActivity.MOVE_LEFT_DELAY:
                    HiLogcatUtil.d("MOVE_LEFT ##################-------------isLongPress =" + OSLiveViewActivity.this.isLongPress);
                    if (OSLiveViewActivity.this.isLongPress) {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 0, OSLiveViewActivity.this.speed, (short) OSLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 1, OSLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                case OSLiveViewActivity.MOVE_RIGHT_DELAY:
                    HiLogcatUtil.d("MOVE_RIGHT ##################-----------isLongPress =" + OSLiveViewActivity.this.isLongPress);
                    if (OSLiveViewActivity.this.isLongPress) {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 0, OSLiveViewActivity.this.speed, (short) OSLiveViewActivity.this.u32TurnTime));
                        return;
                    } else {
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 1, OSLiveViewActivity.this.speed, (short) 20));
                        return;
                    }
                default:
                    switch (i) {
                        case OSLiveViewActivity.MOVE_UP:
                            OSLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSLiveViewActivity.MOVE_UP_DELAY, 400L);
                            return;
                        case OSLiveViewActivity.MOVE_DOWN:
                            OSLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSLiveViewActivity.MOVE_DOWN_DELAY, 400L);
                            return;
                        case OSLiveViewActivity.MOVE_LEFT:
                            OSLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSLiveViewActivity.MOVE_LEFT_DELAY, 400L);
                            return;
                        case OSLiveViewActivity.MOVE_RIGHT:
                            OSLiveViewActivity.this.moveHandler.sendEmptyMessageDelayed(OSLiveViewActivity.MOVE_RIGHT_DELAY, 400L);
                            return;
                        default:
                            return;
                    }
            }
        }
    };
    private Handler mHandler_lockScreen = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                OSLiveViewActivity.this.root_lock_screen.setVisibility(0);
                OSLiveViewActivity.this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
            } else {
                OSLiveViewActivity.this.root_lock_screen.setVisibility(8);
                OSLiveViewActivity.this.mHandler_lockScreen.removeCallbacksAndMessages(null);
            }
        }
    };
    private boolean isNeedFinish = false;
    private boolean isDoPause = true;

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

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

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

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

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

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

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

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

    static int access$3612(OSLiveViewActivity oSLiveViewActivity, int i) {
        int i2 = oSLiveViewActivity.focusNum + i;
        oSLiveViewActivity.focusNum = i2;
        return i2;
    }

    static int access$3620(OSLiveViewActivity oSLiveViewActivity, int i) {
        int i2 = oSLiveViewActivity.focusNum - i;
        oSLiveViewActivity.focusNum = i2;
        return i2;
    }

    static int access$908(OSLiveViewActivity oSLiveViewActivity) {
        int i = oSLiveViewActivity.mPercentage;
        oSLiveViewActivity.mPercentage = i + 1;
        return i;
    }

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

    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) {
                    OSLiveViewActivity.this.lambda$getDevRunMode$0$OSLiveViewActivity(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$OSLiveViewActivity(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) {
                OSLiveViewActivity.this.lambda$setDevRunMode$1$OSLiveViewActivity(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$OSLiveViewActivity(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 void WakeUp() {
        wakeUpAndConnect(this.mMyCamera);
        this.mAnimHandler.sendEmptyMessageDelayed(1180, 100L);
        this.tv_percentage.setVisibility(0);
    }

    private void startLiveShow() {
        if (this.mMyCamera != null) {
            new Thread() {
                @Override
                public void run() {
                    if (!HiDataValue.isNeedkillNoMain) {
                        OSLiveViewActivity.this.mMyCamera.startLiveShow(OSLiveViewActivity.this.mMyCamera.getVideoQuality(), OSLiveViewActivity.this.mMonitor);
                    } else {
                        OSLiveViewActivity.this.mMyCamera.setLiveShowMonitor(OSLiveViewActivity.this.mMonitor);
                    }
                    HiDataValue.isNeedkillNoMain = false;
                }
            }.start();
        }
    }

    private void initViewPager() {
        resetViewPager();
        OSFirstTabFragment oSFirstTabFragment = new OSFirstTabFragment();
        this.osFirstTabFragment = oSFirstTabFragment;
        oSFirstTabFragment.setmMyCamera(this.mMyCamera);
        OSSecondTabFragment oSSecondTabFragment = new OSSecondTabFragment();
        this.osSecondTabFragment = oSSecondTabFragment;
        oSSecondTabFragment.setCamera(this.mMyCamera);
        boolean appGetCommandFunction = this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_CONTROL);
        this.supportZoom = appGetCommandFunction;
        if (appGetCommandFunction) {
            this.iv_third_tab.setVisibility(0);
            this.ll_focus_layout.setVisibility(0);
            this.ll_move_layout.setVisibility(0);
            OSThirdTabFragment oSThirdTabFragment = new OSThirdTabFragment();
            this.osThirdTabFragment = oSThirdTabFragment;
            oSThirdTabFragment.setCamera(this.mMyCamera);
            this.viewPager.setOffscreenPageLimit(4);
        }
        this.fragments.add(this.osFirstTabFragment);
        if (this.supportZoom) {
            this.fragments.add(this.osThirdTabFragment);
        }
        this.fragments.add(this.osSecondTabFragment);
        OSVpAdapter oSVpAdapter = new OSVpAdapter(getSupportFragmentManager(), this.fragments);
        this.mVpAdapter = oSVpAdapter;
        this.viewPager.setAdapter(oSVpAdapter);
        this.onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                HiLogcatUtil.i("OSLiveViewActivity-> onGlobalLayout->viewPager.getHeight(): " + OSLiveViewActivity.this.viewPager.getHeight());
                OSLiveViewActivity.this.viewPager.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                OSLiveViewActivity.this.osFirstTabFragment.initHeight(OSLiveViewActivity.this.viewPager.getHeight());
                OSLiveViewActivity.this.osSecondTabFragment.initHeight(OSLiveViewActivity.this.viewPager.getHeight());
                if (OSLiveViewActivity.this.osThirdTabFragment != null) {
                    OSLiveViewActivity.this.osThirdTabFragment.initHeight(OSLiveViewActivity.this.viewPager.getHeight());
                }
                OSLiveViewActivity.this.setViewWhetherClick(false);
            }
        };
        this.viewPager.getViewTreeObserver().addOnGlobalLayoutListener(this.onGlobalLayoutListener);
        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 (OSLiveViewActivity.this.fragments.size() != 3) {
                    if (OSLiveViewActivity.this.fragments.size() == 2) {
                        if (i == 0) {
                            OSLiveViewActivity.this.iv_first_tab.setSelected(true);
                            OSLiveViewActivity.this.iv_second_tab.setSelected(false);
                            return;
                        } else {
                            if (i == 1) {
                                OSLiveViewActivity.this.iv_first_tab.setSelected(false);
                                OSLiveViewActivity.this.iv_second_tab.setSelected(true);
                                return;
                            }
                            return;
                        }
                    }
                    return;
                }
                if (i == 0) {
                    OSLiveViewActivity.this.iv_first_tab.setSelected(true);
                    OSLiveViewActivity.this.iv_second_tab.setSelected(false);
                    OSLiveViewActivity.this.iv_third_tab.setSelected(false);
                } else if (i == 1) {
                    OSLiveViewActivity.this.iv_first_tab.setSelected(false);
                    OSLiveViewActivity.this.iv_second_tab.setSelected(false);
                    OSLiveViewActivity.this.iv_third_tab.setSelected(true);
                } else if (i == 2) {
                    OSLiveViewActivity.this.iv_first_tab.setSelected(false);
                    OSLiveViewActivity.this.iv_second_tab.setSelected(true);
                    OSLiveViewActivity.this.iv_third_tab.setSelected(false);
                }
            }
        });
        this.rl_wrap.setVisibility(8);
        this.btn_floating_window.setVisibility(8);
        this.rl_viewPager.setAlpha(0.3f);
        this.viewPager.setCanScroll(false);
    }

    private void resetViewPager() {
        this.fragments.clear();
        OSVpAdapter oSVpAdapter = this.mVpAdapter;
        if (oSVpAdapter != null) {
            oSVpAdapter.notifyDataSetChanged();
        }
        if (this.osFirstTabFragment != null) {
            this.osFirstTabFragment = null;
        }
        if (this.osSecondTabFragment != null) {
            this.osSecondTabFragment = null;
        }
        if (this.osThirdTabFragment != null) {
            this.osThirdTabFragment = null;
        }
        if (this.mVpAdapter != null) {
            this.mVpAdapter = null;
        }
        MyViewPager myViewPager = this.viewPager;
        if (myViewPager != null) {
            myViewPager.clearOnPageChangeListeners();
            if (this.onGlobalLayoutListener != null) {
                this.viewPager.getViewTreeObserver().removeOnGlobalLayoutListener(this.onGlobalLayoutListener);
            }
        }
    }

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

    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;
        } else if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_WHITE_LIGHT_GET_EXT)) {
            this.lightModel = 1;
        } else if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_WHITE_LIGHT_GET)) {
            this.lightModel = 2;
        }
    }

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

    private void setListeners() {
        this.mMonitor.setOnTouchListener(this);
        this.tv_video_quality.setOnClickListener(this);
        this.iv_landscape_listen.setOnClickListener(this);
        this.iv_landscape_talk.setOnClickListener(this);
        this.tv_landscape_video_quality.setOnClickListener(this);
        this.tv_landscape_video_adaption.setOnClickListener(this);
        this.btn_return.setOnClickListener(this);
        this.iv_setting.setOnClickListener(this);
        this.tv_know.setOnClickListener(this);
        this.rl_guide_monitor.setOnTouchListener(this);
        this.ll_land_return.setOnClickListener(this);
        this.iv_land_more.setOnClickListener(this);
        this.iv_landscape_record.setOnClickListener(this);
        this.iv_land_snapshot.setOnClickListener(this);
        this.iv_full_screen.setOnClickListener(this);
        this.iv_full_screen.setClickable(false);
        this.iv_ydzz_land.setOnClickListener(this);
        this.iv_playback.setOnClickListener(this);
        this.iv_playback.setClickable(false);
        this.focusGap = this.mMonitor.screen_width / 100;
        this.iv_zoom_in.setOnTouchListener(this);
        this.iv_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.btn_floating_window.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;
            }
        }
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            this.mCameraVideoQuality = myCamera.getVideoQuality();
            int i = SharePreUtils.getInt(HiDataValue.CACHE, this, "pictureSize" + HiDataValue.userAccount + this.mMyCamera.getUid());
            this.mPictureSize = i;
            if (i == -1) {
                this.mPictureSize = 0;
            }
            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, 300.0f);
        this.mMonitorHeight = (HiTools.getScreenW(this) * 2) / 3;
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            this.mFloatingWindow = new FloatingWindow(this, myCamera, HiTools.getScreenW(this), false);
        }
        this.mMonitor.setCamera(this.mMyCamera);
        showPlaceLoadingView();
        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) {
                    OSLiveViewActivity.this.iv_placeholder.setImageBitmap(bitmap);
                }
            });
        } else {
            this.iv_placeholder.setImageResource(R.mipmap.videoclip);
        }
        this.title_middle.setText(this.mMyCamera.getNikeName());
        this.mMyCamera.setLiveShowMonitor(this.mMonitor);
        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));
        this.tv_landscape_video_adaption.setText(getString(this.mPictureSize == 0 ? R.string.picture_size_fill : R.string.picture_size_adaption));
        this.tv_uid.setText(this.mMyCamera.getUid());
        this.mIsHaveVirtual = HiTools.checkDeviceHasNavigationBar(this);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
        this.mMonitor.setLayoutParams(layoutParams);
        this.iv_placeholder.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -2);
        layoutParams2.setMargins(10, this.mMonitorHeight - HiTools.dip2px(this, 42.0f), HiTools.dip2px(this, 10.0f), 3);
        this.rl_wrap.setLayoutParams(layoutParams2);
        if (this.mIsHaveVirtual) {
            RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams3.setMargins(10, this.mMonitorHeight - HiTools.dip2px(this, 42.0f), 10, 3);
            this.rl_wrap.setLayoutParams(layoutParams3);
        }
        this.iv_first_tab.setSelected(true);
    }

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

    public class AnonymousClass5 extends AnimatorListenerAdapter {
        AnonymousClass5() {
        }

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

            class C03081 extends AnimatorListenerAdapter {
                C03081() {
                }

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

                class C03091 extends AnimatorListenerAdapter {
                    C03091() {
                    }

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

                    class C03101 extends AnimatorListenerAdapter {
                        C03101() {
                        }

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

                        class C03111 extends AnimatorListenerAdapter {
                            C03111() {
                            }

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

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

    @Override
    public void onResume() {
        super.onResume();
        if (!this.isDoPause) {
            this.isDoPause = true;
            return;
        }
        if (this.mMyCamera.getConnectState() != 4) {
            WakeUp();
        } else {
            startLiveShow();
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (OSLiveViewActivity.this.isLarge == 1) {
                    OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                    oSLiveViewActivity.resetMonitorSize(true, oSLiveViewActivity.nLenStart);
                } else if (OSLiveViewActivity.this.isLarge == 2) {
                    OSLiveViewActivity oSLiveViewActivity2 = OSLiveViewActivity.this;
                    oSLiveViewActivity2.resetMonitorSize(false, oSLiveViewActivity2.nLenStart);
                }
            }
        }, 100L);
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        this.mFloatingWindow.dismiss();
        if (HiDataValue.isOrientation) {
            if (this.isLeft) {
                setRequestedOrientation(0);
            } else {
                setRequestedOrientation(8);
            }
        } else {
            setRequestedOrientation(1);
        }
        OSSecondTabFragment oSSecondTabFragment = this.osSecondTabFragment;
        if (oSSecondTabFragment != null) {
            oSSecondTabFragment.RegisterMyCamera();
        }
    }

    @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.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();
        }
        MyCamera myCamera3 = this.mMyCamera;
        if (myCamera3 != null) {
            myCamera3.Wol_WakeUpStop();
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitor;
        if (myLiveViewGLMonitor != null) {
            myLiveViewGLMonitor.FreeMonitor();
            this.mMonitor = null;
        }
        this.mFloatingWindow.dismiss();
        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 myCamera4 = this.mMyCamera;
        if (myCamera4 != null) {
            myCamera4.clearMonitor(this.mMonitor);
        }
        if (HiTools.dialogUtilsAgreements != null) {
            HiTools.dialogUtilsAgreements.build().dismiss();
        }
    }

    @Override
    public void onBackPressed() {
        if (this.mMonitor.getmIsFullScreen() == 0) {
            OSSecondTabFragment oSSecondTabFragment = this.osSecondTabFragment;
            if (oSSecondTabFragment != null && oSSecondTabFragment.mPopupWindow != null && this.osSecondTabFragment.mPopupWindow.isShowing()) {
                this.osSecondTabFragment.mPopupWindow.dismiss();
            }
            super.onBackPressed();
            return;
        }
        PopupWindow popupWindow = this.mPopupWindow;
        if (popupWindow != null && popupWindow.isShowing()) {
            this.mPopupWindow.dismiss();
        }
        Handler handler = this.mHandler;
        if (handler != null) {
            handler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    OSLiveViewActivity.this.lambda$onBackPressed$2$OSLiveViewActivity();
                }
            }, 400L);
        } else {
            setRequestedOrientation(1);
        }
        this.mIsClickReturn = true;
        releaseLockScreen();
        handTalkingBack();
    }

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

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

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

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

    @Override
    public void callbackState(HiCamera hiCamera, int i, int i2, int i3) {
        if (this.mMyCamera != hiCamera) {
            return;
        }
        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);
    }

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

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

    private void handCloudStep(MotionEvent motionEvent) {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        int i = displayMetrics.widthPixels;
        if (this.mMonitor.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;
            }
            short s = 58;
            if (this.mMyCamera.getChipVersion() == 1 && this.mMyCamera.getDeviceType() != 3) {
                s = 25;
            }
            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, s, (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, s, (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, s, (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, s, (short) ceil2));
            }
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        if (view.getId() == R.id.live_monitor) {
            int pointerCount = motionEvent.getPointerCount();
            if ((motionEvent.getAction() & 255) == 5 && 2 == pointerCount) {
                if (this.supportZoom) {
                    return false;
                }
                this.mMonitor.setTouchMove(2);
                for (int i = 0; i < pointerCount; i++) {
                    new Point((int) motionEvent.getX(i), (int) motionEvent.getY(i));
                }
                this.xlenOld = Math.abs(((int) motionEvent.getX(0)) - ((int) motionEvent.getX(1)));
                int abs = Math.abs(((int) motionEvent.getY(0)) - ((int) motionEvent.getY(1)));
                this.ylenOld = abs;
                int i2 = this.xlenOld;
                this.nLenStart = Math.sqrt((i2 * i2) + (abs * abs));
            } else {
                if ((motionEvent.getAction() & 255) == 2 && 2 == pointerCount) {
                    if (this.supportZoom) {
                        return false;
                    }
                    this.mMonitor.setTouchMove(2);
                    for (int i3 = 0; i3 < pointerCount; i3++) {
                        new Point((int) motionEvent.getX(i3), (int) motionEvent.getY(i3));
                    }
                    int abs2 = Math.abs(((int) motionEvent.getX(0)) - ((int) motionEvent.getX(1)));
                    int abs3 = Math.abs(((int) motionEvent.getY(0)) - ((int) motionEvent.getY(1)));
                    int abs4 = Math.abs(abs2 - this.xlenOld);
                    int abs5 = Math.abs(abs3 - this.ylenOld);
                    double d = abs2;
                    double d2 = abs3;
                    double sqrt = Math.sqrt((d * d) + (d2 * d2));
                    if (abs4 < 20 && abs5 < 20) {
                        return false;
                    }
                    if (sqrt > this.nLenStart) {
                        resetMonitorSize(true, sqrt);
                    } else {
                        resetMonitorSize(false, sqrt);
                    }
                    this.xlenOld = abs2;
                    this.ylenOld = abs3;
                    this.nLenStart = sqrt;
                    return true;
                }
                if (pointerCount != 1 || (this.mMonitor.getmIsFullScreen() == 1 && this.mMonitor.getState() == 1 && this.ll_move_layout.getVisibility() == 0)) {
                    return false;
                }
                int action = motionEvent.getAction();
                if (action == 0) {
                    this.down_X = motionEvent.getRawX();
                    this.down_Y = motionEvent.getRawY();
                    this.action_down_x = motionEvent.getRawX();
                    float rawY = motionEvent.getRawY();
                    this.action_down_y = rawY;
                    this.lastX = this.action_down_x;
                    this.lastY = rawY;
                    this.mMonitor.setTouchMove(0);
                } else if (action != 1) {
                    if (action == 2 && this.mMonitor.getTouchMove() == 0) {
                        this.move_x = motionEvent.getRawX();
                        this.move_y = motionEvent.getRawY();
                    }
                } else if (this.mMonitor.getTouchMove() == 0 && this.mMonitor.getState() == 0) {
                    float rawX = motionEvent.getRawX();
                    float rawY2 = motionEvent.getRawY();
                    float f = rawX - this.down_X;
                    float f2 = rawY2 - this.down_Y;
                    if (f > 0.0f && Math.abs(f) > Math.abs(f2)) {
                        int abs6 = (int) ((Math.abs(f) / (this.mMonitor.screen_width / 2)) * 100.0f);
                        if (abs6 > 100) {
                            abs6 = 100;
                        }
                        if (abs6 <= 0) {
                            abs6 = 1;
                        }
                        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 2, 1, (short) 58, (short) abs6));
                    }
                    if (f < 0.0f && Math.abs(f) > Math.abs(f2)) {
                        int abs7 = (int) ((Math.abs(f) / (this.mMonitor.screen_width / 2)) * 100.0f);
                        if (abs7 > 100) {
                            abs7 = 100;
                        }
                        if (abs7 <= 0) {
                            abs7 = 1;
                        }
                        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 1, 1, (short) 58, (short) abs7));
                    }
                    if (f2 > 0.0f && Math.abs(f2) > Math.abs(f)) {
                        int abs8 = (int) ((Math.abs(f2) / (this.mMonitor.screen_width / 2)) * 100.0f);
                        if (abs8 > 100) {
                            abs8 = 100;
                        }
                        if (abs8 <= 0) {
                            abs8 = 1;
                        }
                        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 4, 1, (short) 58, (short) abs8));
                    }
                    if (f2 < 0.0f && Math.abs(f2) > Math.abs(f)) {
                        int abs9 = (int) ((Math.abs(f2) / (this.mMonitor.screen_width / 2)) * 100.0f);
                        int i4 = abs9 <= 100 ? abs9 : 100;
                        if (i4 <= 0) {
                            i4 = 1;
                        }
                        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 3, 1, (short) 58, (short) i4));
                    }
                }
            }
        } else {
            if (view.getId() == R.id.rl_guide_monitor) {
                handGuideMonitor(motionEvent);
                return true;
            }
            if (view.getId() == R.id.iv_zoom_in) {
                Log.e("test", "onTouch: " + motionEvent.getAction());
                if (motionEvent.getAction() == 0) {
                    OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
                    if (orientationWatchDog != null) {
                        orientationWatchDog.setCloseOrientation(true);
                    }
                    this.iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus_press);
                    this.touchTimeDown = System.currentTimeMillis();
                    if (this.mFocusHandler.hasMessages(ZOOM_IN)) {
                        stopZoom(1);
                    }
                    if (this.focusNum >= 200) {
                        zoomIn();
                    }
                    if (!this.mFocusHandler.hasMessages(ZOOM_OUT) && !this.mFocusHandler.hasMessages(ZOOM_IN)) {
                        this.type = 0;
                        this.mFocusHandler.sendEmptyMessage(ZOOM_IN);
                    }
                } else if (motionEvent.getAction() == 1) {
                    OrientationWatchDog orientationWatchDog2 = this.mOrientationWatchDog;
                    if (orientationWatchDog2 != null) {
                        orientationWatchDog2.setCloseOrientation(false);
                    }
                    this.iv_zoom_in.setBackgroundResource(R.drawable.shape_button_focus);
                    long currentTimeMillis = System.currentTimeMillis();
                    this.touchTimeUp = currentTimeMillis;
                    if (currentTimeMillis - this.touchTimeDown < 500) {
                        this.type = 1;
                    } else {
                        this.type = -1;
                    }
                    stopZoom(0);
                }
                return true;
            }
            if (view.getId() == R.id.iv_zoom_out) {
                if (motionEvent.getAction() == 0) {
                    OrientationWatchDog orientationWatchDog3 = this.mOrientationWatchDog;
                    if (orientationWatchDog3 != null) {
                        orientationWatchDog3.setCloseOrientation(true);
                    }
                    this.iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus_press);
                    this.touchTimeDown = System.currentTimeMillis();
                    if (this.mFocusHandler.hasMessages(ZOOM_OUT)) {
                        stopZoom(1);
                    }
                    if (this.focusNum <= 0) {
                        zoomOut();
                    }
                    if (!this.mFocusHandler.hasMessages(ZOOM_OUT) && !this.mFocusHandler.hasMessages(ZOOM_IN)) {
                        this.type = 0;
                        this.mFocusHandler.sendEmptyMessage(ZOOM_OUT);
                    }
                } else if (motionEvent.getAction() == 1) {
                    OrientationWatchDog orientationWatchDog4 = this.mOrientationWatchDog;
                    if (orientationWatchDog4 != null) {
                        orientationWatchDog4.setCloseOrientation(false);
                    }
                    this.iv_zoom_out.setBackgroundResource(R.drawable.shape_button_focus);
                    long currentTimeMillis2 = System.currentTimeMillis();
                    this.touchTimeUp = currentTimeMillis2;
                    if (currentTimeMillis2 - this.touchTimeDown < 500) {
                        this.type = 1;
                    } else {
                        this.type = -1;
                    }
                    stopZoom(0);
                }
                return true;
            }
            if (view.getId() == R.id.iv_move_up) {
                if (motionEvent.getAction() == 0) {
                    OrientationWatchDog orientationWatchDog5 = this.mOrientationWatchDog;
                    if (orientationWatchDog5 != null) {
                        orientationWatchDog5.setCloseOrientation(true);
                    }
                    this.iv_move_up.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) {
                    OrientationWatchDog orientationWatchDog6 = this.mOrientationWatchDog;
                    if (orientationWatchDog6 != null) {
                        orientationWatchDog6.setCloseOrientation(false);
                    }
                    this.iv_move_up.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) {
                if (motionEvent.getAction() == 0) {
                    OrientationWatchDog orientationWatchDog7 = this.mOrientationWatchDog;
                    if (orientationWatchDog7 != null) {
                        orientationWatchDog7.setCloseOrientation(true);
                    }
                    this.iv_move_down.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) {
                    OrientationWatchDog orientationWatchDog8 = this.mOrientationWatchDog;
                    if (orientationWatchDog8 != null) {
                        orientationWatchDog8.setCloseOrientation(false);
                    }
                    this.iv_move_down.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) {
                if (motionEvent.getAction() == 0) {
                    OrientationWatchDog orientationWatchDog9 = this.mOrientationWatchDog;
                    if (orientationWatchDog9 != null) {
                        orientationWatchDog9.setCloseOrientation(true);
                    }
                    this.iv_move_left.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) {
                    OrientationWatchDog orientationWatchDog10 = this.mOrientationWatchDog;
                    if (orientationWatchDog10 != null) {
                        orientationWatchDog10.setCloseOrientation(false);
                    }
                    this.iv_move_left.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) {
                if (motionEvent.getAction() == 0) {
                    OrientationWatchDog orientationWatchDog11 = this.mOrientationWatchDog;
                    if (orientationWatchDog11 != null) {
                        orientationWatchDog11.setCloseOrientation(true);
                    }
                    this.iv_move_right.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) {
                    OrientationWatchDog orientationWatchDog12 = this.mOrientationWatchDog;
                    if (orientationWatchDog12 != null) {
                        orientationWatchDog12.setCloseOrientation(false);
                    }
                    this.iv_move_right.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;
            }
        }
        return false;
    }

    public void resetMonitorSize(boolean z, double d) {
        this.isLarge = z ? 1 : 2;
        if (this.mMonitor.getmIsFullScreen() == 0) {
            this.mMonitor.screen_height = this.mMonitorHeight;
        }
        if (this.mMonitor.height == 0 && this.mMonitor.width == 0) {
            initMatrix(this.mMonitor.screen_width, this.mMonitor.screen_height);
        }
        this.moveX = (int) (d / 2.0d);
        this.moveY = (int) (((d * this.mMonitor.screen_height) / this.mMonitor.screen_width) / 2.0d);
        if (z) {
            if (this.mMonitor.width <= this.mMonitor.screen_width * 2 && this.mMonitor.height <= this.mMonitor.screen_height * 2) {
                this.mMonitor.left -= this.moveX / 2;
                this.mMonitor.bottom -= this.moveY / 2;
                this.mMonitor.width += this.moveX;
                this.mMonitor.height += this.moveY;
            }
        } else {
            this.mMonitor.left += this.moveX / 2;
            this.mMonitor.bottom += this.moveY / 2;
            this.mMonitor.width -= this.moveX;
            this.mMonitor.height -= this.moveY;
            if (this.mMonitor.bottom + this.mMonitor.height < this.mMonitor.screen_height) {
                MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitor;
                myLiveViewGLMonitor.bottom = myLiveViewGLMonitor.screen_height - this.mMonitor.height;
            }
            if (this.mMonitor.left + this.mMonitor.width < this.mMonitor.screen_width) {
                MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor;
                myLiveViewGLMonitor2.left = myLiveViewGLMonitor2.screen_width - this.mMonitor.width;
            }
        }
        if (this.mMonitor.left > 0 || this.mMonitor.width < this.mMonitor.screen_width || this.mMonitor.height < this.mMonitor.screen_height || this.mMonitor.bottom > 0) {
            if (this.focusNum >= 1) {
                if (this.mMonitor.left > 0) {
                    this.mMonitor.left = 0;
                }
                if (this.mMonitor.bottom > 0) {
                    this.mMonitor.bottom = 0;
                }
            } else {
                initMatrix(this.mMonitor.screen_width, this.mMonitor.screen_height);
            }
        }
        if (this.mMonitor.width > this.mMonitor.screen_width) {
            this.mMonitor.setState(1);
        } else {
            this.mMonitor.setState(0);
        }
        MyLiveViewGLMonitor myLiveViewGLMonitor3 = this.mMonitor;
        myLiveViewGLMonitor3.setMatrix(myLiveViewGLMonitor3.left, this.mMonitor.bottom, this.mMonitor.width, this.mMonitor.height);
    }

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

    public void handMsgSessionState(Message message) {
        MyCamera myCamera;
        int i = message.arg1;
        if (i == 0) {
            HiDataValue.isNeedkillNoMain = false;
            FloatingWindow floatingWindow = this.mFloatingWindow;
            if (floatingWindow != null) {
                floatingWindow.dismiss();
            }
            if (this.osFirstTabFragment.iv_listen.isSelected()) {
                this.osFirstTabFragment.iv_listen.setSelected(false);
            }
            if (this.osFirstTabFragment.iv_duijiang.isSelected()) {
                this.osFirstTabFragment.iv_duijiang.setSelected(false);
            }
            if (this.osFirstTabFragment.iv_record.isSelected()) {
                this.osFirstTabFragment.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() {
                        OSLiveViewActivity.this.lambda$handMsgSessionState$3$OSLiveViewActivity();
                    }
                }, 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;
                    return;
                }
                return;
            }
            return;
        }
        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);
            }
            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");
        HiLogcatUtil.d("OSLiveViewActivity-->" + this.mMyCamera.getUid() + " receive CAMERA_CONNECTION_STATE_LOGIN");
        StringBuilder sb = new StringBuilder();
        sb.append("SUPPORT HI_P2P_PTZ_CONTROL--> ");
        sb.append(this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_CONTROL));
        HiLogcatUtil.d(sb.toString());
        boolean appGetCommandFunction = this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_CONTROL);
        this.supportZoom = appGetCommandFunction;
        if (appGetCommandFunction && !this.mIsSwitchResolution) {
            this.ll_focus_layout.setVisibility(0);
            this.ll_move_layout.setVisibility(0);
            if (this.fragments.size() < 3) {
                initViewPager();
            }
        }
        startLiveShow();
        MyCamera myCamera4 = this.mMyCamera;
        if (myCamera4 != null) {
            myCamera4.Wol_WakeUpStop();
        }
        this.mIsSwitchResolution = false;
        this.progressbar.setVisibility(8);
        if (this.mCameraVideoQuality != this.mMyCamera.getVideoQuality()) {
            this.mMyCamera.stopRecording();
            Timer timer = this.timer;
            if (timer != null) {
                timer.cancel();
                this.timer = null;
            }
            TimerTask timerTask = this.timerTask;
            if (timerTask != null) {
                timerTask.cancel();
                this.timerTask = null;
            }
        }
        this.mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (OSLiveViewActivity.this.mMyCamera.getCameraLevel() == 1) {
                    if (OSLiveViewActivity.this.mMyCamera.isBindCurrentAccount() == 2) {
                        OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                        ToastUtil.showShort(oSLiveViewActivity, oSLiveViewActivity.getString(R.string.isbind_camera));
                        OSLiveViewActivity.this.finish();
                        return;
                    } else {
                        if ("admin".equals(OSLiveViewActivity.this.mMyCamera.getPassword())) {
                            OSLiveViewActivity oSLiveViewActivity2 = OSLiveViewActivity.this;
                            ToastUtil.showShort(oSLiveViewActivity2, oSLiveViewActivity2.getString(R.string.psw_hint));
                            OSLiveViewActivity.this.finish();
                            return;
                        }
                        return;
                    }
                }
                if (OSLiveViewActivity.this.mMyCamera.isBindCurrentAccount() == 2) {
                    OSLiveViewActivity oSLiveViewActivity3 = OSLiveViewActivity.this;
                    ToastUtil.showShort(oSLiveViewActivity3, oSLiveViewActivity3.getString(R.string.share_already_unbind));
                    OSLiveViewActivity.this.finish();
                }
            }
        }, 1000L);
    }

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

    public void handMsgReceiveIoctrl(Message message) {
        if (message.arg2 == 0) {
            handIOSuccess(message);
            return;
        }
        dismissLoadingView();
        int i = message.arg1;
        if (i != 4097) {
            if (i == 18453) {
                MyToast.showToast(this, getString(R.string.application_fail));
                return;
            }
            if (i == 65540) {
                this.ll_battery.setVisibility(0);
                this.batterview.setPower(0.1f);
                return;
            } else {
                if (i != 65586) {
                    return;
                }
                if (this.mFlagPreset == 1) {
                    MyToast.showToast(this, getString(R.string.tip_preset_fail));
                }
                if (this.mFlagPreset == 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());
        this.mIsSwitchResolution = false;
        setViewWhetherClick(true);
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null && myCamera.getVideoQuality() != this.mQuality) {
            this.mQuality = this.mMyCamera.getVideoQuality();
            MyCamera myCamera2 = this.mMyCamera;
            myCamera2.ChangeStream(myCamera2.getVideoQuality());
        } else {
            Toast.makeText(getApplicationContext(), getString(R.string.tips_open_video_fail), 0).show();
            finish();
        }
    }

    private void handIOSuccess(Message message) {
        String string;
        byte[] byteArray = message.getData().getByteArray("data");
        if (byteArray == null) {
            return;
        }
        int i = message.arg1;
        if (i == 12561) {
            HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr = new HiChipDefines.HI_P2P_S_AUDIO_ATTR(byteArray);
            this.audio_attr = hi_p2p_s_audio_attr;
            if (hi_p2p_s_audio_attr.u32InMode == 0) {
                this.mInputMethod = 0;
            } else if (this.audio_attr.u32InMode == 1) {
                this.mInputMethod = 1;
            }
            if (this.mMonitor.getmIsFullScreen() == 1) {
                View inflate = View.inflate(this, R.layout.view_land_volume, null);
                handLandShowContent(inflate);
                if (this.mMyCamera.getChipVersion() == 1) {
                    this.maxInputValue = 16;
                    this.maxOutputValue = 13;
                }
                this.seekbar_input = (SeekBar) inflate.findViewById(R.id.seekbar_input);
                final TextView textView = (TextView) inflate.findViewById(R.id.txt_input_value);
                HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr2 = this.audio_attr;
                if (hi_p2p_s_audio_attr2 != null) {
                    this.seekbar_input.setProgress(hi_p2p_s_audio_attr2.u32InVol - 1);
                    textView.setText(String.valueOf(this.audio_attr.u32InVol));
                }
                this.seekbar_input.setMax(this.maxInputValue - 1);
                this.seekbar_input.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                    }

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

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                        textView.setText(String.valueOf(seekBar.getProgress() + 1));
                        OSLiveViewActivity.this.sendToDevice();
                    }
                });
                this.seekbar_output = (SeekBar) inflate.findViewById(R.id.seekbar_output);
                final TextView textView2 = (TextView) inflate.findViewById(R.id.txt_output_value);
                HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr3 = this.audio_attr;
                if (hi_p2p_s_audio_attr3 != null) {
                    this.seekbar_output.setProgress(hi_p2p_s_audio_attr3.u32OutVol - 1);
                    textView2.setText(String.valueOf(this.audio_attr.u32OutVol));
                }
                this.seekbar_output.setMax(this.maxOutputValue - 1);
                this.seekbar_output.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                    @Override
                    public void onStartTrackingTouch(SeekBar seekBar) {
                    }

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

                    @Override
                    public void onStopTrackingTouch(SeekBar seekBar) {
                        textView2.setText(String.valueOf(seekBar.getProgress() + 1));
                        OSLiveViewActivity.this.sendToDevice();
                    }
                });
                return;
            }
            View.inflate(this, R.layout.view_volume, null);
            return;
        }
        if (i != 12562) {
            switch (i) {
                case 4097:
                    this.video_width = Packet.byteArrayToInt_Little(byteArray, 4);
                    int byteArrayToInt_Little = Packet.byteArrayToInt_Little(byteArray, 8);
                    this.video_height = byteArrayToInt_Little;
                    int i2 = this.video_width;
                    if (i2 <= 0 || byteArrayToInt_Little <= 0 || i2 > 5000 || byteArrayToInt_Little > 5000) {
                        MyToast.showToast(this, getString(R.string.tips_open_video_fail));
                        finish();
                        return;
                    }
                    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;
                    }
                    this.tv_connect_num.setText(hi_p2p_get_dev_info_ext.sUserNum + "");
                    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.mMonitor.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.mMonitor.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.mMonitor.getmIsFullScreen() == 1) {
                        showPupLight();
                        return;
                    }
                    return;
                case ConstantCommand.HI_P2P_SET_IMAGE_PARAM:
                    break;
                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;
                    }
                    this.tv_connect_num.setText(hi_p2p_s_dev_info.sUserNum + "");
                    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 i3 = hi_p2p_s_dev_status_resp.sSignalIntensity;
                        if (i3 == -1) {
                            this.wifi_info.setWiFiSignal(0);
                        } else if (i3 == 0) {
                            this.wifi_info.setWiFiSignal(2);
                        } else if (i3 == 1) {
                            this.wifi_info.setWiFiSignal(1);
                        } else if (i3 == 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_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_GET_PTZ_SPEED:
                    final ConstantCommand.HI_P2P_S_PTZ_SPEED_PARAM hi_p2p_s_ptz_speed_param = new ConstantCommand.HI_P2P_S_PTZ_SPEED_PARAM(byteArray);
                    View inflate2 = View.inflate(this, R.layout.view_land_speed, null);
                    handLandShowContent(inflate2);
                    TextView textView3 = (TextView) inflate2.findViewById(R.id.tv_self_check);
                    if (this.isSupportPTZTest) {
                        textView3.setVisibility(0);
                    }
                    SeekBar seekBar = (SeekBar) inflate2.findViewById(R.id.seekbar_speed);
                    final TextView textView4 = (TextView) inflate2.findViewById(R.id.txt_speed_value);
                    seekBar.setProgress(hi_p2p_s_ptz_speed_param.u8Speed - hi_p2p_s_ptz_speed_param.u8MinSpeed);
                    textView4.setText(String.valueOf(hi_p2p_s_ptz_speed_param.u8Speed));
                    textView3.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            HiLogcatUtil.i("云台自检");
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_SELFTEST, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 24, 1, (short) 58, (short) 20));
                        }
                    });
                    seekBar.setMax(hi_p2p_s_ptz_speed_param.u8MaxSpeed - hi_p2p_s_ptz_speed_param.u8MinSpeed);
                    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                        @Override
                        public void onStartTrackingTouch(SeekBar seekBar2) {
                        }

                        @Override
                        public void onProgressChanged(SeekBar seekBar2, int i4, boolean z) {
                            textView4.setText(String.valueOf(i4 + hi_p2p_s_ptz_speed_param.u8MinSpeed));
                        }

                        @Override
                        public void onStopTrackingTouch(SeekBar seekBar2) {
                            textView4.setText(String.valueOf(seekBar2.getProgress() + hi_p2p_s_ptz_speed_param.u8MinSpeed));
                            hi_p2p_s_ptz_speed_param.u8Speed = seekBar2.getProgress() + hi_p2p_s_ptz_speed_param.u8MinSpeed;
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_PTZ_SPEED, hi_p2p_s_ptz_speed_param.parseContent());
                        }
                    });
                    return;
                case ConstantCommand.HI_P2P_PTZ_PRESET_CONTROL:
                    if (this.mFlagPreset == 1) {
                        MyToast.showToast(this, getString(R.string.tips_preset_set_btn));
                    }
                    if (this.mFlagPreset == 3) {
                        MyToast.showToast(this, getString(R.string.tips_preset_delete_success));
                        return;
                    }
                    return;
                default:
                    switch (i) {
                        case ConstantCommand.HI_P2P_SET_WDR_PARAM:
                        case ConstantCommand.HI_P2P_SET_INFRARED_PARAM:
                        case ConstantCommand.HI_P2P_SET_IMAGE_MODE_INFO:
                            break;
                        case ConstantCommand.HI_P2P_GET_WDR_PARAM:
                            this.wdr_param = new ConstantCommand.HI_P2P_S_WDR_PARMA(byteArray);
                            if (this.hmsz_fuc_num.size() > 0) {
                                List<Integer> list = this.hmsz_fuc_num;
                                if (list.get(list.size() - 1).intValue() == 65552) {
                                    dismissLoadingView();
                                    View inflate3 = View.inflate(this, R.layout.view_land_hmsz, null);
                                    handLandShowContent(inflate3);
                                    handHMSZ(inflate3);
                                    return;
                                }
                                return;
                            }
                            return;
                        case ConstantCommand.HI_P2P_GET_INFRARED_PARAM:
                            this.infrared_param = new ConstantCommand.HI_P2P_S_INFRARED_PARMA(byteArray);
                            if (this.hmsz_fuc_num.size() > 0) {
                                List<Integer> list2 = this.hmsz_fuc_num;
                                if (list2.get(list2.size() - 1).intValue() == 65554) {
                                    dismissLoadingView();
                                    View inflate4 = View.inflate(this, R.layout.view_land_hmsz, null);
                                    handLandShowContent(inflate4);
                                    handHMSZ(inflate4);
                                    return;
                                }
                                return;
                            }
                            return;
                        case ConstantCommand.HI_P2P_GET_IMAGE_MODE_INFO:
                            this.model_info = new ConstantCommand.HI_P2P_S_IMAGR_MODE_INFO(byteArray);
                            if (this.hmsz_fuc_num.size() > 0) {
                                List<Integer> list3 = this.hmsz_fuc_num;
                                if (list3.get(list3.size() - 1).intValue() == 65556) {
                                    dismissLoadingView();
                                    View inflate5 = View.inflate(this, R.layout.view_land_hmsz, null);
                                    handLandShowContent(inflate5);
                                    handHMSZ(inflate5);
                                    return;
                                }
                                return;
                            }
                            return;
                        case ConstantCommand.HI_P2P_SET_DISPLAY_INFO:
                            dismissLoadingView();
                            return;
                        case ConstantCommand.HI_P2P_GET_DISPLAY_INFO:
                            this.display_param = new ConstantCommand.HI_P2P_S_DISPLAY_INFO(byteArray);
                            if (this.mMonitor.getmIsFullScreen() == 1) {
                                if (this.mIsTXTJ) {
                                    if (this.ll_pup_content.getChildCount() > 0) {
                                        SeekBar seekBar2 = this.sb_brightness;
                                        if (seekBar2 != null) {
                                            seekBar2.setProgress(this.display_param.u32Brightness - this.display_param.u32MinBrightness);
                                        }
                                        TextView textView5 = this.tv_brightness;
                                        if (textView5 != null) {
                                            textView5.setText(this.display_param.u32Brightness + "");
                                        }
                                        SeekBar seekBar3 = this.sb_contrast;
                                        if (seekBar3 != null) {
                                            seekBar3.setProgress(this.display_param.u32Contrast - this.display_param.u32MinContrast);
                                        }
                                        TextView textView6 = this.tv_contrast;
                                        if (textView6 != null) {
                                            textView6.setText(this.display_param.u32Contrast + "");
                                        }
                                        SeekBar seekBar4 = this.sb_saturation;
                                        if (seekBar4 != null) {
                                            seekBar4.setProgress(this.display_param.u32Saturation - this.display_param.u32MinSaturation);
                                        }
                                        TextView textView7 = this.tv_saturation;
                                        if (textView7 != null) {
                                            textView7.setText(this.display_param.u32Saturation + "");
                                            return;
                                        }
                                        return;
                                    }
                                    View inflate6 = View.inflate(this, R.layout.view_land_txtj, null);
                                    handLandShowContent(inflate6);
                                    SeekBar seekBar5 = (SeekBar) inflate6.findViewById(R.id.sb_brightness);
                                    this.sb_brightness = seekBar5;
                                    seekBar5.setMax(this.display_param.u32MaxBrightness - this.display_param.u32MinBrightness);
                                    this.sb_brightness.setProgress(this.display_param.u32Brightness - this.display_param.u32MinBrightness);
                                    this.sb_brightness.setOnSeekBarChangeListener(this);
                                    TextView textView8 = (TextView) inflate6.findViewById(R.id.tv_brightness);
                                    this.tv_brightness = textView8;
                                    textView8.setText(this.display_param.u32Brightness + "");
                                    SeekBar seekBar6 = (SeekBar) inflate6.findViewById(R.id.sb_contrast);
                                    this.sb_contrast = seekBar6;
                                    seekBar6.setMax(this.display_param.u32MaxContrast - this.display_param.u32MinContrast);
                                    this.sb_contrast.setProgress(this.display_param.u32Contrast - this.display_param.u32MinContrast);
                                    this.sb_contrast.setOnSeekBarChangeListener(this);
                                    TextView textView9 = (TextView) inflate6.findViewById(R.id.tv_contrast);
                                    this.tv_contrast = textView9;
                                    textView9.setText(this.display_param.u32Contrast + "");
                                    SeekBar seekBar7 = (SeekBar) inflate6.findViewById(R.id.sb_saturation);
                                    this.sb_saturation = seekBar7;
                                    seekBar7.setMax(this.display_param.u32MaxSaturation - this.display_param.u32MinSaturation);
                                    this.sb_saturation.setProgress(this.display_param.u32Saturation - this.display_param.u32MinSaturation);
                                    this.sb_saturation.setOnSeekBarChangeListener(this);
                                    TextView textView10 = (TextView) inflate6.findViewById(R.id.tv_saturation);
                                    this.tv_saturation = textView10;
                                    textView10.setText(this.display_param.u32Saturation + "");
                                    ((TextView) inflate6.findViewById(R.id.tv_restore_default)).setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public void onClick(View view) {
                                            final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(OSLiveViewActivity.this);
                                            niftyDialogBuilder.withMessageLayoutHWrapW(HiTools.dip2px(OSLiveViewActivity.this, 280.0f));
                                            niftyDialogBuilder.withTitle(OSLiveViewActivity.this.getString(R.string.restore_param)).withMessage(OSLiveViewActivity.this.getString(R.string.hint_restore_param));
                                            niftyDialogBuilder.withButton1Text(OSLiveViewActivity.this.getString(R.string.cancel)).withButton2TextColor(OSLiveViewActivity.this.getResources().getColor(R.color.colorRed)).withButton2Text(OSLiveViewActivity.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();
                                                    OSLiveViewActivity.this.showLoadingView();
                                                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_DEF_DISPLAY_INFO, new byte[0]);
                                                }
                                            });
                                            niftyDialogBuilder.show();
                                        }
                                    });
                                    return;
                                }
                                View inflate7 = View.inflate(this, R.layout.view_land_mirror_flip, null);
                                handLandShowContent(inflate7);
                                handMirrorFlip(inflate7);
                                return;
                            }
                            return;
                        case ConstantCommand.HI_P2P_DEF_DISPLAY_INFO:
                            dismissLoadingView();
                            this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_DISPLAY_INFO, new byte[0]);
                            return;
                        default:
                            switch (i) {
                                case ConstantCommand.HI_P2P_GET_LIGHTS:
                                    this.lights_params = new ConstantCommand.HI_P2P_S_LIGHTS(byteArray);
                                    if (this.hmsz_fuc_num.size() > 0) {
                                        List<Integer> list4 = this.hmsz_fuc_num;
                                        if (list4.get(list4.size() - 1).intValue() == 65564) {
                                            dismissLoadingView();
                                            View inflate8 = View.inflate(this, R.layout.view_land_hmsz, null);
                                            handLandShowContent(inflate8);
                                            handHMSZ(inflate8);
                                            return;
                                        }
                                        return;
                                    }
                                    return;
                                case ConstantCommand.HI_P2P_SET_LIGHTS:
                                    break;
                                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 i4 = hi_p2p_s_signal_operator.s32OperatorName;
                                        if (i4 == 0) {
                                            string = getString(R.string.cmcc);
                                        } else if (i4 == 1) {
                                            string = getString(R.string.cucc);
                                        } else if (i4 == 2) {
                                            string = getString(R.string.ctcc);
                                        } else {
                                            string = getString(R.string.none);
                                            getOneMoreTime();
                                        }
                                        this.tv_brand.setText(string);
                                        return;
                                    }
                                    return;
                                default:
                                    switch (i) {
                                        case ConstantCommand.HI_P2P_GET_SCENE_MODE:
                                            this.scan_params = new ConstantCommand.HI_P2P_S_SCENE_MODE_PARAM(byteArray);
                                            if (this.hmsz_fuc_num.size() > 0) {
                                                List<Integer> list5 = this.hmsz_fuc_num;
                                                if (list5.get(list5.size() - 1).intValue() == 65588) {
                                                    dismissLoadingView();
                                                    View inflate9 = View.inflate(this, R.layout.view_land_hmsz, null);
                                                    handLandShowContent(inflate9);
                                                    handHMSZ(inflate9);
                                                    return;
                                                }
                                                return;
                                            }
                                            return;
                                        case ConstantCommand.HI_P2P_SET_SCENE_MODE:
                                            break;
                                        default:
                                            return;
                                    }
                            }
                    }
            }
            dismissLoadingView();
            return;
        }
        dismissLoadingView();
    }

    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() {
                    OSLiveViewActivity.this.getSignalOperator();
                }
            }, 10000L);
        }
    }

    private void handHMSZ(View view) {
        RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(R.id.rl_wdr_param);
        LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ll_infrared_param);
        LinearLayout linearLayout2 = (LinearLayout) view.findViewById(R.id.ll_pic_param);
        LinearLayout linearLayout3 = (LinearLayout) view.findViewById(R.id.ll_exposure_param);
        LinearLayout linearLayout4 = (LinearLayout) view.findViewById(R.id.ll_light_choose);
        LinearLayout linearLayout5 = (LinearLayout) view.findViewById(R.id.ll_use_place);
        View findViewById = view.findViewById(R.id.line1);
        View findViewById2 = view.findViewById(R.id.line2);
        View findViewById3 = view.findViewById(R.id.line3);
        View findViewById4 = view.findViewById(R.id.line4);
        View findViewById5 = view.findViewById(R.id.line5);
        View findViewById6 = view.findViewById(R.id.line6);
        if (this.lights_params == null) {
            linearLayout4.setVisibility(8);
            findViewById2.setVisibility(8);
        }
        TextView textView = (TextView) view.findViewById(R.id.tv_light_control);
        if (this.isSupportLightSelect) {
            textView.setText(getString(R.string.Light_control));
        } else {
            textView.setText(getString(R.string.fill_light_control));
        }
        if (this.wdr_param == null) {
            relativeLayout.setVisibility(8);
            findViewById.setVisibility(8);
        }
        if (this.infrared_param == null) {
            linearLayout.setVisibility(8);
            findViewById5.setVisibility(8);
        }
        if (this.model_info == null) {
            linearLayout2.setVisibility(8);
            linearLayout3.setVisibility(8);
            findViewById3.setVisibility(8);
            findViewById4.setVisibility(8);
        }
        if (this.scan_params == null) {
            linearLayout5.setVisibility(8);
            findViewById6.setVisibility(8);
        }
        if (this.lights_params != null) {
            RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.rg_light_choose);
            RadioButton radioButton = (RadioButton) view.findViewById(R.id.rb_red_light);
            RadioButton radioButton2 = (RadioButton) view.findViewById(R.id.rb_white_light);
            if (this.lights_params.u32Lights == 0) {
                radioButton.setChecked(true);
            } else if (this.lights_params.u32Lights == 1) {
                radioButton2.setChecked(true);
            }
            radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(RadioGroup radioGroup2, int i) {
                    OSLiveViewActivity.this.lambda$handHMSZ$4$OSLiveViewActivity(radioGroup2, i);
                }
            });
        }
        if (this.wdr_param != null) {
            SwitchButton switchButton = (SwitchButton) view.findViewById(R.id.switch_kdt);
            switchButton.setCheckedNoEvent(this.wdr_param.u32WdrMode == 1);
            switchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
                    OSLiveViewActivity.this.lambda$handHMSZ$5$OSLiveViewActivity(compoundButton, z);
                }
            });
        }
        if (this.model_info != null) {
            RadioButton radioButton3 = (RadioButton) view.findViewById(R.id.rb_expose_auto);
            RadioButton radioButton4 = (RadioButton) view.findViewById(R.id.rb_expose_indoor);
            RadioButton radioButton5 = (RadioButton) view.findViewById(R.id.rb_expose_outside);
            int i = this.model_info.u32AeMode;
            if (i == 0) {
                radioButton3.setChecked(true);
            } else if (i == 1) {
                radioButton4.setChecked(true);
            } else if (i == 2) {
                radioButton5.setChecked(true);
            }
            ((RadioGroup) view.findViewById(R.id.rg_expose_mode)).setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(RadioGroup radioGroup2, int i2) {
                    OSLiveViewActivity.this.lambda$handHMSZ$6$OSLiveViewActivity(radioGroup2, i2);
                }
            });
            RadioGroup radioGroup2 = (RadioGroup) view.findViewById(R.id.rg_priority_mode);
            RadioButton radioButton6 = (RadioButton) view.findViewById(R.id.rb_frame_rate);
            RadioButton radioButton7 = (RadioButton) view.findViewById(R.id.rb_image);
            if (this.model_info.u32ImgMode == 0) {
                radioButton6.setChecked(true);
            } else if (this.model_info.u32ImgMode == 1) {
                radioButton7.setChecked(true);
            }
            radioGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(RadioGroup radioGroup3, int i2) {
                    OSLiveViewActivity.this.lambda$handHMSZ$7$OSLiveViewActivity(radioGroup3, i2);
                }
            });
        }
        if (this.infrared_param != null) {
            RadioGroup radioGroup3 = (RadioGroup) view.findViewById(R.id.rg_ircut);
            RadioButton radioButton8 = (RadioButton) view.findViewById(R.id.rb_ircut_auto);
            RadioButton radioButton9 = (RadioButton) view.findViewById(R.id.rb_ircut_open);
            RadioButton radioButton10 = (RadioButton) view.findViewById(R.id.rb_ircut_close);
            int i2 = this.infrared_param.s32Infrared;
            if (i2 == 0) {
                radioButton8.setChecked(true);
            } else if (i2 == 1) {
                radioButton9.setChecked(true);
            } else if (i2 == 2) {
                radioButton10.setChecked(true);
            }
            radioGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(RadioGroup radioGroup4, int i3) {
                    OSLiveViewActivity.this.lambda$handHMSZ$8$OSLiveViewActivity(radioGroup4, i3);
                }
            });
        }
        if (this.scan_params != null) {
            RadioGroup radioGroup4 = (RadioGroup) view.findViewById(R.id.rg_use_place);
            RadioButton radioButton11 = (RadioButton) view.findViewById(R.id.rb_use_indoor);
            RadioButton radioButton12 = (RadioButton) view.findViewById(R.id.rb_use_outdoor);
            int i3 = this.scan_params.u8SceneMode;
            if (i3 == 0) {
                radioButton12.setChecked(true);
            } else if (i3 == 1) {
                radioButton11.setChecked(true);
            }
            radioGroup4.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
                @Override
                public final void onCheckedChanged(RadioGroup radioGroup5, int i4) {
                    OSLiveViewActivity.this.lambda$handHMSZ$9$OSLiveViewActivity(radioGroup5, i4);
                }
            });
        }
    }

    public void lambda$handHMSZ$4$OSLiveViewActivity(RadioGroup radioGroup, int i) {
        if (i == R.id.rb_red_light) {
            this.lights_params.u32Lights = 0;
        } else if (i == R.id.rb_white_light) {
            this.lights_params.u32Lights = 1;
        }
        showLoadingView();
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_LIGHTS, this.lights_params.parseContent());
    }

    public void lambda$handHMSZ$5$OSLiveViewActivity(CompoundButton compoundButton, boolean z) {
        if (z) {
            this.wdr_param.u32WdrMode = 1;
        } else {
            this.wdr_param.u32WdrMode = 0;
        }
        showLoadingView();
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_WDR_PARAM, this.wdr_param.parseContent());
    }

    public void lambda$handHMSZ$6$OSLiveViewActivity(RadioGroup radioGroup, int i) {
        switch (i) {
            case R.id.rb_expose_auto:
                this.model_info.u32AeMode = 0;
                break;
            case R.id.rb_expose_indoor:
                this.model_info.u32AeMode = 1;
                break;
            case R.id.rb_expose_outside:
                this.model_info.u32AeMode = 2;
                break;
        }
        showLoadingView();
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_IMAGE_MODE_INFO, this.model_info.parseContent());
    }

    public void lambda$handHMSZ$7$OSLiveViewActivity(RadioGroup radioGroup, int i) {
        if (i == R.id.rb_frame_rate) {
            this.model_info.u32ImgMode = 0;
        } else if (i == R.id.rb_image) {
            this.model_info.u32ImgMode = 1;
        }
        showLoadingView();
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_IMAGE_MODE_INFO, this.model_info.parseContent());
    }

    public void lambda$handHMSZ$8$OSLiveViewActivity(RadioGroup radioGroup, int i) {
        switch (i) {
            case R.id.rb_ircut_auto:
                this.infrared_param.s32Infrared = 0;
                break;
            case R.id.rb_ircut_close:
                this.infrared_param.s32Infrared = 2;
                break;
            case R.id.rb_ircut_open:
                this.infrared_param.s32Infrared = 1;
                break;
        }
        showLoadingView();
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_INFRARED_PARAM, this.infrared_param.parseContent());
    }

    public void lambda$handHMSZ$9$OSLiveViewActivity(RadioGroup radioGroup, int i) {
        switch (i) {
            case R.id.rb_use_indoor:
                this.scan_params.u8SceneMode = 1;
                break;
            case R.id.rb_use_outdoor:
                this.scan_params.u8SceneMode = 0;
                break;
        }
        showLoadingView();
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_SCENE_MODE, this.scan_params.parseContent());
    }

    public 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, OSLiveViewActivity.this.mDp_250);
                    ofFloat2.setDuration(300L);
                    ofFloat2.start();
                    ofFloat2.addListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animator) {
                            super.onAnimationEnd(animator);
                            OSLiveViewActivity.this.ll_pup_content.setVisibility(8);
                            OSLiveViewActivity.this.ll_pup_content.removeAllViews();
                            OSLiveViewActivity.this.ll_pup_main.setVisibility(0);
                            ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(OSLiveViewActivity.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) {
                OSLiveViewActivity.this.mirrorChecked = z ? 1 : 0;
                OSLiveViewActivity.this.display_param.u32Mirror = OSLiveViewActivity.this.mirrorChecked;
                OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_DISPLAY_INFO, OSLiveViewActivity.this.display_param.parseContent());
                OSLiveViewActivity.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) {
                OSLiveViewActivity.this.filpChecked = z ? 1 : 0;
                OSLiveViewActivity.this.display_param.u32Flip = OSLiveViewActivity.this.filpChecked;
                OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_DISPLAY_INFO, OSLiveViewActivity.this.display_param.parseContent());
                OSLiveViewActivity.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 onStartTrackingTouch(SeekBar seekBar3) {
            }

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

            @Override
            public void onProgressChanged(SeekBar seekBar3, int i, boolean z) {
                textView.setText(String.valueOf(i + 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));
                OSLiveViewActivity.this.sendToDevice(seekBar, seekBar2);
            }

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

    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;
                this.mFloatingWindow.setReady(true);
                boolean z = this.mMyCamera.isFirstEnterLive && this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_CONTROL);
                LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.rl_guide_monitor.getLayoutParams();
                layoutParams.height = this.mMonitorHeight;
                layoutParams.width = -1;
                this.rl_guide_monitor.setLayoutParams(layoutParams);
                this.ll_guide.setVisibility(z ? 0 : 8);
                if (z) {
                    handAnim();
                }
                this.rl_viewPager.setAlpha(1.0f);
                this.viewPager.setCanScroll(true);
                this.iv_full_screen.setClickable(true);
                this.iv_playback.setClickable(true);
                Log.i("tedu", "--PLAY_STATE_START--:");
                handPercentageView();
                if (this.mMonitor.getmIsFullScreen() == 0) {
                    this.rl_wrap.setVisibility(0);
                    if (HiTools.getAndroidVersion() >= 29) {
                        this.btn_floating_window.setVisibility(0);
                    }
                }
                getLightModel();
                getData();
                setViewWhetherClick(true);
                dismissPlaceLoadingView();
                dismissLoadingView();
                MyCamera myCamera = this.mMyCamera;
                Bitmap snapshot_EXT = myCamera != null ? myCamera.getSnapshot_EXT(1, 640, 352) : null;
                if (snapshot_EXT != null) {
                    HiTools.saveSnapshot(snapshot_EXT, this.mMyCamera, this);
                }
                HiLogcatUtil.d("mIsSwitchResolution: " + this.mIsSwitchResolution);
                if (this.mMyCamera != null && this.mIsSwitchResolution) {
                    if (this.mRecordingState == 2) {
                        this.mStartRecordTime = 0L;
                        Timer timer = this.timer;
                        if (timer != null) {
                            timer.cancel();
                            this.timer = null;
                        }
                        TimerTask timerTask = this.timerTask;
                        if (timerTask != null) {
                            timerTask.cancel();
                            this.timerTask = null;
                        }
                        continueRecording();
                    }
                    this.mMyCamera.setVideoQuality(this.mQuality);
                    this.tv_video_quality.setText(this.mQuality == 0 ? getString(R.string.high_definition) : getString(R.string.fluent));
                    this.tv_landscape_video_quality.setText(this.mQuality == 0 ? getString(R.string.high_definition) : getString(R.string.fluent));
                    this.mMyCamera.updateInDatabase(this);
                }
                this.mIsSwitchResolution = false;
                return;
            }
            if (i == 3) {
                if (TextUtils.isEmpty(string) || this.mRecordingState != 2) {
                    return;
                }
                grabRecordSnapshot(string);
                return;
            }
            if (i == 4) {
                if (TextUtils.isEmpty(this.recordFile)) {
                    return;
                }
                File file = new File(this.recordFile);
                if (file.length() <= 1024 && file.isFile() && file.exists()) {
                    file.delete();
                    return;
                }
                return;
            }
            if (i == 5) {
                this.mRecordingState = 0;
                this.mRecHandler.removeCallbacksAndMessages(null);
                if (TextUtils.isEmpty(this.recordFile)) {
                    return;
                }
                File file2 = new File(this.recordFile);
                if (file2.length() <= 1024 && file2.isFile() && file2.exists()) {
                    file2.delete();
                    return;
                }
                return;
            }
            if (i != 6) {
                return;
            }
        }
        finish();
        MyToast.showToast(this, getString(R.string.video_exception));
    }

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

    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(OSLiveViewActivity.this.mMyCamera.getUid(), OSLiveViewActivity.this));
                if (!file.exists()) {
                    file.mkdirs();
                }
                if (TextUtils.isEmpty(str)) {
                    return null;
                }
                String[] split = new File(str).getName().split("\\.");
                HiTools.saveBitmap(bitmap, file.getAbsolutePath() + "/" + split[0]);
                return null;
            }
        }.execute(new Void[0]);
    }

    @Override
    public void onClick(View view) {
        int i = 0;
        switch (view.getId()) {
            case R.id.btn_floating_window:
                if (this.mMyCamera.getConnectState() == 4) {
                    clickFloatingWindow();
                    return;
                }
                return;
            case R.id.btn_return:
                OSSecondTabFragment oSSecondTabFragment = this.osSecondTabFragment;
                if (oSSecondTabFragment != null && oSSecondTabFragment.mPopupWindow != null && this.osSecondTabFragment.mPopupWindow.isShowing()) {
                    this.osSecondTabFragment.mPopupWindow.dismiss();
                }
                finish();
                return;
            case R.id.iv_full_screen:
                this.mIsClickReturn = false;
                OSSecondTabFragment oSSecondTabFragment2 = this.osSecondTabFragment;
                if (oSSecondTabFragment2 != null && oSSecondTabFragment2.mPopupWindow != null && this.osSecondTabFragment.mPopupWindow.isShowing()) {
                    this.osSecondTabFragment.mPopupWindow.dismiss();
                }
                if (this.iv_placeholder_rotate.getAlpha() == 1.0f) {
                    return;
                }
                if (getResources().getConfiguration().orientation == 1) {
                    if (this.isTalking) {
                        return;
                    } else {
                        setRequestedOrientation(0);
                    }
                } else if (getResources().getConfiguration().orientation == 2) {
                    setRequestedOrientation(1);
                }
                this.mMonitor.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 {
                    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_ydzz_land:
                if (this.iv_ydzz_land.isSelected()) {
                    this.iv_ydzz_land.setSelected(false);
                    MyToast.showToast(this, getString(R.string.tracking_close));
                } else {
                    this.iv_ydzz_land.setSelected(true);
                    MyToast.showToast(this, getString(R.string.tracking_open));
                    i = 1;
                }
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_SMART_MOTO, HiChipDefines.HI_P2P_SMART_MOTO.parseContent(i));
                return;
            case R.id.ll_land_return:
                if (getResources().getConfiguration().orientation == 2) {
                    this.mIsClickReturn = true;
                    releaseLockScreen();
                    setRequestedOrientation(1);
                }
                handTalkingBack();
                return;
            case R.id.root_lock_screen:
                OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
                if (orientationWatchDog != null) {
                    orientationWatchDog.setLockScreen(true);
                }
                this.root_lock_screen.setVisibility(8);
                this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                return;
            case R.id.tv_know:
                Handler handler = this.mHandler;
                if (handler != null) {
                    handler.removeCallbacksAndMessages(null);
                }
                this.ll_guide.setVisibility(8);
                this.mMyCamera.isFirstEnterLive = false;
                SharePreUtils.putBoolean(HiDataValue.CACHE, this, this.mMyCamera.getUid() + "isFirstEnterLive", false);
                return;
            case R.id.tv_landscape_video_adaption:
                handPictureSize(this.tv_landscape_video_adaption);
                return;
            case R.id.tv_landscape_video_quality:
                handVideoQuality(this.tv_landscape_video_quality, true);
                return;
            case R.id.tv_video_quality:
                if (this.isTalking) {
                    return;
                }
                handVideoQuality(this.tv_video_quality, false);
                return;
            default:
                return;
        }
    }

    private void handWork(View view) {
        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);
        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)};
        int i = this.lightModel;
        if (i == 2) {
            radioGroup.setVisibility(8);
            radioGroup3.setVisibility(8);
            radioGroup2.setVisibility(0);
            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) {
            radioGroup.setVisibility(0);
            radioGroup2.setVisibility(8);
            radioGroup3.setVisibility(8);
            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);
            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);
            }
        }
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup4, int i2) {
                if (OSLiveViewActivity.this.light_info_ext == null) {
                    return;
                }
                switch (i2) {
                    case R.id.live_view_ext_btn_auto:
                        OSLiveViewActivity.this.light_info_ext.u32State = 2;
                        break;
                    case R.id.live_view_ext_btn_color:
                        OSLiveViewActivity.this.light_info_ext.u32State = 1;
                        break;
                    case R.id.live_view_ext_btn_normal:
                        OSLiveViewActivity.this.light_info_ext.u32State = 0;
                        break;
                }
                OSLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET_EXT, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT.parseContent(OSLiveViewActivity.this.light_info_ext.u32Chn, OSLiveViewActivity.this.light_info_ext.u32State));
            }
        });
        radioGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup4, int i2) {
                if (OSLiveViewActivity.this.light_info == null) {
                    return;
                }
                switch (i2) {
                    case R.id.live_view_nor_btn_close:
                        OSLiveViewActivity.this.light_info.u32State = 1;
                        break;
                    case R.id.live_view_nor_btn_open:
                        OSLiveViewActivity.this.light_info.u32State = 0;
                        break;
                }
                OSLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO.parseContent(OSLiveViewActivity.this.light_info.u32Chn, OSLiveViewActivity.this.light_info.u32State));
            }
        });
        radioGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup4, int i2) {
                if (OSLiveViewActivity.this.abs_light == null) {
                    return;
                }
                switch (i2) {
                    case R.id.abs_light_auto:
                        OSLiveViewActivity.this.abs_light.s32State = 0;
                        break;
                    case R.id.abs_light_close:
                        OSLiveViewActivity.this.abs_light.s32State = 2;
                        break;
                    case R.id.abs_light_open:
                        OSLiveViewActivity.this.abs_light.s32State = 1;
                        break;
                }
                OSLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_ABSOLUTE_LIGHT_TYPE, HiChipDefines.ABSOLUTE_LIGHT_TYPE.parseContent(OSLiveViewActivity.this.abs_light.s32State));
            }
        });
    }

    private void handLandMore() {
        View inflate = View.inflate(this, R.layout.pup_os_landscape_more, null);
        this.ll_pup_content = (LinearLayout) inflate.findViewById(R.id.ll_pup_content);
        this.ll_pup_main = (LinearLayout) inflate.findViewById(R.id.ll_pup_main);
        getFunction();
        HiLogcatUtil.i("handLandMore function size: " + this.functionList.size());
        GridView gridView = (GridView) inflate.findViewById(R.id.function_grid);
        gridView.setAdapter((ListAdapter) new FunAdapter(this, this.functionList, 1));
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setOutsideTouchable(true);
        this.mPopupWindow.setHeight(-1);
        this.mPopupWindow.setWidth(this.mDp_250 + HiTools.dip2px(this, 10.0f));
        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 void onDismiss() {
                AnimationProUtils.alpha0To1(OSLiveViewActivity.this.rl_landscape_view, 300);
            }
        });
        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                int name = OSLiveViewActivity.this.functionList.get(i).getName();
                HiLogcatUtil.i("click fuction name: " + name);
                switch (name) {
                    case R.string.adjust_image:
                        OSLiveViewActivity.this.mIsTXTJ = true;
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_DISPLAY_INFO, null);
                        return;
                    case R.string.focus:
                        View inflate2 = View.inflate(OSLiveViewActivity.this, R.layout.view_land_zoom_focus, null);
                        LinearLayout linearLayout = (LinearLayout) inflate2.findViewById(R.id.ll_focus);
                        TextView textView = (TextView) inflate2.findViewById(R.id.tv_self_check);
                        linearLayout.setVisibility(8);
                        textView.setVisibility(0);
                        OSLiveViewActivity.this.handLandShowContent(inflate2);
                        OSLiveViewActivity.this.handZoomAndFocus(inflate2);
                        return;
                    case R.string.mirror_flip:
                        OSLiveViewActivity.this.mIsTXTJ = false;
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_DISPLAY_INFO, null);
                        return;
                    case R.string.perset_position:
                        View inflate3 = View.inflate(OSLiveViewActivity.this, R.layout.view_land_preset_os, null);
                        OSLiveViewActivity.this.handLandShowContent(inflate3);
                        OSLiveViewModel oSLiveViewModel = OSLiveViewModel.getInstance();
                        OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                        oSLiveViewModel.handKeyBoard(oSLiveViewActivity, inflate3, oSLiveViewActivity.mMyCamera);
                        return;
                    case R.string.picture_setting:
                        if (OSLiveViewActivity.this.hmsz_fuc_num.contains(Integer.valueOf(ConstantCommand.HI_P2P_GET_WDR_PARAM))) {
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_WDR_PARAM, null);
                        }
                        if (OSLiveViewActivity.this.hmsz_fuc_num.contains(Integer.valueOf(ConstantCommand.HI_P2P_GET_INFRARED_PARAM))) {
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_INFRARED_PARAM, null);
                        }
                        if (OSLiveViewActivity.this.hmsz_fuc_num.contains(Integer.valueOf(ConstantCommand.HI_P2P_GET_IMAGE_MODE_INFO))) {
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_IMAGE_MODE_INFO, null);
                        }
                        if (OSLiveViewActivity.this.hmsz_fuc_num.contains(Integer.valueOf(ConstantCommand.HI_P2P_GET_LIGHTS))) {
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_LIGHTS, null);
                        }
                        if (OSLiveViewActivity.this.hmsz_fuc_num.contains(Integer.valueOf(ConstantCommand.HI_P2P_GET_SCENE_MODE))) {
                            OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SCENE_MODE, null);
                            return;
                        }
                        return;
                    case R.string.spin_speed:
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_PTZ_SPEED, null);
                        return;
                    case R.string.suspended_window:
                        OSLiveViewActivity.this.clickFloatingWindow();
                        return;
                    case R.string.volume_control:
                        OSLiveViewActivity.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_AUDIO_ATTR, null);
                        return;
                    default:
                        return;
                }
            }
        });
    }

    private void getFunction() {
        this.functionList.clear();
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_DISPLAY_INFO)) {
            this.functionList.add(new LiveFunBean(R.string.mirror_flip, R.mipmap.land_mirror_flip));
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_AF_CONTROL)) {
            this.functionList.add(new LiveFunBean(R.string.focus, R.mipmap.land_focusing));
        }
        HiLogcatUtil.d("HI_P2P_PTZ_PRESET_CONTROL: " + this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_PRESET_CONTROL));
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_PRESET_CONTROL)) {
            this.functionList.add(new LiveFunBean(R.string.perset_position, R.mipmap.land_preset));
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_AUDIO_ATTR)) {
            this.functionList.add(new LiveFunBean(R.string.volume_control, R.mipmap.land_volume));
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_DISPLAY_INFO)) {
            this.functionList.add(new LiveFunBean(R.string.adjust_image, R.mipmap.land_color_gray));
        }
        getPic();
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_PTZ_SPEED)) {
            this.functionList.add(new LiveFunBean(R.string.spin_speed, R.mipmap.land_preset));
        }
        if (HiTools.getAndroidVersion() >= 29) {
            this.functionList.add(new LiveFunBean(R.string.suspended_window, R.mipmap.land_floating));
        }
        HiLogcatUtil.d("HI_P2P_PTZ_SELFTEST: " + this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_SELFTEST));
        this.isSupportPTZTest = this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_SELFTEST);
    }

    private void getPic() {
        this.hmsz_fuc_num.clear();
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_WDR_PARAM)) {
            this.hmsz_fuc_num.add(Integer.valueOf(ConstantCommand.HI_P2P_GET_WDR_PARAM));
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_INFRARED_PARAM)) {
            this.hmsz_fuc_num.add(Integer.valueOf(ConstantCommand.HI_P2P_GET_INFRARED_PARAM));
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_IMAGE_MODE_INFO)) {
            this.hmsz_fuc_num.add(Integer.valueOf(ConstantCommand.HI_P2P_GET_IMAGE_MODE_INFO));
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_LIGHTS)) {
            this.isSupportLightSelect = true;
            this.hmsz_fuc_num.add(Integer.valueOf(ConstantCommand.HI_P2P_GET_LIGHTS));
        }
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SCENE_MODE)) {
            this.hmsz_fuc_num.add(Integer.valueOf(ConstantCommand.HI_P2P_GET_SCENE_MODE));
        }
        if (this.hmsz_fuc_num.size() > 0) {
            this.functionList.add(new LiveFunBean(R.string.picture_setting, R.mipmap.land_color_gray));
        }
    }

    private void showPupLight() {
        View inflate = View.inflate(this, R.layout.view_land_night_model, null);
        handLandShowContent(inflate);
        handWork(inflate);
    }

    public 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) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 9, 0, OSLiveViewActivity.this.speed, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, OSLiveViewActivity.this.speed, (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) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 10, 0, OSLiveViewActivity.this.speed, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, OSLiveViewActivity.this.speed, (short) 10));
                }
                return false;
            }
        });
        ((TextView) view.findViewById(R.id.tv_self_check)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                OSLiveViewActivity.this.lambda$handZoomAndFocus$10$OSLiveViewActivity(view2);
            }
        });
        ((TextView) view.findViewById(R.id.tv_focusin)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                if (motionEvent.getAction() == 0) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 11, 0, OSLiveViewActivity.this.speed, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, OSLiveViewActivity.this.speed, (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) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 12, 0, OSLiveViewActivity.this.speed, (short) 10));
                } else if (motionEvent.getAction() == 1) {
                    OSLiveViewActivity.this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, OSLiveViewActivity.this.speed, (short) 10));
                }
                return false;
            }
        });
    }

    public void lambda$handZoomAndFocus$10$OSLiveViewActivity(View view) {
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 23, 0, this.speed, (short) 10));
    }

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

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

    private void handSnapshot() {
        clickSnapshot();
    }

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

    private void SaveToPhone(final String str, final String str2) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    MediaStore.Images.Media.insertImage(OSLiveViewActivity.this.getContentResolver(), str, str2, (String) null);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                OSLiveViewActivity.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.osFirstTabFragment.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.osFirstTabFragment.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.osFirstTabFragment.iv_listen.setSelected(true);
                this.isListening = true;
            }
        } else {
            this.mMyCamera.startTalk();
        }
        this.isTalking = !this.isTalking;
        this.osFirstTabFragment.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.osFirstTabFragment.iv_listen.setSelected(true);
                this.isListening = true;
            }
            this.isTalking = !this.isTalking;
            this.osFirstTabFragment.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.osFirstTabFragment.iv_listen.setSelected(false);
            this.iv_landscape_listen.setSelected(false);
            this.isListening = !this.isListening;
        }
        this.isTalking = !this.isTalking;
        this.osFirstTabFragment.iv_duijiang.setSelected(this.isTalking);
        this.iv_landscape_talk.setSelected(this.isTalking);
    }

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

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

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

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

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

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

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

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

    private void handPictureSize(View view) {
        View inflate = getLayoutInflater().inflate(R.layout.popview_resolution_ratio, (ViewGroup) null, false);
        this.mPictureSizePopupWindow = new PopupWindow(inflate);
        this.mPictureSizePopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPictureSizePopupWindow.setOutsideTouchable(true);
        this.mPictureSizePopupWindow.setFocusable(false);
        this.mPictureSizePopupWindow.setWidth(-2);
        this.mPictureSizePopupWindow.setHeight(-2);
        int[] iArr = new int[2];
        view.getLocationOnScreen(iArr);
        int dip2px = HiTools.dip2px(this, 90.0f);
        getWindowManager().getDefaultDisplay().getRealMetrics(new DisplayMetrics());
        this.mPictureSizePopupWindow.showAtLocation(view, 0, iArr[0] - (!this.isLeft ? 0 : LiuHaiScreenTools.getNotchHeight(this) - HiTools.dip2px(this, 5.0f)), iArr[1] - dip2px);
        final TextView textView = (TextView) inflate.findViewById(R.id.ratio_fluent);
        final TextView textView2 = (TextView) inflate.findViewById(R.id.ratio_high);
        textView.setText(R.string.picture_size_fill);
        textView2.setText(R.string.picture_size_adaption);
        int i = this.mPictureSize;
        if (i == 0) {
            textView.setSelected(true);
            textView2.setSelected(false);
        } else if (i == 1) {
            textView.setSelected(false);
            textView2.setSelected(true);
        }
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                OSLiveViewActivity.this.mPictureSizePopupWindow.dismiss();
                OSLiveViewActivity.this.mPictureSize = 0;
                textView.setSelected(true);
                textView2.setSelected(false);
                OSLiveViewActivity.this.tv_landscape_video_adaption.setText(R.string.picture_size_fill);
                if (OSLiveViewActivity.this.mMyCamera != null) {
                    SharePreUtils.putInt(HiDataValue.CACHE, OSLiveViewActivity.this, "pictureSize" + HiDataValue.userAccount + OSLiveViewActivity.this.mMyCamera.getUid(), 0);
                }
                OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                oSLiveViewActivity.handLandScape(oSLiveViewActivity.mPictureSize);
            }
        });
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view2) {
                OSLiveViewActivity.this.mPictureSizePopupWindow.dismiss();
                OSLiveViewActivity.this.mPictureSize = 1;
                textView.setSelected(true);
                textView2.setSelected(false);
                OSLiveViewActivity.this.tv_landscape_video_adaption.setText(R.string.picture_size_adaption);
                if (OSLiveViewActivity.this.mMyCamera != null) {
                    SharePreUtils.putInt(HiDataValue.CACHE, OSLiveViewActivity.this, "pictureSize" + HiDataValue.userAccount + OSLiveViewActivity.this.mMyCamera.getUid(), 1);
                }
                OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                oSLiveViewActivity.handLandScape(oSLiveViewActivity.mPictureSize);
            }
        });
    }

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

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

    public void switchVideoQuality(int i) {
        MyCamera myCamera = this.mMyCamera;
        if (myCamera == null || i == myCamera.getVideoQuality()) {
            return;
        }
        this.mIsSwitchResolution = true;
        setViewWhetherClick(false);
        this.osFirstTabFragment.iv_listen.setSelected(false);
        this.iv_landscape_listen.setSelected(false);
        this.mMyCamera.stopListening();
        this.mIsListenTrans = false;
        this.mVoiceIsTran = false;
        this.isListening = false;
        this.osFirstTabFragment.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);
    }

    public 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.osFirstTabFragment.iv_listen.setSelected(false);
            } else {
                this.iv_landscape_listen.setSelected(true);
                this.osFirstTabFragment.iv_listen.setSelected(true);
            }
        } else if (this.isListening) {
            this.iv_landscape_listen.setSelected(false);
            this.osFirstTabFragment.iv_listen.setSelected(false);
            this.mMyCamera.stopListening();
            this.mIsListenTrans = false;
            this.mVoiceIsTran = false;
        } else {
            this.iv_landscape_listen.setSelected(true);
            this.osFirstTabFragment.iv_listen.setSelected(true);
            this.mMyCamera.startListening();
            this.mVoiceIsTran = true;
        }
        if (this.isTalking) {
            this.osFirstTabFragment.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(OSLiveViewActivity.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();
        } else {
            handLandScape(this.mPictureSize);
            this.mMonitor.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();
            }
        }
        if (this.isShowPermissionDialog) {
            HiTools.dialogUtilsAgreements.build().show();
        }
    }

    public void handLandScape(int i) {
        RelativeLayout.LayoutParams layoutParams;
        OSSecondTabFragment oSSecondTabFragment = this.osSecondTabFragment;
        if (oSSecondTabFragment != null && oSSecondTabFragment.mPopupWindow != null && this.osSecondTabFragment.mPopupWindow.isShowing()) {
            this.osSecondTabFragment.mPopupWindow.dismiss();
        }
        boolean hideBottomUIMenu = hideBottomUIMenu();
        this.osSecondTabFragment.unRegisterMyCamera();
        this.mMonitor.setmIsFullScreen(1);
        this.focusNum = 0;
        getWindow().setFlags(1024, 1024);
        this.titleview.setVisibility(8);
        this.ll_bottom.setVisibility(8);
        this.rl_wrap.setVisibility(8);
        this.btn_floating_window.setVisibility(8);
        this.rl_landscape_view.setVisibility(0);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(this.ll_recording.getLayoutParams());
        layoutParams2.setMargins(HiTools.dip2px(this, 20.0f), HiTools.dip2px(this, 55.0f), 0, 0);
        this.ll_recording.setLayoutParams(layoutParams2);
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(this.ll_battery.getLayoutParams());
        layoutParams3.setMargins(0, HiTools.dip2px(this, 25.0f), HiTools.dip2px(this, 15.0f), 0);
        layoutParams3.addRule(11);
        this.ll_battery.setLayoutParams(layoutParams3);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitor;
        int i2 = displayMetrics.heightPixels;
        myLiveViewGLMonitor.screen_height = i2;
        this.PictureRealHeight = i2;
        MyLiveViewGLMonitor myLiveViewGLMonitor2 = this.mMonitor;
        int i3 = displayMetrics.widthPixels;
        myLiveViewGLMonitor2.screen_width = i3;
        this.PictureRealWidth = i3;
        if (HiTools.isAllScreenDevice(this)) {
            if (hideBottomUIMenu) {
                MyLiveViewGLMonitor myLiveViewGLMonitor3 = this.mMonitor;
                int navigationBarHeight = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(this);
                myLiveViewGLMonitor3.screen_width = navigationBarHeight;
                this.PictureRealWidth = navigationBarHeight;
            }
            layoutParams = new RelativeLayout.LayoutParams(-1, -1);
        } else {
            layoutParams = new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());
        }
        if (i == 1) {
            int Getwh = HiTools.Getwh(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
            if (Getwh == 2) {
                this.mMonitor.screen_height = HiTools.getVideoshowh(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
                layoutParams.setMargins(0, (this.PictureRealHeight - this.mMonitor.screen_height) / 2, 0, (this.PictureRealHeight - this.mMonitor.screen_height) / 2);
                RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) this.ll_battery.getLayoutParams();
                layoutParams4.setMargins(0, HiTools.dip2px(this, (this.PictureRealHeight - this.mMonitor.screen_height) / 2), 0, (this.PictureRealHeight - this.mMonitor.screen_height) / 2);
                this.ll_battery.setLayoutParams(layoutParams4);
            } else if (Getwh == 3) {
                this.mMonitor.screen_width = HiTools.getVideoshoww(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
                layoutParams.setMargins((this.PictureRealWidth - this.mMonitor.screen_width) / 2, 0, (this.PictureRealWidth - this.mMonitor.screen_width) / 2, 0);
                RelativeLayout.LayoutParams layoutParams5 = (RelativeLayout.LayoutParams) this.ll_battery.getLayoutParams();
                layoutParams5.setMargins((this.PictureRealWidth - this.mMonitor.screen_width) / 2, 0, (this.PictureRealWidth - this.mMonitor.screen_width) / 2, 0);
                this.ll_battery.setLayoutParams(layoutParams5);
            } else {
                layoutParams.setMargins(0, 0, 0, 0);
            }
        }
        this.mMonitor.setLayoutParams(layoutParams);
        initMatrix(this.mMonitor.screen_width, this.mMonitor.screen_height);
        this.mMonitor.setState(0);
        MyLiveViewGLMonitor myLiveViewGLMonitor4 = this.mMonitor;
        myLiveViewGLMonitor4.setMatrix(myLiveViewGLMonitor4.left, this.mMonitor.bottom, this.mMonitor.width, this.mMonitor.height);
    }

    private void handPortrait() {
        PopupWindow popupWindow = this.mPopupWindow;
        if (popupWindow != null && popupWindow.isShowing()) {
            this.mPopupWindow.dismiss();
        }
        OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
        if (orientationWatchDog != null) {
            orientationWatchDog.setLockScreen(false);
        }
        if (this.mHandler_lockScreen != null) {
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
        showBottomUIMenu();
        this.osSecondTabFragment.RegisterMyCamera();
        this.mMonitor.setmIsFullScreen(0);
        OSThirdTabFragment oSThirdTabFragment = this.osThirdTabFragment;
        if (oSThirdTabFragment != null) {
            oSThirdTabFragment.focusNum = 0;
        }
        getWindow().clearFlags(1024);
        this.titleview.setVisibility(0);
        this.ll_bottom.setVisibility(0);
        this.rl_wrap.setVisibility(0);
        if (HiTools.getAndroidVersion() >= 29) {
            this.btn_floating_window.setVisibility(0);
        }
        this.rl_landscape_view.setVisibility(8);
        this.mMonitor.setLayoutParams(new RelativeLayout.LayoutParams(getWindowManager().getDefaultDisplay().getWidth(), this.mMonitorHeight));
        if (this.mIsHaveVirtual) {
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, this.mMonitorHeight);
            this.mMonitor.setLayoutParams(layoutParams);
            this.iv_placeholder.setLayoutParams(layoutParams);
            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams2.setMargins(10, this.mMonitorHeight - HiTools.dip2px(this, 42.0f), 10, 3);
            this.rl_wrap.setLayoutParams(layoutParams2);
        }
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(this.ll_recording.getLayoutParams());
        layoutParams3.setMargins(HiTools.dip2px(this, 12.0f), HiTools.dip2px(this, 5.0f), 0, 0);
        this.ll_recording.setLayoutParams(layoutParams3);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mMonitor.screen_height = displayMetrics.heightPixels;
        this.mMonitor.screen_width = displayMetrics.widthPixels;
        initMatrix(this.mMonitor.screen_width, this.mMonitorHeight);
        this.mMonitor.setState(0);
        MyLiveViewGLMonitor myLiveViewGLMonitor = this.mMonitor;
        myLiveViewGLMonitor.setMatrix(myLiveViewGLMonitor.left, this.mMonitor.bottom, this.mMonitor.width, this.mMonitor.height);
        RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(this.ll_battery.getLayoutParams());
        layoutParams4.setMargins(0, HiTools.dip2px(this, 13.0f), HiTools.dip2px(this, 10.0f), 0);
        layoutParams4.addRule(11);
        this.ll_battery.setLayoutParams(layoutParams4);
    }

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

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

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

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

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

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

    public void setViewWhetherClick(boolean z) {
        if (this.osFirstTabFragment == null || this.osSecondTabFragment == null) {
            return;
        }
        ImageView imageView = this.iv_landscape_listen;
        if (imageView != null) {
            imageView.setClickable(z);
        }
        if (this.osFirstTabFragment.iv_listen != null) {
            this.osFirstTabFragment.iv_listen.setClickable(z);
        }
        ImageView imageView2 = this.iv_landscape_record;
        if (imageView2 != null) {
            imageView2.setClickable(z);
        }
        if (this.osFirstTabFragment.iv_record != null) {
            this.osFirstTabFragment.iv_record.setClickable(z);
        }
        ImageView imageView3 = this.iv_land_snapshot;
        if (imageView3 != null) {
            imageView3.setClickable(z);
        }
        if (this.osFirstTabFragment.iv_snapshot != null) {
            this.osFirstTabFragment.iv_snapshot.setClickable(z);
        }
        ImageView imageView4 = this.iv_landscape_talk;
        if (imageView4 != null) {
            imageView4.setClickable(z);
        }
        if (this.osFirstTabFragment.iv_duijiang != null) {
            this.osFirstTabFragment.iv_duijiang.setClickable(z);
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getIsLowEletrice(LowElectricBean lowElectricBean) {
        MyCamera myCamera;
        if (lowElectricBean.isLowElectricBean() && (myCamera = this.mMyCamera) != null && myCamera.getUid().equals(lowElectricBean.getUid()) && HiTools.isForeground(this, getClass().getName())) {
            final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(this);
            niftyDialogBuilder.withMessageLayoutHWrapW(HiTools.dip2px(this, 300.0f));
            niftyDialogBuilder.withTitle(getString(R.string.tip_reminder)).withMessage(this.mMyCamera.getNikeName() + "(" + this.mMyCamera.getUid() + ")" + getString(R.string.dev_low_power_hint));
            niftyDialogBuilder.withButOnlyOne(getString(R.string.got_it), getResources().getColor(R.color.color_theme_blue), 18);
            niftyDialogBuilder.show();
            niftyDialogBuilder.setButton2Click(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    NiftyDialogBuilder.this.dismiss();
                }
            });
        }
    }

    public void wakeUpAndConnect(MyCamera myCamera) {
        Intent intent = new Intent(this, (Class<?>) WakeUpDevService.class);
        intent.putExtra(HiDataValue.EXTRAS_KEY_UID, myCamera.getUid());
        startService(intent);
    }

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

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

    private void stopZoom(int i) {
        HiLogcatUtil.i("stopZoom: ###################");
        int i2 = this.focusNum;
        if (i2 <= 0 || i2 >= 200) {
            if (i == 0) {
                this.iv_move_up.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        OSLiveViewActivity.this.lambda$stopZoom$12$OSLiveViewActivity();
                    }
                }, 60L);
            } else {
                HiLogcatUtil.i("stopZoom: ###################");
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, this.speed, (short) 10));
            }
        }
    }

    public void lambda$stopZoom$12$OSLiveViewActivity() {
        HiLogcatUtil.i("stopZoom: ###################");
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_AF_CONTROL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, this.speed, (short) 10));
    }

    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) {
                OSLiveViewActivity.this.lambda$showgoRechargeHint$13$OSLiveViewActivity(imageView, myCamera, view);
            }
        });
        inflate.findViewById(R.id.tv_know).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSLiveViewActivity.this.lambda$showgoRechargeHint$14$OSLiveViewActivity(myCamera, dialog, view);
            }
        });
        inflate.findViewById(R.id.tv_gorecharge).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSLiveViewActivity.this.lambda$showgoRechargeHint$15$OSLiveViewActivity(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$13$OSLiveViewActivity(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$14$OSLiveViewActivity(MyCamera myCamera, Dialog dialog, View view) {
        myCamera.misshowgoRecharge = true;
        dialog.dismiss();
        finish();
    }

    public void lambda$showgoRechargeHint$15$OSLiveViewActivity(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();
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        super.onActivityResult(i, i2, intent);
        if (i != 9999 || Build.VERSION.SDK_INT < 23 || Settings.canDrawOverlays(getApplicationContext())) {
            return;
        }
        Toast.makeText(getApplicationContext(), getString(R.string.floating_pfail), 0).show();
    }

    public void clickFloatingWindow() {
        PopupWindow popupWindow = this.mPopupWindow;
        if (popupWindow != null && popupWindow.isShowing()) {
            this.mPopupWindow.dismiss();
        }
        if (!HiTools.commonROMPermissionCheck(this)) {
            new DialogUtilsCamHiPro(this).title(getString(R.string.tip_reminder)).message(getString(R.string.floating_tips)).cancelText(getString(R.string.cancel)).setCancelOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    SharePreUtils.putBoolean(HiDataValue.CACHE, OSLiveViewActivity.this.getApplicationContext(), "isShowFloatingPermission", true);
                }
            }).sureText(getString(R.string.open)).setSureOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    OSLiveViewActivity.this.startActivityForResult(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + OSLiveViewActivity.this.getPackageName())), 9999);
                }
            }).build().show();
            return;
        }
        if (this.isTalking) {
            OSFirstTabFragment oSFirstTabFragment = this.osFirstTabFragment;
            if (oSFirstTabFragment != null) {
                oSFirstTabFragment.iv_duijiang.setSelected(false);
            }
            this.iv_landscape_talk.setSelected(false);
            MyCamera myCamera = this.mMyCamera;
            if (myCamera != null) {
                myCamera.stopTalk();
            }
            this.isTalking = !this.isTalking;
        }
        if (getResources().getConfiguration().orientation == 2) {
            setRequestedOrientation(1);
            HiDataValue.isOrientation = true;
        } else {
            HiDataValue.isOrientation = false;
        }
        if (this.mRecordingState == 2) {
            endRecording();
        }
        this.mFloatingWindow.showFloatingWindowView(this.isListening);
        this.mMyCamera.isFloatingW = true;
        HiDataValue.isNeedkillNoMain = true;
        Intent intent = new Intent();
        intent.setAction("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.HOME");
        startActivity(intent);
    }

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

    @Override
    public void changedScreenDirection(int i) {
        if (!this.isReadyPlay || this.ll_guide.getVisibility() == 0 || HiDataValue.isNeedkillNoMain) {
            return;
        }
        if (i == 90) {
            this.isLeft = false;
            if (!this.mIsClickReturn) {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        if (OSLiveViewActivity.this.isLarge == 1) {
                            OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                            oSLiveViewActivity.resetMonitorSize(true, oSLiveViewActivity.nLenStart);
                        } else if (OSLiveViewActivity.this.isLarge == 2) {
                            OSLiveViewActivity oSLiveViewActivity2 = OSLiveViewActivity.this;
                            oSLiveViewActivity2.resetMonitorSize(false, oSLiveViewActivity2.nLenStart);
                        }
                    }
                }, 200L);
            }
            PopupWindow popupWindow = this.mPictureSizePopupWindow;
            if (popupWindow != null && popupWindow.isShowing()) {
                this.mPictureSizePopupWindow.dismiss();
            }
            PopupWindow popupWindow2 = this.videoQualityPopupWindow;
            if (popupWindow2 != null && popupWindow2.isShowing()) {
                this.videoQualityPopupWindow.dismiss();
            }
            PopupWindow popupWindow3 = this.playbackPopupWindow;
            if (popupWindow3 != null && popupWindow3.isShowing()) {
                this.playbackPopupWindow.dismiss();
            }
            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 (OSLiveViewActivity.this.isLarge == 1) {
                            OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                            oSLiveViewActivity.resetMonitorSize(true, oSLiveViewActivity.nLenStart);
                        } else if (OSLiveViewActivity.this.isLarge == 2) {
                            OSLiveViewActivity oSLiveViewActivity2 = OSLiveViewActivity.this;
                            oSLiveViewActivity2.resetMonitorSize(false, oSLiveViewActivity2.nLenStart);
                        }
                    }
                }, 200L);
            }
            PopupWindow popupWindow4 = this.mPictureSizePopupWindow;
            if (popupWindow4 != null && popupWindow4.isShowing()) {
                this.mPictureSizePopupWindow.dismiss();
            }
            PopupWindow popupWindow5 = this.videoQualityPopupWindow;
            if (popupWindow5 != null && popupWindow5.isShowing()) {
                this.videoQualityPopupWindow.dismiss();
            }
            PopupWindow popupWindow6 = this.playbackPopupWindow;
            if (popupWindow6 != null && popupWindow6.isShowing()) {
                this.playbackPopupWindow.dismiss();
            }
            if (!this.mIsClickReturn) {
                setRequestedOrientation(0);
            }
            if (!this.isFirstRevolveLand) {
                this.isFirstRevolveLand = true;
                return;
            }
            if (this.mIsClickReturn) {
                return;
            }
            if (this.root_lock_screen.getVisibility() == 0) {
                this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
                return;
            } else {
                this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
                return;
            }
        }
        this.mIsClickReturn = false;
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                OSLiveViewActivity.this.handTalkingBack();
                if (OSLiveViewActivity.this.mPictureSizePopupWindow != null && OSLiveViewActivity.this.mPictureSizePopupWindow.isShowing()) {
                    OSLiveViewActivity.this.mPictureSizePopupWindow.dismiss();
                }
                if (OSLiveViewActivity.this.videoQualityPopupWindow != null && OSLiveViewActivity.this.videoQualityPopupWindow.isShowing()) {
                    OSLiveViewActivity.this.videoQualityPopupWindow.dismiss();
                }
                if (OSLiveViewActivity.this.playbackPopupWindow != null && OSLiveViewActivity.this.playbackPopupWindow.isShowing()) {
                    OSLiveViewActivity.this.playbackPopupWindow.dismiss();
                }
                OSLiveViewActivity.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 == 10038) {
            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) {
                OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                oSLiveViewActivity.jumpSdPlaybackActivity(oSLiveViewActivity.mMyCamera);
                OSLiveViewActivity.this.isNeedFinish = true;
            }
        });
        imageView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                OSLiveViewActivity oSLiveViewActivity = OSLiveViewActivity.this;
                oSLiveViewActivity.checkCloudStatus(oSLiveViewActivity.mMyCamera);
                OSLiveViewActivity.this.isNeedFinish = true;
            }
        });
    }

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