OSSettingActivity.java 源代码


package liteos.ossetting;

import account.bean.EmptyBean;
import account.bean.LoginUserInfo;
import account.bean.UnbindDevBean;
import activity.EditCameraActivity;
import activity.FishEye.FishEyeActivity;
import activity.WallMounted.WallMountedActivity;
import activity.cloud.CloudStorageInformationActivity;
import activity.cloud.api.UserApiFactory;
import activity.cloud.re.MyCallBack;
import activity.cloud.utils.DateUtils;
import activity.setting.AudioSettingActivity;
import activity.setting.DeviceInfoActivity;
import activity.setting.PasswordSettingActivity;
import activity.setting.SDCardSettingActivity;
import activity.setting.SystemSettingActivity;
import activity.setting.TimeSettingActivity;
import activity.setting.VideoSettingActivity;
import activity.setting.WiFiSettingActivity;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.app.ActionBar;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AccelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import base.HiActivity;
import bean.GroupBeanSave;
import bean.GroupBeanUse;
import bean.MyCamera;
import com.bumptech.glide.Glide;
import com.hichip.callback.ICameraIOSessionCallback;
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.xiaomi.mipush.sdk.Constants;
import common.CamHiDefines;
import common.Constant;
import common.ConstantCommand;
import common.HiDataValue;
import custom.FloatingWindow;
import custom.ObservableScrollView;
import custom.ShadowLayout;
import custom.dialog.NiftyDialogBuilder;
import custom.pageloading.LoadingView;
import java.io.ByteArrayOutputStream;
import java.util.Iterator;
import java.util.Locale;
import java.util.Objects;
import java.util.regex.Pattern;
import jp.wasabeef.glide.transformations.BlurTransformation;
import liteos.ShareQRDetCodeActivity;
import liteos.live.OSDualLiveViewActivity;
import liteos.live.OSLiveViewActivity;
import main.CameraFragment;
import main.NVR.adapter.NVRListBean;
import org.json.JSONException;
import org.json.JSONObject;
import service.WakeUpDevService;
import utils.DialogUtilsCamHiPro;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;
import utils.SharePreUtils;
import utils.ToastUtil;
import utils.WifiUtils;

public class OSSettingActivity extends HiActivity implements View.OnClickListener, ICameraIOSessionCallback, ObservableScrollView.ScrollViewListener {
    private static final int MY_PERMISSION_REQUEST_CODE = 10039;
    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";
    String autoShare;
    private Bitmap bitmap;
    TextView btn_delete_camera;
    private byte[] bytes;
    EditText et_head_nickname;
    EditText et_nickname;
    private HiLitosSDK hiLitosSDK;
    private HiSearchSDK hiSearchSDK;
    private boolean isJuHe;
    private boolean isSupportCloud;
    TextView iv_auto_share;
    ImageView iv_edit_name;
    ImageView iv_head;
    ImageView iv_head_icon;
    ImageView iv_return;
    ImageView iv_return_01;
    TextView iv_share;
    private int lastDis;
    LinearLayout ll_alarm_setting;
    LinearLayout ll_all_setting;
    LinearLayout ll_buy_storage;
    LinearLayout ll_cloud;
    LinearLayout ll_floating;
    LinearLayout ll_hand_edit;
    LinearLayout ll_liteos;
    LinearLayout ll_setting_device_info;
    LinearLayout ll_setting_floating;
    LinearLayout ll_setting_password;
    LinearLayout ll_setting_plan_video;
    LinearLayout ll_setting_sd_card;
    LinearLayout ll_setting_system;
    LinearLayout ll_setting_time;
    LinearLayout ll_setting_video;
    LinearLayout ll_setting_wifi;
    LinearLayout ll_station;
    LoadingView loadView;
    private FloatingWindow mFloatingWindow;
    private MyCamera mMyCamera;
    private int mTop;
    private boolean not_hint;
    RelativeLayout rl_head_name;
    RelativeLayout rl_loading;
    RelativeLayout rl_setting_audio;
    ObservableScrollView scrollView;
    ShadowLayout shadowlayout;
    private String str_nick;
    TextView tv_current_device_wifi;
    TextView tv_disconnect_1;
    TextView tv_head_uid;
    TextView tv_uid;
    private float alpha = 0.4f;
    MyCamera.OnBindPushResult bindPushResult = new MyCamera.OnBindPushResult() {
        @Override
        public void onBindTokenIsNull(MyCamera myCamera, boolean z) {
        }

        @Override
        public void onBindSuccess(MyCamera myCamera) {
            Log.i("tedu", myCamera.getUid() + " 绑定成功" + myCamera.getServerData());
            myCamera.setPushDevName(OSSettingActivity.this.str_nick);
        }

        @Override
        public void onBindFail(MyCamera myCamera) {
            Log.i("tedu", myCamera.getUid() + " 解绑推送失败:" + myCamera.getServerData());
        }

        @Override
        public void onUnBindSuccess(MyCamera myCamera) {
            Log.i("tedu", myCamera.getUid() + " 解绑推送成功:" + myCamera.getServerData());
        }

        @Override
        public void onUnBindFail(MyCamera myCamera) {
            if (myCamera.getPushState() > 0) {
                SharePreUtils.putInt("subId", OSSettingActivity.this, myCamera.getUid(), myCamera.getPushState());
            }
        }

        @Override
        public void onUpdatePushNameSuccess(MyCamera myCamera) {
            Log.i("tedu", myCamera.getUid() + " onUpdatePushNameSuccess ");
        }

        @Override
        public void onUpdatePushNameFail(MyCamera myCamera) {
            Log.i("tedu", myCamera.getUid() + " onUpdatePushNameFail ");
        }
    };
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            switch (message.what) {
                case HiDataValue.HANDLE_MESSAGE_SESSION_STATE:
                    OSSettingActivity.this.handMsgSessionState(message);
                    return;
                case HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL:
                    OSSettingActivity.this.handIOCTRL(message);
                    return;
                case 2456:
                    if (OSSettingActivity.this.bytes != null) {
                        Glide.with((FragmentActivity) OSSettingActivity.this).load(OSSettingActivity.this.bytes).placeholder(R.mipmap.videoclip).error(R.mipmap.videoclip).bitmapTransform(new BlurTransformation(OSSettingActivity.this, 23, 5)).into(OSSettingActivity.this.iv_head);
                        return;
                    }
                    return;
                case 65537:
                    for (int i = 0; i < HiDataValue.mapBeanList.size(); i++) {
                        NVRListBean nVRListBean = HiDataValue.mapBeanList.get(i);
                        HiLogcatUtil.e("HANDLE_MESSAGE_DELETE_FILE " + i + "::" + OSSettingActivity.this.mMyCamera.mNVRChaildDevNum + "::" + nVRListBean.getMyCamera().getUid() + ":::" + OSSettingActivity.this.mMyCamera.getUid());
                        if (nVRListBean.getMyCamera().getUid().equalsIgnoreCase(OSSettingActivity.this.mMyCamera.getUid()) && nVRListBean.getViewType() == 0) {
                            HiDataValue.mapBeanList.indexOf(nVRListBean);
                            if (nVRListBean.getMyCamera() == null) {
                                return;
                            }
                            OSSettingActivity.this.mMyCamera.disconnect(1);
                            nVRListBean.deleteInCameraList();
                            OSSettingActivity.this.mMyCamera.deleteInCameraList();
                            OSSettingActivity.this.mMyCamera.deleteInDatabase(OSSettingActivity.this);
                            int i2 = 0;
                            while (i2 < HiDataValue.groupList.size()) {
                                int i3 = 0;
                                while (true) {
                                    if (i3 < HiDataValue.groupList.get(i2).getCameraList().length) {
                                        if (HiDataValue.groupList.get(i2).getCameraList()[i3] == null || !HiDataValue.groupList.get(i2).getCameraList()[i3].getUid().equals(OSSettingActivity.this.mMyCamera.getUid())) {
                                            i3++;
                                        } else {
                                            HiDataValue.groupList.get(i2).getCameraList()[i3] = null;
                                        }
                                    }
                                }
                                if (HiDataValue.groupList.get(i2).getCameraList()[0] != null || HiDataValue.groupList.get(i2).getCameraList()[1] != null || HiDataValue.groupList.get(i2).getCameraList()[2] != null || HiDataValue.groupList.get(i2).getCameraList()[3] != null) {
                                    OSSettingActivity.this.updateGroup(HiDataValue.groupList.get(i2));
                                } else {
                                    OSSettingActivity.this.deleteGroup(HiDataValue.groupList.get(i2));
                                    i2--;
                                }
                                i2++;
                            }
                            OSSettingActivity.this.dismissjuHuaDialog();
                            SharePreUtils.putInt(HiDataValue.CACHE, OSSettingActivity.this, "pictureSize" + HiDataValue.userAccount + OSSettingActivity.this.mMyCamera.getUid(), 0);
                            if (HiTools.isNVRDev(OSSettingActivity.this.mMyCamera.getUid())) {
                                OSSettingActivity oSSettingActivity = OSSettingActivity.this;
                                MyToast.showToast(oSSettingActivity, oSSettingActivity.getString(R.string.tips_remove_success_nvr));
                            } else {
                                OSSettingActivity oSSettingActivity2 = OSSettingActivity.this;
                                MyToast.showToast(oSSettingActivity2, oSSettingActivity2.getString(R.string.tips_remove_success));
                            }
                            OSSettingActivity.this.sendBroadcast(new Intent(HiDataValue.ACTION_CAMERA_INIT_END));
                            OSSettingActivity.this.finish();
                            return;
                        }
                    }
                    return;
                case ConstantCommand.HI_P2P_SET_SCENE_MODE:
                    OSSettingActivity.this.mFloatingWindow.setTopApp(OSSettingActivity.this);
                    OSSettingActivity oSSettingActivity3 = OSSettingActivity.this;
                    Toast.makeText(oSSettingActivity3, oSSettingActivity3.getString(R.string.tips_open_video_fail), 0).show();
                    return;
                case ConstantCommand.HI_P2P_GET_DEVICE_WORKING_MODE:
                    MyToast.showToast(OSSettingActivity.this.getApplicationContext(), OSSettingActivity.this.getString(R.string.netword_abnormal));
                    if (OSSettingActivity.this.mMyCamera != null) {
                        OSSettingActivity.this.mMyCamera.stopLiveShow();
                        OSSettingActivity.this.mMyCamera.stopListening();
                    }
                    HiDataValue.isNeedkillNoMain = false;
                    if (OSSettingActivity.this.mFloatingWindow != null) {
                        OSSettingActivity.this.mFloatingWindow.dismiss();
                    }
                    OSSettingActivity.this.finish();
                    return;
                default:
                    return;
            }
        }
    };
    private boolean canToLive = true;

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

    @Override
    protected void init(Bundle bundle) {
        CameraFragment.addCameraCanClick = true;
        getIntentData();
        if (HiTools.cameraWhetherNull(this.mMyCamera, this)) {
            return;
        }
        getDevRunMode();
        initViewAndData();
        setListeners();
    }

    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)) || this.mMyCamera.getIsAPRunMode()) {
            return;
        }
        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 void onReceiveLitosResult(String str, int i, int i2, int i3) {
                if (TextUtils.isEmpty(str) || str.split("\r\n").length <= 3) {
                    OSSettingActivity.this.setDevRunMode();
                    return;
                }
                try {
                    if (new JSONObject(str.split("\r\n")[r1.length - 1]).getJSONObject("devinfo").getString(Constant.MODE).equals("1")) {
                        return;
                    }
                    OSSettingActivity.this.setDevRunMode();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
        this.hiLitosSDK = hiLitosSDK;
        hiLitosSDK.HttpRequest("192.168.55.1", 15555, "/liteos/param.cgi?cmd=getdevinfo", 5, 6);
    }

    public void setDevRunMode() {
        HiLitosSDK hiLitosSDK = new HiLitosSDK(new HiLitosSDK.ILitosResult() {
            @Override
            public void onReceiveLitosResult(String str, int i, int i2, int i3) {
                if (!TextUtils.isEmpty(str) && str.split("\r\n").length > 3) {
                    OSSettingActivity.this.mMyCamera.setIsAPRunMode(true);
                } else {
                    OSSettingActivity oSSettingActivity = OSSettingActivity.this;
                    MyToast.showToast(oSSettingActivity, oSSettingActivity.getString(R.string.netword_abnormal));
                }
            }
        });
        this.hiLitosSDK = hiLitosSDK;
        hiLitosSDK.HttpRequest("192.168.55.1", 15555, "/liteos/param.cgi?cmd=setsysmode&-mode=1&", 5, 5);
    }

    @Override
    public void onResume() {
        super.onResume();
        this.et_nickname.setText(this.mMyCamera.getNikeName());
        this.et_head_nickname.setText(this.mMyCamera.getNikeName());
        if (this.bitmap == null) {
            initHeadView();
        }
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.registerIOSessionListener(this);
            if (this.mMyCamera.getConnectState() != 4 && !this.mMyCamera.getIsLiteOs()) {
                this.ll_cloud.setEnabled(false);
                this.ll_cloud.setAlpha(this.alpha);
                this.ll_setting_wifi.setEnabled(false);
                this.ll_setting_wifi.setAlpha(this.alpha);
                this.ll_setting_password.setEnabled(false);
                this.ll_setting_password.setAlpha(this.alpha);
                this.ll_floating.setEnabled(false);
                this.ll_floating.setAlpha(this.alpha);
                this.ll_setting_floating.setEnabled(false);
                this.ll_setting_floating.setAlpha(this.alpha);
                this.ll_setting_system.setEnabled(false);
                this.ll_setting_system.setAlpha(this.alpha);
                this.ll_setting_device_info.setEnabled(false);
                this.ll_setting_device_info.setAlpha(this.alpha);
                this.ll_alarm_setting.setEnabled(false);
                this.ll_alarm_setting.setAlpha(this.alpha);
                this.ll_setting_plan_video.setEnabled(false);
                this.ll_setting_plan_video.setAlpha(this.alpha);
                this.ll_setting_sd_card.setEnabled(false);
                this.ll_setting_sd_card.setAlpha(this.alpha);
                this.ll_setting_video.setEnabled(false);
                this.ll_setting_video.setAlpha(this.alpha);
                this.rl_setting_audio.setEnabled(false);
                this.rl_setting_audio.setAlpha(this.alpha);
                this.ll_setting_time.setEnabled(false);
                this.ll_setting_time.setAlpha(this.alpha);
                this.iv_share.setVisibility(8);
                if (this.mMyCamera.getConnectState() == 0) {
                    this.mFloatingWindow.setReady(false);
                    this.ll_all_setting.setVisibility(8);
                    this.tv_disconnect_1.setVisibility(0);
                }
            } else if (!TextUtils.isEmpty(this.autoShare)) {
                this.iv_auto_share.setVisibility(0);
            }
        }
        if (HiTools.getAndroidVersion() >= 29) {
            if (this.mMyCamera.isFishEye() || this.mMyCamera.isWallMounted || this.mMyCamera.getdevDual()) {
                this.ll_floating.setVisibility(8);
                this.ll_setting_floating.setVisibility(8);
            } else {
                this.ll_floating.setVisibility(0);
                this.ll_setting_floating.setVisibility(0);
            }
        } else {
            this.ll_floating.setVisibility(8);
            this.ll_setting_floating.setVisibility(8);
        }
        HiDataValue.isNeedkillNoMain = false;
    }

    private void setListeners() {
        this.iv_return.setOnClickListener(this);
        this.iv_edit_name.setOnClickListener(this);
        this.ll_setting_wifi.setOnClickListener(this);
        this.ll_setting_password.setOnClickListener(this);
        this.ll_setting_floating.setOnClickListener(this);
        this.ll_setting_device_info.setOnClickListener(this);
        this.ll_setting_system.setOnClickListener(this);
        this.ll_setting_video.setOnClickListener(this);
        this.ll_setting_sd_card.setOnClickListener(this);
        this.ll_setting_plan_video.setOnClickListener(this);
        this.ll_setting_time.setOnClickListener(this);
        this.scrollView.setScrollViewListener(this);
        this.btn_delete_camera.setOnClickListener(this);
        this.iv_head_icon.setOnClickListener(this);
        this.ll_hand_edit.setOnClickListener(this);
        this.rl_setting_audio.setOnClickListener(this);
        this.ll_alarm_setting.setOnClickListener(this);
        this.ll_liteos.setOnClickListener(this);
        this.iv_return_01.setOnClickListener(this);
        this.iv_share.setOnClickListener(this);
        this.iv_auto_share.setOnClickListener(this);
        this.ll_buy_storage.setOnClickListener(this);
    }

    private void initViewAndData() {
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            this.mFloatingWindow = new FloatingWindow(this, myCamera, HiTools.getScreenW(this), false);
        }
        this.mTop = HiTools.dip2px(this, 105.0f);
        this.lastDis = HiTools.dip2px(this, 5.0f);
        this.tv_uid.setText(this.mMyCamera.getUid());
        this.tv_head_uid.setText(this.mMyCamera.getUid());
        if (this.mMyCamera.getConnectState() == 4) {
            Log.i("tedu", "--OS SettingActivity--P2P在线--:");
            this.rl_loading.setVisibility(8);
            HiTools.setTransStatusBar(this);
            if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_POWER_MODE) || LiteOsSettingActivity.isDebugModel) {
                this.ll_liteos.setVisibility(0);
                this.ll_station.setVisibility(8);
            } else {
                this.ll_liteos.setVisibility(8);
                this.ll_station.setVisibility(0);
                this.isJuHe = true;
            }
            if (this.mMyCamera.isBindCurrentAccount() == 1) {
                this.btn_delete_camera.setVisibility(0);
            } else {
                this.btn_delete_camera.setVisibility(8);
            }
            handShare();
        } else {
            Log.i("tedu", "--OS SettingActivity--P2P不在线唤:");
            this.rl_loading.setVisibility(0);
            WakeUp();
        }
        if (this.mMyCamera.getIs_4G()) {
            this.ll_setting_wifi.setVisibility(8);
        } else {
            this.ll_setting_wifi.setVisibility(0);
        }
    }

    private void handShare() {
        if (this.mMyCamera.getCameraLevel() == 1 && this.mMyCamera.isBindCurrentAccount() == 2) {
            this.iv_share.setVisibility(8);
        } else {
            this.iv_share.setVisibility(0);
        }
        if (TextUtils.isEmpty(this.autoShare)) {
            return;
        }
        this.iv_auto_share.setVisibility(0);
    }

    private void WakeUp() {
        wakeUpAndConnect(this.mMyCamera);
    }

    private void initHeadView() {
        this.bitmap = this.mMyCamera.snapshot;
        new Thread() {
            @Override
            public void run() {
                if (OSSettingActivity.this.mMyCamera.snapshot != null) {
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    OSSettingActivity.this.mMyCamera.snapshot.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
                    OSSettingActivity.this.bytes = byteArrayOutputStream.toByteArray();
                }
                OSSettingActivity.this.mHandler.sendEmptyMessage(2456);
            }
        }.start();
        if (this.mMyCamera.snapshot != null) {
            this.iv_head_icon.setImageBitmap(this.mMyCamera.snapshot);
        } else {
            this.iv_head_icon.setImageResource(R.mipmap.videoclip);
        }
    }

    private void getIntentData() {
        this.iv_share.setVisibility(8);
        String stringExtra = getIntent().getStringExtra(HiDataValue.EXTRAS_KEY_UID);
        this.autoShare = getIntent().getStringExtra("autoShare");
        if (TextUtils.isEmpty(stringExtra)) {
            MyToast.showToast(this, "UID is Empty");
            finish();
            return;
        }
        Iterator<MyCamera> it = HiDataValue.CameraList.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            MyCamera next = it.next();
            if (stringExtra.equalsIgnoreCase(next.getUid())) {
                this.mMyCamera = next;
                break;
            }
        }
        if (HiTools.cameraWhetherNull(this.mMyCamera, this)) {
            return;
        }
        if (this.mMyCamera.getConnectState() == 4) {
            if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_WIFI_PARAM_NEWPWD255_EXT1)) {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_WIFI_PARAM_NEWPWD255_EXT1, new byte[0]);
            } else {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_WIFI_PARAM, null);
            }
        }
        if (this.mMyCamera.getIsSupportLiteCloud() && Locale.getDefault().getLanguage().equals("zh") && Locale.getDefault().getCountry().equals("CN")) {
            this.ll_cloud.setVisibility(0);
            this.isSupportCloud = true;
        }
    }

    @Override
    public void onClick(View view) {
        if (this.et_nickname.hasFocus()) {
            if (view.getId() == R.id.iv_return) {
                finish();
            } else {
                handDown();
                return;
            }
        }
        switch (view.getId()) {
            case R.id.btn_delete_camera:
                if (this.mMyCamera.getConnectState() != 4) {
                    return;
                }
                showDeleteCamera();
                return;
            case R.id.iv_auto_share:
            case R.id.iv_share:
                Intent intent = new Intent(this, (Class<?>) ShareQRDetCodeActivity.class);
                intent.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent);
                return;
            case R.id.iv_edit_name:
                handIvEditName();
                return;
            case R.id.iv_head_icon:
                if (this.canToLive) {
                    MyCamera myCamera = this.mMyCamera;
                    if (myCamera != null && myCamera.getConnectState() == 4) {
                        this.mMyCamera.isFirstEnterLive = SharePreUtils.getBoolean(HiDataValue.CACHE, this, this.mMyCamera.getUid() + "isFirstEnterLive", true);
                        if (this.mMyCamera.isWallMounted) {
                            Intent intent2 = new Intent(this, (Class<?>) WallMountedActivity.class);
                            intent2.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                            startActivity(intent2);
                            finish();
                            return;
                        }
                        if (this.mMyCamera.isFishEye()) {
                            int i = SharePreUtils.getInt(Constant.INSTALLMODE, this, this.mMyCamera.getUid());
                            this.mMyCamera.mInstallMode = i != -1 ? i : 0;
                            Intent intent3 = new Intent(this, (Class<?>) FishEyeActivity.class);
                            intent3.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                            startActivity(intent3);
                            finish();
                            return;
                        }
                        if (HiTools.isFastClick()) {
                            return;
                        }
                        HiDataValue.isNeedkillNoMain = false;
                        Intent intent4 = new Intent(this, (Class<?>) OSLiveViewActivity.class);
                        if (this.mMyCamera.getdevDual()) {
                            intent4.setClass(this, OSDualLiveViewActivity.class);
                        }
                        intent4.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                        startActivity(intent4);
                        finish();
                        return;
                    }
                    MyToast.showToast(this, getString(R.string.current_disconnect));
                    return;
                }
                return;
            case R.id.iv_return:
            case R.id.iv_return_01:
                finish();
                return;
            case R.id.ll_alarm_setting:
                Intent intent5 = new Intent(this, (Class<?>) OSAlarmManageAndNotiActivity.class);
                intent5.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                intent5.putExtra("isJuHe", this.isJuHe);
                intent5.putExtra("isSupportCloud", this.isSupportCloud);
                startActivity(intent5);
                return;
            case R.id.ll_buy_storage:
                Intent intent6 = new Intent(this, (Class<?>) CloudStorageInformationActivity.class);
                intent6.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent6);
                return;
            case R.id.ll_liteos:
                Intent intent7 = new Intent(this, (Class<?>) LiteOsSettingActivity.class);
                intent7.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent7);
                return;
            case R.id.ll_setting_device_info:
                Intent intent8 = new Intent(this, (Class<?>) DeviceInfoActivity.class);
                intent8.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent8);
                return;
            case R.id.ll_setting_floating:
                MyCamera myCamera2 = this.mMyCamera;
                if (myCamera2 == null || myCamera2.getConnectState() != 4) {
                    return;
                }
                clickFloatingWindow();
                return;
            case R.id.ll_setting_password:
                Intent intent9 = new Intent(this, (Class<?>) PasswordSettingActivity.class);
                intent9.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent9);
                return;
            case R.id.ll_setting_plan_video:
                Intent intent10 = new Intent(this, (Class<?>) OSPlanVideoActivity.class);
                intent10.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent10);
                return;
            case R.id.ll_setting_sd_card:
                Intent intent11 = new Intent(this, (Class<?>) SDCardSettingActivity.class);
                intent11.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent11);
                return;
            case R.id.ll_setting_system:
                Intent intent12 = new Intent(this, (Class<?>) SystemSettingActivity.class);
                intent12.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent12);
                return;
            case R.id.ll_setting_time:
                Intent intent13 = new Intent(this, (Class<?>) TimeSettingActivity.class);
                intent13.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent13);
                return;
            case R.id.ll_setting_video:
                Intent intent14 = new Intent(this, (Class<?>) VideoSettingActivity.class);
                intent14.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent14);
                return;
            case R.id.ll_setting_wifi:
                Intent intent15 = new Intent(this, (Class<?>) WiFiSettingActivity.class);
                intent15.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent15);
                return;
            case R.id.rl_setting_audio:
                Intent intent16 = new Intent(this, (Class<?>) AudioSettingActivity.class);
                intent16.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
                startActivity(intent16);
                return;
            default:
                return;
        }
    }

    private void showDeleteCamera() {
        final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(this);
        niftyDialogBuilder.withTitle(getString(R.string.confirm_delete)).withMessage(this.mMyCamera.getUid() + getString(R.string.newline_delete)).withButton1Text(getString(R.string.NO)).withButton2Text(getString(R.string.YES));
        niftyDialogBuilder.setButton1Click(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                NiftyDialogBuilder.this.dismiss();
            }
        });
        niftyDialogBuilder.setButton2Click(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                OSSettingActivity.this.lambda$showDeleteCamera$1$OSSettingActivity(niftyDialogBuilder, view);
            }
        });
        niftyDialogBuilder.show();
    }

    public void lambda$showDeleteCamera$1$OSSettingActivity(NiftyDialogBuilder niftyDialogBuilder, View view) {
        niftyDialogBuilder.dismiss();
        showjuHuaDialog();
        if (this.mMyCamera.getPushState() > 0) {
            this.mMyCamera.bindPushState(false, this.bindPushResult);
        }
        HiTools.removeAllShareKey(this, this.mMyCamera);
        sendUnRegister(this.mMyCamera, 0);
        handUnbindAccount(this.mMyCamera);
        Message obtainMessage = this.mHandler.obtainMessage();
        obtainMessage.what = 65537;
        obtainMessage.obj = this.mMyCamera;
        this.mHandler.sendMessageDelayed(obtainMessage, 1000L);
    }

    private void handUnbindAccount(MyCamera myCamera) {
        myCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_EMAIL_PARAM_NEWPWD255_EXT, new byte[976]);
        unBindDevToService(myCamera);
    }

    private void unBindDevToService(MyCamera myCamera) {
        if (myCamera == null || TextUtils.isEmpty(LoginUserInfo.getInstance().getToken(this))) {
            return;
        }
        UserApiFactory.getApi().DvUnBind(new UnbindDevBean(LoginUserInfo.getInstance().getToken(this), this.mMyCamera.getUid(), DateUtils.getDate())).enqueue(new MyCallBack<EmptyBean>() {
            @Override
            protected void onError(Throwable th, String str) {
            }

            @Override
            public void onSuccess(EmptyBean emptyBean) {
            }
        });
    }

    private void handIvEditName() {
        this.et_nickname.setFocusable(true);
        this.et_nickname.setFocusableInTouchMode(true);
        this.et_nickname.requestFocus();
        if (!TextUtils.isEmpty(this.et_nickname.getText().toString())) {
            EditText editText = this.et_nickname;
            editText.setSelection(editText.getText().toString().length());
        }
        ((InputMethodManager) getSystemService("input_method")).showSoftInput(this.et_nickname, 2);
    }

    private boolean handDown() {
        this.et_nickname.clearFocus();
        this.et_nickname.setFocusable(false);
        ((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(this.et_nickname.getWindowToken(), 0);
        String trim = this.et_nickname.getText().toString().trim();
        this.str_nick = trim;
        if (trim.length() == 0) {
            showAlert(getText(R.string.tips_null_nike));
            return true;
        }
        if (!this.mMyCamera.getNikeName().equals(this.str_nick)) {
            this.mMyCamera.setNikeName(this.str_nick);
            this.mMyCamera.setPushDevName(this.str_nick);
            this.mMyCamera.updateInDatabase(this);
            this.et_head_nickname.setText(this.str_nick);
        }
        if (this.mMyCamera.getPushState() > 0) {
            this.mMyCamera.bindPushState(true, this.bindPushResult);
        }
        return false;
    }

    protected void sendServer(MyCamera myCamera) {
        if (myCamera.getServerData() == null) {
            myCamera.setServerData("120.24.179.113");
            myCamera.updateServerInDatabase(this);
        }
        if (myCamera.appGetCommandFunction(CamHiDefines.HI_P2P_ALARM_ADDRESS_SET) && myCamera.f987push != null) {
            String[] split = myCamera.f987push.getPushServer().split("\\.");
            if (split.length == 4 && isInteger(split[0]) && isInteger(split[1]) && isInteger(split[2]) && isInteger(split[3])) {
                myCamera.sendIOCtrl(CamHiDefines.HI_P2P_ALARM_ADDRESS_SET, CamHiDefines.HI_P2P_ALARM_ADDRESS.parseContent(myCamera.f987push.getPushServer()));
            }
        }
    }

    public static boolean isInteger(String str) {
        return Pattern.compile("^[-\\+]?[\\d]*$").matcher(str).matches();
    }

    private void sendUnRegister(MyCamera myCamera, int i) {
        if (myCamera.getPushState() != 1 && myCamera.appGetCommandFunction(CamHiDefines.HI_P2P_ALARM_TOKEN_UNREGIST)) {
            myCamera.sendIOCtrl(CamHiDefines.HI_P2P_ALARM_TOKEN_UNREGIST, CamHiDefines.HI_P2P_ALARM_TOKEN_INFO.parseContent(0, myCamera.getPushState(), (int) ((System.currentTimeMillis() / 1000) / 3600), i));
        }
    }

    public void updateGroup(GroupBeanUse groupBeanUse) {
        String[] strArr = new String[4];
        for (int i = 0; i < groupBeanUse.getCameraList().length; i++) {
            if (groupBeanUse.getCameraList()[i] != null) {
                strArr[i] = groupBeanUse.getCameraList()[i].getUid();
            }
        }
        GroupBeanSave groupBeanSave = new GroupBeanSave();
        groupBeanSave.setGroupId(groupBeanUse.getGroupId());
        groupBeanSave.setGroupName(groupBeanUse.getGroupName());
        groupBeanSave.setCameraArray(strArr);
        HiTools.updateFourLiveGroup(this, groupBeanSave);
    }

    public void deleteGroup(GroupBeanUse groupBeanUse) {
        HiDataValue.groupList.remove(groupBeanUse);
        GroupBeanSave groupBeanSave = new GroupBeanSave();
        groupBeanSave.setGroupId(groupBeanUse.getGroupId());
        HiTools.deleteFourLiveGroup(this, groupBeanSave);
    }

    public void handMsgSessionState(Message message) {
        int i = message.arg1;
        if (i == 0) {
            if (!this.mMyCamera.misshowgoRecharge && this.mMyCamera.mPreICCIDRecharge == 2) {
                showgoRechargeHint(this.mMyCamera);
            }
            if (HiDataValue.isNeedkillNoMain) {
                this.mHandler.sendEmptyMessageDelayed(ConstantCommand.HI_P2P_GET_DEVICE_WORKING_MODE, 1000L);
                return;
            }
            return;
        }
        if (i == 3) {
            MyToast.showToast(this, getString(R.string.tips_old_password_is_wrong));
            Intent intent = new Intent(this, (Class<?>) EditCameraActivity.class);
            intent.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
            startActivity(intent);
            finish();
            return;
        }
        if (i != 4) {
            return;
        }
        handShare();
        this.mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                OSSettingActivity.this.handPercentageView();
            }
        }, 1500L);
        HiTools.setTransStatusBar(this);
        if (this.mMyCamera.getConnectState() == 4) {
            if (this.mMyCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_POWER_MODE)) {
                this.ll_liteos.setVisibility(0);
                this.ll_station.setVisibility(8);
            } else {
                this.ll_liteos.setVisibility(8);
                this.ll_station.setVisibility(0);
                this.isJuHe = true;
            }
            if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_WIFI_PARAM_NEWPWD255_EXT1)) {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_WIFI_PARAM_NEWPWD255_EXT1, new byte[0]);
            } else {
                this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_WIFI_PARAM, null);
            }
        }
    }

    public void handIOCTRL(Message message) {
        if (message.arg2 == 0) {
            byte[] byteArray = message.getData().getByteArray("data");
            int i = message.arg1;
            if (i == 12562) {
                dismissjuHuaDialog();
                return;
            }
            if (i == 16643) {
                String encoding = HiTools.getEncoding(new HiChipDefines.HI_P2P_S_WIFI_PARAM(byteArray).strSSID);
                if (TextUtils.isEmpty(encoding) || !this.mMyCamera.getIsLiteOs()) {
                    return;
                }
                this.tv_current_device_wifi.setText(encoding);
                return;
            }
            if (i != 16762) {
                return;
            }
            String encoding2 = HiTools.getEncoding(new HiChipDefines.HI_P2P_S_WIFI_PARAM_NEWPWD255_EXT1(byteArray).strSSID);
            if (TextUtils.isEmpty(encoding2) || !this.mMyCamera.getIsLiteOs()) {
                return;
            }
            this.tv_current_device_wifi.setText(encoding2);
            return;
        }
        if (message.arg1 != 4097) {
            return;
        }
        HiLogcatUtil.e("HI_P2P_START_LIVE ERROR ");
        HiLogcatUtil.d("mMyCamera.getVideoQuality(): " + this.mMyCamera.getVideoQuality());
        HiLogcatUtil.e("#########################  APP RECEIVE HI_P2P_START_LIVE ERROR ##############################");
        this.mHandler.sendEmptyMessageDelayed(ConstantCommand.HI_P2P_SET_SCENE_MODE, 1000L);
    }

    protected void sendRegisterToken(MyCamera myCamera) {
        if (myCamera.getPushState() == 1 || myCamera.getPushState() == 0 || !myCamera.appGetCommandFunction(CamHiDefines.HI_P2P_ALARM_TOKEN_REGIST)) {
            return;
        }
        myCamera.sendIOCtrl(CamHiDefines.HI_P2P_ALARM_TOKEN_REGIST, CamHiDefines.HI_P2P_ALARM_TOKEN_INFO.parseContent(0, myCamera.getPushState(), (int) ((System.currentTimeMillis() / 1000) / 3600), 1));
    }

    @Override
    public void onPause() {
        super.onPause();
        InputMethodManager inputMethodManager = (InputMethodManager) getSystemService("input_method");
        if (inputMethodManager.isActive()) {
            inputMethodManager.hideSoftInputFromWindow(this.et_nickname.getWindowToken(), 0);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        FloatingWindow floatingWindow = this.mFloatingWindow;
        if (floatingWindow != null) {
            floatingWindow.dismiss();
        }
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.Wol_WakeUpStop();
        }
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        FloatingWindow floatingWindow = this.mFloatingWindow;
        if (floatingWindow != null) {
            floatingWindow.dismiss();
        }
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.stopListening();
            this.mMyCamera.stopLiveShow();
        }
    }

    @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 onScrollChanged(ObservableScrollView observableScrollView, int i, int i2, int i3, int i4) {
        if (i2 <= this.mTop) {
            this.canToLive = false;
            this.rl_head_name.animate().translationY(-i2).setDuration(0L).start();
            float f = 1.0f;
            float f2 = (1.0f - (i2 / this.mTop)) - 0.1f;
            if (i2 < this.lastDis) {
                this.canToLive = true;
            } else {
                f = f2;
            }
            this.shadowlayout.animate().scaleX(f).scaleY(f).setDuration(0L).start();
            this.shadowlayout.animate().alpha(f).setDuration(0L).start();
            return;
        }
        this.canToLive = false;
        this.rl_head_name.animate().translationY(-this.mTop).setDuration(0L).start();
        this.shadowlayout.animate().scaleX(0.0f).scaleY(0.0f).setDuration(0L).start();
        this.shadowlayout.animate().alpha(0.0f).setDuration(0L).start();
    }

    public void handPercentageView() {
        if (this.mMyCamera.getCameraLevel() == 1) {
            if (this.mMyCamera.isBindCurrentAccount() == 2) {
                ToastUtil.showShort(this, getString(R.string.isbind_camera));
                finish();
                return;
            } else if ("admin".equals(this.mMyCamera.getPassword())) {
                ToastUtil.showShort(this, getString(R.string.psw_hint));
                finish();
            }
        } else if (this.mMyCamera.isBindCurrentAccount() == 2) {
            ToastUtil.showShort(this, getString(R.string.share_already_unbind));
            finish();
        }
        if (this.mMyCamera.getIsSupportLiteCloud() && Locale.getDefault().getLanguage().equals("zh") && Locale.getDefault().getCountry().equals("CN")) {
            this.ll_cloud.setVisibility(0);
            this.isSupportCloud = true;
        }
        this.loadView.setVisibility(8);
        this.iv_return_01.setVisibility(8);
        ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 0.0f);
        ofFloat.setDuration(500L);
        ofFloat.setInterpolator(new AccelerateInterpolator());
        ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                OSSettingActivity.this.lambda$handPercentageView$2$OSSettingActivity(valueAnimator);
            }
        });
        ofFloat.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animator) {
                OSSettingActivity.this.rl_loading.setVisibility(8);
            }
        });
        ofFloat.start();
        if (this.mMyCamera.isBindCurrentAccount() == 1) {
            this.btn_delete_camera.setVisibility(0);
        } else {
            this.btn_delete_camera.setVisibility(8);
        }
    }

    public void lambda$handPercentageView$2$OSSettingActivity(ValueAnimator valueAnimator) {
        this.rl_loading.setAlpha(((Float) valueAnimator.getAnimatedValue()).floatValue());
    }

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

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

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

    private void clickFloatingWindow() {
        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, OSSettingActivity.this.getApplicationContext(), "isShowFloatingPermission", true);
                }
            }).sureText(getString(R.string.open)).setSureOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    OSSettingActivity.this.startActivityForResult(new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION", Uri.parse("package:" + OSSettingActivity.this.getPackageName())), 9999);
                }
            }).build().show();
            return;
        }
        this.mFloatingWindow.setReady(true);
        new Thread() {
            @Override
            public void run() {
                OSSettingActivity.this.mMyCamera.startLiveShow(OSSettingActivity.this.mMyCamera.getVideoQuality(), OSSettingActivity.this.mFloatingWindow.getMonitor());
            }
        }.start();
        this.mMyCamera.isFloatingW = true;
        HiDataValue.isNeedkillNoMain = true;
        this.mFloatingWindow.showFloatingWindowView(false);
        Intent intent = new Intent();
        intent.setAction("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.HOME");
        startActivity(intent);
    }

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