OSTimePlaybackDualFragment_New.java 源代码


package liteos;

import activity.setting.WiFiSettingActivity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.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.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 butterknife.ButterKnife;
import com.dasu.blur.DBlur;
import com.dasu.blur.OnBlurListener;
import com.hichip.base.HiLog;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.callback.ICameraPlayFastStateCallback;
import com.hichip.callback.ICameraPlayStateCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.hichip.control.HiPlayBackFastSDK;
import com.hichip.tools.Packet;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.xiaomi.mipush.sdk.Constants;
import common.Constant;
import common.ConstantCommand;
import common.HiDataValue;
import common.MyPlaybackGLMonitor;
import custom.NoSlidingViewPager;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import liteos.OSTimePlaybackDualFragment_New;
import main.MainActivity;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import service.DeletePFastCacheFileService;
import timeaxis.bean.FilePlaybackModel;
import timeaxis.bean.MsyIsStop;
import timeaxis.bean.PlaybackVo;
import timeaxis.bean.VideoList;
import timeaxis.calender.MsgCalenderDay;
import timeaxis.calender.MyLinearLayout;
import timeaxis.calender.MyPagerAdapter;
import timeaxis.calender.TitleGridAdapter;
import timeaxis.view.TimeLineNew;
import utils.FileSizeUtils;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;
import utils.OrientationWatchDog;
import utils.SharePreUtils;
import utils.SystemUtils;
import utils.TimeUtil;

public class OSTimePlaybackDualFragment_New extends HiFragment implements ICameraIOSessionCallback, ICameraPlayStateCallback, View.OnTouchListener, View.OnClickListener, OrientationWatchDog.OnOrientationListener, ICameraPlayFastStateCallback {
    private static final int HANDLE_MESSAGE_FastFILE_LOADENDINFO = -2147483645;
    private static final int HANDLE_MESSAGE_PLAYLOCAL_STATE_ING = -1879048187;
    private static final int HANDLE_MESSAGE_PLAYLOCAL_STATE_STOP = -1879048186;
    private static final int HANDLE_MESSAGE_PLAYONLINE_DISLOADVIEW = 1879048194;
    private static final int HANDLE_MESSAGE_PLAYONLINE_LODING = -1879048159;
    private static final int HANDLE_MESSAGE_PLAYONLINE_OPENFAIL = -1879048160;
    private static final int HANDLE_MESSAGE_PLAYONLINE_OPENFILE = -1879048167;
    private static final int HANDLE_MESSAGE_PLAYONLINE_PLAYING = -1879048158;
    private static final int HANDLE_MESSAGE_PLAYONLINE_SHOWLOADVIEW = 1879048193;
    private static final int HANDLE_MESSAGE_PROGRESSBAR_RUN = -1879048186;
    private static final int HANDLE_MESSAGE_SEEKBAR_END = -1879048188;
    private static final int HANDLE_MESSAGE_SEEKBAR_RUN = -1879048189;
    private static final int HANDLE_MESSAGE_SEEKBAR_START = -1879048190;
    private static final int HANDLE_VIDEO_RUN = -1879048183;
    public static int mMonth;
    public static int mYear;
    private float action_down_x;
    private float action_down_y;
    public float bottom;
    ImageView bt_landdualswitch;
    ImageView bt_portraitdualswitch;
    private int currentPlayPosition;
    private long currentPlayVideoStartTime;
    boolean currentTypeIs2;
    private String download_path;
    private String fileName;
    int fileType;
    private long firstVideoStartTime;
    public float height;
    private boolean isCalenderChangedMonth;
    private boolean isNeedShowProgress;
    private boolean isOtherDay;
    private boolean isQuit;
    ImageView iv_full_screen;
    ImageView iv_left;
    ImageView iv_placeholder;
    ImageView iv_return;
    ImageView iv_right;
    ImageView iv_snapshot;
    ImageView iv_snapshot_land;
    private long lastClickTime;
    float lastX;
    float lastY;
    public float left;
    MyLinearLayout ll_bottom;
    LinearLayout ll_top;
    private boolean loadingViewIsShowing;
    private OSTimeAxisActivity mAct;
    private int mHeight;
    private boolean mIsDataReceveEnd;
    ImageView mIvLoading;
    private MyCamera mMyCamera;
    private OrientationWatchDog mOrientationWatchDog;
    private HiChipDefines.STimeDay mSaveETimeDay;
    private HiChipDefines.STimeDay mSaveSTimeDay;
    private long mSavestartTime;
    public MyPlaybackGLMonitor monitor_1dual;
    public MyPlaybackGLMonitor monitor_2dual;
    int moveX;
    int moveY;
    float move_x;
    float move_y;
    private PlaybackVo msavepVo;
    private byte[] msavestartTime;
    TimeLineNew myTimeLineView;
    private int nearVideoDay;
    private boolean noFileNeedJump;
    private MyPagerAdapter pagerAdapter;
    private boolean preLoadingFile;
    private int preModle;
    private int recentHaveVideoDay;
    ImageView rl_close2monitor;
    RelativeLayout rl_monitor;
    RelativeLayout rl_portraittopview;
    public LinearLayout root_lock_screen;
    private HiChipDefines.SD_FILEDAY sd_fileday;
    View shadowView;
    LinearLayout stc_calendar_layout;
    private OSTimeAxisActivity timeAxisActivity;
    public boolean timePlayStart;
    private GridView title_gView;
    private boolean todayHasVideo;
    TextView tv_time;
    TextView tv_years_month;
    private boolean videoIsPause;
    private boolean videoIsPlaying;
    private View view;
    NoSlidingViewPager viewpager;
    public float width;
    int xlenOld;
    int ylenOld;
    private boolean isDrag = false;
    private int setpos = 0;
    private long oldTime = 0;
    private long savetime = 0;
    private long previousStartTime = 0;
    private long previousEndTime = 0;
    private long mergeStartTime = 0;
    private long mergeEndTime = 0;
    long mergeStartTime1 = 0;
    long mergeEndTime1 = 0;
    private List<Integer> alreadyGetVideoDay = new ArrayList();
    private List<PlaybackVo> file_list = new ArrayList();
    private List<PlaybackVo> file_list1 = new ArrayList();
    private List<Integer> allHaveVideoDayList = new ArrayList();
    private List<Integer> otherMonthAllHaveVideoDayList = new ArrayList();
    private List<VideoList> videoLists = new ArrayList();
    private List<VideoList> videoLists1 = new ArrayList();
    private List<PlaybackVo> one_day_file_list = new ArrayList();
    private List<PlaybackVo> curentDayVideo = new ArrayList();
    private List<VideoList> videoLists2 = new ArrayList();
    private Calendar calStartDate = Calendar.getInstance();
    private int currPager = 999;
    private int perPager = 999;
    private int mSelectPosition = -1;
    private long mTimeInMicros = 0;
    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 mIsPlayback = false;
    private boolean isPlayEnd = false;
    int mdelaytodo = 0;
    private boolean isCallStopDown = false;
    private Lock myOperlock = new ReentrantLock(true);
    private int mSavedragTime = 0;
    private byte[] mSaveStartTimebyt = new byte[8];
    private byte[] mSaveEndTimebyt = new byte[8];
    private boolean mIsCallStop = false;
    private boolean mIsVisibleToUser = true;
    private boolean isFirstIn = true;
    private boolean mBackToNoFile = false;
    private Handler lineHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == -1879048183 && OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay) {
                if (OSTimePlaybackDualFragment_New.this.tv_time.getVisibility() == 0) {
                    OSTimePlaybackDualFragment_New.this.tv_time.setVisibility(8);
                }
                if (!OSTimePlaybackDualFragment_New.this.mIsVisibleToUser) {
                    if (OSTimePlaybackDualFragment_New.this.mMyCamera != null) {
                        if (OSTimePlaybackDualFragment_New.this.myTimeLineView != null) {
                            HiLog.e("tedG--....()....--" + OSTimePlaybackDualFragment_New.this.mTimeInMicros + ";;;;");
                            OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                            oSTimePlaybackDualFragment_New.mTimeInMicros = oSTimePlaybackDualFragment_New.myTimeLineView.getCurrentValue();
                            HiLog.e("tedG--....()....--" + OSTimePlaybackDualFragment_New.this.mTimeInMicros + ";;;;");
                        }
                        if (OSTimePlaybackDualFragment_New.this.videoIsPause || !OSTimePlaybackDualFragment_New.this.videoIsPlaying) {
                            return;
                        }
                        OSTimePlaybackDualFragment_New.this.pausePlayVideo();
                        OSTimePlaybackDualFragment_New.this.videoIsPause = true;
                        OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                        return;
                    }
                    return;
                }
                OSTimePlaybackDualFragment_New.this.myTimeLineView.setValue(OSTimePlaybackDualFragment_New.this.firstVideoStartTime + Long.parseLong(message.arg1 + "000000"));
                if (OSTimePlaybackDualFragment_New.this.timePlayStart) {
                    return;
                }
                OSTimePlaybackDualFragment_New.this.timePlayStart = true;
            }
        }
    };
    private Handler handler = new AnonymousClass13();
    double nLenStart = 0.0d;
    private Handler mHandler_lockScreen = new Handler() {
        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                OSTimePlaybackDualFragment_New.this.root_lock_screen.setVisibility(0);
                OSTimePlaybackDualFragment_New.this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
            } else {
                OSTimePlaybackDualFragment_New.this.root_lock_screen.setVisibility(8);
                OSTimePlaybackDualFragment_New.this.mHandler_lockScreen.removeCallbacksAndMessages(null);
            }
        }
    };
    private int mdownLoadNextFileTime = 5000;
    private long subtime = 0;
    private boolean mChangeprs = true;
    private Handler mhandlerPF = new AnonymousClass17();
    private String loadingFile = "";
    private boolean fileisDowned = false;

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

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

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

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

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

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        HiLog.e("tedG--....onResume()....--");
        this.mAct = (OSTimeAxisActivity) context;
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        HiTools.mDualTimevalue = 0;
        HiLog.e("tedG--....onResume()....--");
        EventBus.getDefault().register(this);
    }

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        HiLog.e("tedG--....onResume()....--");
        this.view = layoutInflater.inflate(R.layout.fragment_os_time_playback_dual, (ViewGroup) null);
        getActivity().getWindow().addFlags(128);
        ButterKnife.bind(this, this.view);
        getIntentData();
        initViewAndData();
        initViewPager();
        setListeners();
        initOrientationWatchdog();
        initPBFast(this.mMyCamera);
        return this.view;
    }

    private void setListeners() {
        this.iv_full_screen.setOnClickListener(this);
        this.iv_snapshot.setOnClickListener(this);
        this.iv_snapshot_land.setOnClickListener(this);
        this.iv_left.setOnClickListener(this);
        this.iv_right.setOnClickListener(this);
        this.monitor_1dual.setOnClickListener(this);
        this.monitor_1dual.setOnTouchListener(this);
        this.monitor_2dual.setOnClickListener(this);
        this.monitor_2dual.setOnTouchListener(this);
        this.iv_return.setOnClickListener(this);
        this.shadowView.setOnClickListener(this);
        this.root_lock_screen.setOnClickListener(this);
        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) {
                OSTimePlaybackDualFragment_New.this.calStartDate.add(2, i - OSTimePlaybackDualFragment_New.this.perPager);
                OSTimePlaybackDualFragment_New.this.calStartDate.set(5, 1);
                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                oSTimePlaybackDualFragment_New.perPager = oSTimePlaybackDualFragment_New.currPager = i;
                OSTimePlaybackDualFragment_New.this.tv_years_month.setText(OSTimePlaybackDualFragment_New.this.calStartDate.get(1) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + (OSTimePlaybackDualFragment_New.this.calStartDate.get(2) + 1));
                if (OSTimePlaybackDualFragment_New.this.calStartDate.get(1) != OSTimePlaybackDualFragment_New.mYear || OSTimePlaybackDualFragment_New.this.calStartDate.get(2) + 1 != OSTimePlaybackDualFragment_New.mMonth) {
                    OSTimePlaybackDualFragment_New.this.isCalenderChangedMonth = true;
                    OSTimePlaybackDualFragment_New.this.otherMonthAllHaveVideoDayList.clear();
                    OSTimePlaybackDualFragment_New.this.viewpager.setScanScroll(false);
                    OSTimePlaybackDualFragment_New.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLDAY, HiChipDefines.SD_YEARMONTH.parseContent(OSTimePlaybackDualFragment_New.this.calStartDate.get(1), OSTimePlaybackDualFragment_New.this.calStartDate.get(2) + 1));
                    return;
                }
                HiLog.e("MsgCalenderDay:");
                EventBus.getDefault().post(new MsgCalenderDay(OSTimePlaybackDualFragment_New.this.allHaveVideoDayList, OSTimePlaybackDualFragment_New.this.alreadyGetVideoDay, OSTimePlaybackDualFragment_New.this.mSelectPosition, OSTimePlaybackDualFragment_New.this.currPager));
            }
        });
        this.rl_close2monitor.setOnClickListener(this);
        this.bt_landdualswitch.setOnClickListener(this);
        this.bt_portraitdualswitch.setOnClickListener(this);
    }

    protected void reset() {
        Handler handler = this.lineHandler;
        if (handler != null) {
            handler.removeMessages(-1879048183);
        }
        Handler handler2 = this.handler;
        if (handler2 != null) {
            handler2.removeMessages(0);
        }
        Handler handler3 = this.handler;
        if (handler3 != null) {
            handler3.removeMessages(1);
        }
        Handler handler4 = this.handler;
        if (handler4 != null) {
            handler4.removeMessages(2);
        }
        Handler handler5 = this.handler;
        if (handler5 != null) {
            handler5.removeMessages(HiDataValue.HANDLE_MESSAGE_SESSION_STATE);
        }
        Handler handler6 = this.handler;
        if (handler6 != null) {
            handler6.removeMessages(-1879048189);
        }
        this.firstVideoStartTime = 0L;
        this.currentPlayPosition = 0;
        this.currentPlayVideoStartTime = 0L;
        List<PlaybackVo> list = this.one_day_file_list;
        if (list != null) {
            list.clear();
        }
        List<VideoList> list2 = this.videoLists;
        if (list2 != null) {
            list2.clear();
        }
        List<VideoList> list3 = this.videoLists1;
        if (list3 != null) {
            list3.clear();
        }
        List<VideoList> list4 = this.videoLists2;
        if (list4 != null) {
            list4.clear();
        }
        List<PlaybackVo> list5 = this.file_list;
        if (list5 != null) {
            list5.clear();
        }
        List<PlaybackVo> list6 = this.file_list1;
        if (list6 != null) {
            list6.clear();
        }
        List<PlaybackVo> list7 = this.curentDayVideo;
        if (list7 != null) {
            list7.clear();
        }
        List<Integer> list8 = this.alreadyGetVideoDay;
        if (list8 != null) {
            list8.clear();
        }
        List<Integer> list9 = this.allHaveVideoDayList;
        if (list9 != null) {
            list9.clear();
        }
        this.isDrag = false;
        this.isNeedShowProgress = false;
        this.nearVideoDay = 0;
        this.setpos = 0;
        this.videoIsPlaying = false;
        this.todayHasVideo = false;
        this.isOtherDay = false;
        this.videoIsPause = false;
        this.mergeStartTime = 0L;
        this.mergeEndTime = 0L;
        this.mergeStartTime1 = 0L;
        this.mergeEndTime1 = 0L;
        this.previousStartTime = 0L;
        this.previousEndTime = 0L;
        this.preModle = 0;
        this.recentHaveVideoDay = 0;
        TimeLineNew timeLineNew = this.myTimeLineView;
        if (timeLineNew != null) {
            timeLineNew.resetData();
        }
        this.mSelectPosition = -1;
        this.mIsDataReceveEnd = false;
    }

    private void initViewAndData() {
        this.myTimeLineView.setView(this.iv_full_screen);
        this.viewpager.setScanScroll(true);
        this.monitor_1dual.setCamera(this.mMyCamera);
        this.monitor_1dual.setVisibility(0);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        this.mAct.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.mHeight = HiTools.dip2px(getContext(), 250.0f);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, this.mHeight);
        this.rl_monitor.setLayoutParams(layoutParams);
        this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
        if (this.mMyCamera.snapshot != null) {
            DBlur.source(this.mAct, this.mMyCamera.snapshot).mode(1).radius(24).animAlpha().build().doBlur(new OnBlurListener() {
                @Override
                public void onBlurFailed() {
                }

                @Override
                public void onBlurSuccess(Bitmap bitmap) {
                    OSTimePlaybackDualFragment_New.this.iv_placeholder.setImageBitmap(bitmap);
                }
            });
        }
        setListenerTimeView();
        this.monitor_1dual.screen_height = displayMetrics.heightPixels;
        this.monitor_1dual.screen_width = displayMetrics.widthPixels;
        initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        this.monitor_1dual.setState(0);
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        myPlaybackGLMonitor.setMatrix(myPlaybackGLMonitor.left, this.monitor_1dual.bottom, this.monitor_1dual.width, this.monitor_1dual.height);
        resetMonitorSize(false, 10000.0d);
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.monitor_2dual.getLayoutParams();
        HiLog.e("tedG--....onResume()....--" + layoutParams.width + Constants.COLON_SEPARATOR + layoutParams.height + Constants.COLON_SEPARATOR + this.monitor_1dual.screen_height + Constants.COLON_SEPARATOR + this.monitor_1dual.screen_width + ":" + displayMetrics.widthPixels);
        MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
        int i = this.monitor_1dual.screen_width / 3;
        layoutParams2.width = i;
        myPlaybackGLMonitor2.screen_width = i;
        MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_2dual;
        int i2 = this.monitor_1dual.screen_height / 3;
        layoutParams2.height = i2;
        myPlaybackGLMonitor3.screen_height = i2;
        layoutParams2.bottomMargin = 0;
        layoutParams2.rightMargin = 0;
        this.monitor_2dual.setLayoutParams(layoutParams2);
        init2Matrix(this.monitor_2dual.screen_width, this.monitor_2dual.screen_height);
        this.monitor_2dual.setState(0);
        MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor_2dual;
        myPlaybackGLMonitor4.setMatrix(myPlaybackGLMonitor4.left, this.monitor_2dual.bottom, this.monitor_2dual.width, this.monitor_2dual.height);
        HiLog.e("tedG--....onResume()....--" + this.monitor_2dual.screen_width + Constants.COLON_SEPARATOR + this.monitor_2dual.screen_height + ":" + this.monitor_2dual.left + ":" + this.monitor_2dual.bottom + ":" + this.monitor_2dual.width + ":" + this.monitor_2dual.height);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.rl_close2monitor.getLayoutParams();
        layoutParams3.bottomMargin = this.monitor_2dual.screen_height - HiTools.dip2px(getContext(), 30.0f);
        layoutParams3.rightMargin = this.monitor_2dual.screen_width - HiTools.dip2px(getContext(), 30.0f);
        this.rl_close2monitor.setLayoutParams(layoutParams3);
        this.monitor_2dual.setZOrderMediaOverlay(true);
        showLoadingView();
    }

    public void StopFast(boolean z) {
        MyCamera myCamera = this.mMyCamera;
        if (myCamera == null || myCamera.mPBFastsdk == null) {
            return;
        }
        if (this.mAct.isDownloading || this.mAct.isCallDownload) {
            this.mMyCamera.stopPlaybackFast(z);
        }
        this.mMyCamera.isFirstPlayOsDual = z;
        this.mMyCamera.mPBFastsdk.StopDownFast();
        this.mMyCamera.mPBFastsdk.StopPlayLocal();
        this.isCallStopDown = true;
        this.mAct.isDownloading = false;
        this.mAct.isCallDownload = false;
    }

    private void initViewPager() {
        MyPagerAdapter myPagerAdapter = new MyPagerAdapter(this.mAct, true);
        this.pagerAdapter = myPagerAdapter;
        this.viewpager.setAdapter(myPagerAdapter);
        this.viewpager.setCurrentItem(999);
        setTitleGirdView();
        this.stc_calendar_layout.addView(this.title_gView, new LinearLayout.LayoutParams(-1, -2));
        this.pagerAdapter.setOnItemClickListenerPostion(new MyPagerAdapter.OnItemClickListenerPostion() {
            @Override
            public void onItemPostion(int i) {
                boolean z;
                boolean z2;
                if (HiTools.isCustomFastClick(1000)) {
                    return;
                }
                OSTimePlaybackDualFragment_New.this.calStartDate.set(5, 1);
                int i2 = OSTimePlaybackDualFragment_New.this.calStartDate.get(7) - 1;
                int i3 = OSTimePlaybackDualFragment_New.this.calStartDate.get(2) + 1;
                int i4 = (i - i2) + 1;
                if (i4 == OSTimePlaybackDualFragment_New.this.nearVideoDay && i3 == OSTimePlaybackDualFragment_New.mMonth) {
                    return;
                }
                int i5 = OSTimePlaybackDualFragment_New.this.calStartDate.get(2) + 1;
                OSTimePlaybackDualFragment_New.this.myTimeLineView.handler.removeMessages(1);
                OSTimePlaybackDualFragment_New.this.myTimeLineView.handler.removeMessages(0);
                if (i5 == OSTimePlaybackDualFragment_New.mMonth) {
                    Iterator it = OSTimePlaybackDualFragment_New.this.allHaveVideoDayList.iterator();
                    while (true) {
                        if (it.hasNext()) {
                            if (((Integer) it.next()).intValue() == i4) {
                                z2 = true;
                                break;
                            }
                        } else {
                            z2 = false;
                            break;
                        }
                    }
                    if (z2) {
                        OSTimePlaybackDualFragment_New.this.nearVideoDay = i4;
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New.mSelectPosition = oSTimePlaybackDualFragment_New.nearVideoDay;
                        OSTimePlaybackDualFragment_New.this.StopFast(true);
                        HiLog.e("MsgCalenderDay:");
                        EventBus.getDefault().post(new MsgCalenderDay(OSTimePlaybackDualFragment_New.this.allHaveVideoDayList, OSTimePlaybackDualFragment_New.this.alreadyGetVideoDay, OSTimePlaybackDualFragment_New.this.mSelectPosition, OSTimePlaybackDualFragment_New.this.currPager));
                        if (!OSTimePlaybackDualFragment_New.this.alreadyGetVideoDay.contains(Integer.valueOf(OSTimePlaybackDualFragment_New.this.nearVideoDay))) {
                            if (!OSTimePlaybackDualFragment_New.this.mMyCamera.getdevDual()) {
                                OSTimePlaybackDualFragment_New.this.mMyCamera.stopPlaybackNew();
                            } else {
                                OSTimePlaybackDualFragment_New.this.mMyCamera.stopPlaybackFast(true);
                                OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual = true;
                            }
                            OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                            OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
                            OSTimePlaybackDualFragment_New.this.one_day_file_list.clear();
                            OSTimePlaybackDualFragment_New.this.file_list.clear();
                            OSTimePlaybackDualFragment_New.this.file_list1.clear();
                            OSTimePlaybackDualFragment_New.this.isOtherDay = true;
                            OSTimePlaybackDualFragment_New.this.videoIsPause = false;
                            OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New2 = OSTimePlaybackDualFragment_New.this;
                            oSTimePlaybackDualFragment_New2.removeVideoList(oSTimePlaybackDualFragment_New2.nearVideoDay);
                            OSTimePlaybackDualFragment_New.this.showLoadingView();
                            OSTimePlaybackDualFragment_New.this.StopFast(true);
                            OSTimePlaybackDualFragment_New.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, OSTimePlaybackDualFragment_New.mYear, OSTimePlaybackDualFragment_New.mMonth, OSTimePlaybackDualFragment_New.this.nearVideoDay, OSTimePlaybackDualFragment_New.this.getFileType()));
                            OSTimePlaybackDualFragment_New.this.alreadyGetVideoDay.add(Integer.valueOf(OSTimePlaybackDualFragment_New.this.nearVideoDay));
                            return;
                        }
                        OSTimePlaybackDualFragment_New.this.StopFast(true);
                        OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
                        OSTimePlaybackDualFragment_New.this.one_day_file_list.clear();
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New3 = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New3.removeVideoList(oSTimePlaybackDualFragment_New3.nearVideoDay);
                        OSTimePlaybackDualFragment_New.this.videoIsPause = false;
                        OSTimePlaybackDualFragment_New.this.showLoadingView();
                        OSTimePlaybackDualFragment_New.this.StopFast(true);
                        OSTimePlaybackDualFragment_New.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, OSTimePlaybackDualFragment_New.mYear, OSTimePlaybackDualFragment_New.mMonth, OSTimePlaybackDualFragment_New.this.nearVideoDay, OSTimePlaybackDualFragment_New.this.getFileType()));
                        return;
                    }
                    return;
                }
                Iterator it2 = OSTimePlaybackDualFragment_New.this.otherMonthAllHaveVideoDayList.iterator();
                while (true) {
                    if (it2.hasNext()) {
                        if (((Integer) it2.next()).intValue() == i4) {
                            z = true;
                            break;
                        }
                    } else {
                        z = false;
                        break;
                    }
                }
                if (z) {
                    OSTimePlaybackDualFragment_New.this.showLoadingView();
                    OSTimePlaybackDualFragment_New.this.StopFast(true);
                    OSTimePlaybackDualFragment_New.this.reset();
                    OSTimePlaybackDualFragment_New.this.nearVideoDay = i4;
                    OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New4 = OSTimePlaybackDualFragment_New.this;
                    oSTimePlaybackDualFragment_New4.mSelectPosition = oSTimePlaybackDualFragment_New4.nearVideoDay;
                    OSTimePlaybackDualFragment_New.this.allHaveVideoDayList.addAll(OSTimePlaybackDualFragment_New.this.otherMonthAllHaveVideoDayList);
                    for (int i6 = 0; i6 < OSTimePlaybackDualFragment_New.this.allHaveVideoDayList.size(); i6++) {
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.date[((Integer) OSTimePlaybackDualFragment_New.this.allHaveVideoDayList.get(i6)).intValue() - 1] = 1;
                    }
                    OSTimePlaybackDualFragment_New.mYear = OSTimePlaybackDualFragment_New.this.calStartDate.get(1);
                    OSTimePlaybackDualFragment_New.mMonth = OSTimePlaybackDualFragment_New.this.calStartDate.get(2) + 1;
                    OSTimePlaybackDualFragment_New.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, OSTimePlaybackDualFragment_New.mYear, OSTimePlaybackDualFragment_New.mMonth, OSTimePlaybackDualFragment_New.this.nearVideoDay, OSTimePlaybackDualFragment_New.this.getFileType()));
                    OSTimePlaybackDualFragment_New.this.alreadyGetVideoDay.add(Integer.valueOf(OSTimePlaybackDualFragment_New.this.nearVideoDay));
                    if (OSTimePlaybackDualFragment_New.this.allHaveVideoDayList == null || OSTimePlaybackDualFragment_New.this.allHaveVideoDayList.size() <= 0) {
                        return;
                    }
                    OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New5 = OSTimePlaybackDualFragment_New.this;
                    oSTimePlaybackDualFragment_New5.recentHaveVideoDay = ((Integer) oSTimePlaybackDualFragment_New5.allHaveVideoDayList.get(OSTimePlaybackDualFragment_New.this.allHaveVideoDayList.size() - 1)).intValue();
                }
            }
        });
    }

    private void initPBFast(MyCamera myCamera) {
        if (myCamera.mPBFastsdk == null) {
            myCamera.mPBFastsdk = new HiPlayBackFastSDK();
            boolean z = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
            if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z) {
                myCamera.mPBFastsdk.SetDecodeViVoVideoType(0);
            } else {
                myCamera.mPBFastsdk.SetDecodeViVoVideoType(1);
            }
            myCamera.mPBFastsdk.registerPlayFastStateListener(this);
            return;
        }
        myCamera.mPBFastsdk.SetHiCameraObj(myCamera);
        myCamera.mPBFastsdk.registerPlayFastStateListener(this);
        myCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_1dual, this.monitor_2dual);
        myCamera.mPBFastsdk.SetHiCameraTimeSpeedPlay(false);
    }

    public byte getFileType() {
        return this.currentTypeIs2 ? (byte) 2 : (byte) 0;
    }

    private void setTitleGirdView() {
        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(this.mAct));
    }

    private GridView setGirdView() {
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        GridView gridView = new GridView(this.mAct);
        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 getIntentData() {
        String string = getArguments().getString(HiDataValue.EXTRAS_KEY_UID);
        if (!TextUtils.isEmpty(string)) {
            Iterator<MyCamera> it = HiDataValue.CameraList.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                MyCamera next = it.next();
                if (string.equals(next.getUid())) {
                    this.mMyCamera = next;
                    break;
                }
            }
        }
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.registerIOSessionListener(this);
            this.mMyCamera.registerPlayStateListener(this);
        }
    }

    private void searchmonvideo() {
        Calendar calendar = Calendar.getInstance();
        mYear = calendar.get(1);
        mMonth = calendar.get(2) + 1;
        setYearMonth(calendar.getTimeInMillis() * 1000);
        this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLDAY, HiChipDefines.SD_YEARMONTH.parseContent(mYear, mMonth));
    }

    public class AnonymousClass4 implements TimeLineNew.PlaybackViewListener {
        AnonymousClass4() {
        }

        @Override
        public void onValueChanged(String str, long j, boolean z) {
            if (z && OSTimePlaybackDualFragment_New.this.isNeedShowProgress) {
                OSTimePlaybackDualFragment_New.this.tv_time.setVisibility(0);
                OSTimePlaybackDualFragment_New.this.timePlayStart = false;
            }
            OSTimePlaybackDualFragment_New.this.tv_time.setText(str);
            if (str.contains("23:59:59")) {
                OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
            }
        }

        @Override
        public void onVideoStart(String str, long j, int i) {
            String str2 = str;
            long j2 = j;
            String format = HiDataValue.sdf.format(new Date(j2 / 1000));
            HiLogcatUtil.e("tedu--时间轴控件  onVideoStart--:" + format + "-timeInMillis-:" + str2 + ":::" + str.length() + "\n>>type=" + i + ">>timeInMicros=" + j2 + "::" + OSTimePlaybackDualFragment_New.this.nearVideoDay + "::" + OSTimePlaybackDualFragment_New.this.getDay(j2));
            if (!TextUtils.isEmpty(format) && format.length() > 10 && format.indexOf("00:00:00") != -1) {
                j2 += 1000000;
            }
            if (!TextUtils.isEmpty(str) && str.length() >= 8 && str2.indexOf("00:00:00") != -1) {
                str2 = str2.replace("00:00:00", "00:00:01");
            }
            HiLogcatUtil.e("tedu--时间轴控件  onVideoStart--:" + format + "-timeInMillis-:" + str2 + "\n>>type=" + i + ">>timeInMicros=" + j2 + "::" + OSTimePlaybackDualFragment_New.this.nearVideoDay + "::" + OSTimePlaybackDualFragment_New.this.getDay(j2));
            if (i == 0 && "00:00:01".equals(str2)) {
                return;
            }
            OSTimePlaybackDualFragment_New.this.tv_time.setVisibility(8);
            OSTimePlaybackDualFragment_New.this.handler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    OSTimePlaybackDualFragment_New.AnonymousClass4.this.lambda$onVideoStart$0$OSTimePlaybackDualFragment_New$4();
                }
            }, 500L);
            if (OSTimePlaybackDualFragment_New.this.getDay(j2) != -1) {
                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                oSTimePlaybackDualFragment_New.nearVideoDay = oSTimePlaybackDualFragment_New.getDay(j2);
            }
            if (!OSTimePlaybackDualFragment_New.this.isDrag) {
                if (OSTimePlaybackDualFragment_New.this.mhandlerPF != null) {
                    OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessage(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_SHOWLOADVIEW);
                }
                OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = true;
                OSTimePlaybackDualFragment_New.this.isPlayEnd = false;
                if (OSTimePlaybackDualFragment_New.this.one_day_file_list.size() > 0) {
                    PlaybackVo playbackVo = (PlaybackVo) OSTimePlaybackDualFragment_New.this.one_day_file_list.get(0);
                    OSTimePlaybackDualFragment_New.this.setpos = 0;
                    OSTimePlaybackDualFragment_New.this.oldTime = 0L;
                    OSTimePlaybackDualFragment_New.this.firstVideoStartTime = playbackVo.getStartTime();
                    OSTimePlaybackDualFragment_New.this.currentPlayVideoStartTime = playbackVo.getStartTime();
                    byte[] bArr = new byte[8];
                    System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
                    OSTimePlaybackDualFragment_New.this.startPlayBack(bArr, playbackVo.getEndbyt(), playbackVo.getStartTime() / 1000, playbackVo.getEndTime() / 1000, 0L, 0, 0, playbackVo.getFlag());
                    OSTimePlaybackDualFragment_New.this.isDrag = true;
                    OSTimePlaybackDualFragment_New.this.isNeedShowProgress = true;
                    return;
                }
                return;
            }
            if (OSTimePlaybackDualFragment_New.this.mBackToNoFile) {
                int findVideoFile = OSTimePlaybackDualFragment_New.this.findVideoFile(j2, i);
                Log.e("wry----------725", "findVideoFile =" + j2 + "videoPosition = " + findVideoFile + "-----currentPlayPosition = " + OSTimePlaybackDualFragment_New.this.currentPlayPosition);
                StringBuilder sb = new StringBuilder();
                sb.append("--时间轴控件  videoPosition = ");
                sb.append(findVideoFile);
                sb.append("-----curentDayVideo.size() = ");
                sb.append(OSTimePlaybackDualFragment_New.this.curentDayVideo.size());
                HiLogcatUtil.e(sb.toString());
                if (findVideoFile == -1 || findVideoFile == OSTimePlaybackDualFragment_New.this.curentDayVideo.size()) {
                    OSTimePlaybackDualFragment_New.this.myTimeLineView.listener.onNoneVideo(str2, j2);
                    return;
                }
                if (OSTimePlaybackDualFragment_New.this.myTimeLineView.isScroll()) {
                    HiLogcatUtil.e("--时间轴控件  myTimeLineView.isScroll() = " + OSTimePlaybackDualFragment_New.this.myTimeLineView.isScroll());
                    return;
                }
                OSTimePlaybackDualFragment_New.this.mdelaytodo = 0;
                final PlaybackVo playbackVo2 = (PlaybackVo) OSTimePlaybackDualFragment_New.this.curentDayVideo.get(findVideoFile);
                OSTimePlaybackDualFragment_New.this.oldTime = 0L;
                OSTimePlaybackDualFragment_New.this.firstVideoStartTime = j2;
                OSTimePlaybackDualFragment_New.this.setpos = 1;
                HiLogcatUtil.e("currentPlayPosition:" + OSTimePlaybackDualFragment_New.this.currentPlayPosition + "::" + findVideoFile + Constants.COLON_SEPARATOR + OSTimePlaybackDualFragment_New.this.firstVideoStartTime);
                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New2 = OSTimePlaybackDualFragment_New.this;
                oSTimePlaybackDualFragment_New2.currentPlayPosition = findVideoFile > -1 ? findVideoFile : oSTimePlaybackDualFragment_New2.currentPlayPosition;
                final byte[] bArr2 = new byte[8];
                System.arraycopy(playbackVo2.getStartbyt(), 0, bArr2, 0, 8);
                if (OSTimePlaybackDualFragment_New.this.isQuit) {
                    return;
                }
                if (OSTimePlaybackDualFragment_New.this.mhandlerPF != null) {
                    OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessage(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_SHOWLOADVIEW);
                }
                OSTimePlaybackDualFragment_New.this.mBackToNoFile = false;
                OSTimePlaybackDualFragment_New.this.myOperlock.lock();
                if (OSTimePlaybackDualFragment_New.this.mAct.isDownThread || !OSTimePlaybackDualFragment_New.this.mAct.isCallDownload) {
                    if (OSTimePlaybackDualFragment_New.this.currentPlayPosition != findVideoFile) {
                        OSTimePlaybackDualFragment_New.this.StopFast(false);
                        OSTimePlaybackDualFragment_New.this.mdelaytodo = 1000;
                    }
                    OSTimePlaybackDualFragment_New.this.mhandlerPF.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr2, playbackVo2.getEndbyt(), 0L, 0, playbackVo2.getFlag());
                        }
                    }, OSTimePlaybackDualFragment_New.this.mdelaytodo);
                } else {
                    OSTimePlaybackDualFragment_New.this.msavestartTime = bArr2;
                    OSTimePlaybackDualFragment_New.this.msavepVo = playbackVo2;
                    OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessageDelayed(WiFiSettingActivity.SET_WIFI_END, 100L);
                }
                OSTimePlaybackDualFragment_New.this.myOperlock.unlock();
                OSTimePlaybackDualFragment_New.this.myTimeLineView.moveToValue(playbackVo2.getStartTime());
                OSTimePlaybackDualFragment_New.this.videoIsPause = false;
                OSTimePlaybackDualFragment_New.this.videoIsPlaying = true;
                return;
            }
            OSTimePlaybackDualFragment_New.this.handPlayStart(str2, j2, i);
        }

        public void lambda$onVideoStart$0$OSTimePlaybackDualFragment_New$4() {
            OSTimePlaybackDualFragment_New.this.iv_full_screen.setEnabled(true);
            OSTimePlaybackDualFragment_New.this.iv_snapshot.setEnabled(true);
        }

        @Override
        public void onNoneVideo(String str, long j) {
            int i;
            OSTimePlaybackDualFragment_New.this.dismissLoadingView();
            if (OSTimePlaybackDualFragment_New.this.videoIsPlaying && OSTimePlaybackDualFragment_New.this.one_day_file_list.size() > 0) {
                OSTimePlaybackDualFragment_New.this.tv_time.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        if (OSTimePlaybackDualFragment_New.this.getResources().getConfiguration().orientation == 1) {
                            OSTimePlaybackDualFragment_New.this.iv_placeholder.setVisibility(0);
                            OSTimePlaybackDualFragment_New.this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, OSTimePlaybackDualFragment_New.this.mHeight));
                        }
                        if (OSTimePlaybackDualFragment_New.this.mAct != null && !OSTimePlaybackDualFragment_New.this.mAct.isFinishing()) {
                            Toast.makeText(OSTimePlaybackDualFragment_New.this.mAct, OSTimePlaybackDualFragment_New.this.getString(R.string.current_not_video), 1).show();
                        }
                        if (OSTimePlaybackDualFragment_New.this.videoIsPause || !OSTimePlaybackDualFragment_New.this.videoIsPlaying) {
                            return;
                        }
                        OSTimePlaybackDualFragment_New.this.StopPlayVideo();
                        OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                        OSTimePlaybackDualFragment_New.this.videoIsPause = true;
                    }
                }, 500L);
            } else if (OSTimePlaybackDualFragment_New.this.iv_placeholder.getVisibility() == 0) {
                if (OSTimePlaybackDualFragment_New.this.curentDayVideo.size() > 0) {
                    i = OSTimePlaybackDualFragment_New.this.myTimeLineView.getCurrentValue() / 1000000 > ((PlaybackVo) OSTimePlaybackDualFragment_New.this.curentDayVideo.get(OSTimePlaybackDualFragment_New.this.curentDayVideo.size() - 1)).getEndTime() / 1000000 ? OSTimePlaybackDualFragment_New.this.curentDayVideo.size() - 1 : -1;
                    if (OSTimePlaybackDualFragment_New.this.myTimeLineView.getCurrentValue() / 1000000 < ((PlaybackVo) OSTimePlaybackDualFragment_New.this.curentDayVideo.get(0)).getStartTime() / 1000000) {
                        i = 0;
                    }
                } else {
                    i = -1;
                }
                if (i != -1) {
                    final PlaybackVo playbackVo = (PlaybackVo) OSTimePlaybackDualFragment_New.this.curentDayVideo.get(i);
                    if (OSTimePlaybackDualFragment_New.this.mBackToNoFile) {
                        OSTimePlaybackDualFragment_New.this.oldTime = 0L;
                        OSTimePlaybackDualFragment_New.this.firstVideoStartTime = j;
                        OSTimePlaybackDualFragment_New.this.setpos = 1;
                        HiLogcatUtil.e("currentPlayPosition:" + OSTimePlaybackDualFragment_New.this.currentPlayPosition + "::" + i + Constants.COLON_SEPARATOR + OSTimePlaybackDualFragment_New.this.firstVideoStartTime);
                        OSTimePlaybackDualFragment_New.this.mdelaytodo = 0;
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New.currentPlayPosition = i > -1 ? i : oSTimePlaybackDualFragment_New.currentPlayPosition;
                        final byte[] bArr = new byte[8];
                        System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
                        if (OSTimePlaybackDualFragment_New.this.isQuit) {
                            return;
                        }
                        OSTimePlaybackDualFragment_New.this.mBackToNoFile = false;
                        OSTimePlaybackDualFragment_New.this.myOperlock.lock();
                        if (OSTimePlaybackDualFragment_New.this.mAct.isDownThread || !OSTimePlaybackDualFragment_New.this.mAct.isCallDownload) {
                            if (OSTimePlaybackDualFragment_New.this.currentPlayPosition != i) {
                                OSTimePlaybackDualFragment_New.this.StopFast(false);
                                OSTimePlaybackDualFragment_New.this.mdelaytodo = 1000;
                            }
                            OSTimePlaybackDualFragment_New.this.mhandlerPF.postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, playbackVo.getEndbyt(), 0L, 0, playbackVo.getFlag());
                                }
                            }, OSTimePlaybackDualFragment_New.this.mdelaytodo);
                        } else {
                            OSTimePlaybackDualFragment_New.this.msavestartTime = bArr;
                            OSTimePlaybackDualFragment_New.this.msavepVo = playbackVo;
                            OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessageDelayed(WiFiSettingActivity.SET_WIFI_END, 100L);
                        }
                        OSTimePlaybackDualFragment_New.this.myOperlock.unlock();
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.moveToValue(playbackVo.getStartTime());
                    } else {
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.moveToValue(playbackVo.getStartTime());
                    }
                }
            }
            if (OSTimePlaybackDualFragment_New.this.videoIsPause && !OSTimePlaybackDualFragment_New.this.videoIsPlaying && OSTimePlaybackDualFragment_New.this.iv_placeholder.getVisibility() != 0) {
                OSTimePlaybackDualFragment_New.this.iv_placeholder.setVisibility(0);
                OSTimePlaybackDualFragment_New.this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, OSTimePlaybackDualFragment_New.this.mHeight));
            }
            OSTimePlaybackDualFragment_New.this.timePlayStart = true;
        }

        @Override
        public void onChangedScaleMode() {
            if (OSTimePlaybackDualFragment_New.this.myTimeLineView.getScaleMode() == 120 || OSTimePlaybackDualFragment_New.this.myTimeLineView.getScaleMode() == 600) {
                if (OSTimePlaybackDualFragment_New.this.preModle != OSTimePlaybackDualFragment_New.this.myTimeLineView.getScaleMode()) {
                    OSTimePlaybackDualFragment_New.this.myTimeLineView.setVideos(OSTimePlaybackDualFragment_New.this.file_list, false, 0L);
                    OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                    oSTimePlaybackDualFragment_New.preModle = oSTimePlaybackDualFragment_New.myTimeLineView.getScaleMode();
                    return;
                }
                return;
            }
            if (OSTimePlaybackDualFragment_New.this.preModle != OSTimePlaybackDualFragment_New.this.myTimeLineView.getScaleMode()) {
                OSTimePlaybackDualFragment_New.this.myTimeLineView.setVideos(OSTimePlaybackDualFragment_New.this.file_list1, false, 0L);
                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New2 = OSTimePlaybackDualFragment_New.this;
                oSTimePlaybackDualFragment_New2.preModle = oSTimePlaybackDualFragment_New2.myTimeLineView.getScaleMode();
            }
        }
    }

    private void setListenerTimeView() {
        this.myTimeLineView.setOnPlaybackViewListener(new AnonymousClass4());
    }

    public void handPlayStart(String str, long j, int i) {
        this.mdelaytodo = 0;
        int findVideoFile = findVideoFile(j, i);
        Log.e("wry----------893", "findVideoFile =" + j + "videoPosition = " + findVideoFile + "-----currentPlayPosition = " + this.currentPlayPosition);
        StringBuilder sb = new StringBuilder();
        sb.append("--时间轴控件  videoPosition = ");
        sb.append(findVideoFile);
        sb.append("------timeInMicros = ");
        sb.append(j);
        HiLogcatUtil.e(sb.toString());
        if (findVideoFile == -1 || findVideoFile == this.curentDayVideo.size()) {
            this.myTimeLineView.listener.onNoneVideo(str, j);
            return;
        }
        if (this.myTimeLineView.isScroll() || findVideoFile >= this.curentDayVideo.size()) {
            HiLogcatUtil.e("--时间轴控件  myTimeLineView.isScroll() = " + this.myTimeLineView.isScroll() + "----curentDayVideo.size() = " + this.curentDayVideo.size());
            return;
        }
        final PlaybackVo playbackVo = this.curentDayVideo.get(findVideoFile);
        if (this.noFileNeedJump) {
            HiLogcatUtil.e("--时间轴控件  noFileNeedJump = " + this.noFileNeedJump);
            this.myTimeLineView.moveToValue(playbackVo.getStartTime());
            return;
        }
        this.oldTime = 0L;
        this.firstVideoStartTime = j;
        this.setpos = 1;
        if (this.currentPlayPosition != findVideoFile) {
            StopFast(false);
            this.mdelaytodo = 1000;
        }
        if (findVideoFile <= -1) {
            findVideoFile = this.currentPlayPosition;
        }
        this.currentPlayPosition = findVideoFile;
        final byte[] bArr = new byte[8];
        System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
        final int startTime = (int) ((j - playbackVo.getStartTime()) / 1000000);
        if (this.videoIsPlaying || this.videoIsPause) {
            this.iv_placeholder.setVisibility(4);
            this.mhandlerPF.postDelayed(new Runnable() {
                @Override
                public void run() {
                    OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, playbackVo.getEndbyt(), startTime, 1, playbackVo.getFlag());
                }
            }, this.mdelaytodo);
        } else {
            this.iv_placeholder.setVisibility(4);
            this.mhandlerPF.postDelayed(new Runnable() {
                @Override
                public void run() {
                    OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, playbackVo.getEndbyt(), 0L, 0, playbackVo.getFlag());
                }
            }, this.mdelaytodo);
        }
        this.videoIsPause = false;
        this.videoIsPlaying = true;
        this.mMyCamera.mPBFastsdk.PlayLocal_Speed(0, 0);
    }

    private void setYearMonth(long j) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(j / 1000);
        if (isAdded()) {
            this.tv_years_month.setText(calendar.get(1) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + (calendar.get(2) + 1));
        }
    }

    public void pausePlayVideo() {
        if (this.mMyCamera != null) {
            if (this.mAct.isDownloading || this.mAct.isCallDownload) {
                this.mMyCamera.sendIOCtrl(65612, HiChipDefines.HI_P2P_S_PB_PLAY_REQ.parseContent(0, (short) 3, this.mSaveSTimeDay.parseContent()));
            }
            if (this.mMyCamera.mPBFastsdk != null) {
                this.mMyCamera.mPBFastsdk.PlayLocal_pause1();
            }
        }
    }

    public void StopPlayVideo() {
        if (this.mMyCamera != null) {
            if (this.mAct.isDownloading || this.mAct.isCallDownload) {
                this.mMyCamera.sendIOCtrl(65612, HiChipDefines.HI_P2P_S_PB_PLAY_REQ.parseContent(0, (short) 2, this.mSaveSTimeDay.parseContent()));
            }
            if (this.mMyCamera.mPBFastsdk != null) {
                this.mMyCamera.mPBFastsdk.PlayLocal_pause1();
                this.mMyCamera.mPBFastsdk.StopPlayLocal();
            }
        }
    }

    protected int findVideoFileMiss(long j, int i) {
        int findVideoFile = findVideoFile(j, i);
        Log.e("wry----------984", "findVideoFile =" + j + "videoPosition = " + findVideoFile + "-----currentPlayPosition = " + this.currentPlayPosition);
        Log.e("wry---------", "tedG" + j + "--....()....--" + this.mTimeInMicros + ";;;;" + findVideoFile + ":::::" + this.currentPlayPosition);
        int i2 = this.currentPlayPosition;
        return (i2 <= -1 || findVideoFile + (-2) != i2) ? findVideoFile : findVideoFile - 1;
    }

    protected int findVideoFile(long j, int i) {
        StringBuilder sb = new StringBuilder();
        String str = "tedG--....()....--";
        sb.append("tedG--....()....--");
        sb.append(j);
        sb.append(";;;;");
        sb.append(i);
        HiLog.e(sb.toString());
        this.curentDayVideo.clear();
        if (!this.alreadyGetVideoDay.contains(Integer.valueOf(this.nearVideoDay))) {
            HiLog.e("tedG--....()....--");
            return -1;
        }
        int i2 = 0;
        while (true) {
            if (i2 >= this.videoLists.size()) {
                break;
            }
            if (this.nearVideoDay == this.videoLists.get(i2).getDay_of_month()) {
                this.curentDayVideo.addAll(this.videoLists.get(i2).getTodayVideos());
                break;
            }
            i2++;
        }
        if (this.curentDayVideo.size() == 0) {
            return -1;
        }
        List<PlaybackVo> list = this.curentDayVideo;
        long j2 = j / 1000000;
        if (list.get(list.size() - 1).getEndTime() / 1000000 < j2) {
            HiLog.e("tedG--....()....--");
            return this.curentDayVideo.size();
        }
        int size = this.curentDayVideo.size() - 1;
        int i3 = 0;
        while (i3 <= size) {
            int i4 = (i3 + size) / 2;
            StringBuilder sb2 = new StringBuilder();
            sb2.append("get(mid).getStartTime() = ");
            String str2 = str;
            sb2.append(this.curentDayVideo.get(i4).getStartTime() / 1000);
            sb2.append("----get(mid).getEndTime() = ");
            sb2.append(this.curentDayVideo.get(i4).getEndTime() / 1000);
            sb2.append("----timeInMicros = ");
            sb2.append(j / 1000);
            Log.e("wry---------", sb2.toString());
            if (this.curentDayVideo.get(i4).getStartTime() / 1000000 <= j2 && this.curentDayVideo.get(i4).getEndTime() / 1000000 >= j2) {
                this.noFileNeedJump = false;
                Log.e("wry---------", "mid = " + i4);
                return i4;
            }
            if (this.curentDayVideo.get(i4).getEndTime() / 1000000 <= j2) {
                i3 = i4 + 1;
                Log.e("wry---------", "left = " + i3);
            } else if (this.curentDayVideo.get(i4).getStartTime() / 1000000 > j2) {
                int i5 = i4 - 1;
                Log.e("wry---------", "right = " + i5);
                size = i5;
            }
            str = str2;
        }
        String str3 = str;
        int i6 = (i3 + size) / 2;
        HiLog.e(str3 + size + "::" + i3 + ":::" + this.curentDayVideo.size());
        if (i3 == this.curentDayVideo.size() && size == this.curentDayVideo.size() - 1) {
            return size;
        }
        if (size < 0 || i3 > this.curentDayVideo.size() - 1) {
            HiLog.e(str3);
            return -1;
        }
        if (i == 1) {
            this.noFileNeedJump = true;
            return i6 + 1;
        }
        if (i == 0) {
            this.noFileNeedJump = true;
            return i6;
        }
        if (i == -1) {
            this.noFileNeedJump = false;
            return size;
        }
        HiLog.e(str3);
        return -1;
    }

    public void startPlayBack(final byte[] bArr, final byte[] bArr2, long j, long j2, final long j3, int i, final int i2, final byte b) {
        new Thread() {
            @Override
            public void run() {
                super.run();
                if (OSTimePlaybackDualFragment_New.this.curentDayVideo.size() == 0) {
                    if (OSTimePlaybackDualFragment_New.this.isQuit) {
                        return;
                    }
                    OSTimePlaybackDualFragment_New.this.getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            OSTimePlaybackDualFragment_New.this.showLoadingView();
                        }
                    });
                    OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, bArr2, j3, i2, b);
                    return;
                }
                if (OSTimePlaybackDualFragment_New.this.isQuit) {
                    return;
                }
                if (!OSTimePlaybackDualFragment_New.this.mIsPlayback || !OSTimePlaybackDualFragment_New.this.isPlayEnd) {
                    OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, bArr2, j3, i2, b);
                    return;
                }
                OSTimePlaybackDualFragment_New.this.isPlayEnd = false;
                OSTimePlaybackDualFragment_New.this.mIsPlayback = false;
                OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, bArr2, j3, i2, b);
            }
        }.start();
    }

    private String splitFileName(String str) {
        long j;
        try {
            j = new SimpleDateFormat(TimeUtil.FORMAT_DATE_TIME_FULL).parse(str).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
            j = 0;
        }
        return new SimpleDateFormat(TimeUtil.FORMAT_DATE_TIME_NEW2).format(Long.valueOf(j));
    }

    public void HiDoPlayFast(byte[] bArr, byte[] bArr2, final long j, int i, byte b) {
        Handler handler;
        Handler handler2;
        MyCamera myCamera = this.mMyCamera;
        if (myCamera == null || myCamera.mPBFastsdk == null || this.mMyCamera.getConnectState() != 4) {
            return;
        }
        this.myOperlock.lock();
        this.mMyCamera.mPBFastsdk.PlayLocal_Resume();
        if (HiTools.isSDCardValid()) {
            File file = new File(HiDataValue.getPathCameraVideoOnLinePlayFast(this.mMyCamera.getUid(), getActivity()));
            if (!file.exists()) {
                file.mkdirs();
            }
            Handler handler3 = this.mhandlerPF;
            if (handler3 != null) {
                handler3.sendEmptyMessage(HANDLE_MESSAGE_PLAYONLINE_SHOWLOADVIEW);
            }
            bArr[7] = 4;
            getFirstTime(bArr);
            this.download_path = file.getAbsoluteFile() + "/";
            this.fileName = splitFileName(new HiChipDefines.STimeDay(bArr, 0).toString());
            String str = this.download_path + this.fileName + ".pfh26x";
            HiLog.e("filepath:" + str + "::" + j + "::" + this.mAct.isDownloading + Constants.COLON_SEPARATOR + this.mAct.isCallDownload);
            this.mSaveSTimeDay = new HiChipDefines.STimeDay(bArr, 0);
            this.mSaveETimeDay = new HiChipDefines.STimeDay(bArr2, 0);
            if (j > 0) {
                this.mSavedragTime = (int) j;
            }
            if (new File(str).exists()) {
                this.fileisDowned = true;
                if (j > 0) {
                    this.mMyCamera.mPBFastsdk.SetPlaybackSeekFast((int) j, this.mSaveSTimeDay, this.mSaveETimeDay, this.fileisDowned, false);
                }
                int StartPlayLocalTime = this.mMyCamera.mPBFastsdk.StartPlayLocalTime(str, ((int) j) * 1000);
                if (StartPlayLocalTime != 0 && StartPlayLocalTime != -10000 && (handler2 = this.mhandlerPF) != null) {
                    handler2.sendEmptyMessage(HANDLE_MESSAGE_PLAYONLINE_OPENFAIL);
                }
                this.myOperlock.unlock();
                return;
            }
            this.fileisDowned = false;
            final String str2 = this.download_path + this.fileName + ".rec";
            File file2 = new File(str2);
            HiLog.e("filepath:" + str2);
            if (!file2.exists()) {
                HiLog.e("filepath:" + str2);
                try {
                    if (!file2.createNewFile()) {
                        this.myOperlock.unlock();
                        return;
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
                this.mAct.isDownloading = false;
                this.mAct.isCallDownload = false;
                checkPBFastCacheSize();
                this.isCallStopDown = false;
                this.mAct.isCallDownload = true;
                this.mAct.isDownThread = false;
                new Thread() {
                    @Override
                    public void run() {
                        super.run();
                        OSTimePlaybackDualFragment_New.this.mMyCamera.startPlaybackFast(OSTimePlaybackDualFragment_New.this.mSaveSTimeDay, OSTimePlaybackDualFragment_New.this.mSaveETimeDay, (int) j, null, str2, 0L, OSTimePlaybackDualFragment_New.this.fileisDowned, OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual);
                        OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual = false;
                        OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.FastPlayDown(str2, OSTimePlaybackDualFragment_New.this.download_path, OSTimePlaybackDualFragment_New.this.fileName + ".rec", 1, 1);
                        OSTimePlaybackDualFragment_New.this.mAct.isDownThread = true;
                    }
                }.start();
            } else {
                HiLog.e("mAct.isCallDownloadfilepath:" + str2 + "::" + this.mAct.isDownloading + Constants.COLON_SEPARATOR + this.mAct.isCallDownload);
                if (this.mAct.isDownloading) {
                    int i2 = (int) j;
                    int StartPlayLocalTime2 = this.mMyCamera.mPBFastsdk.StartPlayLocalTime(str2, i2 * 1000);
                    if (StartPlayLocalTime2 != 0 && StartPlayLocalTime2 != -10000 && (handler = this.mhandlerPF) != null) {
                        handler.sendEmptyMessage(HANDLE_MESSAGE_PLAYONLINE_OPENFAIL);
                    }
                    if (j > 0) {
                        this.mMyCamera.mPBFastsdk.SetPlaybackSeekFast(i2, this.mSaveSTimeDay, this.mSaveETimeDay, this.fileisDowned, false);
                    }
                } else {
                    checkPBFastCacheSize();
                    this.isCallStopDown = false;
                    this.mAct.isCallDownload = true;
                    this.mAct.isDownThread = false;
                    new Thread() {
                        @Override
                        public void run() {
                            super.run();
                            OSTimePlaybackDualFragment_New.this.mMyCamera.startPlaybackFast(OSTimePlaybackDualFragment_New.this.mSaveSTimeDay, OSTimePlaybackDualFragment_New.this.mSaveETimeDay, (int) j, null, str2, 0L, OSTimePlaybackDualFragment_New.this.fileisDowned, OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual);
                            OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual = false;
                            OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.FastPlayDown(str2, OSTimePlaybackDualFragment_New.this.download_path, OSTimePlaybackDualFragment_New.this.fileName + ".rec", 1, 1);
                            OSTimePlaybackDualFragment_New.this.mAct.isDownThread = true;
                        }
                    }.start();
                }
            }
        }
        this.myOperlock.unlock();
    }

    private void getFirstTime(byte[] bArr) {
        HiChipDefines.STimeDay sTimeDay = new HiChipDefines.STimeDay(bArr, 0);
        Log.e("wry---------", "startday.getTimeInMillis2() = " + sTimeDay.getTimeInMillis2());
        long timeInMillis2 = sTimeDay.getTimeInMillis2() / 1000;
        if (this.currentPlayVideoStartTime / 1000000 != timeInMillis2) {
            if (this.setpos == 0 || this.isOtherDay) {
                long j = timeInMillis2 * 1000000;
                this.firstVideoStartTime = j;
                int findVideoFileMiss = findVideoFileMiss(j, -1);
                Log.e("wry----------1241", "findVideoFile =" + j + "videoPosition = " + findVideoFileMiss + "-----currentPlayPosition = " + this.currentPlayPosition);
                this.currentPlayPosition = findVideoFileMiss > -1 ? findVideoFileMiss : this.currentPlayPosition;
                HiLogcatUtil.e("currentPlayPosition:" + this.currentPlayPosition + "::" + findVideoFileMiss + "::" + timeInMillis2 + ":::" + this.myTimeLineView.getCurrentValue() + Constants.COLON_SEPARATOR + this.firstVideoStartTime);
            }
            this.oldTime = 0L;
        }
        this.setpos = 0;
        this.isOtherDay = false;
        this.currentPlayVideoStartTime = timeInMillis2 * 1000000;
    }

    protected void removeVideoList(int i) {
        this.mIsDataReceveEnd = false;
        this.firstVideoStartTime = 0L;
        this.currentPlayPosition = 0;
        this.currentPlayVideoStartTime = 0L;
        this.one_day_file_list.clear();
        this.file_list.clear();
        this.file_list1.clear();
        this.curentDayVideo.clear();
        this.videoLists.clear();
        this.videoLists1.clear();
        this.videoLists2.clear();
    }

    protected void switchVideoList(int i, int i2) {
        this.file_list.clear();
        this.file_list1.clear();
        findThreeDayFile(this.file_list, i, this.videoLists1);
        findThreeDayFile(this.file_list1, i, this.videoLists2);
        this.curentDayVideo.clear();
        if (this.alreadyGetVideoDay.contains(Integer.valueOf(this.nearVideoDay))) {
            int i3 = 0;
            while (true) {
                if (i3 >= this.videoLists.size()) {
                    break;
                }
                if (this.nearVideoDay == this.videoLists.get(i3).getDay_of_month()) {
                    this.curentDayVideo.addAll(this.videoLists.get(i3).getTodayVideos());
                    break;
                }
                i3++;
            }
        }
        if (this.myTimeLineView.getScaleMode() != 120) {
            if (this.curentDayVideo.size() > 0) {
                this.isNeedShowProgress = true;
                this.myTimeLineView.setVideos(this.file_list1, true, this.curentDayVideo.get(0).getStartTime());
                return;
            }
            StopPlayVideo();
            this.videoIsPause = true;
            this.videoIsPlaying = false;
            this.isNeedShowProgress = false;
            this.iv_placeholder.setVisibility(0);
            this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
            MyToast.showToast(this.mAct, getString(R.string.current_day_novideo));
            Calendar calendar = Calendar.getInstance();
            calendar.set(1, mYear);
            calendar.set(2, mMonth - 1);
            calendar.set(5, i);
            calendar.set(11, 0);
            calendar.set(12, 0);
            calendar.set(13, 1);
            this.myTimeLineView.setVideos(new ArrayList(), false, calendar.getTimeInMillis() * 1000);
            return;
        }
        if (this.curentDayVideo.size() > 0) {
            this.isNeedShowProgress = true;
            this.myTimeLineView.setVideos(this.file_list, true, this.curentDayVideo.get(0).getStartTime());
            return;
        }
        StopPlayVideo();
        this.videoIsPause = true;
        this.videoIsPlaying = false;
        this.isNeedShowProgress = false;
        this.iv_placeholder.setVisibility(0);
        this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
        MyToast.showToast(this.mAct, getString(R.string.current_day_novideo));
        Calendar calendar2 = Calendar.getInstance();
        calendar2.set(1, mYear);
        calendar2.set(2, mMonth - 1);
        calendar2.set(5, i);
        calendar2.set(11, 0);
        calendar2.set(12, 0);
        calendar2.set(13, 1);
        this.myTimeLineView.setVideos(new ArrayList(), false, calendar2.getTimeInMillis() * 1000);
    }

    private void findThreeDayFile(List<PlaybackVo> list, int i, List<VideoList> list2) {
        for (int i2 = 0; i2 < this.allHaveVideoDayList.size(); i2++) {
            if (i == this.allHaveVideoDayList.get(i2).intValue()) {
                getDayVideos(i, list2, list);
                return;
            }
        }
    }

    private void getDayVideos(int i, List<VideoList> list, List<PlaybackVo> list2) {
        for (int i2 = 0; i2 < list.size(); i2++) {
            if (i == list.get(i2).getDay_of_month()) {
                list2.addAll(list.get(i2).getTodayVideos());
                return;
            }
        }
    }

    public int getDay(long j) {
        if (j == 0) {
            return -1;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(j / 1000);
        return calendar.get(5);
    }

    @Override
    public void onResume() {
        super.onResume();
        HiLog.e("tedG--....onResume()....--");
        MyCamera myCamera = this.mMyCamera;
        if (myCamera != null) {
            myCamera.registerIOSessionListener(this);
            this.mMyCamera.registerPlayStateListener(this);
            if (this.mMyCamera.mPBFastsdk != null) {
                this.mMyCamera.mPBFastsdk.SetHiCameraObj(this.mMyCamera);
                this.mMyCamera.mPBFastsdk.registerPlayFastStateListener(this);
                if (!this.misfull) {
                    this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_1dual, this.monitor_2dual);
                } else {
                    this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_2dual, this.monitor_1dual);
                }
            }
        }
        if (this.videoIsPause && !this.videoIsPlaying && this.mIsVisibleToUser) {
            HiLog.i("tedG--....onResume()    我去暂停了....--" + this.mTimeInMicros);
            int findVideoFile = findVideoFile(this.mTimeInMicros, -1);
            Log.e("wry----------1380", "findVideoFile =" + this.mTimeInMicros + "videoPosition = " + findVideoFile + "-----currentPlayPosition = " + this.currentPlayPosition);
            if (findVideoFile == -1) {
                return;
            }
            HiLog.i("tedG--....onResume()    我去暂停了....--");
            pausePlayVideo();
            this.videoIsPause = false;
            this.videoIsPlaying = true;
        }
        OSTimeAxisActivity oSTimeAxisActivity = this.mAct;
        if (oSTimeAxisActivity instanceof OSTimeAxisActivity) {
            this.timeAxisActivity = oSTimeAxisActivity;
        }
        if (getResources().getConfiguration().orientation == 1) {
            TimeLineNew timeLineNew = this.myTimeLineView;
            if (timeLineNew != null && !timeLineNew.isCanPlay && !this.videoIsPlaying && this.videoIsPause) {
                this.iv_placeholder.setVisibility(0);
                this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
            }
        } else {
            handLandscape();
        }
        this.monitor_1dual.setVisibility(0);
        if (this.rl_close2monitor.getVisibility() == 0) {
            this.monitor_2dual.setVisibility(0);
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        HiLog.e("tedG--....onResume()    我去暂停了....--" + this.mTimeInMicros);
        if (((OSTimeAxisActivity) getActivity()).isDoPause) {
            if (this.mMyCamera != null) {
                if (this.myTimeLineView != null) {
                    HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                    this.mTimeInMicros = this.myTimeLineView.getCurrentValue();
                    HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                }
                if (this.mMyCamera.appGetCommandFunction(HiChipDefines.HI_P2P_PLAYBACK_FAST)) {
                    HiLog.e("callstopPlaybackFast");
                    if (this.mAct.isDownloading || this.mAct.isCallDownload) {
                        this.mMyCamera.stopPlaybackFast(true);
                        this.mMyCamera.isFirstPlayOsDual = true;
                    }
                }
                if (this.mMyCamera.mPBFastsdk != null) {
                    this.mMyCamera.mPBFastsdk.unregisterPlayFastStateListener(this);
                    this.mMyCamera.mPBFastsdk.StopPlayLocal();
                    this.mMyCamera.mPBFastsdk.StopDownFast();
                    this.isCallStopDown = true;
                    this.mAct.isDownloading = false;
                    this.mAct.isCallDownload = false;
                }
                Handler handler = this.mhandlerPF;
                if (handler != null) {
                    handler.removeCallbacksAndMessages(null);
                }
                Handler handler2 = this.handler;
                if (handler2 != null) {
                    handler2.removeCallbacksAndMessages(null);
                }
                this.mMyCamera.unregisterIOSessionListener(this);
                this.mMyCamera.unregisterPlayStateListener(this);
                if (!this.videoIsPause && this.videoIsPlaying) {
                    pausePlayVideo();
                    this.videoIsPlaying = false;
                    this.videoIsPause = true;
                }
                MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
                if (myPlaybackGLMonitor != null) {
                    myPlaybackGLMonitor.FreeMonitor();
                }
                MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
                if (myPlaybackGLMonitor2 != null) {
                    myPlaybackGLMonitor2.FreeMonitor();
                }
            }
            if (getResources().getConfiguration().orientation == 2 && getActivity() != null) {
                getActivity().setRequestedOrientation(1);
            }
            HiLog.e("tedG--....onResume()    我去暂停了....--" + this.mTimeInMicros);
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getIsStop(MsyIsStop msyIsStop) {
        boolean ismIsStop = msyIsStop.ismIsStop();
        this.mIsCallStop = ismIsStop;
        if (ismIsStop) {
            this.videoIsPause = false;
            this.videoIsPlaying = false;
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getIsPlay(FilePlaybackModel filePlaybackModel) {
        this.mIsPlayback = filePlaybackModel.ismIsPlay();
    }

    @Override
    public void setUserVisibleHint(boolean z) {
        super.setUserVisibleHint(z);
        HiLog.e("tedG--....onResume()....--" + z + "::" + this.isFirstIn);
        if (z) {
            this.mIsVisibleToUser = true;
            HiChipDefines.SD_FILEDAY sd_fileday = this.sd_fileday;
            if (sd_fileday != null && sd_fileday.num > 1) {
                this.timePlayStart = false;
            }
            if (this.myTimeLineView != null) {
                if (this.isFirstIn) {
                    this.timePlayStart = false;
                    this.isFirstIn = false;
                    this.mIsCallStop = false;
                    searchmonvideo();
                    return;
                }
                HiLog.e("mIsCallStop: " + this.mIsCallStop + "::" + this.isPlayEnd);
                if (this.mIsCallStop) {
                    this.videoIsPause = false;
                    this.videoIsPlaying = true;
                    MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
                    if (myPlaybackGLMonitor != null) {
                        myPlaybackGLMonitor.setmIsFullScreen(0);
                        this.mHeight = HiTools.dip2px(getContext(), 250.0f);
                        resetMonitorSize(false, 10000.0d);
                    }
                    hand0And1();
                    this.mIsCallStop = false;
                    return;
                }
                if (this.isPlayEnd) {
                    this.timePlayStart = true;
                    return;
                }
                if (!this.videoIsPause || this.videoIsPlaying) {
                    return;
                }
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                int findVideoFile = findVideoFile(this.mTimeInMicros, -1);
                Log.e("wry----------1520", "findVideoFile =" + this.mTimeInMicros + "videoPosition = " + findVideoFile + "-----currentPlayPosition = " + this.currentPlayPosition);
                if (findVideoFile == -1) {
                    this.timePlayStart = true;
                    return;
                }
                pausePlayVideo();
                this.videoIsPause = false;
                this.videoIsPlaying = true;
                try {
                    HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                    if (findVideoFile == this.curentDayVideo.size() - 1 && Math.abs((this.mTimeInMicros - this.curentDayVideo.get(findVideoFile).getEndTime()) / 1000000) < 3) {
                        this.timePlayStart = true;
                    }
                    HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                    return;
                } catch (Exception e) {
                    e.printStackTrace();
                    return;
                }
            }
            return;
        }
        this.mIsVisibleToUser = false;
        if (this.mMyCamera != null) {
            if (this.myTimeLineView != null) {
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                this.mTimeInMicros = this.myTimeLineView.getCurrentValue();
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
            }
            if (this.videoIsPlaying && !this.videoIsPause) {
                pausePlayVideo();
                this.videoIsPause = true;
                this.videoIsPlaying = false;
            }
        }
        ImageView imageView = this.iv_full_screen;
        if (imageView == null || this.isFirstIn) {
            return;
        }
        imageView.setVisibility(0);
        this.iv_snapshot.setVisibility(0);
        this.rl_portraittopview.setVisibility(0);
        this.rl_close2monitor.setVisibility(this.monitor_2dual.getVisibility());
    }

    private void hand0And1() {
        if (this.isPlayEnd) {
            this.timePlayStart = true;
            return;
        }
        long j = this.mTimeInMicros;
        int findVideoFile = findVideoFile(j, -1);
        Log.e("wry----------1567", "findVideoFile =" + this.mTimeInMicros + "videoPosition = " + findVideoFile + "-----currentPlayPosition = " + this.currentPlayPosition);
        if (findVideoFile == -1 || findVideoFile == this.curentDayVideo.size()) {
            this.myTimeLineView.listener.onNoneVideo("", j);
            this.mBackToNoFile = true;
            return;
        }
        if (this.myTimeLineView.isScroll()) {
            return;
        }
        this.mdelaytodo = 0;
        final PlaybackVo playbackVo = this.curentDayVideo.get(findVideoFile);
        this.oldTime = 0L;
        this.firstVideoStartTime = j;
        this.setpos = 1;
        HiLogcatUtil.e("currentPlayPosition:" + this.currentPlayPosition + "::" + findVideoFile + Constants.COLON_SEPARATOR + this.firstVideoStartTime);
        if (this.currentPlayPosition != findVideoFile) {
            StopFast(true);
            this.mdelaytodo = 1000;
        }
        this.currentPlayPosition = findVideoFile > -1 ? findVideoFile : this.currentPlayPosition;
        HiLogcatUtil.e("currentPlayPosition:" + this.currentPlayPosition + "::" + findVideoFile + Constants.COLON_SEPARATOR + this.firstVideoStartTime);
        final byte[] bArr = new byte[8];
        final byte[] bArr2 = new byte[8];
        System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
        System.arraycopy(playbackVo.getEndbyt(), 0, bArr2, 0, 8);
        long startTime = playbackVo.getStartTime() / 1000;
        long endTime = playbackVo.getEndTime() / 1000;
        final int startTime2 = (int) ((j - playbackVo.getStartTime()) / 1000);
        playbackVo.getFlag();
        showLoadingView();
        if (this.isQuit) {
            return;
        }
        this.mhandlerPF.postDelayed(new Runnable() {
            @Override
            public void run() {
                OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, bArr2, startTime2 / 1000, 1, playbackVo.getFlag());
            }
        }, this.mdelaytodo);
        if (!this.misfull) {
            this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_1dual, this.monitor_2dual);
        } else {
            this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_2dual, this.monitor_1dual);
        }
        this.mhandlerPF.postDelayed(new Runnable() {
            @Override
            public void run() {
                OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, playbackVo.getEndbyt(), startTime2 / 1000, 1, playbackVo.getFlag());
            }
        }, this.mdelaytodo);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        HiLog.e("tedG--....onResume()....--");
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        if (myPlaybackGLMonitor != null) {
            myPlaybackGLMonitor.FreeMonitor();
        }
        MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
        if (myPlaybackGLMonitor2 != null) {
            myPlaybackGLMonitor2.FreeMonitor();
        }
        Handler handler = this.lineHandler;
        if (handler != null) {
            handler.removeMessages(-1879048183);
        }
        if (this.mHandler_lockScreen != null) {
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
        if (this.mMyCamera != null) {
            this.isQuit = true;
        }
        stopWatchOrientation();
        EventBus.getDefault().unregister(this);
    }

    public class AnonymousClass13 extends Handler {
        AnonymousClass13() {
        }

        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == -1879048191) {
                int i2 = message.arg1;
                if ((i2 == 0 || i2 == 5) && OSTimePlaybackDualFragment_New.this.mIsVisibleToUser) {
                    HiLogcatUtil.e("tedu", "--CAMERA_CONNECTION_STATE_DISCONNECTED--");
                    OSTimePlaybackDualFragment_New.this.dismissLoadingView();
                    MyToast.showToast(OSTimePlaybackDualFragment_New.this.mAct, OSTimePlaybackDualFragment_New.this.getString(R.string.disconnect));
                    HiLogcatUtil.e("#############################  mMyCamera.stopPlaybackNew ###################### ");
                    OSTimePlaybackDualFragment_New.this.StopFast(true);
                    OSTimePlaybackDualFragment_New.this.mAct.finish();
                    return;
                }
                return;
            }
            if (i == -1879048189) {
                if (message.arg2 == 0) {
                    OSTimePlaybackDualFragment_New.this.handIOCTRLSuccess(message);
                    return;
                }
                OSTimePlaybackDualFragment_New.this.dismissLoadingView();
                MyToast.showToast(OSTimePlaybackDualFragment_New.this.mAct, OSTimePlaybackDualFragment_New.this.getString(R.string.get_data_fail));
                if (message.arg1 != 16779) {
                    return;
                }
                OSTimePlaybackDualFragment_New.this.mAct.iv_return.setEnabled(true);
                return;
            }
            if (i == -6) {
                HiLogcatUtil.e("################# timeline PLAY_ONLINESTATE_ERROR ##############  ");
                if (OSTimePlaybackDualFragment_New.this.getActivity() != null) {
                    Toast.makeText(OSTimePlaybackDualFragment_New.this.getActivity(), OSTimePlaybackDualFragment_New.this.getString(R.string.play_4k_sd_error), 1).show();
                }
                OSTimePlaybackDualFragment_New.this.StopFast(true);
                OSTimePlaybackDualFragment_New.this.mMyCamera.setReconnectTimes(10);
                OSTimePlaybackDualFragment_New.this.startActivity(new Intent(OSTimePlaybackDualFragment_New.this.mAct, (Class<?>) MainActivity.class));
                return;
            }
            if (i != 0) {
                if (i != 1) {
                    if (i != 2) {
                        return;
                    }
                    Log.i("tedu", "--PLAY_STATE_POS--");
                    OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = true;
                    OSTimePlaybackDualFragment_New.this.isPlayEnd = false;
                    OSTimePlaybackDualFragment_New.this.dismissLoadingView();
                    return;
                }
                HiLogcatUtil.e("tedu", "--PLAY_STATE_EDN--");
                OSTimePlaybackDualFragment_New.this.isPlayEnd = true;
                MyToast.showToast(OSTimePlaybackDualFragment_New.this.mAct, OSTimePlaybackDualFragment_New.this.getString(R.string.tips_stop_video));
                OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
                if (!OSTimePlaybackDualFragment_New.this.videoIsPause && OSTimePlaybackDualFragment_New.this.videoIsPlaying) {
                    OSTimePlaybackDualFragment_New.this.StopPlayVideo();
                    OSTimePlaybackDualFragment_New.this.videoIsPause = true;
                    OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                }
                OSTimePlaybackDualFragment_New.this.shadowView.setVisibility(8);
                return;
            }
            OSTimePlaybackDualFragment_New.this.isReadyPlay = true;
            Log.i("tedu", "-播放开始-PLAY_STATE_START--");
            if (!OSTimePlaybackDualFragment_New.this.mPlayFirst) {
                OSTimePlaybackDualFragment_New.this.mPlayFirst = true;
                if (OSTimePlaybackDualFragment_New.this.monitor_2dual.getVisibility() != 0) {
                    OSTimePlaybackDualFragment_New.this.monitor_2dual.setVisibility(0);
                }
                if (OSTimePlaybackDualFragment_New.this.iv_full_screen.getVisibility() != 0) {
                    OSTimePlaybackDualFragment_New.this.iv_full_screen.setVisibility(0);
                    OSTimePlaybackDualFragment_New.this.iv_snapshot.setVisibility(0);
                    OSTimePlaybackDualFragment_New.this.rl_portraittopview.setVisibility(0);
                    OSTimePlaybackDualFragment_New.this.rl_close2monitor.setVisibility(OSTimePlaybackDualFragment_New.this.monitor_2dual.getVisibility());
                }
            }
            OSTimePlaybackDualFragment_New.this.handler.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    OSTimePlaybackDualFragment_New.AnonymousClass13.this.lambda$handleMessage$0$OSTimePlaybackDualFragment_New$13();
                }
            }, 100L);
            OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = true;
            OSTimePlaybackDualFragment_New.this.isPlayEnd = false;
            OSTimePlaybackDualFragment_New.this.videoIsPlaying = true;
            OSTimePlaybackDualFragment_New.this.iv_placeholder.setVisibility(8);
            OSTimePlaybackDualFragment_New.this.dismissLoadingView();
            OSTimePlaybackDualFragment_New.this.startWatchOrientation();
        }

        public void lambda$handleMessage$0$OSTimePlaybackDualFragment_New$13() {
            OSTimePlaybackDualFragment_New.this.shadowView.setVisibility(8);
        }
    }

    public void handIOCTRLSuccess(Message message) {
        byte b;
        int i;
        int i2;
        boolean z;
        PlaybackVo playbackVo;
        byte[] byteArray = message.getData().getByteArray("data");
        int i3 = message.arg1;
        if (i3 == 16777) {
            this.viewpager.setScanScroll(true);
            this.sd_fileday = new HiChipDefines.SD_FILEDAY(byteArray);
            if (this.calStartDate.get(1) == this.sd_fileday.year && this.calStartDate.get(2) + 1 == this.sd_fileday.month) {
                HiLog.e("--case HiChipDefines.HI_P2P_GET_RECORD_ALLDAY:::" + ((int) this.sd_fileday.year) + "年:::" + ((int) this.sd_fileday.month) + "月::::::" + ((int) this.sd_fileday.num) + "有录像的总天数");
                if (!this.isCalenderChangedMonth) {
                    if (this.sd_fileday.num < 1) {
                        dismissLoadingView();
                        this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
                        this.iv_placeholder.setVisibility(0);
                        HiLog.e("MsgCalenderDay:");
                        EventBus.getDefault().post(new MsgCalenderDay(this.allHaveVideoDayList, this.alreadyGetVideoDay, this.mSelectPosition, this.currPager));
                        MyToast.showToast(this.mAct, getString(R.string.current_moth_novideo));
                        this.timePlayStart = true;
                        this.mIsDataReceveEnd = true;
                        this.iv_full_screen.setVisibility(8);
                        this.iv_snapshot.setVisibility(8);
                        return;
                    }
                    this.iv_placeholder.setVisibility(4);
                    int i4 = Calendar.getInstance().get(5);
                    boolean z2 = true;
                    for (int i5 = i4 - 1; i5 > -1; i5--) {
                        if (this.sd_fileday.day[i5] != 1) {
                            b = 1;
                        } else if (z2) {
                            this.one_day_file_list.clear();
                            this.file_list.clear();
                            this.file_list1.clear();
                            Log.i("tedu", "--sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY  2222--:");
                            this.mAct.iv_return.setEnabled(false);
                            Log.i("tedu", "--我去请求当天录像文件了  返回键禁掉--");
                            this.mIsDataReceveEnd = false;
                            StopFast(true);
                            int i6 = i5 + 1;
                            this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, this.sd_fileday.year, this.sd_fileday.month, i6, getFileType()));
                            this.alreadyGetVideoDay.add(Integer.valueOf(i6));
                            this.nearVideoDay = i6;
                            this.recentHaveVideoDay = i6;
                            if (i6 == i4) {
                                b = 1;
                                this.todayHasVideo = true;
                            } else {
                                b = 1;
                                this.todayHasVideo = false;
                            }
                            z2 = false;
                        } else {
                            b = 1;
                        }
                        if (this.sd_fileday.day[i5] == b) {
                            this.myTimeLineView.date[i5] = b;
                            this.allHaveVideoDayList.add(Integer.valueOf(i5 + 1));
                        }
                    }
                    Collections.reverse(this.allHaveVideoDayList);
                    Iterator<Integer> it = this.allHaveVideoDayList.iterator();
                    while (it.hasNext()) {
                        HiLogcatUtil.e("tedu", "--当月有录像的天数--:" + it.next().intValue());
                    }
                    HiLog.e("MsgCalenderDay:");
                    EventBus.getDefault().post(new MsgCalenderDay(this.allHaveVideoDayList, this.alreadyGetVideoDay, this.mSelectPosition, this.currPager));
                    HiLog.e("-11-被观察者发出通知---allHaveVideoDayList-:" + this.allHaveVideoDayList.size() + "-alreadyGetVideoDay-:" + this.alreadyGetVideoDay.size() + "-mSelectPosition-:" + this.mSelectPosition + "-currPager-:" + this.currPager);
                    return;
                }
                if (this.sd_fileday.num < 1) {
                    dismissLoadingView();
                    HiLog.e("MsgCalenderDay:");
                    EventBus.getDefault().post(new MsgCalenderDay(new ArrayList(), new ArrayList(), -1, this.currPager));
                    return;
                }
                int i7 = 30;
                for (int i8 = -1; i7 > i8; i8 = -1) {
                    if (this.sd_fileday.day[i7] == 1) {
                        this.otherMonthAllHaveVideoDayList.add(Integer.valueOf(i7 + 1));
                    }
                    i7--;
                }
                Collections.reverse(this.otherMonthAllHaveVideoDayList);
                HiLog.e("MsgCalenderDay:");
                EventBus.getDefault().post(new MsgCalenderDay(this.otherMonthAllHaveVideoDayList, new ArrayList(), -1, this.currPager));
                return;
            }
            return;
        }
        long j = 1000000;
        long j2 = 0;
        if (i3 != 16779) {
            if (i3 != 1174405123) {
                return;
            }
            long timeInMillis2 = new HiChipDefines.Record_FILE_INFO(byteArray).sStartTime.getTimeInMillis2() / 1000;
            if (this.currentPlayVideoStartTime / 1000000 != timeInMillis2) {
                if (this.setpos == 0 || this.isOtherDay) {
                    long j3 = timeInMillis2 * 1000000;
                    this.firstVideoStartTime = j3;
                    int findVideoFileMiss = findVideoFileMiss(j3, -1);
                    Log.e("wry----------1802", "findVideoFile =" + (timeInMillis2 * 1000) + "videoPosition = " + findVideoFileMiss + "-----currentPlayPosition = " + this.currentPlayPosition);
                    if (findVideoFileMiss <= -1) {
                        findVideoFileMiss = this.currentPlayPosition;
                    }
                    this.currentPlayPosition = findVideoFileMiss;
                }
                this.oldTime = 0L;
            }
            this.setpos = 0;
            this.isOtherDay = false;
            this.currentPlayVideoStartTime = timeInMillis2 * 1000000;
            return;
        }
        if (byteArray.length >= 12) {
            byte b2 = byteArray[8];
            short byteArrayToShort_Little = Packet.byteArrayToShort_Little(byteArray, 10);
            if (byteArrayToShort_Little > 0) {
                int i9 = 0;
                PlaybackVo playbackVo2 = null;
                while (i9 < byteArrayToShort_Little) {
                    int sizeof = HiChipDefines.HI_P2P_FILE_INFO.sizeof();
                    int i10 = 24;
                    byte[] bArr = new byte[24];
                    int i11 = (i9 * sizeof) + 12;
                    if (byteArray.length >= i11 + 24) {
                        System.arraycopy(byteArray, i11, bArr, 0, 24);
                        HiChipDefines.HI_P2P_FILE_INFO hi_p2p_file_info = new HiChipDefines.HI_P2P_FILE_INFO(bArr);
                        this.fileType = hi_p2p_file_info.EventType;
                        long timeInMillis = hi_p2p_file_info.sEndTime.getTimeInMillis() - hi_p2p_file_info.sStartTime.getTimeInMillis();
                        if (timeInMillis <= j && timeInMillis > j2) {
                            PlaybackVo playbackVo3 = new PlaybackVo(hi_p2p_file_info.sStartTime.getTimeInMillis2() * 1000, hi_p2p_file_info.sEndTime.getTimeInMillis2() * 1000, hi_p2p_file_info.sStartTime.parseContent(), hi_p2p_file_info.sEndTime.parseContent(), this.fileType, hi_p2p_file_info.sReserved[0]);
                            this.one_day_file_list.add(playbackVo3);
                            handFileList(this.fileType, playbackVo3);
                            if (playbackVo2 == null) {
                                playbackVo = new PlaybackVo(hi_p2p_file_info.sStartTime.getTimeInMillis2() * 1000, hi_p2p_file_info.sEndTime.getTimeInMillis2() * 1000, hi_p2p_file_info.sStartTime.parseContent(), hi_p2p_file_info.sEndTime.parseContent(), this.fileType, Byte.parseByte(PushConstants.PUSH_TYPE_NOTIFY));
                                playbackVo.setEventType(this.fileType);
                            } else {
                                playbackVo = playbackVo2;
                            }
                            if (i9 == byteArrayToShort_Little - 1) {
                                playbackVo.getEndTA().setTimeInMillis(hi_p2p_file_info.sEndTime.getTimeInMillis2());
                                this.file_list1.add(playbackVo);
                            } else {
                                int i12 = i9 + 1;
                                System.arraycopy(byteArray, (i12 * sizeof) + 12, bArr, 0, 24);
                                HiChipDefines.HI_P2P_FILE_INFO hi_p2p_file_info2 = new HiChipDefines.HI_P2P_FILE_INFO(bArr);
                                if (playbackVo.getEventType() != 2) {
                                    if (hi_p2p_file_info2.EventType == 2 || hi_p2p_file_info2.sStartTime.getTimeInMillis2() - hi_p2p_file_info.sEndTime.getTimeInMillis2() > 300000) {
                                        playbackVo.getEndTA().setTimeInMillis(hi_p2p_file_info.sEndTime.getTimeInMillis2());
                                        this.file_list1.add(playbackVo);
                                    } else {
                                        playbackVo2 = playbackVo;
                                    }
                                } else {
                                    int i13 = i12;
                                    while (i13 < byteArrayToShort_Little) {
                                        System.arraycopy(byteArray, (i13 * sizeof) + 12, bArr, 0, i10);
                                        HiChipDefines.HI_P2P_FILE_INFO hi_p2p_file_info3 = new HiChipDefines.HI_P2P_FILE_INFO(bArr);
                                        if (hi_p2p_file_info3.sStartTime.getTimeInMillis2() - hi_p2p_file_info.sEndTime.getTimeInMillis2() > 60000) {
                                            break;
                                        }
                                        if (hi_p2p_file_info3.EventType == 2) {
                                            i9 = i13;
                                            hi_p2p_file_info = hi_p2p_file_info3;
                                        }
                                        i13++;
                                        i10 = 24;
                                    }
                                    while (i12 <= i9) {
                                        System.arraycopy(byteArray, (i12 * sizeof) + 12, bArr, 0, 24);
                                        HiChipDefines.HI_P2P_FILE_INFO hi_p2p_file_info4 = new HiChipDefines.HI_P2P_FILE_INFO(bArr);
                                        PlaybackVo playbackVo4 = new PlaybackVo(hi_p2p_file_info4.sStartTime.getTimeInMillis2() * 1000, hi_p2p_file_info4.sEndTime.getTimeInMillis2() * 1000, hi_p2p_file_info4.sStartTime.parseContent(), hi_p2p_file_info4.sEndTime.parseContent(), this.fileType, hi_p2p_file_info4.sReserved[0]);
                                        handFileList(hi_p2p_file_info4.EventType, playbackVo4);
                                        this.one_day_file_list.add(playbackVo4);
                                        i12++;
                                    }
                                    playbackVo.getEndTA().setTimeInMillis(hi_p2p_file_info.sEndTime.getTimeInMillis2());
                                    this.file_list1.add(playbackVo);
                                }
                            }
                            playbackVo2 = null;
                        }
                    }
                    i9++;
                    j = 1000000;
                    j2 = 0;
                }
            }
            if (b2 == 1) {
                this.mIsDataReceveEnd = true;
                dismissLoadingView();
                this.mAct.iv_return.setEnabled(true);
                this.previousStartTime = 0L;
                this.previousEndTime = 0L;
                this.mergeStartTime = 0L;
                this.mergeEndTime = 0L;
                this.mergeStartTime1 = 0L;
                this.mergeEndTime1 = 0L;
                if (this.one_day_file_list.size() > 0) {
                    ArrayList arrayList = new ArrayList();
                    arrayList.addAll(this.one_day_file_list);
                    this.videoLists.add(new VideoList(this.nearVideoDay, arrayList));
                    ArrayList arrayList2 = new ArrayList();
                    arrayList2.addAll(this.file_list);
                    this.videoLists1.add(new VideoList(this.nearVideoDay, arrayList2));
                    ArrayList arrayList3 = new ArrayList();
                    arrayList3.addAll(this.file_list1);
                    this.videoLists2.add(new VideoList(this.nearVideoDay, arrayList3));
                    long startTime = this.one_day_file_list.get(0).getStartTime();
                    if (this.calStartDate.get(1) != mYear || this.calStartDate.get(2) + 1 != mMonth) {
                        z = true;
                        jumpCurrentYM(mYear, this.calStartDate.get(1), mMonth, this.calStartDate.get(2) + 1);
                    } else {
                        HiLog.e("MsgCalenderDay:");
                        EventBus.getDefault().post(new MsgCalenderDay(this.allHaveVideoDayList, this.alreadyGetVideoDay, this.mSelectPosition, this.currPager));
                        z = true;
                    }
                    this.isNeedShowProgress = z;
                    if (this.myTimeLineView.getScaleMode() != 120) {
                        this.myTimeLineView.setVideos(this.file_list1, z, startTime);
                        return;
                    } else {
                        this.myTimeLineView.setVideos(this.file_list, z, startTime);
                        return;
                    }
                }
                this.iv_placeholder.setVisibility(0);
                this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
                if (this.currentTypeIs2) {
                    MyToast.showToast(this.mAct, getString(R.string.time_no_alarm));
                } else {
                    MyToast.showToast(this.mAct, getString(R.string.current_day_novideo));
                }
                this.shadowView.setVisibility(8);
                this.timePlayStart = true;
                if (this.calStartDate.get(1) != mYear || this.calStartDate.get(2) + 1 != mMonth) {
                    i = 1;
                    i2 = 2;
                    jumpCurrentYM(mYear, this.calStartDate.get(1), mMonth, this.calStartDate.get(2) + 1);
                } else {
                    HiLog.e("MsgCalenderDay:");
                    EventBus.getDefault().post(new MsgCalenderDay(this.allHaveVideoDayList, this.alreadyGetVideoDay, this.mSelectPosition, this.currPager));
                    i = 1;
                    i2 = 2;
                }
                Calendar calendar = Calendar.getInstance();
                calendar.set(i, mYear);
                calendar.set(i2, mMonth + i);
                calendar.set(5, this.nearVideoDay);
                calendar.set(11, 0);
                calendar.set(12, 0);
                calendar.set(13, i);
                this.isNeedShowProgress = false;
                this.myTimeLineView.setVideos(new ArrayList(), false, calendar.getTimeInMillis() * 1000);
            }
        }
    }

    private void jumpCurrentYM(int i, int i2, int i3, int i4) {
        int i5 = 0;
        if (i > i2) {
            int i6 = ((i - i2) * 12) + 0;
            i5 = i3 >= i4 ? i6 + (i3 - i4) : i6 + (12 - i4);
        } else if (i == i2) {
            i5 = i3 >= i4 ? i3 - i4 : -(i4 - i3);
        }
        NoSlidingViewPager noSlidingViewPager = this.viewpager;
        if (noSlidingViewPager != null) {
            noSlidingViewPager.setCurrentItem(this.currPager + i5);
        }
    }

    private void handFileList(int i, PlaybackVo playbackVo) {
        if (this.file_list.size() <= 0) {
            playbackVo.setEventType(i);
            this.file_list.add(playbackVo);
            return;
        }
        PlaybackVo playbackVo2 = this.file_list.get(r0.size() - 1);
        int eventType = playbackVo2.getEventType();
        if (i == 2 && eventType == 2 && playbackVo.getStartTime() - playbackVo2.getEndTime() <= 1000000) {
            playbackVo2.getEndTA().setTimeInMillis(playbackVo.getEndTime() / 1000);
            return;
        }
        if (i != 2 && eventType != 2 && playbackVo.getStartTime() - playbackVo2.getEndTime() <= 1000000) {
            playbackVo2.getEndTA().setTimeInMillis(playbackVo.getEndTime() / 1000);
        } else {
            playbackVo.setEventType(i);
            this.file_list.add(playbackVo);
        }
    }

    @Override
    public void receiveIOCtrlData(HiCamera hiCamera, int i, byte[] bArr, int i2) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("data", bArr);
        Message obtainMessage = this.handler.obtainMessage();
        obtainMessage.what = -1879048189;
        obtainMessage.obj = hiCamera;
        obtainMessage.arg1 = i;
        obtainMessage.arg2 = i2;
        obtainMessage.setData(bundle);
        this.handler.sendMessage(obtainMessage);
    }

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

    @Override
    public void callbackStateDual(HiCamera hiCamera, int i, int i2, int i3, int i4) {
        HiLog.e(i + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + i3 + Constants.COLON_SEPARATOR + i4);
        if (HiTools.mDualTimevalue == 0 || HiTools.mDualTimevalue == 1) {
            if (i == 2) {
                return;
            }
        } else if (HiTools.mDualTimevalue == 2 && i == 1) {
            return;
        }
        if (this.mMyCamera != hiCamera) {
            return;
        }
        Message obtainMessage = this.handler.obtainMessage();
        obtainMessage.what = i2;
        obtainMessage.arg1 = i3;
        obtainMessage.arg2 = i4;
        this.handler.sendMessage(obtainMessage);
    }

    @Override
    public void callbackState(HiCamera hiCamera, int i, int i2, int i3) {
        if (this.mMyCamera != hiCamera) {
            return;
        }
        Message obtainMessage = this.handler.obtainMessage();
        obtainMessage.what = i;
        obtainMessage.arg1 = i2;
        obtainMessage.arg2 = i3;
        this.handler.sendMessage(obtainMessage);
    }

    @Override
    public void callbackPlayUTC(HiCamera hiCamera, int i) {
        if (this.mMyCamera != hiCamera) {
            return;
        }
        if (this.oldTime == 0) {
            this.oldTime = i;
        }
        long j = i;
        long j2 = j - this.oldTime;
        long j3 = 60;
        if (j2 < 0) {
            this.oldTime = j;
            j2 = 60;
        }
        if (this.savetime == 0) {
            this.savetime = j;
        }
        if (j - this.savetime > 1000) {
            this.oldTime = j;
        } else {
            j3 = j2;
        }
        this.savetime = j;
        Message obtainMessage = this.handler.obtainMessage();
        obtainMessage.what = -1879048183;
        obtainMessage.arg1 = (int) (j3 / 1000);
        this.lineHandler.sendMessage(obtainMessage);
    }

    @Override
    public void callbackPlayUTCDual(HiCamera hiCamera, int i, int i2) {
        if (HiTools.mDualTimevalue == 0 || HiTools.mDualTimevalue == 1) {
            if (i == 2) {
                return;
            }
        } else if (HiTools.mDualTimevalue == 2 && i == 1) {
            return;
        }
        if (this.mMyCamera != hiCamera) {
            return;
        }
        if (this.oldTime == 0) {
            this.oldTime = i2;
        }
        long j = i2;
        long j2 = j - this.oldTime;
        long j3 = 60;
        if (j2 < 0) {
            this.oldTime = j;
            j2 = 60;
        }
        if (this.savetime == 0) {
            this.savetime = j;
        }
        if (j - this.savetime > 1000) {
            this.oldTime = j;
        } else {
            j3 = j2;
        }
        this.savetime = j;
        Message obtainMessage = this.handler.obtainMessage();
        obtainMessage.what = -1879048183;
        obtainMessage.arg1 = (int) (j3 / 1000);
        this.lineHandler.sendMessage(obtainMessage);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.bt_landdualswitch:
                if (HiTools.mDualTimevalue == 0) {
                    doswitchview();
                    this.misfull = !this.misfull;
                    return;
                }
                HiTools.mDualTimevalue = 0;
                this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
                this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
                this.bt_landdualswitch.setBackgroundResource(R.mipmap.dualswitch_s);
                this.monitor_1dual.setVisibility(0);
                this.monitor_2dual.setVisibility(0);
                this.rl_close2monitor.setVisibility(0);
                return;
            case R.id.bt_portraitdualswitch:
                if (HiTools.mDualTimevalue == 0) {
                    if (this.misfull) {
                        this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_1dual, this.monitor_2dual);
                    } else {
                        this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_2dual, this.monitor_1dual);
                    }
                    this.misfull = !this.misfull;
                    return;
                }
                HiTools.mDualTimevalue = 0;
                this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
                this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
                this.bt_portraitdualswitch.setBackgroundResource(R.mipmap.dualswitch_s);
                this.monitor_1dual.setVisibility(0);
                this.monitor_2dual.setVisibility(0);
                this.rl_close2monitor.setVisibility(0);
                return;
            case R.id.iv_full_screen:
                this.mIsClickReturn = false;
                if (getResources().getConfiguration().orientation == 1) {
                    this.mAct.setRequestedOrientation(0);
                } else if (getResources().getConfiguration().orientation == 2) {
                    this.mAct.setRequestedOrientation(1);
                }
                this.monitor_1dual.setVisibility(4);
                this.monitor_2dual.setVisibility(4);
                return;
            case R.id.iv_left:
                if (HiTools.isCustomFastClick(500)) {
                    return;
                }
                showPreMonth();
                return;
            case R.id.iv_return:
                if (getResources().getConfiguration().orientation == 1) {
                    return;
                }
                this.mIsClickReturn = true;
                releaseLockScreen();
                this.mAct.setRequestedOrientation(1);
                return;
            case R.id.iv_right:
                if (HiTools.isCustomFastClick(500)) {
                    return;
                }
                showNextMonth();
                return;
            case R.id.iv_snapshot:
            case R.id.iv_snapshot_land:
                if (System.currentTimeMillis() - this.lastClickTime <= 500) {
                    return;
                }
                this.lastClickTime = System.currentTimeMillis();
                if (HiTools.HiPermission(getActivity(), getActivity(), 1, OSFilePlaybackFragment.MY_PERMISSION_REQUEST_CODE)) {
                    return;
                }
                handSnapshot();
                return;
            case R.id.monitor_1dual:
            case R.id.monitor_2dual:
                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 (HiTools.mDualTimevalue == 0) {
                        ImageView imageView = this.rl_close2monitor;
                        imageView.setVisibility(imageView.getVisibility() != 0 ? 0 : 8);
                        return;
                    }
                    return;
                }
                if (getResources().getConfiguration().orientation == 1 && this.mPlayFirst) {
                    RelativeLayout relativeLayout = this.rl_portraittopview;
                    relativeLayout.setVisibility(relativeLayout.getVisibility() == 0 ? 8 : 0);
                    if (this.rl_portraittopview.getVisibility() == 0) {
                        this.iv_full_screen.setVisibility(0);
                        this.iv_snapshot.setVisibility(0);
                        if (HiTools.mDualTimevalue == 0) {
                            this.rl_close2monitor.setVisibility(0);
                            return;
                        }
                        return;
                    }
                    this.iv_full_screen.setVisibility(8);
                    this.iv_snapshot.setVisibility(8);
                    if (HiTools.mDualTimevalue == 0) {
                        this.rl_close2monitor.setVisibility(8);
                        return;
                    }
                    return;
                }
                return;
            case R.id.rl_close2monitor:
                if (this.monitor_1dual.getmIsFullScreen() == 1 || this.monitor_2dual.getmIsFullScreen() == 1) {
                    if (this.monitor_1dual.getmIsFullScreen() == 1) {
                        HiTools.mDualTimevalue = 2;
                        this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
                        this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
                    } else if (this.monitor_2dual.getmIsFullScreen() == 1) {
                        HiTools.mDualTimevalue = 1;
                        this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
                        this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
                    }
                    this.monitor_2dual.setVisibility(8);
                    this.bt_landdualswitch.setBackgroundResource(R.mipmap.dualall_s);
                    this.rl_close2monitor.setVisibility(4);
                    return;
                }
                if (this.misfull) {
                    HiTools.mDualTimevalue = 2;
                } else {
                    HiTools.mDualTimevalue = 1;
                }
                this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
                this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
                this.bt_portraitdualswitch.setBackgroundResource(R.mipmap.dualall_s);
                this.rl_close2monitor.setVisibility(4);
                this.monitor_2dual.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 doswitchview() {
        boolean z = this.misfull;
        if (!z) {
            this.monitor_1dual.setmIsFullScreen(1);
            this.monitor_2dual.setmIsFullScreen(0);
            this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_2dual, this.monitor_1dual);
        } else if (z) {
            this.monitor_1dual.setmIsFullScreen(0);
            this.monitor_2dual.setmIsFullScreen(1);
            this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_1dual, this.monitor_2dual);
        }
    }

    private void resetRequestData() {
        this.mIsDataReceveEnd = false;
        this.firstVideoStartTime = 0L;
        this.currentPlayPosition = 0;
        this.currentPlayVideoStartTime = 0L;
        this.videoIsPlaying = false;
        this.videoIsPause = false;
        this.myTimeLineView.isCanPlay = false;
        this.one_day_file_list.clear();
        this.file_list.clear();
        this.file_list1.clear();
        this.videoLists.clear();
        this.videoLists1.clear();
        this.videoLists2.clear();
        this.isDrag = false;
        this.curentDayVideo.clear();
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        OSTimeAxisActivity oSTimeAxisActivity = this.mAct;
        if (oSTimeAxisActivity instanceof OSTimeAxisActivity) {
            this.timeAxisActivity = oSTimeAxisActivity;
        }
        if (getResources().getConfiguration().orientation == 1) {
            handPortrait();
            TimeLineNew timeLineNew = this.myTimeLineView;
            if (timeLineNew != null && !timeLineNew.isCanPlay && !this.videoIsPlaying && this.videoIsPause) {
                this.iv_placeholder.setVisibility(0);
                this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, this.mHeight));
            }
        } else {
            handLandscape();
        }
        this.monitor_1dual.setVisibility(0);
        this.monitor_2dual.setVisibility(0);
    }

    private void handPortrait() {
        if (getActivity() == null || this.monitor_1dual == null) {
            return;
        }
        this.misfull = true;
        showBottomUIMenu(getActivity());
        this.monitor_1dual.setmIsFullScreen(0);
        this.monitor_2dual.setmIsFullScreen(0);
        this.mAct.getWindow().clearFlags(1024);
        this.iv_snapshot_land.setVisibility(8);
        this.timeAxisActivity.ll_title.setVisibility(0);
        this.timeAxisActivity.rl_head.setVisibility(0);
        this.myTimeLineView.setVisibility(0);
        this.ll_bottom.setVisibility(0);
        this.ll_top.setVisibility(8);
        this.iv_full_screen.setVisibility(0);
        this.iv_snapshot.setVisibility(0);
        this.rl_portraittopview.setVisibility(0);
        this.bt_portraitdualswitch.setBackgroundResource(R.mipmap.dualswitch_s);
        this.rl_close2monitor.setVisibility(0);
        HiTools.mDualTimevalue = 0;
        this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
        this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
        this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_2dual, this.monitor_1dual);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, this.mHeight);
        if (this.mIsClickReturn) {
            layoutParams = new LinearLayout.LayoutParams(displayMetrics.widthPixels, this.mHeight);
        }
        this.rl_monitor.setLayoutParams(layoutParams);
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-1, this.mHeight);
        if (this.mIsClickReturn) {
            layoutParams2 = new RelativeLayout.LayoutParams(displayMetrics.widthPixels, this.mHeight);
        }
        this.iv_placeholder.setLayoutParams(layoutParams2);
        this.monitor_1dual.screen_height = displayMetrics.heightPixels;
        this.monitor_1dual.screen_width = displayMetrics.widthPixels;
        HiLogcatUtil.e("" + displayMetrics.heightPixels + ":" + displayMetrics.widthPixels);
        if (this.mIsClickReturn) {
            this.monitor_1dual.screen_height = this.mHeight;
        }
        initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        this.monitor_1dual.setState(0);
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        myPlaybackGLMonitor.setMatrix(myPlaybackGLMonitor.left, this.monitor_1dual.bottom, this.monitor_1dual.width, this.monitor_1dual.height);
        resetMonitorSize(false, 10000.0d);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.monitor_2dual.getLayoutParams();
        HiLogcatUtil.e("tedG--....onResume()....--" + layoutParams.width + Constants.COLON_SEPARATOR + layoutParams.height + Constants.COLON_SEPARATOR + this.monitor_1dual.screen_height + Constants.COLON_SEPARATOR + this.monitor_1dual.screen_width + ":" + displayMetrics.widthPixels + "::" + this.mIsClickReturn);
        MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
        int i = this.monitor_1dual.screen_width / 3;
        layoutParams3.width = i;
        myPlaybackGLMonitor2.screen_width = i;
        MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_2dual;
        int i2 = this.monitor_1dual.height / 3;
        layoutParams3.height = i2;
        myPlaybackGLMonitor3.screen_height = i2;
        layoutParams3.bottomMargin = 0;
        layoutParams3.rightMargin = 0;
        this.monitor_2dual.setLayoutParams(layoutParams3);
        init2Matrix(this.monitor_2dual.screen_width, this.monitor_2dual.screen_height);
        this.monitor_2dual.setState(0);
        MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor_2dual;
        myPlaybackGLMonitor4.setMatrix(myPlaybackGLMonitor4.left, this.monitor_2dual.bottom, this.monitor_2dual.width, this.monitor_2dual.height);
        HiLogcatUtil.e("tedG--....onResume()....--" + this.monitor_2dual.screen_width + Constants.COLON_SEPARATOR + this.monitor_2dual.screen_height + ":" + this.monitor_2dual.left + ":" + this.monitor_2dual.bottom + ":" + this.monitor_2dual.width + ":" + this.monitor_2dual.height);
        RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) this.rl_close2monitor.getLayoutParams();
        layoutParams4.bottomMargin = this.monitor_2dual.screen_height - HiTools.dip2px(getContext(), 30.0f);
        layoutParams4.rightMargin = this.monitor_2dual.screen_width - HiTools.dip2px(getContext(), 30.0f);
        this.rl_close2monitor.setLayoutParams(layoutParams4);
    }

    private void handLandscape() {
        LinearLayout.LayoutParams layoutParams;
        RelativeLayout.LayoutParams layoutParams2;
        if (getActivity() == null || this.monitor_1dual == null) {
            return;
        }
        this.misfull = true;
        boolean hideBottomUIMenu = hideBottomUIMenu(getActivity());
        this.monitor_1dual.setmIsFullScreen(1);
        this.mAct.getWindow().setFlags(1024, 1024);
        this.iv_snapshot_land.setVisibility(0);
        this.timeAxisActivity.ll_title.setVisibility(8);
        this.timeAxisActivity.rl_head.setVisibility(8);
        this.myTimeLineView.setVisibility(8);
        this.ll_bottom.setVisibility(8);
        this.ll_top.setVisibility(0);
        this.iv_full_screen.setVisibility(4);
        this.iv_snapshot.setVisibility(4);
        this.rl_close2monitor.setVisibility(0);
        this.rl_portraittopview.setVisibility(8);
        this.bt_landdualswitch.setBackgroundResource(R.mipmap.dualswitch_s);
        HiTools.mDualTimevalue = 0;
        this.mMyCamera.setSwtichDualCH(HiTools.mDualTimevalue);
        this.mMyCamera.sendIOCtrl(65618, ConstantCommand.HI_P2P_REALSTREAM_PARAM_UNITE_IPC.parseContent(HiTools.mDualTimevalue));
        this.mMyCamera.mPBFastsdk.setDualLiveShowMonitor(this.monitor_2dual, this.monitor_1dual);
        if (hideBottomUIMenu) {
            layoutParams = new LinearLayout.LayoutParams(-1, -1);
        } else {
            layoutParams = new LinearLayout.LayoutParams(this.mAct.getWindowManager().getDefaultDisplay().getWidth(), this.mAct.getWindowManager().getDefaultDisplay().getHeight());
        }
        this.rl_monitor.setLayoutParams(layoutParams);
        DisplayMetrics displayMetrics = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        this.monitor_1dual.screen_height = displayMetrics.heightPixels;
        if (hideBottomUIMenu) {
            layoutParams2 = new RelativeLayout.LayoutParams(-1, -1);
            this.monitor_1dual.setLayoutParams(layoutParams2);
            this.monitor_1dual.screen_width = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(getActivity());
        } else {
            layoutParams2 = new RelativeLayout.LayoutParams(this.mAct.getWindowManager().getDefaultDisplay().getWidth(), this.mAct.getWindowManager().getDefaultDisplay().getHeight());
            this.monitor_1dual.setLayoutParams(layoutParams2);
            this.monitor_1dual.screen_width = displayMetrics.widthPixels;
        }
        initMatrix(this.monitor_1dual.screen_width, this.monitor_1dual.screen_height);
        this.monitor_1dual.setState(0);
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        myPlaybackGLMonitor.setMatrix(myPlaybackGLMonitor.left, this.monitor_1dual.bottom, this.monitor_1dual.width, this.monitor_1dual.height);
        RelativeLayout.LayoutParams layoutParams3 = (RelativeLayout.LayoutParams) this.monitor_2dual.getLayoutParams();
        HiLog.e("tedG--....onResume()....--" + layoutParams2.width + Constants.COLON_SEPARATOR + layoutParams2.height + Constants.COLON_SEPARATOR + this.monitor_1dual.screen_width + Constants.COLON_SEPARATOR + this.monitor_1dual.screen_height + ":" + displayMetrics.widthPixels + Constants.COLON_SEPARATOR + displayMetrics.heightPixels);
        MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
        int i = this.monitor_1dual.screen_width / 3;
        layoutParams3.width = i;
        myPlaybackGLMonitor2.screen_width = i;
        MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor_2dual;
        int i2 = this.monitor_1dual.height / 3;
        layoutParams3.height = i2;
        myPlaybackGLMonitor3.screen_height = i2;
        layoutParams3.bottomMargin = 0;
        layoutParams3.rightMargin = 0;
        this.monitor_2dual.setLayoutParams(layoutParams3);
        init2Matrix(this.monitor_2dual.screen_width, this.monitor_2dual.screen_height);
        this.monitor_2dual.setState(0);
        MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor_2dual;
        myPlaybackGLMonitor4.setMatrix(myPlaybackGLMonitor4.left, this.monitor_2dual.bottom, this.monitor_2dual.width, this.monitor_2dual.height);
        HiLog.e("tedG--....onResume()....--" + this.monitor_2dual.screen_width + Constants.COLON_SEPARATOR + this.monitor_2dual.screen_height + ":" + this.monitor_2dual.left + ":" + this.monitor_2dual.bottom + ":" + this.monitor_2dual.width + ":" + this.monitor_2dual.height);
        RelativeLayout.LayoutParams layoutParams4 = (RelativeLayout.LayoutParams) this.rl_close2monitor.getLayoutParams();
        layoutParams4.bottomMargin = this.monitor_2dual.screen_height - HiTools.dip2px(getContext(), 30.0f);
        layoutParams4.rightMargin = this.monitor_2dual.screen_width - HiTools.dip2px(getContext(), 30.0f);
        this.rl_close2monitor.setLayoutParams(layoutParams4);
    }

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

    private void showNextMonth() {
        int i = this.currPager;
        if (i >= 999) {
            return;
        }
        NoSlidingViewPager noSlidingViewPager = this.viewpager;
        int i2 = i + 1;
        this.currPager = i2;
        noSlidingViewPager.setCurrentItem(i2, true);
    }

    public void showLoadingView() {
        if (isAdded()) {
            this.loadingViewIsShowing = true;
            Animation loadAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
            this.mIvLoading.setVisibility(0);
            this.mIvLoading.startAnimation(loadAnimation);
            this.shadowView.setVisibility(0);
        }
    }

    public void dismissLoadingView() {
        if (isAdded()) {
            this.loadingViewIsShowing = false;
            this.mIvLoading.clearAnimation();
            this.mIvLoading.setVisibility(8);
            this.shadowView.setVisibility(8);
        }
    }

    public void resetMonitorSize(boolean z, double d) {
        if (this.mIsClickReturn) {
            return;
        }
        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);
        if (getResources().getConfiguration().orientation == 1) {
            this.isLarge = 0;
        }
    }

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

    public void startWatchOrientation() {
        OrientationWatchDog orientationWatchDog;
        if (this.iv_full_screen.getVisibility() != 0 || this.iv_placeholder.getVisibility() == 0 || !this.myTimeLineView.isCanPlay || (orientationWatchDog = this.mOrientationWatchDog) == null) {
            return;
        }
        orientationWatchDog.startWatch();
    }

    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.isFirstRevolveLand = 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) {
        if (this.isReadyPlay && this.iv_placeholder.getVisibility() != 0) {
            if (i == 90) {
                if (this.myTimeLineView.isCanPlay) {
                    if (this.mOrientationWatchDog.getLastOrientation() == 270) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                if (OSTimePlaybackDualFragment_New.this.isLarge != 1) {
                                    if (OSTimePlaybackDualFragment_New.this.isLarge == 2) {
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                                        oSTimePlaybackDualFragment_New.resetMonitorSize(false, oSTimePlaybackDualFragment_New.nLenStart);
                                        return;
                                    }
                                    return;
                                }
                                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New2 = OSTimePlaybackDualFragment_New.this;
                                oSTimePlaybackDualFragment_New2.resetMonitorSize(true, oSTimePlaybackDualFragment_New2.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) {
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                if (OSTimePlaybackDualFragment_New.this.isLarge != 1) {
                                    if (OSTimePlaybackDualFragment_New.this.isLarge == 2) {
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                                        oSTimePlaybackDualFragment_New.resetMonitorSize(false, oSTimePlaybackDualFragment_New.nLenStart);
                                        return;
                                    }
                                    return;
                                }
                                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New2 = OSTimePlaybackDualFragment_New.this;
                                oSTimePlaybackDualFragment_New2.resetMonitorSize(true, oSTimePlaybackDualFragment_New2.nLenStart);
                            }
                        }, 200L);
                    }
                    if (!this.mIsClickReturn) {
                        getActivity().setRequestedOrientation(0);
                    }
                    if (this.isFirstRevolveLand && !this.mIsClickReturn) {
                        if (this.root_lock_screen.getVisibility() == 0) {
                            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                            this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
                            return;
                        } else {
                            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
                            this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
                            return;
                        }
                    }
                    return;
                }
                return;
            }
            this.mIsClickReturn = false;
            this.isFirstRevolveLand = false;
            getActivity().setRequestedOrientation(1);
            this.root_lock_screen.setVisibility(8);
            this.mHandler_lockScreen.removeCallbacksAndMessages(null);
        }
    }

    @Override
    public void callbackPlayFastExt(HiCamera hiCamera, int i, int i2, int i3, long j, long j2, int i4, int i5, String str) {
        HiLog.e(hiCamera.getUid() + Constants.COLON_SEPARATOR + i + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + i3 + Constants.COLON_SEPARATOR + j + Constants.COLON_SEPARATOR + j2 + Constants.COLON_SEPARATOR + i4 + Constants.COLON_SEPARATOR + i5 + ":::" + str);
        if (j2 != 0) {
            if (this.oldTime == 0) {
                this.oldTime = j2;
                this.subtime = 0L;
            }
            long j3 = this.oldTime;
            if (j2 > j3) {
                long j4 = j2 - j3;
                long j5 = 60;
                if (j4 < 0) {
                    this.oldTime = j2;
                    j4 = 60;
                }
                if (this.savetime == 0) {
                    this.savetime = j2;
                }
                if (j2 - this.savetime > 9000) {
                    this.oldTime = j2;
                } else {
                    j5 = j4;
                }
                this.savetime = j2;
                Message obtainMessage = this.handler.obtainMessage();
                obtainMessage.what = -1879048183;
                obtainMessage.arg1 = (int) (j5 / 1000);
                this.lineHandler.sendMessage(obtainMessage);
            }
            if (this.subtime == 0) {
                this.subtime = this.oldTime + (i3 * 1000);
            }
            HiLog.e(this.firstVideoStartTime + "tedG" + this.myTimeLineView.getCurrentValue() + "---" + this.mTimeInMicros + ";;;;" + ((this.oldTime + (i3 * 1000)) - j2) + "::" + this.subtime + "::" + (this.subtime - j2) + "::" + this.mAct.isDownloading + "::" + this.mAct.isCallDownload + "::" + this.preLoadingFile + "::" + this.mdownLoadNextFileTime);
            if (!this.mAct.isDownloading && !this.mAct.isCallDownload && !this.preLoadingFile && this.subtime - j2 <= this.mdownLoadNextFileTime) {
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                this.preLoadingFile = true;
                this.mTimeInMicros = this.myTimeLineView.getCurrentValue();
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                long j6 = this.mTimeInMicros;
                int findVideoFileMiss = findVideoFileMiss(j6, -1);
                Log.e("wry----------3041", "findVideoFile =" + j6 + "videoPosition = " + findVideoFileMiss + "-----currentPlayPosition = " + this.currentPlayPosition);
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;" + findVideoFileMiss + ":::::" + this.currentPlayPosition);
                if (findVideoFileMiss == -1) {
                    this.myTimeLineView.listener.onNoneVideo("", j6);
                    this.mBackToNoFile = true;
                    return;
                }
                if (this.myTimeLineView.isScroll()) {
                    return;
                }
                int i6 = findVideoFileMiss + 1;
                if (i6 < this.curentDayVideo.size()) {
                    PlaybackVo playbackVo = this.curentDayVideo.get(i6);
                    HiLogcatUtil.e("currentPlayPosition:" + this.currentPlayPosition + "::" + findVideoFileMiss + ":::" + playbackVo.getStartTime() + ":::" + playbackVo.getEndTime());
                    if (findVideoFileMiss <= -1) {
                        findVideoFileMiss = this.currentPlayPosition;
                    }
                    this.currentPlayPosition = findVideoFileMiss;
                    byte[] bArr = new byte[8];
                    playbackVo.getStartTime();
                    System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
                    preLoadFile(bArr, playbackVo.getEndbyt());
                }
            }
        }
        Message obtain = Message.obtain();
        if (i5 == 21) {
            obtain.what = HANDLE_MESSAGE_PLAYONLINE_LODING;
        } else if (i5 != 22) {
            switch (i5) {
                case -1:
                case 5:
                    this.mhandlerPF.sendEmptyMessage(1101);
                    break;
                case 0:
                    this.preLoadingFile = false;
                    this.oldTime = 0L;
                    this.mhandlerPF.sendEmptyMessage(10);
                    break;
                case 1:
                    this.isReadyPlay = true;
                    obtain.what = HANDLE_MESSAGE_SEEKBAR_START;
                    obtain.arg1 = i;
                    obtain.arg2 = i2;
                    break;
                case 2:
                    obtain.what = -1879048187;
                    break;
                case 3:
                    this.mhandlerPF.sendEmptyMessage(HANDLE_MESSAGE_SEEKBAR_END);
                    break;
                case 4:
                    this.mhandlerPF.sendEmptyMessage(HiDataValue.HANDLE_MESSAGE_SCAN_CHECK);
                    break;
            }
        } else {
            obtain.what = HANDLE_MESSAGE_PLAYONLINE_PLAYING;
        }
        this.mhandlerPF.sendMessage(obtain);
    }

    @Override
    public void callbackPlayDualFastExt(HiCamera hiCamera, int i, int i2, int i3, long j, long j2, int i4, int i5, int i6, String str) {
        long j3;
        HiLog.e(hiCamera.getUid() + Constants.COLON_SEPARATOR + i + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + i3 + Constants.COLON_SEPARATOR + j + Constants.COLON_SEPARATOR + j2 + Constants.COLON_SEPARATOR + i4 + Constants.COLON_SEPARATOR + i5 + "::" + i6 + Constants.COLON_SEPARATOR + str);
        if (i6 != 2) {
            return;
        }
        if (j2 != 0) {
            if (this.oldTime == 0) {
                this.oldTime = j2;
                this.subtime = 0L;
            }
            long j4 = this.oldTime;
            if (j2 > j4) {
                long j5 = j2 - j4;
                long j6 = 60;
                if (j5 < 0) {
                    this.oldTime = j2;
                    j3 = 60;
                } else {
                    j3 = j5;
                }
                if (this.savetime == 0) {
                    this.savetime = j2;
                }
                if (j2 - this.savetime > 9000) {
                    this.oldTime = j2;
                } else {
                    j6 = j3;
                }
                this.savetime = j2;
                Message obtainMessage = this.handler.obtainMessage();
                obtainMessage.what = -1879048183;
                obtainMessage.arg1 = (int) (j6 / 1000);
                this.lineHandler.sendMessage(obtainMessage);
            }
            if (this.subtime == 0) {
                this.subtime = this.oldTime + (i3 * 1000);
            }
            HiLog.e(this.firstVideoStartTime + "tedG" + this.myTimeLineView.getCurrentValue() + "---" + this.mTimeInMicros + ";;;;" + ((this.oldTime + (i3 * 1000)) - j2) + "::" + this.subtime + "::" + (this.subtime - j2) + "::" + this.mAct.isDownloading + "::" + this.mAct.isCallDownload + "::" + this.preLoadingFile + "::" + this.mdownLoadNextFileTime);
            StringBuilder sb = new StringBuilder();
            sb.append("mAct.isDownloading = ");
            sb.append(this.mAct.isDownloading);
            sb.append("mAct.isCallDownload = ");
            sb.append(this.mAct.isCallDownload);
            sb.append("preLoadingFile = ");
            sb.append(this.preLoadingFile);
            sb.append("(subtime - cursec) = ");
            sb.append(this.subtime - j2);
            sb.append("mdownLoadNextFileTime = ");
            sb.append(this.mdownLoadNextFileTime);
            Log.e("wry----------3167", sb.toString());
            if (!this.mAct.isDownloading && !this.mAct.isCallDownload && !this.preLoadingFile && this.subtime - j2 <= this.mdownLoadNextFileTime) {
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                this.preLoadingFile = true;
                this.mTimeInMicros = this.myTimeLineView.getCurrentValue();
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
                long j7 = this.mTimeInMicros;
                int findVideoFileMiss = findVideoFileMiss(j7, -1);
                Log.e("wry----------3165", "findVideoFile =" + j7 + "videoPosition = " + findVideoFileMiss + "-----currentPlayPosition = " + this.currentPlayPosition);
                HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;" + findVideoFileMiss + ":::::" + this.currentPlayPosition);
                if (findVideoFileMiss == -1) {
                    this.myTimeLineView.listener.onNoneVideo("", j7);
                    this.mBackToNoFile = true;
                    return;
                }
                if (this.myTimeLineView.isScroll()) {
                    return;
                }
                int i7 = findVideoFileMiss + 1;
                if (i7 < this.curentDayVideo.size()) {
                    PlaybackVo playbackVo = this.curentDayVideo.get(i7);
                    HiLogcatUtil.e("currentPlayPosition:" + this.currentPlayPosition + "::" + findVideoFileMiss + ":::" + playbackVo.getStartTime() + ":::" + playbackVo.getEndTime());
                    byte[] bArr = new byte[8];
                    playbackVo.getStartTime();
                    System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
                    System.arraycopy(playbackVo.getStartbyt(), 0, this.mSaveStartTimebyt, 0, 8);
                    System.arraycopy(playbackVo.getEndbyt(), 0, this.mSaveEndTimebyt, 0, 8);
                    this.mSavestartTime = playbackVo.getStartTime();
                    preLoadFile(bArr, playbackVo.getEndbyt());
                }
            }
        }
        Message obtain = Message.obtain();
        switch (i5) {
            case -1:
            case 5:
                HiLogcatUtil.e("STATE_ERROR  DISPLAY_ERROR" + i5);
                this.mhandlerPF.sendEmptyMessage(1101);
                break;
            case 0:
                this.preLoadingFile = false;
                this.oldTime = 0L;
                this.mhandlerPF.sendEmptyMessage(10);
                break;
            case 1:
                this.isReadyPlay = true;
                obtain.what = HANDLE_MESSAGE_SEEKBAR_START;
                obtain.arg1 = i;
                obtain.arg2 = i2;
                this.mChangeprs = true;
                break;
            case 2:
                obtain.what = -1879048187;
                break;
            case 3:
                this.mhandlerPF.sendEmptyMessage(HANDLE_MESSAGE_SEEKBAR_END);
                break;
            case 4:
                this.mhandlerPF.sendEmptyMessage(HiDataValue.HANDLE_MESSAGE_SCAN_CHECK);
                break;
            default:
                switch (i5) {
                    case 21:
                        obtain.what = HANDLE_MESSAGE_PLAYONLINE_LODING;
                        break;
                    case 22:
                        obtain.what = HANDLE_MESSAGE_PLAYONLINE_PLAYING;
                        break;
                    case 23:
                        this.mChangeprs = true;
                        break;
                }
        }
        this.mhandlerPF.sendMessage(obtain);
    }

    @Override
    public void CallBackPlayFastDownLoad(HiCamera hiCamera, int i, int i2, int i3, String str) {
        HiLog.e(hiCamera.getUid() + Constants.COLON_SEPARATOR + i + Constants.COLON_SEPARATOR + i2 + Constants.COLON_SEPARATOR + i3 + Constants.COLON_SEPARATOR + str);
        if (!this.mAct.isDownloading && !this.isCallStopDown) {
            if (i == 1) {
                this.mAct.isDownloading = true;
            }
            HiLogcatUtil.e(this.mAct.isDownloading + Constants.COLON_SEPARATOR + i + Constants.COLON_SEPARATOR + 1);
        }
        Bundle bundle = new Bundle();
        bundle.putString("data", str);
        Message obtainMessage = this.handler.obtainMessage();
        obtainMessage.what = i;
        obtainMessage.arg1 = i2;
        obtainMessage.arg2 = i3;
        obtainMessage.setData(bundle);
        this.mhandlerPF.sendMessage(obtainMessage);
    }

    public class AnonymousClass17 extends Handler {
        AnonymousClass17() {
        }

        @Override
        public void handleMessage(Message message) {
            boolean z;
            int i;
            int i2 = message.arg2;
            int i3 = message.arg1;
            String string = message.getData().getString("data");
            if (OSTimePlaybackDualFragment_New.this.loadingFile == null || TextUtils.isEmpty(OSTimePlaybackDualFragment_New.this.loadingFile) || (!TextUtils.isEmpty(string) && !OSTimePlaybackDualFragment_New.this.loadingFile.equals(string))) {
                OSTimePlaybackDualFragment_New.this.loadingFile = string;
            }
            int i4 = message.what;
            if (i4 == OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_SEEKBAR_START) {
                if (!OSTimePlaybackDualFragment_New.this.mPlayFirst) {
                    OSTimePlaybackDualFragment_New.this.mPlayFirst = true;
                    if (OSTimePlaybackDualFragment_New.this.monitor_2dual.getVisibility() != 0) {
                        i = 0;
                        OSTimePlaybackDualFragment_New.this.monitor_2dual.setVisibility(0);
                    } else {
                        i = 0;
                    }
                    if (OSTimePlaybackDualFragment_New.this.iv_full_screen.getVisibility() != 0) {
                        OSTimePlaybackDualFragment_New.this.iv_full_screen.setVisibility(i);
                        OSTimePlaybackDualFragment_New.this.iv_snapshot.setVisibility(i);
                        OSTimePlaybackDualFragment_New.this.rl_portraittopview.setVisibility(i);
                        OSTimePlaybackDualFragment_New.this.rl_close2monitor.setVisibility(OSTimePlaybackDualFragment_New.this.monitor_2dual.getVisibility());
                    }
                    if (OSTimePlaybackDualFragment_New.this.getResources().getConfiguration().orientation == 1) {
                        z = false;
                        OSTimePlaybackDualFragment_New.this.iv_full_screen.setVisibility(0);
                        OSTimePlaybackDualFragment_New.this.iv_snapshot.setVisibility(0);
                        OSTimePlaybackDualFragment_New.this.rl_close2monitor.setVisibility(OSTimePlaybackDualFragment_New.this.monitor_2dual.getVisibility());
                        OSTimePlaybackDualFragment_New.this.rl_portraittopview.setVisibility(0);
                        OSTimePlaybackDualFragment_New.this.isReadyPlay = true;
                        OSTimePlaybackDualFragment_New.this.isPlayEnd = z;
                        OSTimePlaybackDualFragment_New.this.videoIsPause = z;
                        OSTimePlaybackDualFragment_New.this.videoIsPlaying = true;
                        HiLogcatUtil.e("tedu", "-播放开始-PLAY_STATE_START--");
                        OSTimePlaybackDualFragment_New.this.handler.postDelayed(new Runnable() {
                            @Override
                            public final void run() {
                                OSTimePlaybackDualFragment_New.AnonymousClass17.this.lambda$handleMessage$0$OSTimePlaybackDualFragment_New$17();
                            }
                        }, 100L);
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = true;
                        OSTimePlaybackDualFragment_New.this.videoIsPlaying = true;
                        OSTimePlaybackDualFragment_New.this.iv_placeholder.setVisibility(8);
                        OSTimePlaybackDualFragment_New.this.dismissLoadingView();
                        OSTimePlaybackDualFragment_New.this.startWatchOrientation();
                        return;
                    }
                }
                z = false;
                OSTimePlaybackDualFragment_New.this.isReadyPlay = true;
                OSTimePlaybackDualFragment_New.this.isPlayEnd = z;
                OSTimePlaybackDualFragment_New.this.videoIsPause = z;
                OSTimePlaybackDualFragment_New.this.videoIsPlaying = true;
                HiLogcatUtil.e("tedu", "-播放开始-PLAY_STATE_START--");
                OSTimePlaybackDualFragment_New.this.handler.postDelayed(new Runnable() {
                    @Override
                    public final void run() {
                        OSTimePlaybackDualFragment_New.AnonymousClass17.this.lambda$handleMessage$0$OSTimePlaybackDualFragment_New$17();
                    }
                }, 100L);
                OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = true;
                OSTimePlaybackDualFragment_New.this.videoIsPlaying = true;
                OSTimePlaybackDualFragment_New.this.iv_placeholder.setVisibility(8);
                OSTimePlaybackDualFragment_New.this.dismissLoadingView();
                OSTimePlaybackDualFragment_New.this.startWatchOrientation();
                return;
            }
            if (i4 == OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFILE) {
                HiLog.e("filepath:" + OSTimePlaybackDualFragment_New.this.loadingFile);
                if (!TextUtils.isEmpty(OSTimePlaybackDualFragment_New.this.loadingFile)) {
                    File file = new File(OSTimePlaybackDualFragment_New.this.loadingFile.replace(".rec", ".pfh26x"));
                    if (OSTimePlaybackDualFragment_New.this.mAct.isDownloading || file.exists()) {
                        if (TextUtils.isEmpty(OSTimePlaybackDualFragment_New.this.loadingFile)) {
                            return;
                        }
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New.mSaveSTimeDay = new HiChipDefines.STimeDay(oSTimePlaybackDualFragment_New.mSaveStartTimebyt, 0);
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New2 = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New2.mSaveETimeDay = new HiChipDefines.STimeDay(oSTimePlaybackDualFragment_New2.mSaveEndTimebyt, 0);
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New3 = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New3.firstVideoStartTime = oSTimePlaybackDualFragment_New3.mSavestartTime;
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New4 = OSTimePlaybackDualFragment_New.this;
                        oSTimePlaybackDualFragment_New4.mTimeInMicros = oSTimePlaybackDualFragment_New4.myTimeLineView.getCurrentValue();
                        long j = OSTimePlaybackDualFragment_New.this.mTimeInMicros;
                        int findVideoFileMiss = OSTimePlaybackDualFragment_New.this.findVideoFileMiss(j, -1);
                        Log.e("wry----------3306", "findVideoFile =" + j + "videoPosition = " + findVideoFileMiss + "-----currentPlayPosition = " + OSTimePlaybackDualFragment_New.this.currentPlayPosition);
                        HiLog.e("tedG--....()....--" + OSTimePlaybackDualFragment_New.this.mTimeInMicros + ";;;;" + OSTimePlaybackDualFragment_New.this.currentPlayPosition + "::" + findVideoFileMiss);
                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New5 = OSTimePlaybackDualFragment_New.this;
                        if (findVideoFileMiss <= -1) {
                            findVideoFileMiss = oSTimePlaybackDualFragment_New5.currentPlayPosition;
                        }
                        oSTimePlaybackDualFragment_New5.currentPlayPosition = findVideoFileMiss;
                        int StartPlayLocalTime = OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.StartPlayLocalTime(OSTimePlaybackDualFragment_New.this.loadingFile, 0);
                        if (StartPlayLocalTime == 0 || StartPlayLocalTime == -10000 || OSTimePlaybackDualFragment_New.this.mhandlerPF == null) {
                            return;
                        }
                        OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessage(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFAIL);
                        return;
                    }
                    if (OSTimePlaybackDualFragment_New.this.mhandlerPF != null) {
                        OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessageDelayed(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFILE, 1000L);
                        return;
                    }
                    return;
                }
            } else if (i4 != OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFAIL) {
                if (i4 == -1) {
                    HiLogcatUtil.e("################# timeline PLAY_ONLINESTATE_ERROR ##############  ");
                    if (OSTimePlaybackDualFragment_New.this.getActivity() != null) {
                        Toast.makeText(OSTimePlaybackDualFragment_New.this.getActivity(), OSTimePlaybackDualFragment_New.this.getString(R.string.play_4k_sd_error), 1).show();
                    }
                    OSTimePlaybackDualFragment_New.this.mMyCamera.setReconnectTimes(10);
                    OSTimePlaybackDualFragment_New.this.startActivity(new Intent(OSTimePlaybackDualFragment_New.this.mAct, (Class<?>) MainActivity.class));
                    return;
                }
                if (i4 == 7) {
                    OSTimePlaybackDualFragment_New.this.mAct.isDownloading = false;
                    OSTimePlaybackDualFragment_New.this.mAct.isCallDownload = false;
                    if (OSTimePlaybackDualFragment_New.this.mMyCamera != null && OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk != null) {
                        OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.SetHiCameraLoadFin();
                    }
                    HiLog.e("ICameraPlayFastStateCallback.DOWNLOAD_STATE_FINISH" + string);
                    if (new File(string).exists()) {
                        String replace = string.replace(".rec", ".pfh26x");
                        HiLogcatUtil.e(string + ":" + replace + Constants.COLON_SEPARATOR);
                        OSTimePlaybackDualFragment_New.this.renameFile(string, replace);
                        return;
                    }
                    return;
                }
                if (i4 == 10) {
                    HiLogcatUtil.e(string + ":mSavedragTime:" + OSTimePlaybackDualFragment_New.this.mSavedragTime + ":::" + OSTimePlaybackDualFragment_New.this.mAct.isDownloading);
                    if (OSTimePlaybackDualFragment_New.this.mSavedragTime > 0) {
                        if (OSTimePlaybackDualFragment_New.this.mAct.isDownloading) {
                            OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.SetPlaybackSeekFast(OSTimePlaybackDualFragment_New.this.mSavedragTime, OSTimePlaybackDualFragment_New.this.mSaveSTimeDay, OSTimePlaybackDualFragment_New.this.mSaveETimeDay, OSTimePlaybackDualFragment_New.this.fileisDowned, false);
                        } else {
                            OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.SetPlaybackSeekFast(OSTimePlaybackDualFragment_New.this.mSavedragTime, OSTimePlaybackDualFragment_New.this.mSaveSTimeDay, OSTimePlaybackDualFragment_New.this.mSaveETimeDay, OSTimePlaybackDualFragment_New.this.fileisDowned, true);
                        }
                    }
                    OSTimePlaybackDualFragment_New.this.mSavedragTime = 0;
                    return;
                }
                if (i4 == 1101) {
                    HiLogcatUtil.e("data_parsindddg_error");
                    MyToast.showToast(OSTimePlaybackDualFragment_New.this.getActivity(), OSTimePlaybackDualFragment_New.this.getString(R.string.data_parsing_error));
                    OSTimePlaybackDualFragment_New.this.handler.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            OSTimePlaybackDualFragment_New.this.getActivity().finish();
                        }
                    }, 1000L);
                    return;
                }
                if (i4 == 2457) {
                    HiLogcatUtil.e("0x999:" + OSTimePlaybackDualFragment_New.this.mAct.isDownThread + "::::" + OSTimePlaybackDualFragment_New.this.mAct.isCallDownload);
                    if (OSTimePlaybackDualFragment_New.this.mAct.isDownThread || !OSTimePlaybackDualFragment_New.this.mAct.isCallDownload) {
                        OSTimePlaybackDualFragment_New.this.StopFast(false);
                        OSTimePlaybackDualFragment_New.this.mdelaytodo = 1000;
                        OSTimePlaybackDualFragment_New.this.mhandlerPF.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                OSTimePlaybackDualFragment_New.this.HiDoPlayFast(OSTimePlaybackDualFragment_New.this.msavestartTime, OSTimePlaybackDualFragment_New.this.msavepVo.getEndbyt(), 0L, 0, OSTimePlaybackDualFragment_New.this.msavepVo.getFlag());
                            }
                        }, OSTimePlaybackDualFragment_New.this.mdelaytodo);
                        return;
                    }
                    OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessageDelayed(WiFiSettingActivity.SET_WIFI_END, 100L);
                    return;
                }
                if (i4 == OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_SHOWLOADVIEW) {
                    OSTimePlaybackDualFragment_New.this.showLoadingView();
                    return;
                }
                if (i4 == 3) {
                    int StartPlayLocalTime2 = OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.StartPlayLocalTime(OSTimePlaybackDualFragment_New.this.download_path + OSTimePlaybackDualFragment_New.this.fileName + ".rec", 0);
                    if (StartPlayLocalTime2 == 0 || StartPlayLocalTime2 == -10000) {
                        return;
                    }
                    OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessage(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFAIL);
                    return;
                }
                if (i4 == 4) {
                    OSTimePlaybackDualFragment_New.this.mAct.isDownloading = false;
                    OSTimePlaybackDualFragment_New.this.mAct.isCallDownload = false;
                    HiLog.e("ICameraPlayFastStateCallback.DOWNLOAD_STATE_END");
                    return;
                }
                switch (i4) {
                    case OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_SEEKBAR_END:
                        HiLogcatUtil.e("tedu", "--HANDLE_MESSAGE_SEEKBAR_END--" + OSTimePlaybackDualFragment_New.this.mAct.isDownloading + "::" + OSTimePlaybackDualFragment_New.this.mAct.isCallDownload + ":::" + OSTimePlaybackDualFragment_New.this.loadingFile);
                        OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.StopPlayLocal();
                        if (!OSTimePlaybackDualFragment_New.this.mAct.isCallDownload) {
                            OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New6 = OSTimePlaybackDualFragment_New.this;
                            oSTimePlaybackDualFragment_New6.mTimeInMicros = oSTimePlaybackDualFragment_New6.myTimeLineView.getCurrentValue();
                            HiLog.e("tedG--....()....--" + OSTimePlaybackDualFragment_New.this.mTimeInMicros + ";;;;");
                            long j2 = OSTimePlaybackDualFragment_New.this.mTimeInMicros;
                            int findVideoFileMiss2 = OSTimePlaybackDualFragment_New.this.findVideoFileMiss(j2, -1);
                            Log.e("wry----------3445", "findVideoFile =" + j2 + "videoPosition = " + findVideoFileMiss2 + "-----currentPlayPosition = " + OSTimePlaybackDualFragment_New.this.currentPlayPosition);
                            StringBuilder sb = new StringBuilder();
                            sb.append("--HANDLE_MESSAGE_SEEKBAR_END--");
                            sb.append(OSTimePlaybackDualFragment_New.this.currentPlayPosition);
                            HiLogcatUtil.e("tedu", sb.toString());
                            if (findVideoFileMiss2 <= OSTimePlaybackDualFragment_New.this.currentPlayPosition) {
                                findVideoFileMiss2 = OSTimePlaybackDualFragment_New.this.currentPlayPosition + 1;
                            }
                            HiLogcatUtil.e("tedu", "--HANDLE_MESSAGE_SEEKBAR_END--" + findVideoFileMiss2 + "---" + TimeUtil.longToString(j2 / 1000, TimeUtil.FORMAT_DATE_TIME_FULL));
                            if (findVideoFileMiss2 == -1) {
                                OSTimePlaybackDualFragment_New.this.myTimeLineView.listener.onNoneVideo("", j2);
                                OSTimePlaybackDualFragment_New.this.mBackToNoFile = true;
                                return;
                            }
                            if (OSTimePlaybackDualFragment_New.this.myTimeLineView.isScroll()) {
                                return;
                            }
                            if (findVideoFileMiss2 < OSTimePlaybackDualFragment_New.this.curentDayVideo.size()) {
                                PlaybackVo playbackVo = (PlaybackVo) OSTimePlaybackDualFragment_New.this.curentDayVideo.get(findVideoFileMiss2);
                                HiLogcatUtil.e("currentPlayPosition:" + OSTimePlaybackDualFragment_New.this.currentPlayPosition + "::" + findVideoFileMiss2 + "::" + playbackVo.getStartTime() + "::" + playbackVo.getEndTime());
                                OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New7 = OSTimePlaybackDualFragment_New.this;
                                if (findVideoFileMiss2 <= -1) {
                                    findVideoFileMiss2 = oSTimePlaybackDualFragment_New7.currentPlayPosition;
                                }
                                oSTimePlaybackDualFragment_New7.currentPlayPosition = findVideoFileMiss2;
                                byte[] bArr = new byte[8];
                                System.arraycopy(playbackVo.getStartbyt(), 0, bArr, 0, 8);
                                OSTimePlaybackDualFragment_New.this.HiDoPlayFast(bArr, playbackVo.getEndbyt(), 0L, 0, playbackVo.getFlag());
                            } else {
                                MyToast.showToast(OSTimePlaybackDualFragment_New.this.mAct, OSTimePlaybackDualFragment_New.this.getString(R.string.tips_stop_video));
                                OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
                                if (!OSTimePlaybackDualFragment_New.this.videoIsPause && OSTimePlaybackDualFragment_New.this.videoIsPlaying) {
                                    OSTimePlaybackDualFragment_New.this.StopPlayVideo();
                                    OSTimePlaybackDualFragment_New.this.videoIsPause = true;
                                    OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                                }
                                OSTimePlaybackDualFragment_New.this.shadowView.setVisibility(8);
                            }
                        } else {
                            HiLog.e("filepath:" + OSTimePlaybackDualFragment_New.this.loadingFile);
                            OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New8 = OSTimePlaybackDualFragment_New.this;
                            oSTimePlaybackDualFragment_New8.firstVideoStartTime = oSTimePlaybackDualFragment_New8.myTimeLineView.getCurrentValue();
                            if (!TextUtils.isEmpty(OSTimePlaybackDualFragment_New.this.loadingFile)) {
                                File file2 = new File(OSTimePlaybackDualFragment_New.this.loadingFile.replace(".rec", ".pfh26x"));
                                if (OSTimePlaybackDualFragment_New.this.mAct.isDownloading || file2.exists()) {
                                    if (!TextUtils.isEmpty(OSTimePlaybackDualFragment_New.this.loadingFile)) {
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New9 = OSTimePlaybackDualFragment_New.this;
                                        oSTimePlaybackDualFragment_New9.mSaveSTimeDay = new HiChipDefines.STimeDay(oSTimePlaybackDualFragment_New9.mSaveStartTimebyt, 0);
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New10 = OSTimePlaybackDualFragment_New.this;
                                        oSTimePlaybackDualFragment_New10.mSaveETimeDay = new HiChipDefines.STimeDay(oSTimePlaybackDualFragment_New10.mSaveEndTimebyt, 0);
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New11 = OSTimePlaybackDualFragment_New.this;
                                        oSTimePlaybackDualFragment_New11.firstVideoStartTime = oSTimePlaybackDualFragment_New11.mSavestartTime;
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New12 = OSTimePlaybackDualFragment_New.this;
                                        oSTimePlaybackDualFragment_New12.mTimeInMicros = oSTimePlaybackDualFragment_New12.myTimeLineView.getCurrentValue();
                                        long j3 = OSTimePlaybackDualFragment_New.this.mTimeInMicros;
                                        int findVideoFileMiss3 = OSTimePlaybackDualFragment_New.this.findVideoFileMiss(j3, -1);
                                        Log.e("wry----------3489", "findVideoFile =" + j3 + "videoPosition = " + findVideoFileMiss3 + "-----currentPlayPosition = " + OSTimePlaybackDualFragment_New.this.currentPlayPosition);
                                        HiLog.e("tedG--....()....--" + OSTimePlaybackDualFragment_New.this.mTimeInMicros + ";;;;" + OSTimePlaybackDualFragment_New.this.currentPlayPosition + "::" + findVideoFileMiss3);
                                        OSTimePlaybackDualFragment_New oSTimePlaybackDualFragment_New13 = OSTimePlaybackDualFragment_New.this;
                                        if (findVideoFileMiss3 <= -1) {
                                            findVideoFileMiss3 = oSTimePlaybackDualFragment_New13.currentPlayPosition;
                                        }
                                        oSTimePlaybackDualFragment_New13.currentPlayPosition = findVideoFileMiss3;
                                        int StartPlayLocalTime3 = OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.StartPlayLocalTime(OSTimePlaybackDualFragment_New.this.loadingFile, 0);
                                        if (StartPlayLocalTime3 != 0 && StartPlayLocalTime3 != -10000 && OSTimePlaybackDualFragment_New.this.mhandlerPF != null) {
                                            OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessage(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFAIL);
                                        }
                                    }
                                } else {
                                    OSTimePlaybackDualFragment_New.this.showLoadingView();
                                    if (OSTimePlaybackDualFragment_New.this.mhandlerPF != null) {
                                        OSTimePlaybackDualFragment_New.this.mhandlerPF.sendEmptyMessage(OSTimePlaybackDualFragment_New.HANDLE_MESSAGE_PLAYONLINE_OPENFILE);
                                    }
                                }
                            }
                        }
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
                        OSTimePlaybackDualFragment_New.this.isPlayEnd = true;
                        OSTimePlaybackDualFragment_New.this.shadowView.setVisibility(8);
                        return;
                    case -1879048187:
                        OSTimePlaybackDualFragment_New.this.dismissLoadingView();
                        return;
                    case HiDataValue.HANDLE_MESSAGE_SCAN_CHECK:
                        OSTimePlaybackDualFragment_New.this.myTimeLineView.isCanPlay = false;
                        if (!OSTimePlaybackDualFragment_New.this.videoIsPause && OSTimePlaybackDualFragment_New.this.videoIsPlaying) {
                            OSTimePlaybackDualFragment_New.this.StopPlayVideo();
                            OSTimePlaybackDualFragment_New.this.videoIsPause = true;
                            OSTimePlaybackDualFragment_New.this.videoIsPlaying = false;
                        }
                        OSTimePlaybackDualFragment_New.this.shadowView.setVisibility(8);
                        return;
                    default:
                        return;
                }
            }
            MyToast.showToast(OSTimePlaybackDualFragment_New.this.getActivity(), OSTimePlaybackDualFragment_New.this.getString(R.string.tips_open_video_fail));
            OSTimePlaybackDualFragment_New.this.mhandlerPF.postDelayed(new Runnable() {
                @Override
                public void run() {
                    OSTimePlaybackDualFragment_New.this.getActivity().finish();
                }
            }, 1000L);
        }

        public void lambda$handleMessage$0$OSTimePlaybackDualFragment_New$17() {
            OSTimePlaybackDualFragment_New.this.shadowView.setVisibility(8);
        }
    }

    private void preLoadFile(final byte[] bArr, final byte[] bArr2) {
        if (HiTools.isSDCardExist()) {
            File file = new File(HiDataValue.getPathCameraVideoOnLinePlayFast(this.mMyCamera.getUid(), getActivity()));
            if (!file.exists()) {
                Log.d("==cloudPlay", "CameraVideoFastDownLoadCache: " + file.mkdirs());
            }
            this.download_path = file.getAbsoluteFile() + "/";
            this.fileName = splitFileName(new HiChipDefines.STimeDay(bArr, 0).toString());
            String str = this.download_path + this.fileName + ".pfh26x";
            HiLog.e("filepath:" + str);
            if (new File(str).exists()) {
                this.fileisDowned = true;
                HiLog.e("==cloudPlay执行预加载,下一个文件,本地已经存在");
                return;
            }
            MyCamera myCamera = this.mMyCamera;
            if (myCamera == null || myCamera.mPBFastsdk == null) {
                return;
            }
            this.fileisDowned = false;
            final String str2 = this.download_path + this.fileName + ".rec";
            File file2 = new File(str2);
            if (!file2.exists()) {
                try {
                    if (!file2.createNewFile()) {
                        return;
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            HiLog.e("mAct.isCallDownloadfilepath:" + str2);
            checkPBFastCacheSize();
            new Thread() {
                @Override
                public void run() {
                    super.run();
                    OSTimePlaybackDualFragment_New.this.isCallStopDown = false;
                    OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.PlayLocal_Resume();
                    OSTimePlaybackDualFragment_New.this.mAct.isCallDownload = true;
                    OSTimePlaybackDualFragment_New.this.mMyCamera.startPlaybackFast(new HiChipDefines.STimeDay(bArr, 0), new HiChipDefines.STimeDay(bArr2, 0), 0, null, str2, 0L, OSTimePlaybackDualFragment_New.this.fileisDowned, OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual);
                    OSTimePlaybackDualFragment_New.this.mMyCamera.isFirstPlayOsDual = false;
                    OSTimePlaybackDualFragment_New.this.mMyCamera.mPBFastsdk.FastPlayDown(str2, OSTimePlaybackDualFragment_New.this.download_path, OSTimePlaybackDualFragment_New.this.fileName + ".rec", 1, 1);
                }
            }.start();
        }
    }

    public void renameFile(String str, String str2) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return;
        }
        new File(str).renameTo(new File(str2));
    }

    private void handSnapshot() {
        if (HiTools.mDualTimevalue == 0 || HiTools.mDualTimevalue == 1) {
            clickSnapshot();
        }
        if (HiTools.mDualTimevalue == 0 || HiTools.mDualTimevalue == 2) {
            clickSnap2shot();
        }
    }

    public void clickSnapshot() {
        if (this.mMyCamera != null) {
            if (HiTools.isSDCardValid()) {
                File file = new File(HiDataValue.getPathCameraSnapshot(this.mMyCamera.getUid(), getActivity()));
                if (!file.exists()) {
                    file.mkdirs();
                }
                String fileNameWithTimeExt = HiTools.getFileNameWithTimeExt(0, this.mMyCamera.getdevDual() ? 1 : 0);
                String str = file.getAbsoluteFile() + "/" + fileNameWithTimeExt;
                Bitmap snapshot = this.mMyCamera.mPBFastsdk != null ? this.mMyCamera.mPBFastsdk.getSnapshot() : null;
                if (snapshot != null && HiTools.saveImage(str, snapshot)) {
                    SaveToPhone(str, fileNameWithTimeExt);
                    if (HiTools.mDualTimevalue == 1) {
                        Toast.makeText(getActivity(), getText(R.string.tips_snapshot_success), 0).show();
                        return;
                    }
                    return;
                }
                Toast.makeText(getActivity(), getText(R.string.tips_snapshot_failed), 0).show();
                return;
            }
            Toast.makeText(getActivity(), getText(R.string.tips_no_sdcard).toString(), 0).show();
        }
    }

    public void clickSnap2shot() {
        if (this.mMyCamera != null) {
            if (HiTools.isSDCardValid()) {
                File file = new File(HiDataValue.getPathCameraSnapshot(this.mMyCamera.getUid(), getActivity()));
                if (!file.exists()) {
                    file.mkdirs();
                }
                String fileNameWithTimeExt = HiTools.getFileNameWithTimeExt(0, this.mMyCamera.getdevDual() ? 2 : 0);
                String str = file.getAbsoluteFile() + "/" + fileNameWithTimeExt;
                Bitmap dualnum2Snapshot = this.mMyCamera.mPBFastsdk != null ? this.mMyCamera.mPBFastsdk.getDualnum2Snapshot() : null;
                if (dualnum2Snapshot != null && HiTools.saveImage(str, dualnum2Snapshot)) {
                    SaveToPhone(str, fileNameWithTimeExt);
                    if (HiTools.mDualTimevalue == 0 || HiTools.mDualTimevalue == 2) {
                        Toast.makeText(getActivity(), getText(R.string.tips_snapshot_success), 0).show();
                        return;
                    }
                    return;
                }
                Toast.makeText(getActivity(), getText(R.string.tips_snapshot_failed), 0).show();
                return;
            }
            Toast.makeText(getActivity(), getText(R.string.tips_no_sdcard).toString(), 0).show();
        }
    }

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

    @Override
    public void onDestroy() {
        super.onDestroy();
        MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor_1dual;
        if (myPlaybackGLMonitor != null) {
            myPlaybackGLMonitor.FreeMonitor();
            MyCamera myCamera = this.mMyCamera;
            if (myCamera != null) {
                myCamera.clearMonitor(this.monitor_1dual);
            }
        }
        MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor_2dual;
        if (myPlaybackGLMonitor2 != null) {
            myPlaybackGLMonitor2.FreeMonitor();
            MyCamera myCamera2 = this.mMyCamera;
            if (myCamera2 != null) {
                myCamera2.clearMonitor(this.monitor_2dual);
            }
        }
    }

    private void checkPBFastCacheSize() {
        if (getActivity() != null && Double.valueOf(FileSizeUtils.getFileOrFilesSize(HiDataValue.getPathCameraVideoOnLinePlayFast(getActivity()), 3)).compareTo(Double.valueOf(HiDataValue.DelCacheMax)) > 0) {
            Intent intent = new Intent(getActivity(), (Class<?>) DeletePFastCacheFileService.class);
            intent.putExtra("PBFast", true);
            intent.putExtra("PBFastuid", this.mMyCamera.getUid());
            getActivity().startService(intent);
        }
    }
}