CloudTimePlaybackDualFragment_ThreeEyes.java 源代码


package activity.cloud.timeaxis.fragment;

import activity.cloud.timeaxis.NewCloudPlaybackDualActivity;
import activity.cloud.timeaxis.adapter.CloudTimeMyPagerAdapter;
import activity.cloud.timeaxis.bean.CloudTimeCalenderDay;
import activity.cloud.timeaxis.fragment.CloudTimePlaybackDualFragment_ThreeEyes;
import activity.cloud.timeaxis.view.CloudTimeLine;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.NestedScrollView;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import base.HiFragment;
import bean.MyCamera;
import bean.VideoInfo;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.bytedance.android.live.base.api.push.model.PushUIConfig;
import com.hichip.base.HiLog;
import com.hichip.callback.ICameraDownloadCallback;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.callback.PlayOSSFileCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.hichip.sdk.HiPlayOSSDualSDK;
import com.hichip.tools.Packet;
import com.xiaomi.mipush.sdk.Constants;
import common.HiDataValue;
import common.MyPlaybackGLMonitor;
import custom.NoSlidingViewPager;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import org.greenrobot.eventbus.EventBus;
import timeaxis.calender.MyLinearLayout;
import timeaxis.calender.TitleGridAdapter;
import utils.BitmapUtils;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;
import utils.OrientationWatchDog;
import utils.SystemUtils;
import utils.TimeUtil;

public class CloudTimePlaybackDualFragment_ThreeEyes extends HiFragment implements View.OnClickListener, PlayOSSFileCallback, AdapterView.OnItemClickListener, ICameraIOSessionCallback, ICameraDownloadCallback, View.OnTouchListener, OrientationWatchDog.OnOrientationListener {
    private static final int ECS_CALL_BACK = 1114;
    private static final int FILE_PLAY_START = 1116;
    private static final int HANDLE_FILE_PLAYING_PROGRESS = 1117;
    private static final int HAVE_FILE_DAY_CALL_BACK = 1113;
    private static final int OSS_CALL_BACK = 1115;
    private static final int PLAY_LOCAL_STATE_END = 1119;
    private static final int PLAY_LOCAL_STATE_ERROR = 2000;
    private static final int PLAY_LOCAL_STATE_START = 1118;
    private static final int SINGLE_DAY_FILE_CALLBACK_END = 1112;
    public static int mFrameMode = 1;
    private long FilePlayEndTime;
    private long FilePlayStartTime;
    private float action_down_x;
    private float action_down_y;
    public float bottom;
    ImageView bt_landdualswitch;
    ImageView bt_portraitdualswitch;
    private NewCloudPlaybackDualActivity cloudActivity;
    private byte[] cloudBuff;
    private int cloudBuffLength;
    private String currentPlayVideoDay;
    private int dragTime;
    private String filePlayPath;
    public float height;
    private boolean isDownloading;
    private boolean isVisibleToUser;
    ImageView iv_full_screen;
    ImageView iv_left;
    ImageView iv_loading;
    ImageView iv_return;
    ImageView iv_right;
    ImageView iv_snapshot;
    ImageView iv_snapshot_land;
    private long lastClickTime;
    public float left;
    MyLinearLayout ll_bottom;
    LinearLayout ll_top;
    private String loadingFile;
    private MyCamera mCamera;
    private int mHeight;
    RelativeLayout mLayoutMonitor;
    private OnDataLoadingListener mOnDataLoadingListener;
    private OnWrongPswListener mOnWrongPswListener;
    private OrientationWatchDog mOrientationWatchDog;
    View mReplaceView;
    NestedScrollView mScrollView;
    private long mergeEndTime1;
    private long mergeStartTime1;
    public MyPlaybackGLMonitor monitor_1dual;
    public MyPlaybackGLMonitor monitor_2dual;
    public MyPlaybackGLMonitor monitor_3dual;
    private int moveCalendarCurrentPage;
    int moveX;
    int moveY;
    float move_x;
    float move_y;
    CloudTimeLine myTimeLineView;
    private boolean noFileNeedJump;
    public boolean onValueChange;
    private int pareMode;
    private long playingFileDevStartTime;
    private int playingFilePosition;
    private boolean preLoadingFile;
    private long previousEndTime;
    private long previousStartTime;
    private boolean pswChanged;
    private Point realSize;
    RelativeLayout rl_2monitor;
    ImageView rl_close2monitor;
    ImageView rl_close3monitor;
    ImageView rl_closemonitor;
    RelativeLayout rl_monitor;
    RelativeLayout rl_portraittopview;
    public LinearLayout root_lock_screen;
    LinearLayout stc_calendar_layout;
    private GridView title_gView;
    TextView tv_osd_time1;
    TextView tv_osd_time3;
    TextView tv_time;
    TextView tv_years_month;
    private Unbinder unbinder;
    NoSlidingViewPager viewpager;
    public float width;
    int xlenOld;
    int ylenOld;
    private List<String> haveVideoDayList = new ArrayList();
    private List<VideoInfo> video_list = new ArrayList();
    private List<VideoInfo> roughVideoList = new ArrayList();
    private ArrayList<Integer> listDay = new ArrayList<>();
    private int mCalendarCurrentPage = 999;
    private boolean mFirst = true;
    private boolean firstPlay = true;
    private boolean firstPlayDayVideo = true;
    private boolean isFirst = true;
    private boolean misfull = true;
    private boolean mPlayFirst = false;
    private boolean isLeft = true;
    private boolean isFirstRevolveLand = false;
    private boolean isReadyPlay = false;
    private int isLarge = 0;
    public boolean mIsClickReturn = false;
    private boolean isBallShowBig = true;
    private int showType = 0;
    private int firstReceive = 0;
    private Handler fileHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what != CloudTimePlaybackDualFragment_ThreeEyes.SINGLE_DAY_FILE_CALLBACK_END) {
                return;
            }
            if (CloudTimePlaybackDualFragment_ThreeEyes.this.mergeStartTime1 != 0 && CloudTimePlaybackDualFragment_ThreeEyes.this.mergeEndTime1 != 0) {
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.mergeEndTime1 < CloudTimePlaybackDualFragment_ThreeEyes.this.mergeStartTime1) {
                    CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                    CloudTimePlaybackDualFragment_ThreeEyes.access$1814(cloudTimePlaybackDualFragment_ThreeEyes, cloudTimePlaybackDualFragment_ThreeEyes.mergeStartTime1 + 500654080);
                }
                CloudTimePlaybackDualFragment_ThreeEyes.this.roughVideoList.add(new VideoInfo(CloudTimePlaybackDualFragment_ThreeEyes.this.mergeStartTime1, CloudTimePlaybackDualFragment_ThreeEyes.this.mergeEndTime1));
            }
            CloudTimePlaybackDualFragment_ThreeEyes.this.mergeStartTime1 = 0L;
            CloudTimePlaybackDualFragment_ThreeEyes.this.mergeEndTime1 = 0L;
            CloudTimePlaybackDualFragment_ThreeEyes.this.previousStartTime = 0L;
            CloudTimePlaybackDualFragment_ThreeEyes.this.previousEndTime = 0L;
            CloudTimePlaybackDualFragment_ThreeEyes.this.firstReceive = 0;
            CloudTimePlaybackDualFragment_ThreeEyes.this.setVideo();
        }
    };
    private Handler lineHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == CloudTimePlaybackDualFragment_ThreeEyes.HANDLE_FILE_PLAYING_PROGRESS && CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView != null && CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.isCanPlay) {
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time != null && CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time.getVisibility() == 0) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time.setVisibility(8);
                }
                CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.setValue(CloudTimePlaybackDualFragment_ThreeEyes.this.FilePlayStartTime + Long.parseLong(message.arg1 + "000"));
            }
        }
    };
    private Handler ioHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == -1879048191 && message.arg1 == 3) {
                Log.e("tedu", " cloud time receive WRONG_PASSWORD ");
                CloudTimePlaybackDualFragment_ThreeEyes.this.pswChanged = true;
            }
        }
    };
    private Handler mHandler = new AnonymousClass7();
    double nLenStart = 0.0d;
    private Handler mHandler_lockScreen = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                CloudTimePlaybackDualFragment_ThreeEyes.this.root_lock_screen.setVisibility(0);
                CloudTimePlaybackDualFragment_ThreeEyes.this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
            } else {
                CloudTimePlaybackDualFragment_ThreeEyes.this.root_lock_screen.setVisibility(8);
                CloudTimePlaybackDualFragment_ThreeEyes.this.mHandler_lockScreen.removeCallbacksAndMessages(null);
            }
        }
    };

    public interface OnDataLoadingListener {
        void onLoading(boolean z);
    }

    public interface OnWrongPswListener {
        void onWrongPsw();
    }

    @Override
    public void callbackDownloadSnapData(HiCamera hiCamera, int i, byte[] bArr, int i2, int i3) {
    }

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

    @Override
    public void callbackOSSOCloudReq(String str, int i, int i2, int i3, int i4, String str2) {
    }

    @Override
    public void callbackplaylocal(int i, int i2, int i3, long j, int i4, int i5) {
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        return false;
    }

    @Override
    public void receiveIOCtrlData(HiCamera hiCamera, int i, byte[] bArr, int i2) {
    }

    static long access$1814(CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes, long j) {
        long j2 = cloudTimePlaybackDualFragment_ThreeEyes.mergeEndTime1 + j;
        cloudTimePlaybackDualFragment_ThreeEyes.mergeEndTime1 = j2;
        return j2;
    }

    static int access$612(CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes, int i) {
        int i2 = cloudTimePlaybackDualFragment_ThreeEyes.playingFilePosition + i;
        cloudTimePlaybackDualFragment_ThreeEyes.playingFilePosition = i2;
        return i2;
    }

    public static CloudTimePlaybackDualFragment_ThreeEyes newInstance(String str) {
        CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = new CloudTimePlaybackDualFragment_ThreeEyes();
        Bundle bundle = new Bundle();
        bundle.putSerializable("UID", str);
        cloudTimePlaybackDualFragment_ThreeEyes.setArguments(bundle);
        return cloudTimePlaybackDualFragment_ThreeEyes;
    }

    @Override
    public void onCreate(Bundle bundle) {
        String string;
        super.onCreate(bundle);
        HiLog.e("tedG--....onResume()....--");
        Bundle arguments = getArguments();
        if (arguments == null || (string = arguments.getString("UID")) == null) {
            return;
        }
        for (MyCamera myCamera : HiDataValue.CameraList) {
            if (string.equals(myCamera.getUid())) {
                this.mCamera = myCamera;
                return;
            }
        }
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        HiLog.e("tedG--....onResume()....--");
        View inflate = layoutInflater.inflate(R.layout.fragment_cloud_time_playback_dual_three_eyes, viewGroup, false);
        this.unbinder = ButterKnife.bind(this, inflate);
        initView();
        setListener();
        initOrientationWatchdog();
        return inflate;
    }

    private void initView() {
        HiLog.e("tedG--....onResume()....--");
        HiTools.mDualTimevalue = 0;
        this.mPlayFirst = false;
        DisplayMetrics displayMetrics = new DisplayMetrics();
        FragmentActivity activity2 = getActivity();
        Objects.requireNonNull(activity2);
        activity2.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mHeight = (int) ((HiTools.getScreenW(getActivity()) * 2.2d) / 4.0d);
        this.showType = 0;
        notifyLayout(0, false);
        Display defaultDisplay = getActivity().getWindowManager().getDefaultDisplay();
        Point point = new Point();
        this.realSize = point;
        defaultDisplay.getRealSize(point);
    }

    @Override
    public void onActivityCreated(Bundle bundle) {
        super.onActivityCreated(bundle);
        HiLog.e("tedG--....onResume()....--");
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
    }

    @Override
    public void onResume() {
        super.onResume();
        HiLog.e("tedG--....onResume()....--" + this.isVisibleToUser);
        if (this.isVisibleToUser) {
            registerListener();
            MyCamera myCamera = this.mCamera;
            if (myCamera == null || myCamera.mPlayDualOSS == null) {
                return;
            }
            Log.e("test", "onResume: video_list.size()" + this.video_list.size() + "--" + this.playingFilePosition);
            if (this.playingFilePosition < 0 || this.video_list.size() <= 0) {
                return;
            }
            startVideoPath(this.video_list.get(this.playingFilePosition).getStartTime(), this.video_list.get(this.playingFilePosition).getStartTime(), this.video_list.get(this.playingFilePosition).getEndTime(), this.video_list.get(this.playingFilePosition).getFilename(), this.video_list.get(this.playingFilePosition).getFileLen(), true);
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        HiLog.e("tedG--....onResume()....--");
        unregisterListener();
        MyCamera myCamera = this.mCamera;
        if (myCamera != null && myCamera.mPlayDualOSS != null) {
            this.mCamera.mPlayDualOSS.StopPlayLocal();
            this.mCamera.mPlayDualOSS.StopDownOSS();
            this.isDownloading = false;
            MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
            if (myPlaybackGLMonitor != null) {
                myPlaybackGLMonitor.FreeMonitor();
            }
            MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
            if (myPlaybackGLMonitor2 != null) {
                myPlaybackGLMonitor2.FreeMonitor();
            }
            MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_3dual;
            if (myPlaybackGLMonitor3 != null) {
                myPlaybackGLMonitor3.FreeMonitor();
            }
            HiLog.e("tedG--....onResume()....--");
        }
        if (getResources().getConfiguration().orientation != 2 || getActivity() == null) {
            return;
        }
        getActivity().setRequestedOrientation(1);
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }

    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void setUserVisibleHint(boolean z) {
        super.setUserVisibleHint(z);
        HiLog.e("tedG--....onResume()....--" + z);
        this.isVisibleToUser = z;
        if (z) {
            MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
            if (myPlaybackGLMonitor != null && myPlaybackGLMonitor.getVisibility() == 8) {
                this.monitor_1dual.setVisibility(0);
            }
            registerListener();
            if (this.isFirst) {
                this.isFirst = false;
                Handler handler = this.mHandler;
                if (handler != null) {
                    handler.sendEmptyMessageDelayed(111, 500L);
                    return;
                } else {
                    initOSS();
                    return;
                }
            }
            MyCamera myCamera = this.mCamera;
            if (myCamera == null || myCamera.mPlayDualOSS == null) {
                return;
            }
            if (this.mCamera.mPlayDualOSS != null) {
                this.mCamera.mPlayDualOSS.setLiveShowMonitor(this.monitor_1dual, this.monitor_2dual, this.monitor_3dual);
            }
            if (this.playingFilePosition < 0 || this.video_list.size() <= 0) {
                return;
            }
            startVideoPath(this.video_list.get(this.playingFilePosition).getStartTime(), this.video_list.get(this.playingFilePosition).getStartTime(), this.video_list.get(this.playingFilePosition).getEndTime(), this.video_list.get(this.playingFilePosition).getFilename(), this.video_list.get(this.playingFilePosition).getFileLen(), true);
            return;
        }
        unregisterListener();
        MyCamera myCamera2 = this.mCamera;
        if (myCamera2 == null || myCamera2.mPlayDualOSS == null) {
            return;
        }
        this.mCamera.mPlayDualOSS.StopPlayLocal();
        this.mCamera.mPlayDualOSS.StopDownOSS();
        this.isDownloading = false;
    }

    public void initOSS() {
        if (getContext() == null) {
            return;
        }
        OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
        if (onDataLoadingListener != null) {
            onDataLoadingListener.onLoading(true);
            this.onValueChange = true;
            showLoadingView();
        }
        if (this.mCamera.mPlayDualOSS == null) {
            this.mCamera.mPlayDualOSS = new HiPlayOSSDualSDK();
            this.mCamera.mPlayDualOSS.registerPlayOSSStateListener(this);
        } else {
            this.mCamera.mPlayDualOSS.registerPlayOSSStateListener(this);
        }
        this.mCamera.mPlayDualOSS.setLiveShowMonitor(this.monitor_1dual, this.monitor_2dual, this.monitor_3dual);
        if (this.mCamera.mPlayDualOSS.GetOSSisInfo()) {
            Log.i("==cloud", "GetOSSisInfo: SUCCESS");
            this.mCamera.mPlayDualOSS.GetOSSFileTime(1, 0);
        } else {
            this.mCamera.mPlayDualOSS.SetContext(getContext(), this.mCamera.getUid());
            this.mCamera.mPlayDualOSS.GetOSSInfoOCloud(this.mCamera.getUsername(), this.mCamera.getPassword(), this.mCamera.getEcsIp(), this.mCamera.getEcsPort(), 1, 0);
        }
    }

    private void setListener() {
        this.myTimeLineView.setOnPlaybackViewListener(new CloudTimeLine.PlaybackViewListener() {
            @Override
            public void onValueChanged(String str, long j, boolean z) {
                if (z) {
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time != null) {
                        CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time.setVisibility(0);
                    }
                    CloudTimePlaybackDualFragment_ThreeEyes.this.onValueChange = true;
                }
                CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time.setText(str);
                if (!str.contains("23:59:59") || CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView == null) {
                    return;
                }
                HiLogcatUtil.e(new String[0]);
                CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.isCanPlay = false;
            }

            @Override
            public void onVideoStart(String str, long j, int i) {
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView == null) {
                    return;
                }
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null && CloudTimePlaybackDualFragment_ThreeEyes.this.mOnWrongPswListener != null && CloudTimePlaybackDualFragment_ThreeEyes.this.pswChanged) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mOnWrongPswListener.onWrongPsw();
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera == null || CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS == null) {
                        return;
                    }
                    CloudTimePlaybackDualFragment_ThreeEyes.this.unregisterListener();
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.unregisterIOSessionListener(CloudTimePlaybackDualFragment_ThreeEyes.this);
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS != null) {
                        CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.StopPlayLocal();
                        CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.StopDownOSS();
                        CloudTimePlaybackDualFragment_ThreeEyes.this.isDownloading = false;
                    }
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS = null;
                    return;
                }
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time != null) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time.setVisibility(8);
                }
                CloudTimePlaybackDualFragment_ThreeEyes.this.playingFileDevStartTime = 0L;
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition == -1 && CloudTimePlaybackDualFragment_ThreeEyes.this.findFilePosition(j, i) == -1 && CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.size() > 0) {
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.getCurrentValue() / 1000000 > ((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.size() - 1)).getEndTime() / 1000000) {
                        CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition = r1.video_list.size() - 1;
                    }
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.getCurrentValue() / 1000000 < ((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(0)).getStartTime() / 1000000) {
                        CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition = 0;
                    }
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition == -1) {
                        return;
                    }
                    CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.moveToValue(((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition)).getStartTime());
                    return;
                }
                CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                cloudTimePlaybackDualFragment_ThreeEyes.playingFilePosition = cloudTimePlaybackDualFragment_ThreeEyes.findFilePosition(j, i);
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition != -1) {
                    VideoInfo videoInfo = (VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition);
                    if (!CloudTimePlaybackDualFragment_ThreeEyes.this.noFileNeedJump) {
                        if (CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener != null) {
                            CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener.onLoading(false);
                            CloudTimePlaybackDualFragment_ThreeEyes.this.onValueChange = false;
                        }
                        CloudTimePlaybackDualFragment_ThreeEyes.this.startVideoPath(videoInfo.getStartTime(), j, videoInfo.getEndTime(), videoInfo.getFilename(), videoInfo.getFileLen(), true);
                        return;
                    }
                    CloudTimePlaybackDualFragment_ThreeEyes.this.FilePlayStartTime = videoInfo.getStartTime();
                    CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.moveToValue(videoInfo.getStartTime());
                    return;
                }
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView == null || CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.listener == null) {
                    return;
                }
                CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.listener.onNoneVideo(str, j);
            }

            @Override
            public void onNoneVideo(String str, long j) {
                Toast.makeText(CloudTimePlaybackDualFragment_ThreeEyes.this.getContext(), CloudTimePlaybackDualFragment_ThreeEyes.this.getString(R.string.current_not_video), 1).show();
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null && CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS != null) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.StopPlayLocal();
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.StopDownOSS();
                    CloudTimePlaybackDualFragment_ThreeEyes.this.isDownloading = false;
                    CloudTimePlaybackDualFragment_ThreeEyes.this.resetMonitorToStart(true);
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.setLiveShowMonitor(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual, CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_2dual, CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual);
                }
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener != null) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener.onLoading(false);
                    CloudTimePlaybackDualFragment_ThreeEyes.this.onValueChange = false;
                }
            }

            @Override
            public void onChangedScaleMode() {
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.getScaleMode() == 120 || CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.getScaleMode() == 600) {
                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.pareMode != CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.getScaleMode()) {
                        CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.setVideos(CloudTimePlaybackDualFragment_ThreeEyes.this.video_list, 0L);
                        CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                        cloudTimePlaybackDualFragment_ThreeEyes.pareMode = cloudTimePlaybackDualFragment_ThreeEyes.myTimeLineView.getScaleMode();
                        return;
                    }
                    return;
                }
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.pareMode != CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.getScaleMode()) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.setVideos(CloudTimePlaybackDualFragment_ThreeEyes.this.roughVideoList, 0L);
                    CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes2 = CloudTimePlaybackDualFragment_ThreeEyes.this;
                    cloudTimePlaybackDualFragment_ThreeEyes2.pareMode = cloudTimePlaybackDualFragment_ThreeEyes2.myTimeLineView.getScaleMode();
                }
            }
        });
        this.iv_full_screen.setOnClickListener(this);
        this.iv_snapshot.setOnClickListener(this);
        this.iv_snapshot_land.setOnClickListener(this);
        this.monitor_1dual.setOnClickListener(this);
        this.monitor_1dual.setOnTouchListener(this);
        this.monitor_2dual.setOnClickListener(this);
        this.monitor_2dual.setOnTouchListener(this);
        this.monitor_3dual.setOnClickListener(this);
        this.monitor_3dual.setOnTouchListener(this);
        this.iv_return.setOnClickListener(this);
        this.rl_closemonitor.setOnClickListener(this);
        this.rl_close2monitor.setOnClickListener(this);
        this.rl_close3monitor.setOnClickListener(this);
        this.bt_landdualswitch.setOnClickListener(this);
        this.bt_portraitdualswitch.setOnClickListener(this);
        this.root_lock_screen.setOnClickListener(this);
        this.myTimeLineView.setView(this.iv_full_screen);
    }

    public int findFilePosition(long j, int i) {
        int size = this.video_list.size() - 1;
        int i2 = 0;
        while (i2 <= size) {
            int i3 = (i2 + size) / 2;
            if (this.video_list.get(i3).getStartTime() <= j && this.video_list.get(i3).getEndTime() >= j) {
                this.noFileNeedJump = false;
                return i3;
            }
            if (this.video_list.get(i3).getEndTime() <= j) {
                i2 = i3 + 1;
            } else if (this.video_list.get(i3).getStartTime() > j) {
                size = i3 - 1;
            }
        }
        int i4 = (i2 + size) / 2;
        if (size >= 0 && i2 <= this.video_list.size() - 1) {
            if (i == 1) {
                this.noFileNeedJump = true;
                return i4 + 1;
            }
            if (i == 0) {
                this.noFileNeedJump = true;
                return i4;
            }
        }
        return -1;
    }

    private void preLoadFile(String str, int i) {
        String replaceAll;
        if (HiTools.isSDCardExist()) {
            File file = new File(HiDataValue.getPathCameraVideoOSSDownLoadcache(getContext()));
            if (!file.exists()) {
                Log.d("==cloudPlay", "CameraVideoOSSDownLoadCache: " + file.mkdirs());
            }
            String[] split = str.split("/");
            String str2 = file.getAbsoluteFile() + "/" + this.mCamera.getUid().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
            String str3 = split[1] + Constants.ACCEPT_TIME_SEPARATOR_SERVER + split[3];
            String str4 = file.getAbsoluteFile() + "/" + this.mCamera.getUid().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "") + str3;
            if (str4.contains(".rec")) {
                replaceAll = str4.replaceAll(".rec", ".ch26x");
            } else {
                replaceAll = str4.replaceAll(".hx", ".ch26x");
            }
            if (new File(replaceAll).exists()) {
                Log.e("==cloudPlay", "执行预加载,下一个文件,本地已经存在");
                return;
            }
            MyCamera myCamera = this.mCamera;
            if (myCamera == null || myCamera.mPlayDualOSS == null) {
                return;
            }
            this.mCamera.mPlayDualOSS.OSSPlayDown(str, str2, str3, i, 1);
        }
    }

    public void startVideoPath(long j, long j2, long j3, String str, int i, boolean z) {
        String replaceAll;
        if (this.isVisibleToUser) {
            if (this.cloudActivity == null && (getActivity() instanceof NewCloudPlaybackDualActivity)) {
                this.cloudActivity = (NewCloudPlaybackDualActivity) getActivity();
            }
            NewCloudPlaybackDualActivity newCloudPlaybackDualActivity = this.cloudActivity;
            if (newCloudPlaybackDualActivity == null || this.firstPlayDayVideo || newCloudPlaybackDualActivity.loading.getVisibility() != 0) {
                this.firstPlayDayVideo = false;
                OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
                if (onDataLoadingListener != null) {
                    onDataLoadingListener.onLoading(true);
                    this.onValueChange = true;
                    showLoadingView();
                }
                this.FilePlayStartTime = j2;
                this.FilePlayEndTime = j3;
                this.playingFileDevStartTime = 0L;
                if (j2 > j) {
                    this.dragTime = (int) ((j2 - j) / 1000000);
                }
                if (HiTools.isSDCardExist()) {
                    File file = new File(HiDataValue.getPathCameraVideoOSSDownLoadcache(getContext()));
                    if (!file.exists()) {
                        file.mkdirs();
                    }
                    String[] split = str.split("/");
                    String str2 = file.getAbsoluteFile() + "/" + this.mCamera.getUid().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
                    String str3 = split[1] + Constants.ACCEPT_TIME_SEPARATOR_SERVER + split[3];
                    String str4 = file.getAbsoluteFile() + "/" + this.mCamera.getUid().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "") + str3;
                    boolean contains = str4.contains(".rec");
                    if (contains) {
                        replaceAll = str4.replaceAll(".rec", ".ch26x");
                    } else {
                        replaceAll = str4.replaceAll(".hx", ".ch26x");
                    }
                    final String str5 = replaceAll;
                    if (new File(str5).exists()) {
                        this.mCamera.mPlayDualOSS.StopPlayLocal();
                        resetMonitorToStart(z);
                        this.mCamera.mPlayDualOSS.setLiveShowMonitor(this.monitor_1dual, this.monitor_2dual, this.monitor_3dual);
                        this.tv_time.postDelayed(new Runnable() {
                            @Override
                            public final void run() {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.lambda$startVideoPath$0$CloudTimePlaybackDualFragment_ThreeEyes(str5);
                            }
                        }, 200L);
                        return;
                    }
                    if (this.isDownloading) {
                        if (!str.equals(this.loadingFile)) {
                            this.mCamera.mPlayDualOSS.StopDownOSS();
                            this.isDownloading = false;
                            downCurrentFile(str5, contains, str, str2, str3, i, true, z);
                            return;
                        }
                        downCurrentFile(str5, contains, str, str2, str3, i, false, z);
                        return;
                    }
                    downCurrentFile(str5, contains, str, str2, str3, i, true, z);
                }
            }
        }
    }

    public void lambda$startVideoPath$0$CloudTimePlaybackDualFragment_ThreeEyes(String str) {
        MyCamera myCamera = this.mCamera;
        if (myCamera != null && myCamera.mPlayDualOSS != null) {
            if (this.mCamera.getCloudType() == 2) {
                this.mCamera.mPlayDualOSS.SetOSSOCloudDate(this.mCamera.getUid(), this.currentPlayVideoDay, true);
            } else {
                this.mCamera.mPlayDualOSS.SetOSSOCloudDate(this.mCamera.getUid(), this.currentPlayVideoDay, false);
            }
            this.mCamera.mPlayDualOSS.StartPlayLocalTimeExt(str, this.dragTime, (int) this.playingFileDevStartTime);
        }
        this.dragTime = 0;
        this.firstPlay = false;
        this.filePlayPath = str;
    }

    public void resetMonitorToStart(boolean z) {
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        if (myPlaybackGLMonitor == null || !z) {
            return;
        }
        myPlaybackGLMonitor.setmIsFullScreen(0);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        FragmentActivity activity2 = getActivity();
        Objects.requireNonNull(activity2);
        activity2.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    }

    private void downCurrentFile(String str, boolean z, final String str2, final String str3, final String str4, final int i, boolean z2, boolean z3) {
        MyCamera myCamera = this.mCamera;
        if (myCamera == null || myCamera.mPlayDualOSS == null) {
            return;
        }
        this.mCamera.mPlayDualOSS.StopPlayLocal();
        resetMonitorToStart(z3);
        this.mCamera.mPlayDualOSS.setLiveShowMonitor(this.monitor_1dual, this.monitor_2dual, this.monitor_3dual);
        this.filePlayPath = str;
        if (z) {
            this.filePlayPath = str.replaceAll(HiDataValue.OSSFILEEnd, HiDataValue.OSSFILEEn);
        } else {
            this.filePlayPath = str.replaceAll(HiDataValue.OSSFILEEnd, HiDataValue.OSSFILEEn_HX);
        }
        if (z2) {
            this.tv_time.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.lambda$downCurrentFile$1$CloudTimePlaybackDualFragment_ThreeEyes(str2, str3, str4, i);
                }
            }, 500L);
        }
    }

    public void lambda$downCurrentFile$1$CloudTimePlaybackDualFragment_ThreeEyes(String str, String str2, String str3, int i) {
        this.mCamera.mPlayDualOSS.OSSPlayDown(str, str2, str3, i, 1);
    }

    public void setVideo() {
        Log.d("==cloudPlay->setVideo", this.roughVideoList.toString());
        Log.d("==cloudPlay->setVideo", this.myTimeLineView.getScaleMode() + "");
        if (this.myTimeLineView.getScaleMode() == 120) {
            if (this.video_list.size() > 0) {
                CloudTimeLine cloudTimeLine = this.myTimeLineView;
                List<VideoInfo> list = this.video_list;
                cloudTimeLine.setVideos(list, list.get(0).getStartTime());
                return;
            }
            return;
        }
        if (this.roughVideoList.size() > 0) {
            CloudTimeLine cloudTimeLine2 = this.myTimeLineView;
            List<VideoInfo> list2 = this.roughVideoList;
            cloudTimeLine2.setVideos(list2, list2.get(0).getStartTime());
        }
    }

    private void registerListener() {
        MyCamera myCamera = this.mCamera;
        if (myCamera != null) {
            myCamera.registerIOSessionListener(this);
            this.mCamera.registerDownloadListener(this);
            if (this.mCamera.mPlayDualOSS != null) {
                this.mCamera.mPlayDualOSS.registerPlayOSSStateListener(this);
            }
        }
    }

    public void unregisterListener() {
        MyCamera myCamera = this.mCamera;
        if (myCamera != null) {
            myCamera.unregisterDownloadListener(this);
            if (this.mCamera.mPlayDualOSS != null) {
                this.mCamera.mPlayDualOSS.unregisterPlayOSSStateListener(this);
            }
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.d("==fragment", "time-onDestroy: ");
        Handler handler = this.mHandler;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
        Handler handler2 = this.fileHandler;
        if (handler2 != null) {
            handler2.removeCallbacksAndMessages(null);
        }
        Handler handler3 = this.ioHandler;
        if (handler3 != null) {
            handler3.removeCallbacksAndMessages(null);
        }
        Handler handler4 = this.lineHandler;
        if (handler4 != null) {
            handler4.removeCallbacksAndMessages(null);
        }
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        if (myPlaybackGLMonitor != null) {
            myPlaybackGLMonitor.FreeMonitor();
            MyCamera myCamera = this.mCamera;
            if (myCamera != null) {
                myCamera.clearMonitor(this.monitor_1dual);
            }
        }
        MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
        if (myPlaybackGLMonitor2 != null) {
            myPlaybackGLMonitor2.FreeMonitor();
            MyCamera myCamera2 = this.mCamera;
            if (myCamera2 != null) {
                myCamera2.clearMonitor(this.monitor_2dual);
            }
        }
        if (HiTools.dialogUtilsAgreements != null) {
            HiTools.dialogUtilsAgreements.build().dismiss();
        }
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        this.unbinder.unbind();
        Handler handler = this.mHandler_lockScreen;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
        }
        EventBus.getDefault().unregister(this);
        unregisterListener();
        MyCamera myCamera = this.mCamera;
        if (myCamera != null) {
            myCamera.unregisterIOSessionListener(this);
            if (this.mCamera.mPlayDualOSS != null) {
                this.mCamera.mPlayDualOSS.StopPlayLocal();
                this.mCamera.mPlayDualOSS.StopDownOSS();
                this.isDownloading = false;
            }
        }
        stopWatchOrientation();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_landdualswitch:
                doswitchview(true);
                this.misfull = !this.misfull;
                return;
            case R.id.bt_portraitdualswitch:
                if (this.showType == 0) {
                    this.showType = 1;
                } else {
                    this.showType = 0;
                }
                notifyLayout(this.showType, true);
                return;
            case R.id.iv_full_screen:
                if (getActivity() != null && this.myTimeLineView.isCanPlay) {
                    this.mIsClickReturn = false;
                    if (getResources().getConfiguration().orientation == 1) {
                        getActivity().setRequestedOrientation(0);
                    } else if (getResources().getConfiguration().orientation == 2) {
                        getActivity().setRequestedOrientation(1);
                    }
                    this.monitor_1dual.setVisibility(4);
                    this.monitor_2dual.setVisibility(4);
                    this.monitor_3dual.setVisibility(4);
                    return;
                }
                return;
            case R.id.iv_return:
                if (getResources().getConfiguration().orientation == 2) {
                    this.mIsClickReturn = true;
                    releaseLockScreen();
                    if (getActivity() != null) {
                        getActivity().setRequestedOrientation(1);
                        return;
                    }
                    return;
                }
                return;
            case R.id.iv_snapshot:
            case R.id.iv_snapshot_land:
                if (this.myTimeLineView.isCanPlay && System.currentTimeMillis() - this.lastClickTime > 500) {
                    this.lastClickTime = System.currentTimeMillis();
                    if (HiTools.HiPermission(getActivity(), getActivity(), 1, 10017)) {
                        return;
                    }
                    clickSnapshot();
                    return;
                }
                return;
            case R.id.monitor_1dual:
            case R.id.monitor_2dual:
            case R.id.monitor_3dual:
                if (getResources().getConfiguration().orientation == 2) {
                    LinearLayout linearLayout = this.ll_top;
                    linearLayout.setVisibility(linearLayout.getVisibility() == 0 ? 8 : 0);
                    this.iv_snapshot_land.setVisibility(this.ll_top.getVisibility());
                    if (this.ll_top.getVisibility() == 0) {
                        if (this.isBallShowBig) {
                            this.rl_closemonitor.setVisibility(this.monitor_1dual.getVisibility());
                            this.rl_close3monitor.setVisibility(this.monitor_3dual.getVisibility());
                            this.rl_close2monitor.setVisibility(8);
                            return;
                        } else {
                            this.rl_close2monitor.setVisibility(this.monitor_2dual.getVisibility());
                            this.rl_close2monitor.setVisibility(8);
                            this.rl_closemonitor.setVisibility(8);
                            this.rl_close3monitor.setVisibility(8);
                            return;
                        }
                    }
                    this.rl_closemonitor.setVisibility(8);
                    this.rl_close2monitor.setVisibility(8);
                    this.rl_close3monitor.setVisibility(8);
                    return;
                }
                if (getResources().getConfiguration().orientation == 1 && this.mPlayFirst) {
                    RelativeLayout relativeLayout = this.rl_portraittopview;
                    relativeLayout.setVisibility(relativeLayout.getVisibility() == 0 ? 8 : 0);
                    this.rl_close2monitor.setVisibility(8);
                    this.iv_full_screen.setVisibility(this.rl_portraittopview.getVisibility());
                    if (this.rl_portraittopview.getVisibility() == 0) {
                        this.iv_snapshot.setVisibility(0);
                        this.rl_closemonitor.setVisibility(8);
                        this.rl_close3monitor.setVisibility(8);
                        return;
                    } else {
                        this.iv_snapshot.setVisibility(8);
                        this.rl_closemonitor.setVisibility(8);
                        this.rl_close3monitor.setVisibility(8);
                        return;
                    }
                }
                return;
            case R.id.rl_close2monitor:
                this.monitor_2dual.setVisibility(8);
                this.rl_close2monitor.setVisibility(4);
                return;
            case R.id.rl_close3monitor:
                this.monitor_3dual.setVisibility(8);
                this.rl_close3monitor.setVisibility(4);
                this.tv_osd_time3.setVisibility(8);
                return;
            case R.id.rl_closemonitor:
                this.monitor_1dual.setVisibility(8);
                this.rl_closemonitor.setVisibility(4);
                this.tv_osd_time1.setVisibility(8);
                return;
            case R.id.root_lock_screen:
                OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
                if (orientationWatchDog != null) {
                    orientationWatchDog.setLockScreen(true);
                }
                this.root_lock_screen.setVisibility(8);
                this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                return;
            default:
                return;
        }
    }

    private void notifyLayout(int i, boolean z) {
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        if (i == 1) {
            this.rl_monitor.setLayoutParams(new LinearLayout.LayoutParams(-1, -1));
            this.rl_2monitor.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams.setMargins(0, this.mHeight + HiTools.dip2px(getActivity(), 2.0f), 0, HiTools.dip2px(getActivity(), 2.0f));
            this.mLayoutMonitor.setLayoutParams(layoutParams);
            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
            int i2 = displayMetrics.widthPixels;
            layoutParams2.width = i2;
            myPlaybackGLMonitor.screen_width = i2;
            MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_1dual;
            int i3 = this.mHeight;
            layoutParams2.height = i3;
            myPlaybackGLMonitor2.screen_height = i3;
            layoutParams2.setMargins(0, 0, 0, 0);
            this.monitor_1dual.setLayoutParams(layoutParams2);
            RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.rl_closemonitor.getLayoutParams();
            layoutParams3.setMargins(HiTools.dip2px(getContext(), 5.0f), (this.mHeight * 2) / 3, 0, 0);
            this.rl_closemonitor.setLayoutParams(layoutParams3);
            this.rl_closemonitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-1, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_2dual;
            int i4 = displayMetrics.widthPixels;
            layoutParams4.width = i4;
            myPlaybackGLMonitor3.screen_width = i4;
            MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor_2dual;
            int i5 = this.mHeight;
            layoutParams4.height = i5;
            myPlaybackGLMonitor4.screen_height = i5;
            layoutParams4.setMargins(0, 0, 0, 0);
            this.monitor_2dual.setLayoutParams(layoutParams4);
            this.rl_close2monitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-2, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor5 = this.monitor_3dual;
            int i6 = displayMetrics.widthPixels;
            layoutParams5.width = i6;
            myPlaybackGLMonitor5.screen_width = i6;
            MyPlaybackGLMonitor myPlaybackGLMonitor6 = this.monitor_3dual;
            int i7 = this.mHeight;
            layoutParams5.height = i7;
            myPlaybackGLMonitor6.screen_height = i7;
            layoutParams5.setMargins(0, HiTools.dip2px(getActivity(), 2.0f), 0, 0);
            layoutParams5.addRule(3, R.id.monitor_1dual);
            this.monitor_3dual.setLayoutParams(layoutParams5);
            RelativeLayout.LayoutParams layoutParams6 = (RelativeLayout.LayoutParams) this.rl_close3monitor.getLayoutParams();
            layoutParams6.addRule(21);
            layoutParams6.setMargins(0, (this.mHeight * 2) / 3, this.monitor_3dual.screen_width - HiTools.dip2px(getContext(), 30.0f), 0);
            this.rl_close3monitor.setLayoutParams(layoutParams6);
            this.rl_close3monitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams7.addRule(21);
            layoutParams7.setMargins(0, this.mHeight + HiTools.dip2px(getActivity(), 2.0f), 0, 0);
            this.tv_osd_time1.setTextSize(0, HiTools.dip2px(getActivity(), 9.0f));
            this.tv_osd_time1.setLayoutParams(layoutParams7);
            RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams8.addRule(21);
            layoutParams8.setMargins(0, (this.mHeight * 2) + HiTools.dip2px(getActivity(), 4.0f), 0, 0);
            this.tv_osd_time3.setTextSize(0, HiTools.dip2px(getActivity(), 9.0f));
            this.tv_osd_time3.setLayoutParams(layoutParams8);
            this.ll_bottom.setVisibility(8);
        } else {
            this.rl_monitor.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
            this.rl_2monitor.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
            RelativeLayout.LayoutParams layoutParams9 = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams9.setMargins(0, this.mHeight + HiTools.dip2px(getActivity(), 2.0f), 0, HiTools.dip2px(getActivity(), 2.0f));
            this.mLayoutMonitor.setLayoutParams(layoutParams9);
            RelativeLayout.LayoutParams layoutParams10 = new RelativeLayout.LayoutParams(-2, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor7 = this.monitor_1dual;
            int dip2px = (displayMetrics.widthPixels / 2) - HiTools.dip2px(getActivity(), 1.0f);
            layoutParams10.width = dip2px;
            myPlaybackGLMonitor7.screen_width = dip2px;
            MyPlaybackGLMonitor myPlaybackGLMonitor8 = this.monitor_1dual;
            int i8 = this.mHeight / 2;
            layoutParams10.height = i8;
            myPlaybackGLMonitor8.screen_height = i8;
            layoutParams10.setMargins(0, 0, HiTools.dip2px(getActivity(), 1.0f), 0);
            this.monitor_1dual.setLayoutParams(layoutParams10);
            RelativeLayout.LayoutParams layoutParams11 = (RelativeLayout.LayoutParams) this.rl_closemonitor.getLayoutParams();
            layoutParams11.setMargins(HiTools.dip2px(getContext(), 5.0f), this.mHeight, 0, 0);
            this.rl_closemonitor.setLayoutParams(layoutParams11);
            this.rl_closemonitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams12 = new RelativeLayout.LayoutParams(-1, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor9 = this.monitor_2dual;
            int i9 = displayMetrics.widthPixels;
            layoutParams12.width = i9;
            myPlaybackGLMonitor9.screen_width = i9;
            MyPlaybackGLMonitor myPlaybackGLMonitor10 = this.monitor_2dual;
            int i10 = this.mHeight;
            layoutParams12.height = i10;
            myPlaybackGLMonitor10.screen_height = i10;
            layoutParams12.setMargins(0, 0, 0, 0);
            this.monitor_2dual.setLayoutParams(layoutParams12);
            this.rl_close2monitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams13 = new RelativeLayout.LayoutParams(-2, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor11 = this.monitor_3dual;
            int dip2px2 = (displayMetrics.widthPixels / 2) - HiTools.dip2px(getActivity(), 1.0f);
            layoutParams13.width = dip2px2;
            myPlaybackGLMonitor11.screen_width = dip2px2;
            MyPlaybackGLMonitor myPlaybackGLMonitor12 = this.monitor_3dual;
            int i11 = this.mHeight / 2;
            layoutParams13.height = i11;
            myPlaybackGLMonitor12.screen_height = i11;
            layoutParams13.addRule(21);
            layoutParams13.setMargins(HiTools.dip2px(getActivity(), 1.0f), 0, 0, 0);
            this.monitor_3dual.setLayoutParams(layoutParams13);
            RelativeLayout.LayoutParams layoutParams14 = (RelativeLayout.LayoutParams) this.rl_close3monitor.getLayoutParams();
            layoutParams14.addRule(21);
            layoutParams14.setMargins(0, this.mHeight, this.monitor_3dual.screen_width - HiTools.dip2px(getContext(), 30.0f), 0);
            this.rl_close3monitor.setLayoutParams(layoutParams14);
            this.rl_close3monitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams15 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams15.addRule(21);
            layoutParams15.setMargins(0, this.mHeight + HiTools.dip2px(getActivity(), 2.0f), (displayMetrics.widthPixels / 2) + 2, 0);
            this.tv_osd_time1.setTextSize(0, HiTools.dip2px(getActivity(), 9.0f));
            this.tv_osd_time1.setLayoutParams(layoutParams15);
            RelativeLayout.LayoutParams layoutParams16 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams16.addRule(21);
            layoutParams16.setMargins(0, this.mHeight + HiTools.dip2px(getActivity(), 2.0f), 0, 0);
            this.tv_osd_time3.setTextSize(0, HiTools.dip2px(getActivity(), 9.0f));
            this.tv_osd_time3.setLayoutParams(layoutParams16);
            this.ll_bottom.setVisibility(0);
            if (!this.mPlayFirst) {
                this.mReplaceView.setLayoutParams(new RelativeLayout.LayoutParams(-1, ((int) (this.mHeight * 1.5d)) + HiTools.dip2px(getActivity(), 2.0f)));
            }
        }
        RelativeLayout.LayoutParams layoutParams17 = new RelativeLayout.LayoutParams(HiTools.dip2px(getContext(), 30.0f), HiTools.dip2px(getContext(), 30.0f));
        layoutParams17.addRule(21);
        layoutParams17.setMargins(0, this.mHeight - HiTools.dip2px(getContext(), 40.0f), HiTools.dip2px(getContext(), 10.0f), 0);
        this.iv_full_screen.setLayoutParams(layoutParams17);
        RelativeLayout.LayoutParams layoutParams18 = new RelativeLayout.LayoutParams(HiTools.dip2px(getContext(), 40.0f), HiTools.dip2px(getContext(), 40.0f));
        layoutParams18.addRule(21);
        layoutParams18.addRule(15);
        this.iv_snapshot.setLayoutParams(layoutParams18);
        initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        MyPlaybackGLMonitor myPlaybackGLMonitor13 = this.monitor_1dual;
        myPlaybackGLMonitor13.setMatrix(myPlaybackGLMonitor13.left, this.monitor_1dual.bottom, this.monitor_1dual.width, this.monitor_1dual.height);
        init2Matrix(this.monitor_2dual.screen_width, this.monitor_2dual.screen_height);
        MyPlaybackGLMonitor myPlaybackGLMonitor14 = this.monitor_2dual;
        myPlaybackGLMonitor14.setMatrix(myPlaybackGLMonitor14.left, this.monitor_2dual.bottom, this.monitor_2dual.width, this.monitor_2dual.height);
        init3Matrix(this.monitor_3dual.screen_width, this.monitor_3dual.screen_height);
        MyPlaybackGLMonitor myPlaybackGLMonitor15 = this.monitor_3dual;
        myPlaybackGLMonitor15.setMatrix(myPlaybackGLMonitor15.left, this.monitor_3dual.bottom, this.monitor_3dual.width, this.monitor_3dual.height);
        this.monitor_1dual.setVisibility(0);
        this.monitor_2dual.setVisibility(0);
        this.monitor_3dual.setVisibility(0);
        this.monitor_2dual.setZOrderMediaOverlay(false);
        this.monitor_1dual.setZOrderMediaOverlay(true);
        this.monitor_3dual.setZOrderMediaOverlay(true);
    }

    private void doswitchview(boolean z) {
        int i;
        if (HiTools.isAllScreenDevice(getActivity())) {
            i = this.realSize.y - HiTools.getStatusBarHeight(getActivity());
            Display defaultDisplay = getActivity().getWindowManager().getDefaultDisplay();
            Point point = new Point();
            defaultDisplay.getSize(point);
            if (SystemUtils.isSamSungMobile(getActivity())) {
                if (HiDataValue.isNavigationBarExist) {
                    i = point.x + HiTools.getNavigationBarHeight(getActivity());
                } else if (i != point.x) {
                    i = point.x;
                }
            } else if (i < point.x) {
                i = point.x;
            }
        } else {
            i = this.realSize.y;
        }
        int i2 = this.realSize.x;
        boolean z2 = this.misfull;
        if (!z2) {
            this.showType = 0;
            this.isBallShowBig = true;
            int i3 = i2 / 3;
            this.monitor_1dual.screen_height = i3;
            int i4 = i / 3;
            this.monitor_1dual.screen_width = i4;
            this.monitor_3dual.screen_height = i3;
            this.monitor_3dual.screen_width = i4;
            this.monitor_2dual.screen_height = i2;
            this.monitor_2dual.screen_width = i;
            this.rl_monitor.setLayoutParams(new LinearLayout.LayoutParams(i, i2));
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            int i5 = (i2 * 2) / 3;
            layoutParams.setMargins(0, i5, 0, 0);
            this.mLayoutMonitor.setLayoutParams(layoutParams);
            this.monitor_1dual.setLayoutParams(new RelativeLayout.LayoutParams(i4, i3));
            this.monitor_1dual.setVisibility(0);
            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, i2);
            this.rl_2monitor.setLayoutParams(layoutParams2);
            this.monitor_2dual.setLayoutParams(layoutParams2);
            this.rl_2monitor.setVisibility(0);
            this.monitor_2dual.setVisibility(0);
            RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(i4, i3);
            layoutParams3.addRule(21);
            this.monitor_3dual.setLayoutParams(layoutParams3);
            this.monitor_3dual.setVisibility(0);
            RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams4.addRule(21);
            layoutParams4.setMargins(0, i5, (i * 2) / 3, 0);
            this.tv_osd_time1.setTextSize(0, HiTools.dip2px(getActivity(), 9.0f));
            this.tv_osd_time1.setLayoutParams(layoutParams4);
            this.tv_osd_time1.setVisibility(this.monitor_1dual.getVisibility());
            RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams5.addRule(21);
            layoutParams5.setMargins(0, i5, 0, 0);
            this.tv_osd_time3.setTextSize(0, HiTools.dip2px(getActivity(), 9.0f));
            this.tv_osd_time3.setLayoutParams(layoutParams5);
            this.tv_osd_time3.setVisibility(this.monitor_3dual.getVisibility());
            RelativeLayout.LayoutParams layoutParams6 = (RelativeLayout.LayoutParams) this.rl_closemonitor.getLayoutParams();
            layoutParams6.setMargins(HiTools.dip2px(getActivity(), 10.0f), HiTools.dip2px(getActivity(), 5.0f) + i5, 0, 0);
            this.rl_closemonitor.setLayoutParams(layoutParams6);
            if (z) {
                this.rl_closemonitor.setVisibility(0);
            } else {
                this.rl_closemonitor.setVisibility(8);
            }
            this.rl_close2monitor.setLayoutParams((RelativeLayout.LayoutParams) this.rl_close2monitor.getLayoutParams());
            this.rl_close2monitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams7 = (RelativeLayout.LayoutParams) this.rl_close3monitor.getLayoutParams();
            layoutParams7.addRule(21);
            layoutParams7.setMargins(0, i5 + HiTools.dip2px(getActivity(), 5.0f), this.monitor_3dual.screen_width - HiTools.dip2px(getActivity(), 30.0f), 0);
            this.rl_close3monitor.setLayoutParams(layoutParams7);
            if (z) {
                this.rl_close3monitor.setVisibility(0);
            } else {
                this.rl_close3monitor.setVisibility(8);
            }
        } else if (z2) {
            this.showType = 1;
            this.isBallShowBig = false;
            int i6 = i2 / 2;
            this.monitor_1dual.screen_height = i6;
            int i7 = i / 2;
            this.monitor_1dual.screen_width = i7;
            this.monitor_3dual.screen_height = i6;
            this.monitor_3dual.screen_width = i7;
            int i8 = i2 / 3;
            this.monitor_2dual.screen_height = i8;
            int i9 = i / 3;
            this.monitor_2dual.screen_width = i9;
            this.rl_monitor.setLayoutParams(new LinearLayout.LayoutParams(i, i2));
            RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(-1, -2);
            int i10 = i2 / 6;
            layoutParams8.setMargins(0, i10, 0, 0);
            this.mLayoutMonitor.setLayoutParams(layoutParams8);
            this.monitor_1dual.setLayoutParams(new RelativeLayout.LayoutParams(i7, i6));
            this.monitor_1dual.setVisibility(0);
            RelativeLayout.LayoutParams layoutParams9 = new RelativeLayout.LayoutParams(-1, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_2dual;
            layoutParams9.width = i9;
            myPlaybackGLMonitor.screen_width = i9;
            MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
            layoutParams9.height = i8;
            myPlaybackGLMonitor2.screen_height = i8;
            int i11 = (i2 * 2) / 3;
            layoutParams9.setMargins(i9, i11, 0, 0);
            this.monitor_2dual.setLayoutParams(layoutParams9);
            this.monitor_2dual.setVisibility(0);
            RelativeLayout.LayoutParams layoutParams10 = new RelativeLayout.LayoutParams(-2, -2);
            MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_3dual;
            layoutParams10.width = i7;
            myPlaybackGLMonitor3.screen_width = i7;
            MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor_3dual;
            layoutParams10.height = i6;
            myPlaybackGLMonitor4.screen_height = i6;
            layoutParams10.addRule(21);
            layoutParams10.setMargins(2, 0, 0, 0);
            this.monitor_3dual.setLayoutParams(layoutParams10);
            this.monitor_3dual.setVisibility(0);
            RelativeLayout.LayoutParams layoutParams11 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams11.addRule(21);
            layoutParams11.setMargins(0, i10, i7, 0);
            this.tv_osd_time1.setTextSize(0, HiTools.dip2px(getActivity(), 12.0f));
            this.tv_osd_time1.setLayoutParams(layoutParams11);
            this.tv_osd_time1.setVisibility(this.monitor_1dual.getVisibility());
            RelativeLayout.LayoutParams layoutParams12 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams12.addRule(21);
            layoutParams12.setMargins(0, i10, 0, 0);
            this.tv_osd_time3.setTextSize(0, HiTools.dip2px(getActivity(), 12.0f));
            this.tv_osd_time3.setLayoutParams(layoutParams12);
            this.tv_osd_time3.setVisibility(this.monitor_3dual.getVisibility());
            this.rl_closemonitor.setVisibility(8);
            RelativeLayout.LayoutParams layoutParams13 = (RelativeLayout.LayoutParams) this.rl_close2monitor.getLayoutParams();
            layoutParams13.setMargins(i9 + HiTools.dip2px(getActivity(), 10.0f), i11 + HiTools.dip2px(getActivity(), 5.0f), 0, 0);
            this.rl_close2monitor.setLayoutParams(layoutParams13);
            this.rl_close2monitor.setVisibility(8);
            this.rl_close3monitor.setVisibility(8);
        }
        initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        MyPlaybackGLMonitor myPlaybackGLMonitor5 = this.monitor_1dual;
        myPlaybackGLMonitor5.setMatrix(myPlaybackGLMonitor5.left, this.monitor_1dual.bottom, this.monitor_1dual.width, this.monitor_1dual.height);
        init3Matrix(this.monitor_3dual.screen_width, this.monitor_3dual.screen_height);
        MyPlaybackGLMonitor myPlaybackGLMonitor6 = this.monitor_3dual;
        myPlaybackGLMonitor6.setMatrix(myPlaybackGLMonitor6.left, this.monitor_3dual.bottom, this.monitor_3dual.width, this.monitor_3dual.height);
        init2Matrix(this.monitor_2dual.screen_width, this.monitor_2dual.screen_height);
        MyPlaybackGLMonitor myPlaybackGLMonitor7 = this.monitor_2dual;
        myPlaybackGLMonitor7.setMatrix(myPlaybackGLMonitor7.left, this.monitor_2dual.bottom, this.monitor_2dual.width, this.monitor_2dual.height);
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        HiLog.e("tedG--....onResume()....--");
        if (getActivity() instanceof NewCloudPlaybackDualActivity) {
            this.cloudActivity = (NewCloudPlaybackDualActivity) getActivity();
        }
        if (getResources().getConfiguration().orientation == 1) {
            handPortrait();
            this.mScrollView.setBackgroundColor(getResources().getColor(R.color.white));
        } else {
            handLandscape();
            this.mScrollView.setBackgroundColor(getResources().getColor(R.color.colorBlack));
        }
        if (this.cloudActivity.isShowPermissionDialog) {
            HiTools.dialogUtilsAgreements.build().show();
        }
        this.monitor_1dual.setVisibility(0);
        this.monitor_2dual.setVisibility(0);
        this.monitor_3dual.setVisibility(0);
    }

    private void handPortrait() {
        if (getActivity() == null) {
            return;
        }
        showBottomUIMenu(getActivity());
        this.misfull = true;
        this.monitor_1dual.setmIsFullScreen(0);
        this.monitor_2dual.setmIsFullScreen(0);
        this.monitor_3dual.setmIsFullScreen(0);
        getActivity().getWindow().clearFlags(1024);
        this.cloudActivity.ll_title.setVisibility(0);
        this.cloudActivity.rl_head.setVisibility(0);
        this.myTimeLineView.setVisibility(0);
        this.ll_bottom.setVisibility(0);
        this.ll_top.setVisibility(8);
        this.iv_full_screen.setVisibility(8);
        this.iv_snapshot.setVisibility(8);
        this.rl_portraittopview.setVisibility(8);
        this.iv_snapshot_land.setVisibility(8);
        this.bt_portraitdualswitch.setBackgroundResource(R.mipmap.dualswitch_s);
        this.showType = 0;
        notifyLayout(0, true);
    }

    private void handLandscape() {
        LinearLayout.LayoutParams layoutParams;
        if (getActivity() == null) {
            return;
        }
        boolean hideBottomUIMenu = hideBottomUIMenu(getActivity());
        this.misfull = true;
        getActivity().getWindow().setFlags(1024, 1024);
        this.cloudActivity.ll_title.setVisibility(8);
        this.cloudActivity.rl_head.setVisibility(8);
        this.myTimeLineView.setVisibility(8);
        this.ll_bottom.setVisibility(8);
        this.ll_top.setVisibility(8);
        this.iv_full_screen.setVisibility(4);
        this.iv_snapshot.setVisibility(4);
        this.iv_snapshot_land.setVisibility(8);
        this.rl_close2monitor.setVisibility(8);
        this.rl_portraittopview.setVisibility(8);
        this.bt_landdualswitch.setBackgroundResource(R.mipmap.dualswitch);
        if (hideBottomUIMenu) {
            layoutParams = new LinearLayout.LayoutParams(-1, -1);
        } else {
            layoutParams = new LinearLayout.LayoutParams(getActivity().getWindowManager().getDefaultDisplay().getWidth(), getActivity().getWindowManager().getDefaultDisplay().getHeight());
        }
        this.rl_monitor.setLayoutParams(layoutParams);
        this.monitor_1dual.setmIsFullScreen(1);
        this.monitor_2dual.setmIsFullScreen(1);
        this.monitor_3dual.setmIsFullScreen(1);
        HiTools.mDualTimevalue = 0;
        MyCamera myCamera = this.mCamera;
        if (myCamera != null && myCamera.mPlayDualOSS != null) {
            this.mCamera.mPlayDualOSS.setLiveShowNum(HiTools.mDualTimevalue);
            this.mCamera.mPlayDualOSS.setLiveShowMonitor(this.monitor_1dual, this.monitor_2dual, this.monitor_3dual);
        }
        if (this.showType == 0) {
            this.misfull = false;
        } else {
            this.misfull = true;
        }
        this.misfull = false;
        doswitchview(false);
        this.misfull = !this.misfull;
    }

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

    @Override
    public void callbackplaylocalExt(int i, int i2, int i3, long j, long j2, int i4, int i5, String str) {
        if (j2 != 0) {
            if (this.playingFileDevStartTime == 0 && 1 == i5) {
                this.playingFileDevStartTime = j2;
            }
            long j3 = this.playingFileDevStartTime;
            long j4 = j2 - j3;
            if (j4 > 1000 && j3 != 0) {
                Message obtain = Message.obtain();
                obtain.what = HANDLE_FILE_PLAYING_PROGRESS;
                obtain.arg1 = (int) j4;
                this.lineHandler.sendMessage(obtain);
            }
            if (!this.isDownloading && !this.preLoadingFile && (j + (i3 * 1000)) - j2 <= PushUIConfig.dismissTime) {
                this.preLoadingFile = true;
                if (this.playingFilePosition + 1 >= this.video_list.size()) {
                    return;
                } else {
                    preLoadFile(this.video_list.get(this.playingFilePosition + 1).getFilename(), this.video_list.get(this.playingFilePosition + 1).getFileLen());
                }
            }
        }
        Message obtain2 = Message.obtain();
        if (i5 == 0) {
            this.preLoadingFile = false;
        } else if (i5 == 1) {
            this.mHandler.sendEmptyMessage(PLAY_LOCAL_STATE_START);
            this.isReadyPlay = true;
            this.myTimeLineView.isCanPlay = true;
            startWatchOrientation();
        } else if (i5 == 3) {
            Log.e("==cloudPlay", "收到播放结束,开始播放下一个文件");
            this.mHandler.sendEmptyMessage(PLAY_LOCAL_STATE_END);
        }
        this.mHandler.sendMessage(obtain2);
    }

    @Override
    public void callbackplayDuallocalExt(int i, int i2, int i3, int i4, long j, long j2, int i5, int i6, String str) {
        HiLog.e("state:" + i6 + Constants.COLON_SEPARATOR + HiTools.mDualTimevalue + Constants.COLON_SEPARATOR + i);
        if (HiTools.mDualTimevalue == 0 || HiTools.mDualTimevalue == 1) {
            if (i == 2) {
                return;
            }
        } else if (HiTools.mDualTimevalue == 2 && i == 1) {
            return;
        }
        HiLog.e("state:" + i6);
        if (j2 != 0) {
            if (this.playingFileDevStartTime == 0 && 1 == i6) {
                this.playingFileDevStartTime = j2;
            }
            if (i6 == 7) {
                long j3 = j2 / 1000;
                final long j4 = (this.FilePlayStartTime / 1000) + j2;
                this.FilePlayStartTime = j4 * 1000;
                getActivity().runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1 != null && CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual != null) {
                            CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1.setVisibility(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual.getVisibility());
                            CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1.setText(TimeUtil.longToString(j4, TimeUtil.FORMAT_DATE_TIME_FULL));
                        }
                        if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3 == null || CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual == null) {
                            return;
                        }
                        CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3.setVisibility(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual.getVisibility());
                        CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3.setText(TimeUtil.longToString(j4, TimeUtil.FORMAT_DATE_TIME_FULL));
                    }
                });
            } else {
                long j5 = this.playingFileDevStartTime;
                long j6 = j2 - j5;
                if (j6 > 1000 && j5 != 0) {
                    Message obtain = Message.obtain();
                    obtain.what = HANDLE_FILE_PLAYING_PROGRESS;
                    obtain.arg1 = (int) j6;
                    this.lineHandler.sendMessage(obtain);
                    final long j7 = (this.FilePlayStartTime / 1000) + j6;
                    getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            CloudTimePlaybackDualFragment_ThreeEyes.this.dismissLoadingView();
                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1 != null && CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual != null) {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1.setVisibility(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual.getVisibility());
                                CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1.setText(TimeUtil.longToString(j7, TimeUtil.FORMAT_DATE_TIME_FULL));
                            }
                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3 == null || CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual == null) {
                                return;
                            }
                            CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3.setVisibility(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual.getVisibility());
                            CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3.setText(TimeUtil.longToString(j7, TimeUtil.FORMAT_DATE_TIME_FULL));
                        }
                    });
                }
            }
            if (!this.isDownloading && !this.preLoadingFile && (j + (i4 * 1000)) - j2 <= PushUIConfig.dismissTime) {
                this.preLoadingFile = true;
                if (this.playingFilePosition + 1 >= this.video_list.size()) {
                    return;
                } else {
                    preLoadFile(this.video_list.get(this.playingFilePosition + 1).getFilename(), this.video_list.get(this.playingFilePosition + 1).getFileLen());
                }
            }
        }
        Message obtain2 = Message.obtain();
        if (i6 == 0) {
            this.preLoadingFile = false;
            this.FilePlayStartTime = ((this.FilePlayEndTime / 1000) - (i4 * 1000)) * 1000;
        } else if (i6 == 1) {
            obtain2.arg1 = i4;
            obtain2.what = PLAY_LOCAL_STATE_START;
        } else if (i6 == 3) {
            Log.e("==cloudPlay", "收到播放结束,开始播放下一个文件");
            this.mHandler.sendEmptyMessage(PLAY_LOCAL_STATE_END);
        }
        this.mHandler.sendMessage(obtain2);
    }

    @Override
    public void callbackOSSReq(String str, int i, int i2, int i3, String str2) {
        Message obtain = Message.obtain();
        if (i == 1) {
            obtain.what = ECS_CALL_BACK;
        } else if (i == 2) {
            obtain.what = OSS_CALL_BACK;
        } else {
            obtain.what = i;
        }
        obtain.obj = str;
        obtain.arg1 = i2;
        obtain.arg2 = i3;
        this.mHandler.sendMessage(obtain);
    }

    @Override
    public void callbackOSSData(int i, byte[] bArr, int i2, int i3, int i4, int i5, int i6, int i7, String str) {
        if (i == 4) {
            if (this.firstPlay) {
                playFile(i7);
            }
        } else if (i == 24837) {
            getHaveFileDay(bArr, i2, i7);
        } else {
            if (i != 25093) {
                return;
            }
            initSingleFile(i7, bArr, i2);
        }
    }

    private void playFile(int i) {
        Message obtain = Message.obtain();
        obtain.what = FILE_PLAY_START;
        obtain.arg1 = i;
        this.mHandler.sendMessage(obtain);
    }

    @Override
    public void CallBackOSSDownLoad(int i, int i2, int i3, String str) {
        this.loadingFile = str;
        boolean z = true;
        if (i == 2) {
            this.mCamera.mPlayDualOSS.StopDownOSS();
            this.isDownloading = false;
            Log.e("==cloudPlay", "收到文件下载完成回调(CallBackOSSDownLoad): \n是否是第一个文件:" + this.firstPlay + "当前播放文件: " + this.filePlayPath + "当前下载文件:" + str);
            String str2 = this.filePlayPath;
            if (str2 == null) {
                return;
            }
            int length = str2.length();
            String substring = this.filePlayPath.substring(length - 17, length);
            int length2 = str.length();
            String substring2 = str.substring(length2 - 17, length2);
            Log.e("==cloudPlay", "当前播放文件: " + substring + "当前下载文件:" + substring2);
            if (!this.firstPlay && substring.equals(substring2)) {
                playFile(1);
                return;
            } else {
                this.firstPlay = false;
                return;
            }
        }
        if (i != 0 && i != 1) {
            z = false;
        }
        this.isDownloading = z;
    }

    @Override
    public void CallBackOSSDownLoadExt(int i, long j, long j2, String str) {
        HiLog.e(j + ":::::" + j2 + ":::" + i);
        if (i == 24831 || i == 25087) {
            if (this.firstReceive != 1) {
                this.cloudBuffLength = 0;
                this.firstReceive = 1;
                this.cloudBuff = null;
                this.cloudBuff = new byte[(int) j2];
                return;
            }
            return;
        }
        switch (i) {
            case 25345:
            case 25346:
            case 25347:
                break;
            default:
                switch (i) {
                    case 25601:
                    case 25602:
                    case 25603:
                        break;
                    default:
                        switch (i) {
                            case 25857:
                            case 25858:
                            case 25859:
                                break;
                            default:
                                return;
                        }
                }
        }
        this.isDownloading = false;
        this.mCamera.mPlayDualOSS.StopDownOSS();
        this.mHandler.sendEmptyMessage(PLAY_LOCAL_STATE_END);
    }

    private void initSingleFile(int i, byte[] bArr, int i2) {
        byte[] bArr2;
        HiLog.e("initSingleFile" + bArr.length + "::" + i2);
        if (this.fileHandler == null) {
            return;
        }
        int i3 = 1;
        if (i == 1) {
            int i4 = this.cloudBuffLength;
            byte[] bArr3 = this.cloudBuff;
            if (i4 >= bArr3.length) {
                HiLog.e("getHaveFileDay" + bArr.length + "::" + i2 + Constants.COLON_SEPARATOR + this.cloudBuffLength + Constants.COLON_SEPARATOR + this.cloudBuff.length);
                return;
            }
            if (i2 <= bArr.length) {
                System.arraycopy(bArr, 0, bArr3, i4, i2);
                this.cloudBuffLength += i2;
            } else {
                System.arraycopy(bArr, 0, bArr3, i4, bArr.length);
                this.cloudBuffLength += bArr.length;
            }
        }
        if (i == 2) {
            int i5 = 148;
            int i6 = this.cloudBuffLength / 148;
            HiLog.e("" + this.cloudBuffLength + ":::::" + i6);
            byte[] bArr4 = new byte[148];
            int i7 = 128;
            byte[] bArr5 = new byte[128];
            if (i6 > 0) {
                int i8 = 0;
                while (i8 < i6) {
                    System.arraycopy(this.cloudBuff, i8 * 148, bArr4, 0, i5);
                    System.arraycopy(bArr4, 0, bArr5, 0, i7);
                    int byteArrayToInt_Little = Packet.byteArrayToInt_Little(bArr4, i7);
                    int byteArrayToInt_Little2 = Packet.byteArrayToInt_Little(bArr4, 132);
                    int byteArrayToInt_Little3 = Packet.byteArrayToInt_Little(bArr4, 136);
                    int byteArrayToInt_Little4 = Packet.byteArrayToInt_Little(bArr4, 140);
                    if (byteArrayToInt_Little4 > byteArrayToInt_Little3) {
                        VideoInfo videoInfo = new VideoInfo(0);
                        videoInfo.setRecType(byteArrayToInt_Little2);
                        videoInfo.setFilename(new String(bArr5).trim());
                        String[] split = videoInfo.getFilename().split("/");
                        if (split.length >= 4) {
                            videoInfo.setStart_time(split[i3] + Constants.ACCEPT_TIME_SEPARATOR_SERVER + split[3]);
                            videoInfo.setTimeLength(Integer.toString((byteArrayToInt_Little4 - byteArrayToInt_Little3) / 1000));
                            videoInfo.setFileLen(byteArrayToInt_Little);
                            videoInfo.setTime((long) byteArrayToInt_Little3);
                            String[] split2 = split[3].split("_");
                            videoInfo.setStartTime(getMicros(split[i3] + split2[0]));
                            videoInfo.setEndTime(getMicros(split[i3] + split2[i3].substring(0, 7)));
                            if (this.video_list.size() != 0) {
                                if (this.video_list.size() > 0) {
                                    long startTime = videoInfo.getStartTime();
                                    List<VideoInfo> list = this.video_list;
                                }
                            }
                            this.video_list.add(videoInfo);
                            if (videoInfo.getEndTime() - videoInfo.getStartTime() > 0) {
                                long startTime2 = videoInfo.getStartTime();
                                long endTime = videoInfo.getEndTime();
                                if (this.previousStartTime != 0) {
                                    long j = this.previousEndTime;
                                    if (j != 0) {
                                        if (j >= startTime2 || startTime2 - j <= 1) {
                                            bArr2 = bArr4;
                                            this.mergeEndTime1 = endTime;
                                        } else if (startTime2 - j > 300000000) {
                                            this.mergeEndTime1 = j;
                                            bArr2 = bArr4;
                                            this.roughVideoList.add(new VideoInfo(this.mergeStartTime1, j));
                                            this.mergeStartTime1 = startTime2;
                                            this.mergeEndTime1 = endTime;
                                        } else {
                                            bArr2 = bArr4;
                                            this.mergeEndTime1 = endTime;
                                        }
                                        if (this.mergeStartTime1 == 0) {
                                            this.mergeStartTime1 = startTime2;
                                            this.mergeEndTime1 = endTime;
                                        }
                                        this.previousStartTime = startTime2;
                                        this.previousEndTime = endTime;
                                        i8++;
                                        bArr4 = bArr2;
                                        i5 = 148;
                                        i3 = 1;
                                        i7 = 128;
                                    }
                                }
                                bArr2 = bArr4;
                                if (this.mergeStartTime1 == 0) {
                                }
                                this.previousStartTime = startTime2;
                                this.previousEndTime = endTime;
                                i8++;
                                bArr4 = bArr2;
                                i5 = 148;
                                i3 = 1;
                                i7 = 128;
                            }
                        }
                    }
                    bArr2 = bArr4;
                    i8++;
                    bArr4 = bArr2;
                    i5 = 148;
                    i3 = 1;
                    i7 = 128;
                }
                Message obtainMessage = this.fileHandler.obtainMessage();
                obtainMessage.what = SINGLE_DAY_FILE_CALLBACK_END;
                this.fileHandler.sendMessage(obtainMessage);
            }
        }
    }

    private void getHaveFileDay(byte[] bArr, int i, int i2) {
        HiLog.e("getHaveFileDay" + bArr.length + "::" + i);
        if (this.mHandler == null) {
            return;
        }
        Message obtain = Message.obtain();
        if (i2 == 1) {
            int i3 = this.cloudBuffLength;
            byte[] bArr2 = this.cloudBuff;
            if (i3 >= bArr2.length) {
                HiLog.e("getHaveFileDay" + bArr.length + "::" + i + Constants.COLON_SEPARATOR + this.cloudBuffLength + Constants.COLON_SEPARATOR + this.cloudBuff.length);
                return;
            }
            if (i <= bArr.length) {
                System.arraycopy(bArr, 0, bArr2, i3, i);
                this.cloudBuffLength += i;
                return;
            } else {
                System.arraycopy(bArr, 0, bArr2, i3, bArr.length);
                this.cloudBuffLength += bArr.length;
                return;
            }
        }
        if (i2 == 2) {
            int i4 = this.cloudBuffLength / 12;
            HiLog.e("" + this.cloudBuffLength + ":::::" + i4);
            byte[] bArr3 = new byte[12];
            byte[] bArr4 = new byte[8];
            if (i4 > 0) {
                for (int i5 = 0; i5 < i4; i5++) {
                    System.arraycopy(this.cloudBuff, i5 * 12, bArr3, 0, 12);
                    System.arraycopy(bArr3, 0, bArr4, 0, 8);
                    this.haveVideoDayList.add(new String(bArr4));
                }
            }
            obtain.what = HAVE_FILE_DAY_CALL_BACK;
            this.mHandler.sendMessage(obtain);
        }
    }

    public class AnonymousClass7 extends Handler {
        AnonymousClass7() {
        }

        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i != 111) {
                if (i != 2000) {
                    if (i == CloudTimePlaybackDualFragment_ThreeEyes.PLAY_LOCAL_STATE_START) {
                        if (!CloudTimePlaybackDualFragment_ThreeEyes.this.mPlayFirst) {
                            CloudTimePlaybackDualFragment_ThreeEyes.this.mPlayFirst = true;
                            CloudTimePlaybackDualFragment_ThreeEyes.this.mReplaceView.setVisibility(8);
                            CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual.setVisibility(0);
                            CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_2dual.setVisibility(0);
                            CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual.setVisibility(0);
                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual.getVisibility() == 0 && CloudTimePlaybackDualFragment_ThreeEyes.this.showType == 0 && CloudTimePlaybackDualFragment_ThreeEyes.this.getResources().getConfiguration().orientation == 2) {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.rl_closemonitor.setVisibility(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual.getVisibility());
                            } else {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.rl_closemonitor.setVisibility(8);
                            }
                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual.getVisibility() == 0 && CloudTimePlaybackDualFragment_ThreeEyes.this.showType == 0 && CloudTimePlaybackDualFragment_ThreeEyes.this.getResources().getConfiguration().orientation == 2) {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.rl_close3monitor.setVisibility(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual.getVisibility());
                            } else {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.rl_close3monitor.setVisibility(8);
                            }
                        }
                        CloudTimePlaybackDualFragment_ThreeEyes.this.isReadyPlay = true;
                        CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.isCanPlay = true;
                        CloudTimePlaybackDualFragment_ThreeEyes.this.startWatchOrientation();
                        CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time1.setText(TimeUtil.longToString(CloudTimePlaybackDualFragment_ThreeEyes.this.FilePlayStartTime / 1000, TimeUtil.FORMAT_DATE_TIME_FULL));
                        CloudTimePlaybackDualFragment_ThreeEyes.this.tv_osd_time3.setText(TimeUtil.longToString(CloudTimePlaybackDualFragment_ThreeEyes.this.FilePlayStartTime / 1000, TimeUtil.FORMAT_DATE_TIME_FULL));
                    } else {
                        if (i == CloudTimePlaybackDualFragment_ThreeEyes.PLAY_LOCAL_STATE_END) {
                            CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.isCanPlay = false;
                            CloudTimePlaybackDualFragment_ThreeEyes.this.playingFileDevStartTime = 0L;
                            HiLogcatUtil.d("==cloudPlay", "PLAY_STATE_END");
                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null && CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS != null) {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.StopPlayLocal();
                                CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.setLiveShowMonitor(CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_1dual, CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_2dual, CloudTimePlaybackDualFragment_ThreeEyes.this.monitor_3dual);
                            }
                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition == CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.size() - 1) {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.dismissLoadingView();
                                CloudTimePlaybackDualFragment_ThreeEyes.this.onValueChange = false;
                                CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener.onLoading(false);
                                MyToast.showToast(CloudTimePlaybackDualFragment_ThreeEyes.this.getActivity(), CloudTimePlaybackDualFragment_ThreeEyes.this.getString(R.string.tips_stop_video));
                            }
                            CloudTimePlaybackDualFragment_ThreeEyes.this.tv_time.postDelayed(new Runnable() {
                                @Override
                                public final void run() {
                                    CloudTimePlaybackDualFragment_ThreeEyes.AnonymousClass7.this.lambda$handleMessage$0$CloudTimePlaybackDualFragment_ThreeEyes$7();
                                }
                            }, 200L);
                            return;
                        }
                        if (i == 10001) {
                            String str = (String) message.obj;
                            if (str != null) {
                                CloudTimePlaybackDualFragment_ThreeEyes.this.getActivity().sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.parse("file://" + str)));
                            }
                            MyToast.showToast(CloudTimePlaybackDualFragment_ThreeEyes.this.getActivity(), CloudTimePlaybackDualFragment_ThreeEyes.this.getString(R.string.tips_snapshot_success));
                            return;
                        }
                        if (i != 10002) {
                            switch (i) {
                                case CloudTimePlaybackDualFragment_ThreeEyes.HAVE_FILE_DAY_CALL_BACK:
                                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.size() > 0) {
                                        HiTools.sortList(CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList);
                                        HiLogcatUtil.dTag(HiLogcatUtil.TAG_Google, "haveVideoDayList: " + CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.toString());
                                        CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                        cloudTimePlaybackDualFragment_ThreeEyes.currentPlayVideoDay = (String) cloudTimePlaybackDualFragment_ThreeEyes.haveVideoDayList.get(CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.size() - 1);
                                        CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.GetOSSFileList((String) CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.get(CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.size() - 1), 1, 0);
                                        String str2 = (String) CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.get(CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.size() - 1);
                                        int parseInt = Integer.parseInt(str2.substring(0, 4));
                                        int parseInt2 = Integer.parseInt(str2.substring(4, 6));
                                        Calendar calendar = Calendar.getInstance();
                                        calendar.set(1, parseInt);
                                        calendar.set(2, parseInt2 - 1);
                                        calendar.set(5, 1);
                                        CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes2 = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                        cloudTimePlaybackDualFragment_ThreeEyes2.initCalenderViewPager(cloudTimePlaybackDualFragment_ThreeEyes2.haveVideoDayList, str2, calendar, CloudTimePlaybackDualFragment_ThreeEyes.this.mCalendarCurrentPage);
                                    }
                                    CloudTimePlaybackDualFragment_ThreeEyes.this.firstReceive = 0;
                                    return;
                                case CloudTimePlaybackDualFragment_ThreeEyes.ECS_CALL_BACK:
                                    if (message.arg1 != 0) {
                                        CloudTimePlaybackDualFragment_ThreeEyes.this.showEcsError(message.arg1, message.arg2);
                                        return;
                                    } else {
                                        Log.i("==cloud", "ECS_CALL_BACK: SUCCESS");
                                        return;
                                    }
                                case CloudTimePlaybackDualFragment_ThreeEyes.OSS_CALL_BACK:
                                    if (message.arg1 != 0) {
                                        CloudTimePlaybackDualFragment_ThreeEyes.this.showOssError(message.arg1, message.arg2);
                                        return;
                                    }
                                    Log.i("==cloud", "OSS_CALL_BACK: SUCCESS");
                                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.mFirst) {
                                        CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.GetOSSFileTime(1, 0);
                                        CloudTimePlaybackDualFragment_ThreeEyes.this.mFirst = false;
                                        return;
                                    }
                                    return;
                                case CloudTimePlaybackDualFragment_ThreeEyes.FILE_PLAY_START:
                                    if (message.arg1 == 1) {
                                        HiLog.e("开始播放dragTime: " + CloudTimePlaybackDualFragment_ThreeEyes.this.dragTime + "--file: " + CloudTimePlaybackDualFragment_ThreeEyes.this.filePlayPath);
                                        if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null && CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS != null) {
                                            if (CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.getCloudType() == 2) {
                                                CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.SetOSSOCloudDate(CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.getUid(), CloudTimePlaybackDualFragment_ThreeEyes.this.currentPlayVideoDay, true);
                                            } else {
                                                CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.SetOSSOCloudDate(CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.getUid(), CloudTimePlaybackDualFragment_ThreeEyes.this.currentPlayVideoDay, false);
                                            }
                                            CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.StartPlayLocalTimeExt(CloudTimePlaybackDualFragment_ThreeEyes.this.filePlayPath, CloudTimePlaybackDualFragment_ThreeEyes.this.dragTime, (int) CloudTimePlaybackDualFragment_ThreeEyes.this.playingFileDevStartTime);
                                        }
                                        CloudTimePlaybackDualFragment_ThreeEyes.this.dragTime = 0;
                                        return;
                                    }
                                    return;
                                default:
                                    switch (i) {
                                        case 24832:
                                            CloudTimePlaybackDualFragment_ThreeEyes.this.ShowError(1, message.what + "");
                                            return;
                                        case HiChipDefines.HI_P2P_GET_SNAP_AUTO_PARAM:
                                            if (message.what == 24833) {
                                                CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes3 = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                                cloudTimePlaybackDualFragment_ThreeEyes3.ShowError(0, cloudTimePlaybackDualFragment_ThreeEyes3.getString(R.string.no_record_file));
                                                return;
                                            }
                                            CloudTimePlaybackDualFragment_ThreeEyes.this.ShowError(1, message.what + "");
                                            return;
                                        case HiChipDefines.HI_P2P_SET_SNAP_AUTO_PARAM:
                                        case HiChipDefines.HI_P2P_GET_SNAP_AUTO_SCHEDULE:
                                        case HiChipDefines.HI_P2P_SET_SNAP_AUTO_SCHEDULE:
                                            CloudTimePlaybackDualFragment_ThreeEyes.this.show_02_error(CloudFilePlaybackFragment.toHex(message.what, 6));
                                            return;
                                        default:
                                            switch (i) {
                                                case 25088:
                                                    break;
                                                case 25089:
                                                    break;
                                                case 25090:
                                                case 25091:
                                                case 25092:
                                                    break;
                                                default:
                                                    switch (i) {
                                                        case 25344:
                                                            break;
                                                        case 25345:
                                                            break;
                                                        case 25346:
                                                        case 25347:
                                                        case 25348:
                                                            break;
                                                        default:
                                                            switch (i) {
                                                                case 25600:
                                                                    break;
                                                                case 25601:
                                                                    break;
                                                                case 25602:
                                                                case 25603:
                                                                case 25604:
                                                                    break;
                                                                default:
                                                                    switch (i) {
                                                                        case 25856:
                                                                            break;
                                                                        case 25857:
                                                                            break;
                                                                        case 25858:
                                                                        case 25859:
                                                                        case 25860:
                                                                            break;
                                                                        default:
                                                                            switch (i) {
                                                                                case 26112:
                                                                                    break;
                                                                                case 26113:
                                                                                    break;
                                                                                case 26114:
                                                                                case 26115:
                                                                                case 26116:
                                                                                    break;
                                                                                default:
                                                                                    return;
                                                                            }
                                                                    }
                                                            }
                                                    }
                                            }
                                    }
                            }
                        } else {
                            MyToast.showToast(CloudTimePlaybackDualFragment_ThreeEyes.this.getActivity(), CloudTimePlaybackDualFragment_ThreeEyes.this.getString(R.string.tips_snapshot_failed));
                            return;
                        }
                    }
                }
                if (CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener != null) {
                    CloudTimePlaybackDualFragment_ThreeEyes.this.mOnDataLoadingListener.onLoading(false);
                    CloudTimePlaybackDualFragment_ThreeEyes.this.onValueChange = false;
                    CloudTimePlaybackDualFragment_ThreeEyes.this.dismissLoadingView();
                }
                CloudTimePlaybackDualFragment_ThreeEyes.this.myTimeLineView.isCanPlay = true;
                CloudTimePlaybackDualFragment_ThreeEyes.this.iv_full_screen.setEnabled(true);
                CloudTimePlaybackDualFragment_ThreeEyes.this.iv_snapshot.setEnabled(true);
                return;
            }
            CloudTimePlaybackDualFragment_ThreeEyes.this.initOSS();
        }

        public void lambda$handleMessage$0$CloudTimePlaybackDualFragment_ThreeEyes$7() {
            if (CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.size() <= 0 || CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition >= CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.size() - 1) {
                return;
            }
            CloudTimePlaybackDualFragment_ThreeEyes.access$612(CloudTimePlaybackDualFragment_ThreeEyes.this, 1);
            Log.e("==cloudPlay", "开始连播下一个文件");
            CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
            cloudTimePlaybackDualFragment_ThreeEyes.startVideoPath(((VideoInfo) cloudTimePlaybackDualFragment_ThreeEyes.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition)).getStartTime(), ((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition)).getStartTime(), ((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition)).getEndTime(), ((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition)).getFilename(), ((VideoInfo) CloudTimePlaybackDualFragment_ThreeEyes.this.video_list.get(CloudTimePlaybackDualFragment_ThreeEyes.this.playingFilePosition)).getFileLen(), false);
        }
    }

    public void show_02_error(String str) {
        this.firstReceive = 0;
        Toast.makeText(getContext(), HiTools.getErrorMsg(getContext(), str, 0, 0), 1).show();
        dismissLoadingView();
        OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
        if (onDataLoadingListener != null) {
            onDataLoadingListener.onLoading(false);
            this.onValueChange = false;
        }
    }

    public void ShowError(int i, String str) {
        this.firstReceive = 0;
        if (i == 1) {
            try {
                str = HiTools.getErrorMsg(getContext(), CloudFilePlaybackFragment.toHex(Integer.parseInt(str), 6), 0, 0);
            } catch (Exception unused) {
                str = "-10001";
            }
        }
        MyToast.showToast(getContext(), str);
        dismissLoadingView();
        OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
        if (onDataLoadingListener != null) {
            onDataLoadingListener.onLoading(false);
            this.onValueChange = false;
        }
    }

    private long getMicros(String str) {
        Date date;
        try {
            date = new SimpleDateFormat(TimeUtil.FORMAT_STRING, Locale.getDefault()).parse(str);
        } catch (ParseException e) {
            e.printStackTrace();
            date = null;
        }
        if (date != null) {
            return date.getTime() * 1000;
        }
        return 0L;
    }

    public void showEcsError(int i, int i2) {
        this.firstReceive = 0;
        MyToast.showToast(getContext(), HiTools.getErrorMsg(getContext(), "ECS", i, i2));
        dismissLoadingView();
        OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
        if (onDataLoadingListener != null) {
            onDataLoadingListener.onLoading(false);
            this.onValueChange = false;
        }
    }

    public void showOssError(int i, int i2) {
        MyCamera myCamera = this.mCamera;
        if (myCamera != null && myCamera.mPlayDualOSS != null) {
            this.mCamera.mPlayDualOSS = null;
        }
        this.firstReceive = 0;
        MyToast.showToast(getContext(), HiTools.getErrorMsg(getContext(), "OSS", i, i2));
        dismissLoadingView();
        OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
        if (onDataLoadingListener != null) {
            onDataLoadingListener.onLoading(false);
            this.onValueChange = false;
        }
    }

    public void initCalenderViewPager(List<String> list, String str, final Calendar calendar, int i) {
        this.moveCalendarCurrentPage = i;
        int parseInt = Integer.parseInt(str.substring(0, 4));
        int parseInt2 = Integer.parseInt(str.substring(4, 6));
        this.tv_years_month.setText(parseInt + Constants.ACCEPT_TIME_SEPARATOR_SERVER + parseInt2);
        this.viewpager.setScanScroll(true);
        this.listDay.addAll(getDaysByTimeStamp(list, parseInt, parseInt2));
        CloudTimeMyPagerAdapter cloudTimeMyPagerAdapter = new CloudTimeMyPagerAdapter(getActivity(), this.listDay, str, calendar, i);
        this.viewpager.setAdapter(cloudTimeMyPagerAdapter);
        this.viewpager.setCurrentItem(this.moveCalendarCurrentPage);
        setTitleGirdView();
        this.stc_calendar_layout.addView(this.title_gView, new LinearLayout.LayoutParams(-1, -2));
        cloudTimeMyPagerAdapter.setOnGridItemClickListener(new CloudTimeMyPagerAdapter.OnGridItemClickListener() {
            @Override
            public final void onDayItemClick(int i2) {
                CloudTimePlaybackDualFragment_ThreeEyes.this.lambda$initCalenderViewPager$2$CloudTimePlaybackDualFragment_ThreeEyes(calendar, i2);
            }
        });
        setListeners(this.listDay, calendar);
    }

    public void lambda$initCalenderViewPager$2$CloudTimePlaybackDualFragment_ThreeEyes(Calendar calendar, int i) {
        OnWrongPswListener onWrongPswListener;
        if (HiTools.isCustomFastClick(500) || this.onValueChange) {
            return;
        }
        calendar.set(5, 1);
        int i2 = (i - (calendar.get(7) - 1)) + 1;
        int i3 = calendar.get(2) + 1;
        int i4 = calendar.get(1);
        if (isContainDays(this.listDay, i2)) {
            if (this.mCamera != null && (onWrongPswListener = this.mOnWrongPswListener) != null && this.pswChanged) {
                onWrongPswListener.onWrongPsw();
                MyCamera myCamera = this.mCamera;
                if (myCamera == null || myCamera.mPlayDualOSS == null) {
                    return;
                }
                unregisterListener();
                this.mCamera.unregisterIOSessionListener(this);
                if (this.mCamera.mPlayDualOSS != null) {
                    this.mCamera.mPlayDualOSS.StopPlayLocal();
                    this.mCamera.mPlayDualOSS.StopDownOSS();
                    this.isDownloading = false;
                }
                this.mCamera.mPlayDualOSS = null;
                return;
            }
            HiLogcatUtil.d("==cloudPlay", "点击日历: " + isContainDays(this.listDay, i2) + "chooseDay: " + i2 + "----" + this.listDay.toString());
            StringBuilder sb = new StringBuilder();
            sb.append(i4);
            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
            if (i3 < 10) {
                sb.append(0);
                sb.append(i3);
            } else {
                sb.append(i3);
            }
            sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
            if (i2 < 10) {
                sb.append(0);
                sb.append(i2);
            } else {
                sb.append(i2);
            }
            if (!sb.toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "").equals(this.currentPlayVideoDay) && isContainDays(this.listDay, i2)) {
                HiLogcatUtil.e(new String[0]);
                this.myTimeLineView.isCanPlay = false;
                this.firstPlayDayVideo = true;
                OnDataLoadingListener onDataLoadingListener = this.mOnDataLoadingListener;
                if (onDataLoadingListener != null) {
                    onDataLoadingListener.onLoading(true);
                    this.onValueChange = true;
                    showLoadingView();
                }
                MyCamera myCamera2 = this.mCamera;
                if (myCamera2 != null && myCamera2.mPlayDualOSS != null) {
                    this.mCamera.mPlayDualOSS.StopPlayLocal();
                    this.mCamera.mPlayDualOSS.StopDownOSS();
                    this.isDownloading = false;
                    this.mCamera.mPlayDualOSS.setLiveShowMonitor(this.monitor_1dual, this.monitor_2dual, this.monitor_3dual);
                }
                EventBus.getDefault().post(new CloudTimeCalenderDay(this.listDay, i4, i3, this.moveCalendarCurrentPage, sb.toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "")));
                this.mCalendarCurrentPage = this.moveCalendarCurrentPage;
                MyCamera myCamera3 = this.mCamera;
                if (myCamera3 == null || myCamera3.mPlayDualOSS == null) {
                    return;
                }
                this.video_list.clear();
                this.roughVideoList.clear();
                this.currentPlayVideoDay = sb.toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
                Log.d("==cloudPlay", "点击日历请求点击日期的文件");
                this.mCamera.mPlayDualOSS.GetOSSFileList(sb.toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, ""), 1, 0);
            }
        }
    }

    private void setTitleGirdView() {
        if (getActivity() == null) {
            return;
        }
        this.title_gView = setGirdView();
        this.title_gView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
        this.title_gView.setVerticalSpacing(1);
        this.title_gView.setHorizontalSpacing(1);
        this.title_gView.setAdapter((ListAdapter) new TitleGridAdapter(getActivity()));
    }

    private boolean isContainDays(List<Integer> list, int i) {
        Iterator<Integer> it = list.iterator();
        while (it.hasNext()) {
            if (it.next().intValue() == i) {
                return true;
            }
        }
        return false;
    }

    public List<Integer> getDaysByTimeStamp(List<String> list, int i, int i2) {
        ArrayList arrayList = new ArrayList();
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(i);
        if (i2 < 10) {
            stringBuffer.append(0);
        }
        stringBuffer.append(i2);
        for (String str : list) {
            if (str.startsWith(stringBuffer.toString())) {
                arrayList.add(Integer.valueOf(str.replace(stringBuffer, "")));
            }
        }
        return arrayList;
    }

    private GridView setGirdView() {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        GridView gridView = new GridView(getActivity());
        gridView.setLayoutParams(layoutParams);
        gridView.setNumColumns(7);
        gridView.setGravity(16);
        gridView.setVerticalSpacing(1);
        gridView.setHorizontalSpacing(1);
        gridView.setBackgroundColor(0);
        gridView.setSelector(new ColorDrawable(0));
        return gridView;
    }

    private void setListeners(final List<Integer> list, final Calendar calendar) {
        this.iv_left.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CloudTimePlaybackDualFragment_ThreeEyes.this.lambda$setListeners$3$CloudTimePlaybackDualFragment_ThreeEyes(view);
            }
        });
        this.iv_right.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CloudTimePlaybackDualFragment_ThreeEyes.this.lambda$setListeners$4$CloudTimePlaybackDualFragment_ThreeEyes(view);
            }
        });
        this.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrollStateChanged(int i) {
            }

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

            @Override
            public void onPageSelected(int i) {
                calendar.add(2, i - CloudTimePlaybackDualFragment_ThreeEyes.this.moveCalendarCurrentPage);
                calendar.set(5, 1);
                CloudTimePlaybackDualFragment_ThreeEyes.this.moveCalendarCurrentPage = i;
                CloudTimePlaybackDualFragment_ThreeEyes.this.tv_years_month.setText(calendar.get(1) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + (calendar.get(2) + 1));
                list.clear();
                Log.d("==cloud", "onPageSelected->day_list: " + CloudTimePlaybackDualFragment_ThreeEyes.this.haveVideoDayList.toString());
                Log.d("==cloud", "onPageSelected->selectedDateCalendar: " + calendar.get(1) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + (calendar.get(2) + 1));
                List list2 = list;
                CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                list2.addAll(cloudTimePlaybackDualFragment_ThreeEyes.getDaysByTimeStamp(cloudTimePlaybackDualFragment_ThreeEyes.haveVideoDayList, calendar.get(1), calendar.get(2) + 1));
                Log.d("==cloud", "onPageSelected->listDay: " + list.toString() + "--" + CloudTimePlaybackDualFragment_ThreeEyes.this.currentPlayVideoDay + "--" + CloudTimePlaybackDualFragment_ThreeEyes.this.moveCalendarCurrentPage);
                EventBus.getDefault().post(new CloudTimeCalenderDay(list, calendar.get(1), calendar.get(2) + 1, CloudTimePlaybackDualFragment_ThreeEyes.this.moveCalendarCurrentPage, CloudTimePlaybackDualFragment_ThreeEyes.this.currentPlayVideoDay));
            }
        });
    }

    public void lambda$setListeners$3$CloudTimePlaybackDualFragment_ThreeEyes(View view) {
        showPreMonth(this.moveCalendarCurrentPage);
    }

    public void lambda$setListeners$4$CloudTimePlaybackDualFragment_ThreeEyes(View view) {
        showNextMonth(this.moveCalendarCurrentPage);
    }

    private void showPreMonth(int i) {
        this.viewpager.setCurrentItem(i - 1, true);
    }

    private void showNextMonth(int i) {
        this.viewpager.setCurrentItem(i + 1, true);
    }

    public void resetMonitorSize(boolean z, double d) {
        this.isLarge = z ? 1 : 2;
        if (this.monitor_1dual.getmIsFullScreen() == 0) {
            this.monitor_1dual.screen_height = this.mHeight;
        }
        if (this.monitor_1dual.height == 0 && this.monitor_1dual.width == 0) {
            initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        }
        this.moveX = (int) (d / 2.0d);
        this.moveY = (int) (((d * this.monitor_1dual.screen_height) / this.monitor_1dual.screen_width) / 2.0d);
        if (z) {
            if (this.monitor_1dual.width <= this.monitor_1dual.screen_width * 2 && this.monitor_1dual.height <= this.monitor_1dual.screen_height * 2) {
                this.monitor_1dual.left -= this.moveX / 2;
                this.monitor_1dual.bottom -= this.moveY / 2;
                this.monitor_1dual.width += this.moveX;
                this.monitor_1dual.height += this.moveY;
            }
        } else {
            this.monitor_1dual.left += this.moveX / 2;
            this.monitor_1dual.bottom += this.moveY / 2;
            this.monitor_1dual.width -= this.moveX;
            this.monitor_1dual.height -= this.moveY;
            if (this.monitor_1dual.bottom + this.monitor_1dual.height < this.monitor_1dual.screen_height) {
                MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
                myPlaybackGLMonitor.bottom = myPlaybackGLMonitor.screen_height - this.monitor_1dual.height;
            }
            if (this.monitor_1dual.left + this.monitor_1dual.width < this.monitor_1dual.screen_width) {
                MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_1dual;
                myPlaybackGLMonitor2.left = myPlaybackGLMonitor2.screen_width - this.monitor_1dual.width;
            }
        }
        if (this.monitor_1dual.left > 0 || this.monitor_1dual.width < this.monitor_1dual.screen_width || this.monitor_1dual.height < this.monitor_1dual.screen_height || this.monitor_1dual.bottom > 0) {
            initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        }
        if (this.monitor_1dual.width > this.monitor_1dual.screen_width) {
            this.monitor_1dual.setState(1);
        } else {
            this.monitor_1dual.setState(0);
        }
        MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_1dual;
        myPlaybackGLMonitor3.setMatrix(myPlaybackGLMonitor3.left, this.monitor_1dual.bottom, this.monitor_1dual.width, this.monitor_1dual.height);
    }

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

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

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

    public void setOnDataLoadingListener(OnDataLoadingListener onDataLoadingListener) {
        this.mOnDataLoadingListener = onDataLoadingListener;
    }

    public void setOnWrongPswListener(OnWrongPswListener onWrongPswListener) {
        this.mOnWrongPswListener = onWrongPswListener;
    }

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

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

    private void handDownLoad(Message message) {
        int i = message.arg1;
    }

    public void startWatchOrientation() {
        HiLogcatUtil.e("" + this.myTimeLineView.isCanPlay);
        if (this.myTimeLineView.isCanPlay) {
            OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
            if (orientationWatchDog != null) {
                orientationWatchDog.startWatch();
            }
            HiLogcatUtil.e(new String[0]);
        }
    }

    public void stopWatchOrientation() {
        OrientationWatchDog orientationWatchDog = this.mOrientationWatchDog;
        if (orientationWatchDog != null) {
            orientationWatchDog.stopWatch();
        }
    }

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

    private void initOrientationWatchdog() {
        OrientationWatchDog orientationWatchDog = new OrientationWatchDog(getActivity());
        this.mOrientationWatchDog = orientationWatchDog;
        orientationWatchDog.setOnOrientationListener(this);
    }

    @Override
    public void changedScreenDirection(int i) {
        HiLogcatUtil.e(this.isReadyPlay + Constants.COLON_SEPARATOR + this.myTimeLineView.isCanPlay);
        if (this.isReadyPlay) {
            if (i == 90) {
                if (this.myTimeLineView.isCanPlay) {
                    if (this.mOrientationWatchDog.getLastOrientation() == 270 && !this.mIsClickReturn) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                if (CloudTimePlaybackDualFragment_ThreeEyes.this.isLarge != 1) {
                                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.isLarge == 2) {
                                        CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                        cloudTimePlaybackDualFragment_ThreeEyes.resetMonitorSize(false, cloudTimePlaybackDualFragment_ThreeEyes.nLenStart);
                                        return;
                                    }
                                    return;
                                }
                                CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes2 = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                cloudTimePlaybackDualFragment_ThreeEyes2.resetMonitorSize(true, cloudTimePlaybackDualFragment_ThreeEyes2.nLenStart);
                            }
                        }, 200L);
                    }
                    if (!this.mIsClickReturn) {
                        getActivity().setRequestedOrientation(8);
                    }
                    if (!this.isFirstRevolveLand) {
                        this.isFirstRevolveLand = true;
                    }
                    if (this.mIsClickReturn) {
                        return;
                    }
                    if (this.root_lock_screen.getVisibility() == 0) {
                        this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                        this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
                        return;
                    } else {
                        this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                        this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
                        return;
                    }
                }
                return;
            }
            if (i == 270) {
                if (this.myTimeLineView.isCanPlay) {
                    if (this.mOrientationWatchDog.getLastOrientation() == 90 && !this.mIsClickReturn) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                if (CloudTimePlaybackDualFragment_ThreeEyes.this.isLarge != 1) {
                                    if (CloudTimePlaybackDualFragment_ThreeEyes.this.isLarge == 2) {
                                        CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                        cloudTimePlaybackDualFragment_ThreeEyes.resetMonitorSize(false, cloudTimePlaybackDualFragment_ThreeEyes.nLenStart);
                                        return;
                                    }
                                    return;
                                }
                                CloudTimePlaybackDualFragment_ThreeEyes cloudTimePlaybackDualFragment_ThreeEyes2 = CloudTimePlaybackDualFragment_ThreeEyes.this;
                                cloudTimePlaybackDualFragment_ThreeEyes2.resetMonitorSize(true, cloudTimePlaybackDualFragment_ThreeEyes2.nLenStart);
                            }
                        }, 200L);
                    }
                    if (!this.mIsClickReturn) {
                        getActivity().setRequestedOrientation(0);
                    }
                    if (!this.isFirstRevolveLand) {
                        this.isFirstRevolveLand = true;
                        return;
                    }
                    if (this.mIsClickReturn) {
                        return;
                    }
                    if (this.root_lock_screen.getVisibility() == 0) {
                        this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                        this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
                        return;
                    } else {
                        this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                        this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
                        return;
                    }
                }
                return;
            }
            this.mIsClickReturn = false;
            getActivity().setRequestedOrientation(1);
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
    }

    public void clickSnapshot() {
        final ArrayList arrayList = new ArrayList();
        MyCamera myCamera = this.mCamera;
        if (myCamera == null || myCamera.mPlayDualOSS == null) {
            return;
        }
        if (HiTools.isSDCardValid()) {
            File file = new File(HiDataValue.getPathCameraSnapshot(this.mCamera.getUid(), getActivity()));
            if (!file.exists()) {
                file.mkdirs();
            }
            final String fileNameWithTime = HiTools.getFileNameWithTime(0);
            final String str = file.getAbsoluteFile() + "/" + fileNameWithTime;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    Bitmap bitmap = CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null ? CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.get2Snapshot() : null;
                    Bitmap snapshotCut1 = CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null ? CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.getSnapshotCut1() : null;
                    Bitmap snapshotCut2 = CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera != null ? CloudTimePlaybackDualFragment_ThreeEyes.this.mCamera.mPlayDualOSS.getSnapshotCut2() : null;
                    if (bitmap != null) {
                        arrayList.add(bitmap);
                    }
                    if (snapshotCut1 != null) {
                        arrayList.add(snapshotCut1);
                    }
                    if (snapshotCut2 != null) {
                        arrayList.add(snapshotCut2);
                    }
                    if (arrayList.size() > 0) {
                        Bitmap drawMultiV = BitmapUtils.drawMultiV(null, arrayList);
                        if (drawMultiV == null || !HiTools.saveImage(str, drawMultiV)) {
                            CloudTimePlaybackDualFragment_ThreeEyes.this.mHandler.sendEmptyMessage(10002);
                            return;
                        }
                        try {
                            MediaStore.Images.Media.insertImage(CloudTimePlaybackDualFragment_ThreeEyes.this.getActivity().getContentResolver(), str, fileNameWithTime, (String) null);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        Message obtain = Message.obtain();
                        obtain.what = 10001;
                        obtain.obj = str;
                        CloudTimePlaybackDualFragment_ThreeEyes.this.mHandler.sendMessage(obtain);
                    }
                }
            }).start();
            return;
        }
        MyToast.showToast(getActivity(), getString(R.string.tips_no_sdcard));
    }

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