SecondTabFragment.java 源代码


package activity.live.fragment;

import activity.AllAdapter.FunAdapter;
import activity.live.LiveViewActivity;
import activity.live.LiveViewModel;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.CompoundButton;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import base.HiFragment;
import bean.LiveFunBean;
import bean.MyCamera;
import butterknife.ButterKnife;
import com.hichip.base.HiLog;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.xiaomi.mipush.sdk.Constants;
import common.ConstantCommand;
import common.HiDataValue;
import common.MyLiveViewGLMonitor;
import custom.SwitchButton;
import custom.dialog.NiftyDialogBuilder;
import java.util.ArrayList;
import java.util.List;
import utils.DialogUtilsCamHiPro;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;

public class SecondTabFragment extends HiFragment implements ICameraIOSessionCallback, CompoundButton.OnCheckedChangeListener, SeekBar.OnSeekBarChangeListener, AdapterView.OnItemClickListener {
    private HiChipDefines.ABSOLUTE_LIGHT_TYPE abs_light;
    private ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE audible_visual_alarm_type;
    private HiChipDefines.HI_P2P_S_AUDIO_ATTR audio_attr;
    private FunAdapter funAdapter;
    GridView function_grid;
    private ConstantCommand.HI_P2P_SMART_MOTO_EXT hiP2PSmartMotoExt;
    private HiChipDefines.HI_P2P_WHITE_LIGHT_INFO light_info;
    private HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT light_info_ext;
    private LiveViewActivity mAct;
    public ConstantCommand.HI_P2P_Garden_Lamp_INFO mGarden_lamp_info;
    private boolean mGarden_set_cancel;
    private int mHeight;
    private int mInputMethod;
    private MyCamera mMyCamera;
    public PopupWindow mPopupWindow;
    private int msaveGardenstate;
    RelativeLayout rl_zt;
    private SeekBar sb_brightness;
    private SeekBar sb_contrast;
    private SeekBar sb_saturation;
    private SeekBar seekBar_input;
    private SeekBar seekBar_output;
    SwitchButton switch_btn_zt;
    protected HiChipDefines.HI_P2P_SMART_MOTO trackParam;
    TextView tv_added_item_two;
    private TextView tv_brightness;
    private TextView tv_contrast;
    private TextView tv_saturation;
    HiChipDefines.HI_P2P_S_DISPLAY display_param = null;
    private int maxInputValue = 100;
    private int maxOutputValue = 100;
    private boolean mIsPic = false;
    public int lightModel = 0;
    public boolean mIsHaveTrack = false;
    List<LiveFunBean> funList = new ArrayList();
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == -1879048189) {
                SecondTabFragment.this.handReceiveIoCtrl(message);
            }
        }
    };

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = layoutInflater.inflate(R.layout.fragment_live_second_tab, viewGroup, false);
        ButterKnife.bind(this, inflate);
        this.mAct = (LiveViewActivity) getActivity();
        getFunction();
        initView();
        setListener();
        return inflate;
    }

    public void initHeight(int i) {
        this.mHeight = i;
    }

    public void setCamera(MyCamera myCamera) {
        HiLogcatUtil.e("");
        this.mMyCamera = myCamera;
        myCamera.registerIOSessionListener(this);
    }

    public void RegisterMyCamera() {
        HiLogcatUtil.e("");
        this.mMyCamera.registerIOSessionListener(this);
    }

    public void unRegisterMyCamera() {
        HiLogcatUtil.e("");
        this.mMyCamera.unregisterIOSessionListener(this);
    }

    private void getFunction() {
        this.funList.clear();
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM)) {
            this.funList.add(new LiveFunBean(R.string.mirror_flip, R.drawable.selector_jxfz));
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_SET_PTZ_CTRL)) {
            this.funList.add(new LiveFunBean(R.string.focus, R.drawable.selector_jjjj));
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_SET_PTZ_PRESET)) {
            this.funList.add(new LiveFunBean(R.string.perset_position, R.drawable.selector_yzw));
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_AUDIO_ATTR)) {
            this.funList.add(new LiveFunBean(R.string.volume_control, R.drawable.selector_ylkz));
        }
        if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM)) {
            this.funList.add(new LiveFunBean(R.string.adjust_image, R.drawable.selector_txtj));
        }
        getLightModel();
        getTrack();
    }

    private void getLightModel() {
        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;
        } else if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_ABSOLUTE_LIGHT_TYPE)) {
            this.lightModel = 3;
        } else if (this.mMyCamera.appGetCommandFunction(16790)) {
            this.lightModel = 4;
        } else if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_Garden_Lamp)) {
            this.lightModel = 3;
        } else if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_Garden_Lamp)) {
            this.lightModel = 5;
        }
        HiLogcatUtil.d("light111: " + this.lightModel);
        int i = this.lightModel;
        if (i != 0) {
            if (i == 4) {
                this.funList.add(new LiveFunBean(R.string.light_and_sound_alarm, R.drawable.selector_ysms));
            } else if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_Garden_Lamp)) {
                this.funList.add(new LiveFunBean(R.string.gardenlight, R.mipmap.tyd));
            } else {
                this.funList.add(new LiveFunBean(R.string.night_model, R.drawable.selector_ysms));
            }
        }
    }

    private void getTrack() {
        HiLogcatUtil.e("HI_P2P_GET_SMART_MOTO");
        if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SMART_MOTO_EXT)) {
            this.funList.add(new LiveFunBean(R.string.intelligent_tracking, R.drawable.selector_znzz));
            return;
        }
        boolean appGetCommandFunction = this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_SMART_MOTO);
        this.mIsHaveTrack = appGetCommandFunction;
        if (appGetCommandFunction) {
            this.funList.add(new LiveFunBean(R.string.tracking, R.drawable.selector_znzz));
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_SMART_MOTO, new byte[0]);
        }
    }

    private void initView() {
        FunAdapter funAdapter = new FunAdapter(getActivity(), this.funList, 0);
        this.funAdapter = funAdapter;
        this.function_grid.setAdapter((ListAdapter) funAdapter);
    }

    private void setListener() {
        this.function_grid.setOnItemClickListener(this);
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        switch (this.funList.get(i).getName()) {
            case R.string.adjust_image:
                showJuHuaDialog();
                this.mIsPic = true;
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM, null);
                return;
            case R.string.focus:
                PopupWindow popupWindow = this.mPopupWindow;
                if (popupWindow == null || !popupWindow.isShowing()) {
                    handZoomFocus();
                    return;
                }
                return;
            case R.string.gardenlight:
            case R.string.light_and_sound_alarm:
            case R.string.night_model:
                PopupWindow popupWindow2 = this.mPopupWindow;
                if (popupWindow2 == null || !popupWindow2.isShowing()) {
                    getLightParams();
                    return;
                }
                return;
            case R.string.intelligent_tracking:
                showJuHuaDialog();
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SMART_MOTO_EXT, null);
                return;
            case R.string.mirror_flip:
                showJuHuaDialog();
                this.mIsPic = false;
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM, null);
                return;
            case R.string.perset_position:
                PopupWindow popupWindow3 = this.mPopupWindow;
                if (popupWindow3 == null || !popupWindow3.isShowing()) {
                    handPreset();
                    return;
                }
                return;
            case R.string.tracking:
                handTrack(i, this.funList.get(i).isSelected());
                return;
            case R.string.volume_control:
                showJuHuaDialog();
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_AUDIO_ATTR, null);
                return;
            default:
                return;
        }
    }

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

    @Override
    public void onPause() {
        super.onPause();
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.unregisterIOSessionListener(this);
        }
        PopupWindow popupWindow = this.mPopupWindow;
        if (popupWindow != null) {
            popupWindow.dismiss();
        }
        this.mPopupWindow = null;
    }

    @Override
    public void onResume() {
        super.onResume();
        if (this.mMyCamera == null || getResources().getConfiguration().orientation != 1) {
            return;
        }
        this.mMyCamera.registerIOSessionListener(this);
    }

    @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);
    }

    private void handTrack(int i, boolean z) {
        if (z) {
            this.mAct.iv_ydzz_land.setSelected(false);
            this.trackParam.bSmartTrack = 0;
            this.funList.get(i).setSelected(false);
            this.funAdapter.notifyDataSetChanged();
            MyToast.showToast(getContext(), getString(R.string.tracking_close));
        } else {
            this.mAct.iv_ydzz_land.setSelected(true);
            this.trackParam.bSmartTrack = 1;
            this.funList.get(i).setSelected(true);
            this.funAdapter.notifyDataSetChanged();
            MyToast.showToast(getContext(), getString(R.string.tracking_open));
        }
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_SMART_MOTO, HiChipDefines.HI_P2P_SMART_MOTO.parseContent(this.trackParam.bSmartTrack));
    }

    private void showPupLight() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_light, null);
        TextView textView = (TextView) inflate.findViewById(R.id.title);
        if (this.lightModel == 4) {
            textView.setText(R.string.light_and_sound_alarm);
        } else if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_Garden_Lamp)) {
            textView.setText(R.string.gardenlight);
        }
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setOutsideTouchable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$showPupLight$0$SecondTabFragment(view);
            }
        });
        final RadioGroup radioGroup = (RadioGroup) inflate.findViewById(R.id.live_view_ext_layout);
        RadioGroup radioGroup2 = (RadioGroup) inflate.findViewById(R.id.live_view_nor_layout);
        RadioGroup radioGroup3 = (RadioGroup) inflate.findViewById(R.id.live_view_abs_light_layout);
        RadioGroup radioGroup4 = (RadioGroup) inflate.findViewById(R.id.live_view_light_and_sound);
        RadioButton[] radioButtonArr = {(RadioButton) inflate.findViewById(R.id.live_view_ext_btn_normal), (RadioButton) inflate.findViewById(R.id.live_view_ext_btn_color), (RadioButton) inflate.findViewById(R.id.live_view_ext_btn_auto)};
        RadioButton[] radioButtonArr2 = {(RadioButton) inflate.findViewById(R.id.live_view_nor_btn_open), (RadioButton) inflate.findViewById(R.id.live_view_nor_btn_close)};
        RadioButton[] radioButtonArr3 = {(RadioButton) inflate.findViewById(R.id.light_and_sound_close), (RadioButton) inflate.findViewById(R.id.light_and_sound_open), (RadioButton) inflate.findViewById(R.id.light_and_sound_auto)};
        int i = this.lightModel;
        if (i == 2) {
            radioGroup.setVisibility(8);
            radioGroup3.setVisibility(8);
            radioGroup2.setVisibility(0);
            radioGroup4.setVisibility(8);
            HiChipDefines.HI_P2P_WHITE_LIGHT_INFO hi_p2p_white_light_info = this.light_info;
            if (hi_p2p_white_light_info != null && hi_p2p_white_light_info.u32State < 2) {
                radioButtonArr2[this.light_info.u32State].setChecked(true);
            }
        } else if (i == 1 || i == 5) {
            radioGroup.setVisibility(0);
            radioGroup2.setVisibility(8);
            radioGroup3.setVisibility(8);
            radioGroup4.setVisibility(8);
            ConstantCommand.HI_P2P_Garden_Lamp_INFO hI_P2P_Garden_Lamp_INFO = this.mGarden_lamp_info;
            if (hI_P2P_Garden_Lamp_INFO != null && hI_P2P_Garden_Lamp_INFO.u32State < 3) {
                ((RadioButton) radioGroup.getChildAt(this.mGarden_lamp_info.u32State)).setChecked(true);
            }
            HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT hi_p2p_white_light_info_ext = this.light_info_ext;
            if (hi_p2p_white_light_info_ext != null && hi_p2p_white_light_info_ext.u32State < 3) {
                radioButtonArr[this.light_info_ext.u32State].setChecked(true);
            }
        } else if (i == 3) {
            radioGroup3.setVisibility(0);
            radioGroup.setVisibility(8);
            radioGroup2.setVisibility(8);
            radioGroup4.setVisibility(8);
            HiChipDefines.ABSOLUTE_LIGHT_TYPE absolute_light_type = this.abs_light;
            if (absolute_light_type != null && absolute_light_type.s32State < 3) {
                ((RadioButton) radioGroup3.getChildAt(this.abs_light.s32State)).setChecked(true);
            }
        } else {
            radioGroup3.setVisibility(8);
            radioGroup.setVisibility(8);
            radioGroup2.setVisibility(8);
            radioGroup4.setVisibility(0);
            ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE hi_p2p_s_audible_visual_alarm_type = this.audible_visual_alarm_type;
            if (hi_p2p_s_audible_visual_alarm_type != null && hi_p2p_s_audible_visual_alarm_type.u32State < 3) {
                radioButtonArr3[this.audible_visual_alarm_type.u32State].setChecked(true);
            }
        }
        radioGroup4.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                SecondTabFragment.this.lambda$showPupLight$1$SecondTabFragment(radioGroup5, i2);
            }
        });
        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                SecondTabFragment.this.lambda$showPupLight$4$SecondTabFragment(radioGroup, radioGroup5, i2);
            }
        });
        radioGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                SecondTabFragment.this.lambda$showPupLight$5$SecondTabFragment(radioGroup5, i2);
            }
        });
        radioGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public final void onCheckedChanged(RadioGroup radioGroup5, int i2) {
                SecondTabFragment.this.lambda$showPupLight$6$SecondTabFragment(radioGroup5, i2);
            }
        });
    }

    public void lambda$showPupLight$0$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    public void lambda$showPupLight$1$SecondTabFragment(RadioGroup radioGroup, int i) {
        ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE hi_p2p_s_audible_visual_alarm_type = this.audible_visual_alarm_type;
        if (hi_p2p_s_audible_visual_alarm_type == null) {
            return;
        }
        switch (i) {
            case R.id.light_and_sound_auto:
                hi_p2p_s_audible_visual_alarm_type.u32State = 2;
                break;
            case R.id.light_and_sound_close:
                hi_p2p_s_audible_visual_alarm_type.u32State = 0;
                break;
            case R.id.light_and_sound_open:
                hi_p2p_s_audible_visual_alarm_type.u32State = 1;
                break;
        }
        this.mMyCamera.sendIOCtrl(16791, this.audible_visual_alarm_type.parseContent());
    }

    public void lambda$showPupLight$4$SecondTabFragment(final RadioGroup radioGroup, RadioGroup radioGroup2, int i) {
        ConstantCommand.HI_P2P_Garden_Lamp_INFO hI_P2P_Garden_Lamp_INFO;
        int i2 = this.lightModel;
        if (i2 == 1) {
            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) {
                return;
            }
            switch (i) {
                case R.id.live_view_ext_btn_auto:
                    hi_p2p_white_light_info_ext.u32State = 2;
                    break;
                case R.id.live_view_ext_btn_color:
                    hi_p2p_white_light_info_ext.u32State = 1;
                    break;
                case R.id.live_view_ext_btn_normal:
                    hi_p2p_white_light_info_ext.u32State = 0;
                    break;
            }
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET_EXT, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT.parseContent(this.light_info_ext.u32Chn, this.light_info_ext.u32State));
            return;
        }
        if (i2 != 5 || (hI_P2P_Garden_Lamp_INFO = this.mGarden_lamp_info) == null) {
            return;
        }
        if (this.mGarden_set_cancel) {
            this.mGarden_set_cancel = false;
            return;
        }
        switch (i) {
            case R.id.live_view_ext_btn_auto:
                this.msaveGardenstate = 2;
                break;
            case R.id.live_view_ext_btn_color:
                this.msaveGardenstate = 1;
                break;
            case R.id.live_view_ext_btn_normal:
                this.msaveGardenstate = 0;
                break;
        }
        if (hI_P2P_Garden_Lamp_INFO.u32Enable != 1) {
            this.mGarden_lamp_info.u32State = this.msaveGardenstate;
            this.mAct.mGarden_lamp_info.u32Enable = 0;
            this.mAct.mGarden_lamp_info.u32State = this.msaveGardenstate;
            this.mGarden_lamp_info.u32Enable = 0;
            this.mGarden_lamp_info.u32State = this.msaveGardenstate;
            HiLog.e(this.mMyCamera.getUid() + "::41c" + this.mGarden_lamp_info.u32Enable + Constants.COLON_SEPARATOR + this.mGarden_lamp_info.u32State + Constants.COLON_SEPARATOR + i);
            this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_Garden_Lamp, this.mGarden_lamp_info.parseContent());
            return;
        }
        new DialogUtilsCamHiPro(getContext()).title(getString(R.string.tip_hint)).message(getString(R.string.tipoff_tinglight)).sureText(getString(R.string.sure)).cancelText(getString(R.string.cancel)).setCancelable(false).setCanceledOnTouchOutside(false).setSureOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$showPupLight$2$SecondTabFragment(view);
            }
        }).setCancelOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$showPupLight$3$SecondTabFragment(radioGroup, view);
            }
        }).build().show();
    }

    public void lambda$showPupLight$2$SecondTabFragment(View view) {
        MyToast.showToast(this.mAct, getString(R.string.ting_light_off));
        this.mAct.mGarden_lamp_info.u32Enable = 0;
        this.mAct.mGarden_lamp_info.u32State = this.msaveGardenstate;
        this.mGarden_lamp_info.u32Enable = 0;
        this.mGarden_lamp_info.u32State = this.msaveGardenstate;
        this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_Garden_Lamp, this.mGarden_lamp_info.parseContent());
        this.mAct.iv_ting_light.setSelected(false);
    }

    public void lambda$showPupLight$3$SecondTabFragment(RadioGroup radioGroup, View view) {
        this.mGarden_set_cancel = true;
        ((RadioButton) radioGroup.getChildAt(this.mGarden_lamp_info.u32State)).setChecked(true);
    }

    public void lambda$showPupLight$5$SecondTabFragment(RadioGroup radioGroup, int i) {
        HiChipDefines.HI_P2P_WHITE_LIGHT_INFO hi_p2p_white_light_info = this.light_info;
        if (hi_p2p_white_light_info == null) {
            return;
        }
        switch (i) {
            case R.id.live_view_nor_btn_close:
                hi_p2p_white_light_info.u32State = 1;
                break;
            case R.id.live_view_nor_btn_open:
                hi_p2p_white_light_info.u32State = 0;
                break;
        }
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_WHITE_LIGHT_SET, HiChipDefines.HI_P2P_WHITE_LIGHT_INFO.parseContent(this.light_info.u32Chn, this.light_info.u32State));
    }

    public void lambda$showPupLight$6$SecondTabFragment(RadioGroup radioGroup, int i) {
        HiChipDefines.ABSOLUTE_LIGHT_TYPE absolute_light_type;
        if (this.lightModel != 3 || (absolute_light_type = this.abs_light) == null) {
            return;
        }
        switch (i) {
            case R.id.abs_light_auto:
                absolute_light_type.s32State = 0;
                break;
            case R.id.abs_light_close:
                absolute_light_type.s32State = 2;
                break;
            case R.id.abs_light_open:
                absolute_light_type.s32State = 1;
                break;
        }
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_ABSOLUTE_LIGHT_TYPE, HiChipDefines.ABSOLUTE_LIGHT_TYPE.parseContent(this.abs_light.s32State));
    }

    private void handVolume() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_volume, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setOutsideTouchable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handVolume$7$SecondTabFragment(view);
            }
        });
        this.seekBar_input = (SeekBar) inflate.findViewById(R.id.seekbar_input);
        final TextView textView = (TextView) inflate.findViewById(R.id.txt_input_value);
        if (this.mMyCamera.getChipVersion() == 1) {
            this.maxInputValue = 16;
            this.maxOutputValue = 13;
        }
        HiChipDefines.HI_P2P_S_AUDIO_ATTR hi_p2p_s_audio_attr = this.audio_attr;
        if (hi_p2p_s_audio_attr != null) {
            this.seekBar_input.setProgress(hi_p2p_s_audio_attr.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 i, boolean z) {
                textView.setText(String.valueOf(seekBar.getProgress() + 1));
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                SecondTabFragment.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_attr2 = this.audio_attr;
        if (hi_p2p_s_audio_attr2 != null) {
            this.seekBar_output.setProgress(hi_p2p_s_audio_attr2.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 i, boolean z) {
                textView2.setText(String.valueOf(seekBar.getProgress() + 1));
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                SecondTabFragment.this.sendToDevice();
            }
        });
    }

    public void lambda$handVolume$7$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    public void sendToDevice() {
        SeekBar seekBar;
        if (this.audio_attr == null || (seekBar = this.seekBar_input) == null || this.seekBar_output == null) {
            return;
        }
        int progress = seekBar.getProgress() + 1;
        int progress2 = this.seekBar_output.getProgress() + 1;
        showJuHuaDialog();
        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 handPreset() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_preset, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setOutsideTouchable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handPreset$8$SecondTabFragment(view);
            }
        });
        LiveViewModel.getInstance().handKeyBoard(getActivity(), inflate, this.mMyCamera);
    }

    public void lambda$handPreset$8$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    private void handZoomFocus() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_zoom_focus, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setOutsideTouchable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handZoomFocus$9$SecondTabFragment(view);
            }
        });
        ((TextView) inflate.findViewById(R.id.tv_zoomin)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                return SecondTabFragment.this.lambda$handZoomFocus$10$SecondTabFragment(view, motionEvent);
            }
        });
        ((TextView) inflate.findViewById(R.id.tv_zoomout)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                return SecondTabFragment.this.lambda$handZoomFocus$11$SecondTabFragment(view, motionEvent);
            }
        });
        ((TextView) inflate.findViewById(R.id.tv_focusin)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                return SecondTabFragment.this.lambda$handZoomFocus$12$SecondTabFragment(view, motionEvent);
            }
        });
        ((TextView) inflate.findViewById(R.id.tv_focusout)).setOnTouchListener(new View.OnTouchListener() {
            @Override
            public final boolean onTouch(View view, MotionEvent motionEvent) {
                return SecondTabFragment.this.lambda$handZoomFocus$13$SecondTabFragment(view, motionEvent);
            }
        });
    }

    public void lambda$handZoomFocus$9$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    public boolean lambda$handZoomFocus$10$SecondTabFragment(View view, MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 9, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        } else if (motionEvent.getAction() == 1) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        }
        return false;
    }

    public boolean lambda$handZoomFocus$11$SecondTabFragment(View view, MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 10, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        } else if (motionEvent.getAction() == 1) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        }
        return false;
    }

    public boolean lambda$handZoomFocus$12$SecondTabFragment(View view, MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 11, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        } else if (motionEvent.getAction() == 1) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        }
        return false;
    }

    public boolean lambda$handZoomFocus$13$SecondTabFragment(View view, MotionEvent motionEvent) {
        if (motionEvent.getAction() == 0) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 12, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        } else if (motionEvent.getAction() == 1) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_PTZ_CTRL, HiChipDefines.HI_P2P_S_PTZ_CTRL.parseContent(0, 0, 0, (short) MyLiveViewGLMonitor.PTZ_STEP, (short) 10));
        }
        return false;
    }

    private void handPupMirrorFlip() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_mirror_flip, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        this.mPopupWindow.setOutsideTouchable(false);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handPupMirrorFlip$14$SecondTabFragment(view);
            }
        });
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        SwitchButton switchButton = (SwitchButton) inflate.findViewById(R.id.switch_btn_mirror);
        switchButton.setChecked(this.display_param.u32Mirror == 1);
        switchButton.setOnCheckedChangeListener(this);
        SwitchButton switchButton2 = (SwitchButton) inflate.findViewById(R.id.switch_btn_flip);
        switchButton2.setChecked(this.display_param.u32Flip == 1);
        switchButton2.setOnCheckedChangeListener(this);
    }

    public void lambda$handPupMirrorFlip$14$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    public void handReceiveIoCtrl(Message message) {
        if (message.arg2 == 0) {
            handIoCtrlSuccess(message);
        } else {
            hanIoCtrlFail(message);
        }
    }

    private void hanIoCtrlFail(Message message) {
        dismissLoadDialog();
        int i = message.arg1;
        if (i != 12549) {
            if (i == 12562) {
                MyToast.showToast(getActivity(), getString(R.string.application_fail));
                return;
            } else if (i != 16836) {
                return;
            }
        }
        MyToast.showToast(getActivity(), getString(R.string.get_data_fail));
    }

    private void handIoCtrlSuccess(Message message) {
        dismissJuHuaDialog();
        byte[] byteArray = message.getData().getByteArray("data");
        int i = message.arg1;
        if (i == 12549) {
            if (byteArray == null) {
                return;
            }
            this.display_param = new HiChipDefines.HI_P2P_S_DISPLAY(byteArray);
            if (this.mIsPic) {
                PopupWindow popupWindow = this.mPopupWindow;
                if (popupWindow != null && popupWindow.isShowing()) {
                    if (this.tv_brightness != null) {
                        this.tv_brightness.setText(this.display_param.u32Brightness + "");
                    }
                    SeekBar seekBar = this.sb_brightness;
                    if (seekBar != null) {
                        seekBar.setProgress(this.display_param.u32Brightness);
                    }
                    if (this.tv_contrast != null) {
                        this.tv_contrast.setText(this.display_param.u32Contrast + "");
                    }
                    SeekBar seekBar2 = this.sb_contrast;
                    if (seekBar2 != null) {
                        seekBar2.setProgress(this.display_param.u32Contrast);
                    }
                    if (this.tv_saturation != null) {
                        this.tv_saturation.setText(this.display_param.u32Saturation + "");
                    }
                    SeekBar seekBar3 = this.sb_saturation;
                    if (seekBar3 != null) {
                        seekBar3.setProgress(this.display_param.u32Saturation);
                        return;
                    }
                    return;
                }
                handPupImageAdjust();
                return;
            }
            PopupWindow popupWindow2 = this.mPopupWindow;
            if (popupWindow2 == null || !popupWindow2.isShowing()) {
                handPupMirrorFlip();
                return;
            }
            return;
        }
        if (i == 12561) {
            if (byteArray == null) {
                return;
            }
            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;
            }
            PopupWindow popupWindow3 = this.mPopupWindow;
            if (popupWindow3 == null || !popupWindow3.isShowing()) {
                handVolume();
                return;
            }
            return;
        }
        if (i == 12807) {
            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM, new byte[0]);
            return;
        }
        if (i == 16678) {
            if (this.lightModel == 2 && byteArray != null) {
                this.light_info = new HiChipDefines.HI_P2P_WHITE_LIGHT_INFO(byteArray);
                showPupLight();
                return;
            }
            return;
        }
        if (i == 16682) {
            if (this.lightModel == 1 && byteArray != null) {
                this.light_info_ext = new HiChipDefines.HI_P2P_WHITE_LIGHT_INFO_EXT(byteArray);
                showPupLight();
                return;
            }
            return;
        }
        if (i == 16752) {
            HiLogcatUtil.e("HI_P2P_GET_SMART_MOTO");
            if (byteArray == null) {
                return;
            }
            HiLogcatUtil.e("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;
            refreshTrack(hi_p2p_smart_moto.bSmartTrack != 0);
            return;
        }
        if (i == 16766) {
            if (this.lightModel == 3 && byteArray != null) {
                this.abs_light = new HiChipDefines.ABSOLUTE_LIGHT_TYPE(byteArray);
                showPupLight();
                return;
            }
            return;
        }
        if (i == 16790) {
            if (byteArray == null) {
                return;
            }
            this.audible_visual_alarm_type = new ConstantCommand.HI_P2P_S_AUDIBLE_VISUAL_ALARM_TYPE(byteArray);
            showPupLight();
            return;
        }
        if (i != 16836) {
            if (i == 16841 && this.mAct.mselectsecondTab && this.lightModel == 5 && byteArray != null) {
                this.mGarden_lamp_info = new ConstantCommand.HI_P2P_Garden_Lamp_INFO(byteArray);
                showPupLight();
                return;
            }
            return;
        }
        PopupWindow popupWindow4 = this.mPopupWindow;
        if (popupWindow4 == null || !popupWindow4.isShowing()) {
            this.hiP2PSmartMotoExt = new ConstantCommand.HI_P2P_SMART_MOTO_EXT(byteArray);
            handPupMoto();
        }
    }

    public void refreshTrack(boolean z) {
        for (LiveFunBean liveFunBean : this.funList) {
            if (liveFunBean.getName() == R.string.tracking) {
                liveFunBean.setSelected(z);
                this.funAdapter.notifyDataSetChanged();
                return;
            }
        }
    }

    private void handPupImageAdjust() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_image_adjust, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        this.mPopupWindow.setOutsideTouchable(false);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handPupImageAdjust$15$SecondTabFragment(view);
            }
        });
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        this.sb_brightness = (SeekBar) inflate.findViewById(R.id.sb_brightness);
        this.tv_brightness = (TextView) inflate.findViewById(R.id.tv_brightness);
        this.tv_brightness.setText(this.display_param.u32Brightness + "");
        this.sb_brightness.setMax(this.mMyCamera.brightness);
        this.sb_brightness.setProgress(this.display_param.u32Brightness);
        this.sb_brightness.setOnSeekBarChangeListener(this);
        this.sb_contrast = (SeekBar) inflate.findViewById(R.id.sb_contrast);
        this.tv_contrast = (TextView) inflate.findViewById(R.id.tv_contrast);
        this.tv_contrast.setText(this.display_param.u32Contrast + "");
        this.sb_contrast.setMax(this.mMyCamera.contrast);
        this.sb_contrast.setProgress(this.display_param.u32Contrast);
        this.sb_contrast.setOnSeekBarChangeListener(this);
        this.sb_saturation = (SeekBar) inflate.findViewById(R.id.sb_saturation);
        this.tv_saturation = (TextView) inflate.findViewById(R.id.tv_saturation);
        this.tv_saturation.setText(this.display_param.u32Saturation + "");
        this.sb_saturation.setMax(this.mMyCamera.saturation);
        this.sb_saturation.setProgress(this.display_param.u32Saturation);
        this.sb_saturation.setOnSeekBarChangeListener(this);
        ((TextView) inflate.findViewById(R.id.tv_restore_default)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handPupImageAdjust$18$SecondTabFragment(view);
            }
        });
    }

    public void lambda$handPupImageAdjust$15$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    public void lambda$handPupImageAdjust$18$SecondTabFragment(View view) {
        if (getActivity() == null) {
            return;
        }
        final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(getActivity());
        niftyDialogBuilder.withMessageLayoutHWrapW(HiTools.dip2px(getActivity(), 280.0f));
        niftyDialogBuilder.withTitle(getString(R.string.restore_param)).withMessage(getString(R.string.hint_restore_param));
        niftyDialogBuilder.withButton1Text(getString(R.string.cancel)).withButton2TextColor(getResources().getColor(R.color.colorRed)).withButton2Text(getString(R.string.confirm_restore));
        niftyDialogBuilder.setButton1Click(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                NiftyDialogBuilder.this.dismiss();
            }
        });
        niftyDialogBuilder.setButton2Click(new View.OnClickListener() {
            @Override
            public final void onClick(View view2) {
                SecondTabFragment.this.lambda$handPupImageAdjust$17$SecondTabFragment(niftyDialogBuilder, view2);
            }
        });
        niftyDialogBuilder.show();
    }

    public void lambda$handPupImageAdjust$17$SecondTabFragment(NiftyDialogBuilder niftyDialogBuilder, View view) {
        niftyDialogBuilder.dismiss();
        showJuHuaDialog();
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_DEF_DISPLAY_PARAM, new byte[0]);
    }

    private void handPupMoto() {
        if (getActivity() == null) {
            return;
        }
        View inflate = View.inflate(getContext(), R.layout.pup_moto, null);
        this.mPopupWindow = new PopupWindow(inflate);
        this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
        this.mPopupWindow.setFocusable(false);
        this.mPopupWindow.setWidth(-1);
        this.mPopupWindow.setHeight(this.mHeight);
        this.mPopupWindow.setAnimationStyle(R.style.AnimToButtom);
        this.mPopupWindow.setOutsideTouchable(false);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        ((ImageView) inflate.findViewById(R.id.iv_close)).setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SecondTabFragment.this.lambda$handPupMoto$19$SecondTabFragment(view);
            }
        });
        this.mPopupWindow.showAtLocation(inflate, 17, 0, displayMetrics.heightPixels);
        SwitchButton switchButton = (SwitchButton) inflate.findViewById(R.id.switch_btn_mt);
        switchButton.setChecked(this.hiP2PSmartMotoExt.bSmartTrack == 1);
        switchButton.setOnCheckedChangeListener(this);
        this.switch_btn_zt = (SwitchButton) inflate.findViewById(R.id.switch_btn_zt);
        this.rl_zt = (RelativeLayout) inflate.findViewById(R.id.rl_zt);
        this.switch_btn_zt.setChecked(this.hiP2PSmartMotoExt.auto == 0);
        this.switch_btn_zt.setOnCheckedChangeListener(this);
        if (this.hiP2PSmartMotoExt.bSmartTrack != 1) {
            this.switch_btn_zt.setClickable(false);
            this.rl_zt.setAlpha(0.3f);
        }
    }

    public void lambda$handPupMoto$19$SecondTabFragment(View view) {
        this.mPopupWindow.dismiss();
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        switch (compoundButton.getId()) {
            case R.id.switch_btn_flip:
                this.display_param.u32Flip = z ? 1 : 0;
                showJuHuaDialog();
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, this.display_param.parseContent());
                return;
            case R.id.switch_btn_mirror:
                this.display_param.u32Mirror = z ? 1 : 0;
                showJuHuaDialog();
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DISPLAY_PARAM, this.display_param.parseContent());
                return;
            case R.id.switch_btn_mt:
                showJuHuaDialog();
                this.hiP2PSmartMotoExt.bSmartTrack = z ? 1 : 0;
                if (z) {
                    this.switch_btn_zt.setClickable(true);
                    this.rl_zt.setAlpha(1.0f);
                } else {
                    this.switch_btn_zt.setClickable(false);
                    this.rl_zt.setAlpha(0.3f);
                }
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_SMART_MOTO_EXT, this.hiP2PSmartMotoExt.parseContent());
                return;
            case R.id.switch_btn_zt:
                showJuHuaDialog();
                this.hiP2PSmartMotoExt.auto = !z ? 1 : 0;
                this.mMyCamera.sendIOCtrl(ConstantCommand.HI_P2P_SET_SMART_MOTO_EXT, this.hiP2PSmartMotoExt.parseContent());
                return;
            default:
                return;
        }
    }

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

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