LeftLocalVideoFragment.java 源代码


package activity.Left;

import activity.FishEye.FishEyePlaybackLocalActivity;
import activity.Left.adapter.StickyGridVideoAdapter;
import activity.WallMounted.WallMountedPlayLocalActivity;
import activity.cloud.OSSPlaybackDualLocalActivity;
import activity.cloud.OSSPlaybackDualLocalActivity_ThreeEyes;
import activity.cloud.OSSPlaybackLocalActivity;
import activity.cloud.OSSPlaybackSpliceLocalActivity;
import activity.cloud.OSSWallMountedPlaybackLocalActivity;
import activity.video.PlaybackDualLocalActivity;
import activity.video.PlaybackDualLocalActivity_ThreeEyes;
import activity.video.PlaybackDualLocalActivity_ThreeEyes_Download;
import activity.video.PlaybackLocalActivity;
import activity.video.PlaybackSpliceLocalActivity;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.GridView;
import android.widget.ListAdapter;
import android.widget.PopupWindow;
import android.widget.SeekBar;
import android.widget.TextView;
import base.HiFragment;
import bean.LeftLocalFileBean;
import bean.MyCamera;
import butterknife.ButterKnife;
import com.alipay.sdk.util.i;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.hichip.NVR.HiNVRDev;
import com.hichip.NVR.callback.PlayLocalNVRFileCallback;
import com.hichip.base.HiLog;
import com.hichip.callback.PlayLocalFileCallback;
import com.hichip.callback.PlayOSSFileCallback;
import com.hichip.campro.R;
import com.hichip.control.HiCamera;
import com.hichip.sdk.HiPlayOSSDualSDK;
import com.hichip.sdk.HiPlayOSSSDK;
import com.hichip.sdk.PlayDualLocal;
import com.hichip.sdk.PlayLocal;
import com.xiaomi.mipush.sdk.Constants;
import common.Constant;
import common.HiDataValue;
import custom.dialog.NiftyDialogBuilder;
import custom.stickygridview.GridItem;
import custom.stickygridview.YMComparator;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import main.NVR.Video.PlaybackNVRLocalActivity;
import utils.FileHelper;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;
import utils.SharePreUtils;
import utils.SystemUtils;
import utils.TimeUtil;
import utils.UninstallDevTypeKeep;

public class LeftLocalVideoFragment extends HiFragment implements AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, PlayLocalFileCallback, PlayOSSFileCallback, PlayLocalNVRFileCallback {
    private static final int FAST_CLICK_DELAY_TIME = 1000;
    public static final String FILE_PATH = "file_path";
    public static final String FILE_PATH2 = "file_path2";
    private static int section = 1;
    private String absolutePath;
    private LeftLocalVideoPhotoActivity act;

    private LeftLocalFileBean f974bean;
    public StickyGridVideoAdapter mAdapter;
    protected File mConver2File;
    protected File mConverFile;
    private MyCamera mMyCamera;
    private PlayLocal mPlayLocal;
    public PlayDualLocal mPlaydualLocal;
    private SeekBar mSeekBarTrans;
    private TextView mTvCancel;
    private TextView mTvTransRote;
    GridView sticky_gridview;
    public ArrayList<GridItem> mGirdList = new ArrayList<>();
    private Map<String, Integer> sectionMap = new HashMap();
    public List<GridItem> mDeleteList = Collections.synchronizedList(new ArrayList());
    private long mFirstTime = 0;
    public int mdefchn = 0;
    private long lastClickTime = 0;
    private SimpleDateFormat sdf = new SimpleDateFormat(TimeUtil.FORMAT_DATE_TIME_FULL);
    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message message) {
            int i = message.what;
            if (i == -11) {
                MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.data_parsing_error));
                if (LeftLocalVideoFragment.this.mConverFile != null && LeftLocalVideoFragment.this.mConverFile.exists()) {
                    LeftLocalVideoFragment.this.mConverFile.delete();
                }
                if (LeftLocalVideoFragment.this.mConver2File == null || !LeftLocalVideoFragment.this.mConver2File.exists()) {
                    return;
                }
                LeftLocalVideoFragment.this.mConver2File.delete();
                return;
            }
            if (i == 10) {
                LeftLocalVideoFragment.this.showTransPupwindow(message.arg1);
                return;
            }
            if (i == 2184) {
                File file = (File) message.obj;
                if (file != null && file.exists() && file.isFile()) {
                    FileHelper.saveVideoToSystemAlbum(file, LeftLocalVideoFragment.this.getActivity());
                    MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.success_to_album));
                    return;
                }
                return;
            }
            if (i == 131073) {
                String str = (String) message.obj;
                String replace = LeftLocalVideoFragment.this.converStr(LeftLocalVideoFragment.this.mGirdList.get(message.arg1)).substring(0, 10).replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
                HiLogcatUtil.dTag(HiLogcatUtil.TAG_Google, "oclouddate: " + replace);
                if (LeftLocalVideoFragment.this.mMyCamera != null) {
                    if (!LeftLocalVideoFragment.this.mMyCamera.getdevDual()) {
                        if (LeftLocalVideoFragment.this.mMyCamera.mPlayOSS != null) {
                            if (LeftLocalVideoFragment.this.mMyCamera.getCloudType() == 2) {
                                LeftLocalVideoFragment.this.mMyCamera.mPlayOSS.SetOSSOCloudDate(LeftLocalVideoFragment.this.mMyCamera.getUid(), replace, true);
                            } else {
                                LeftLocalVideoFragment.this.mMyCamera.mPlayOSS.SetOSSOCloudDate(LeftLocalVideoFragment.this.mMyCamera.getUid(), replace, false);
                            }
                            LeftLocalVideoFragment.this.mMyCamera.mPlayOSS.Start2Mp4(str, LeftLocalVideoFragment.this.mConverFile.getAbsolutePath());
                            return;
                        }
                        return;
                    }
                    if (LeftLocalVideoFragment.this.mMyCamera.mPlayDualOSS != null) {
                        if (LeftLocalVideoFragment.this.mMyCamera.getCloudType() == 2) {
                            LeftLocalVideoFragment.this.mMyCamera.mPlayDualOSS.SetOSSOCloudDate(LeftLocalVideoFragment.this.mMyCamera.getUid(), replace, true);
                        } else {
                            LeftLocalVideoFragment.this.mMyCamera.mPlayDualOSS.SetOSSOCloudDate(LeftLocalVideoFragment.this.mMyCamera.getUid(), replace, false);
                        }
                        LeftLocalVideoFragment.this.mMyCamera.mPlayDualOSS.Start2Mp4(str, LeftLocalVideoFragment.this.mConverFile.getAbsolutePath(), LeftLocalVideoFragment.this.mConver2File.getAbsolutePath());
                        return;
                    }
                    return;
                }
                return;
            }
            if (i == 12) {
                int i2 = message.arg1;
                int round = (int) Math.round(((i2 / 1000.0d) / message.arg2) * 100.0d);
                if (round < 100) {
                    LeftLocalVideoFragment.this.mTvTransRote.setText(round + "%");
                }
                LeftLocalVideoFragment.this.mSeekBarTrans.setProgress(i2);
                return;
            }
            if (i != 13) {
                return;
            }
            if (LeftLocalVideoFragment.this.isClickCancel) {
                LeftLocalVideoFragment.this.isClickCancel = false;
                return;
            }
            LeftLocalVideoFragment.this.mTvTransRote.setText("100%");
            LeftLocalVideoFragment.this.mTvCancel.setText(LeftLocalVideoFragment.this.getContext().getString(R.string.finish));
            HiLog.e("" + LeftLocalVideoFragment.this.mConverFile + Constants.COLON_SEPARATOR + LeftLocalVideoFragment.this.mConver2File);
            if (LeftLocalVideoFragment.this.mConverFile != null) {
                FileHelper.saveVideoToSystemAlbum(LeftLocalVideoFragment.this.mConverFile, LeftLocalVideoFragment.this.getActivity());
            }
            if (!LeftLocalVideoFragment.this.mMyCamera.getdevDual() || LeftLocalVideoFragment.this.mConver2File == null) {
                return;
            }
            FileHelper.saveVideoToSystemAlbum(LeftLocalVideoFragment.this.mConver2File, LeftLocalVideoFragment.this.getActivity());
        }
    };
    private boolean isClickCancel = false;

    @Override
    public void CallBackOSSDownLoad(int i, int i2, int i3, String str) {
    }

    @Override
    public void CallBackOSSDownLoadExt(int i, long j, long j2, String str) {
    }

    @Override
    public void callbackOSSData(int i, byte[] bArr, int i2, int i3, int i4, int i5, int i6, int i7, String str) {
    }

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

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

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View inflate = View.inflate(getActivity(), R.layout.fragment_left_local_video, null);
        ButterKnife.bind(this, inflate);
        initViewAndData(inflate);
        setListeners();
        this.act = (LeftLocalVideoPhotoActivity) getActivity();
        return inflate;
    }

    private void setListeners() {
        this.sticky_gridview.setOnItemClickListener(this);
        this.sticky_gridview.setOnItemLongClickListener(this);
    }

    private void initViewAndData(View view) {
        initData();
        if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            if (this.mMyCamera.mhiNvrdev == null) {
                this.mMyCamera.mhiNvrdev = new HiNVRDev();
            }
            this.mMyCamera.mhiNvrdev.SetHiCameraObj(this.mMyCamera);
            boolean z = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
            if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z) {
                this.mMyCamera.mhiNvrdev.SetDecodeViVoVideoType(0);
            } else {
                this.mMyCamera.mhiNvrdev.SetDecodeViVoVideoType(1);
            }
        } else if (!this.mMyCamera.getdevDual()) {
            this.mPlayLocal = new PlayLocal();
            boolean z2 = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
            if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z2) {
                this.mPlayLocal.SetDecodeViVoVideoType(0);
            } else {
                this.mPlayLocal.SetDecodeViVoVideoType(1);
            }
        } else {
            this.mPlaydualLocal = new PlayDualLocal();
        }
        StickyGridVideoAdapter stickyGridVideoAdapter = new StickyGridVideoAdapter(getActivity(), this.mGirdList, this.sticky_gridview, this.mMyCamera);
        this.mAdapter = stickyGridVideoAdapter;
        this.sticky_gridview.setAdapter((ListAdapter) stickyGridVideoAdapter);
    }

    private void initData() {
        this.f974bean = (LeftLocalFileBean) getArguments().getSerializable("bean");
        Iterator<MyCamera> it = HiDataValue.CameraList.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            MyCamera next = it.next();
            if (next.getUid().equals(this.f974bean.getUid())) {
                this.mMyCamera = next;
                break;
            }
        }
        if (this.mMyCamera == null) {
            this.mMyCamera = new MyCamera(getActivity(), getString(R.string.title_camera_fragment), this.f974bean.getUid(), "admin", "admin");
            boolean z = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
            if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z) {
                this.mMyCamera.SetDecodeViVoVideoType(0);
            } else {
                this.mMyCamera.SetDecodeViVoVideoType(1);
            }
            if ("true".equalsIgnoreCase(UninstallDevTypeKeep.getValue(getContext(), this.mMyCamera.getUid(), Constant.ISWALLMOUNTED))) {
                this.mMyCamera.isWallMounted = true;
            }
            HiDataValue.DeleteCameraList.add(this.mMyCamera);
            if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
                this.mMyCamera.setIsDevNVR(true);
            } else {
                this.mMyCamera.setIsDevNVR(false);
            }
            this.mMyCamera.mIsDevNVR = SharePreUtils.getBoolean(HiDataValue.CACHE, getContext(), this.mMyCamera.getUid() + "mIsDevNVR", true);
        }
        if (!this.mMyCamera.getdevDual()) {
            if (this.mMyCamera.mPlayOSS == null) {
                this.mMyCamera.mPlayOSS = new HiPlayOSSSDK();
                boolean z2 = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
                if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z2) {
                    this.mMyCamera.mPlayOSS.SetDecodeViVoVideoType(0);
                } else {
                    this.mMyCamera.mPlayOSS.SetDecodeViVoVideoType(1);
                }
                this.mMyCamera.mPlayOSS.SetContext(getActivity(), this.mMyCamera.getUid());
                this.mMyCamera.mPlayOSS.registerPlayOSSStateListener(this);
            }
        } else if (this.mMyCamera.mPlayDualOSS == null) {
            this.mMyCamera.mPlayDualOSS = new HiPlayOSSDualSDK();
            boolean z3 = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
            if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z3) {
                this.mMyCamera.mPlayDualOSS.SetDecodeViVoVideoType(0);
            } else {
                this.mMyCamera.mPlayDualOSS.SetDecodeViVoVideoType(1);
            }
            this.mMyCamera.mPlayDualOSS.SetContext(getActivity(), this.mMyCamera.getUid());
            this.mMyCamera.mPlayDualOSS.registerPlayOSSStateListener(this);
        }
        File file = new File(this.f974bean.getFile().getAbsolutePath() + "/Download/");
        if (file.exists()) {
            File[] listFiles = file.listFiles();
            if (listFiles.length > 0) {
                for (File file2 : listFiles) {
                    GridItem gridItem = new GridItem(file2.getAbsolutePath(), paserTimeToYM(file2.lastModified() / 1000));
                    gridItem.setType(0);
                    gridItem.setFileName(file2.getName());
                    this.mGirdList.add(gridItem);
                }
            }
        }
        File file3 = new File(this.f974bean.getFile().getAbsolutePath() + "/VideoRecoding/");
        if (file3.exists()) {
            File[] listFiles2 = file3.listFiles();
            if (listFiles2.length > 0) {
                for (File file4 : listFiles2) {
                    if (!file4.getName().equals("SnapShot")) {
                        GridItem gridItem2 = new GridItem(file4.getAbsolutePath(), paserTimeToYM(file4.lastModified() / 1000));
                        gridItem2.setType(1);
                        gridItem2.setFileName(file4.getName());
                        this.mGirdList.add(gridItem2);
                    }
                }
            }
        }
        if (this.mMyCamera.getIs_ThreeEyes()) {
            ArrayList<GridItem> arrayList = new ArrayList();
            Iterator<GridItem> it2 = this.mGirdList.iterator();
            while (it2.hasNext()) {
                GridItem next2 = it2.next();
                boolean z4 = true;
                for (GridItem gridItem3 : arrayList) {
                    if (gridItem3.getFileName().contains("-01.mp4") || gridItem3.getFileName().contains("-02.mp4")) {
                        if (next2.getFileName().contains("-01.mp4") || next2.getFileName().contains("-02.mp4")) {
                            if (gridItem3.getFileName().split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)[0].equals(next2.getFileName().split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)[0])) {
                                if (gridItem3.getFileName().contains("-02")) {
                                    gridItem3.setFileName(gridItem3.getFileName() + i.b + next2.getFileName());
                                } else {
                                    gridItem3.setFileName(next2.getFileName() + i.b + gridItem3.getFileName());
                                }
                                z4 = false;
                            }
                        }
                    }
                }
                if (z4) {
                    arrayList.add(next2);
                }
            }
            this.mGirdList.clear();
            this.mGirdList.addAll(arrayList);
        }
        LoadNVRVideo(this.f974bean, this.mdefchn);
        Collections.sort(this.mGirdList, new YMComparator());
        ListIterator<GridItem> listIterator = this.mGirdList.listIterator();
        while (listIterator.hasNext()) {
            GridItem next3 = listIterator.next();
            String time = next3.getTime();
            if (!this.sectionMap.containsKey(time)) {
                next3.setSection(section);
                this.sectionMap.put(time, Integer.valueOf(section));
                section++;
            } else {
                next3.setSection(this.sectionMap.get(time).intValue());
            }
        }
    }

    private void LoadNVRVideo(LeftLocalFileBean leftLocalFileBean, int i) {
        File file = new File(leftLocalFileBean.getFile().getAbsolutePath() + "/NVRDownload/" + i + "/");
        if (file.exists()) {
            File[] listFiles = file.listFiles();
            if (listFiles.length > 0) {
                for (File file2 : listFiles) {
                    GridItem gridItem = new GridItem(file2.getAbsolutePath(), paserTimeToYM(file2.lastModified() / 1000));
                    gridItem.setType(0);
                    gridItem.setFileName(file2.getName());
                    this.mGirdList.add(gridItem);
                }
            }
        }
        File file3 = new File(leftLocalFileBean.getFile().getAbsolutePath() + "/NVRRecord/" + i + "/");
        if (file3.exists()) {
            File[] listFiles2 = file3.listFiles();
            if (listFiles2.length > 0) {
                for (File file4 : listFiles2) {
                    if (!file4.getName().equals("SnapShot")) {
                        GridItem gridItem2 = new GridItem(file4.getAbsolutePath(), paserTimeToYM(file4.lastModified() / 1000));
                        gridItem2.setType(1);
                        gridItem2.setFileName(file4.getName());
                        this.mGirdList.add(gridItem2);
                    }
                }
            }
        }
    }

    public void ReLoadNVRVideo() {
        if (this.f974bean == null) {
            return;
        }
        ArrayList<GridItem> arrayList = this.mGirdList;
        if (arrayList != null) {
            arrayList.clear();
        }
        Map<String, Integer> map = this.sectionMap;
        if (map != null) {
            map.clear();
        }
        List<GridItem> list = this.mDeleteList;
        if (list != null) {
            list.clear();
        }
        section = 1;
        LoadNVRVideo(this.f974bean, this.mdefchn);
        Collections.sort(this.mGirdList, new YMComparator());
        this.mAdapter.setChecks(this.mGirdList);
        ListIterator<GridItem> listIterator = this.mGirdList.listIterator();
        while (listIterator.hasNext()) {
            GridItem next = listIterator.next();
            String time = next.getTime();
            if (!this.sectionMap.containsKey(time)) {
                next.setSection(section);
                this.sectionMap.put(time, Integer.valueOf(section));
                section++;
            } else {
                next.setSection(this.sectionMap.get(time).intValue());
            }
        }
        StickyGridVideoAdapter stickyGridVideoAdapter = this.mAdapter;
        if (stickyGridVideoAdapter != null) {
            stickyGridVideoAdapter.setList(this.mGirdList);
            this.mAdapter.notifyDataSetChanged();
        }
    }

    private String paserTimeToYM(long j) {
        TimeZone.setDefault(TimeZone.getDefault());
        return new SimpleDateFormat(TimeUtil.FORMAT_DATE).format(new Date(j * 1000));
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        if (i < 0) {
            return;
        }
        this.mAdapter.playLocal = null;
        if (this.mAdapter.getDelMode() == 1) {
            CheckBox checkBox = (CheckBox) view.findViewById(R.id.grid_cb);
            checkBox.setChecked(!checkBox.isChecked());
            if (checkBox.isChecked()) {
                this.mDeleteList.add(this.mGirdList.get(i));
            } else {
                this.mDeleteList.remove(this.mGirdList.get(i));
            }
            this.mAdapter.checks[i] = checkBox.isChecked();
            return;
        }
        if (System.currentTimeMillis() - this.lastClickTime < 1000) {
            return;
        }
        this.lastClickTime = System.currentTimeMillis();
        GridItem gridItem = this.mGirdList.get(i);
        Bundle bundle = new Bundle();
        if (gridItem.getType() == 0) {
            if (!HiTools.isNVRDev(this.mMyCamera.getUid())) {
                this.absolutePath = HiDataValue.getPathCameraVideoOnLineDownLoad(this.mMyCamera.getUid(), getActivity());
            } else {
                this.absolutePath = HiDataValue.getPathNVRDownload(this.mMyCamera.getUid(), this.act.mdefchn, getActivity());
            }
        } else if (!HiTools.isNVRDev(this.mMyCamera.getUid())) {
            this.absolutePath = HiDataValue.getPathCameraVideoLocalRecord(this.mMyCamera.getUid(), getActivity());
        } else {
            this.absolutePath = HiDataValue.getPathNVRRecord(this.mMyCamera.getUid(), this.act.mdefchn, getActivity());
        }
        if (gridItem.getFileName().contains(i.b)) {
            bundle.putString("file_path", this.absolutePath + gridItem.getFileName().split(i.b)[1]);
            bundle.putString("file_path2", this.absolutePath + gridItem.getFileName().split(i.b)[0]);
        } else {
            bundle.putString("file_path", this.absolutePath + gridItem.getFileName());
        }
        bundle.putString(HiDataValue.EXTRAS_KEY_UID, this.mMyCamera.getUid());
        String converStr = converStr(gridItem);
        bundle.putString("start_time", converStr);
        HiLogcatUtil.e(this.mMyCamera.getUid() + ":::" + HiTools.isNVRDev(this.mMyCamera.getUid()) + ":::" + this.mMyCamera.getdevDual() + ":::" + this.mMyCamera.getdevSplice() + "start_time: " + converStr);
        String replace = converStr.substring(0, 10).replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
        if (getActivity() == null) {
            return;
        }
        Intent intent = new Intent();
        if (this.mMyCamera.isWallMounted) {
            if (gridItem.getPath().contains(HiDataValue.OSSFILEEnd)) {
                intent.setClass(getActivity(), OSSWallMountedPlaybackLocalActivity.class);
                bundle.putString("oclouddate", replace);
            } else {
                intent.setClass(getActivity(), WallMountedPlayLocalActivity.class);
            }
        } else if (UninstallDevTypeKeep.getValue(getContext(), this.mMyCamera.getUid(), Constant.ISFISHEYE).equalsIgnoreCase("1") || this.mMyCamera.isFishEye()) {
            int i2 = SharePreUtils.getInt(Constant.INSTALLMODE, getActivity(), this.mMyCamera.getUid());
            this.mMyCamera.mInstallMode = i2 != -1 ? i2 : 0;
            if (!HiDataValue.CameraList.contains(this.mMyCamera)) {
                this.mMyCamera.mInstallMode = Integer.parseInt(UninstallDevTypeKeep.getValue(getContext(), this.mMyCamera.getUid(), Constant.INSTALLMODE));
            }
            if (gridItem.getPath().contains(HiDataValue.OSSFILEEnd)) {
                if (!this.mMyCamera.getdevDual()) {
                    if (!this.mMyCamera.getdevSplice()) {
                        intent.setClass(getActivity(), OSSPlaybackLocalActivity.class);
                    } else {
                        intent.setClass(getActivity(), OSSPlaybackSpliceLocalActivity.class);
                    }
                } else {
                    intent.setClass(getActivity(), OSSPlaybackDualLocalActivity.class);
                }
                bundle.putString("oclouddate", replace);
            } else {
                intent.setClass(getActivity(), FishEyePlaybackLocalActivity.class);
            }
        } else if (gridItem.getPath().contains(HiDataValue.OSSFILEEnd)) {
            if (!this.mMyCamera.getdevDual()) {
                if (!this.mMyCamera.getdevSplice()) {
                    intent.setClass(getActivity(), OSSPlaybackLocalActivity.class);
                } else {
                    intent.setClass(getActivity(), OSSPlaybackSpliceLocalActivity.class);
                }
            } else if (this.mMyCamera.getIs_ThreeEyes()) {
                intent.setClass(getActivity(), OSSPlaybackDualLocalActivity_ThreeEyes.class);
            } else {
                intent.setClass(getActivity(), OSSPlaybackDualLocalActivity.class);
            }
            bundle.putString("oclouddate", replace);
            bundle.putString(TTDownloadField.TT_FILE_NAME, gridItem.getFileName());
        } else if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            if (gridItem.getPath().contains(".h264") || gridItem.getPath().contains(".h265")) {
                intent.setClass(getActivity(), PlaybackNVRLocalActivity.class);
            } else {
                intent.setClass(getActivity(), PlaybackLocalActivity.class);
            }
        } else if (this.mMyCamera.getdevDual()) {
            if (gridItem.getPath().contains(".h264") || gridItem.getPath().contains(".h265")) {
                if (this.mMyCamera.getIs_ThreeEyes()) {
                    intent.setClass(getActivity(), PlaybackDualLocalActivity_ThreeEyes_Download.class);
                } else {
                    intent.setClass(getActivity(), PlaybackDualLocalActivity.class);
                }
            } else if (this.mMyCamera.getIs_ThreeEyes() && gridItem.getFileName().contains(i.b)) {
                intent.setClass(getActivity(), PlaybackDualLocalActivity_ThreeEyes.class);
            } else {
                intent.setClass(getActivity(), PlaybackLocalActivity.class);
            }
        } else if (!this.mMyCamera.getdevSplice()) {
            intent.setClass(getActivity(), PlaybackLocalActivity.class);
        } else {
            intent.setClass(getActivity(), PlaybackSpliceLocalActivity.class);
        }
        intent.putExtras(bundle);
        startActivity(intent);
    }

    @Override
    public void onPause() {
        super.onPause();
        this.mAdapter.mFragmentIsOnPause = true;
        if (this.mMyCamera.mhiNvrdev != null) {
            this.mMyCamera.mhiNvrdev.unregisterPlayBackNVRStateListener(this);
            this.mMyCamera.mhiNvrdev.Stop2Mp4();
        }
        PlayLocal playLocal = this.mPlayLocal;
        if (playLocal != null) {
            playLocal.unregisterPlayLocalStateListener(this);
            this.mPlayLocal.Stop2Mp4();
        }
        PlayDualLocal playDualLocal = this.mPlaydualLocal;
        if (playDualLocal != null) {
            playDualLocal.unregisterPlayLocalStateListener(this);
            this.mPlaydualLocal.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayOSS != null) {
            this.mMyCamera.mPlayOSS.unregisterPlayOSSStateListener(this);
            this.mMyCamera.mPlayOSS.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayDualOSS != null) {
            this.mMyCamera.mPlayDualOSS.unregisterPlayOSSStateListener(this);
            this.mMyCamera.mPlayDualOSS.Stop2Mp4();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        this.mAdapter.mFragmentIsOnPause = false;
        if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            if (this.mMyCamera.mhiNvrdev == null) {
                this.mMyCamera.mhiNvrdev = new HiNVRDev();
                this.mMyCamera.mhiNvrdev.SetHiCameraObj(this.mMyCamera);
                boolean z = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
                if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z) {
                    this.mMyCamera.mhiNvrdev.SetDecodeViVoVideoType(0);
                } else {
                    this.mMyCamera.mhiNvrdev.SetDecodeViVoVideoType(1);
                }
            }
            MyCamera myCamera = this.mMyCamera;
            if (myCamera != null && myCamera.mhiNvrdev != null) {
                this.mMyCamera.mhiNvrdev.registerPlayBackNVRStateListener(this);
            }
        } else if (!this.mMyCamera.getdevDual()) {
            if (this.mPlayLocal == null) {
                this.mPlayLocal = new PlayLocal();
                boolean z2 = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
                if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z2) {
                    this.mPlayLocal.SetDecodeViVoVideoType(0);
                } else {
                    this.mPlayLocal.SetDecodeViVoVideoType(1);
                }
            }
            this.mPlayLocal.registerPlayLocalStateListener(this);
        } else {
            if (this.mPlaydualLocal == null) {
                this.mPlaydualLocal = new PlayDualLocal();
                boolean z3 = SharePreUtils.getBoolean(HiDataValue.CACHE, getActivity(), Constant.DEV_IsVivoMedia, false);
                if (SystemUtils.isVIVOMobile(getActivity()) && Build.VERSION.SDK_INT > 29 && !z3) {
                    this.mPlaydualLocal.SetDecodeViVoVideoType(0);
                } else {
                    this.mPlaydualLocal.SetDecodeViVoVideoType(1);
                }
            }
            this.mPlaydualLocal.registerPlayLocalStateListener(this);
        }
        if (this.mMyCamera.mPlayOSS != null) {
            this.mMyCamera.mPlayOSS.registerPlayOSSStateListener(this);
        }
        if (this.mMyCamera.mPlayDualOSS != null) {
            this.mMyCamera.mPlayDualOSS.registerPlayOSSStateListener(this);
        }
    }

    public String converStr(GridItem gridItem) {
        String replace;
        if (gridItem == null || TextUtils.isEmpty(gridItem.getPath())) {
            return " ";
        }
        String[] split = gridItem.getPath().split("/");
        if (split.length <= 0) {
            return " ";
        }
        String str = split[split.length - 1];
        if (str.endsWith(HiDataValue.OSSFILEEnd)) {
            replace = str.split("_")[0].substring(1).replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
        } else {
            replace = str.split("\\.")[0].replace("_", "");
        }
        try {
            return this.sdf.format(new SimpleDateFormat(TimeUtil.FORMAT_STRING, Locale.getDefault()).parse(replace));
        } catch (ParseException e) {
            e.printStackTrace();
            return "";
        }
    }

    @Override
    public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) {
        GridItem gridItem = this.mGirdList.get(i);
        if (gridItem == null || TextUtils.isEmpty(gridItem.getPath())) {
            return true;
        }
        String path = gridItem.getPath();
        this.mFirstTime = 0L;
        if (this.mMyCamera.getIs_ThreeEyes()) {
            return true;
        }
        if (path.endsWith("h264") || path.endsWith("avi") || path.endsWith("h265") || path.endsWith(HiDataValue.OSSFILEEnd)) {
            transDialogshow(gridItem, i);
            return true;
        }
        DumpDialogshow(gridItem);
        return true;
    }

    protected void transDialogshow(final GridItem gridItem, final int i) {
        View inflate = View.inflate(getActivity(), R.layout.dialog_transcord, null);
        final PopupWindow popupWindow = new PopupWindow(inflate);
        popupWindow.setBackgroundDrawable(new ColorDrawable(0));
        popupWindow.setOutsideTouchable(true);
        popupWindow.setFocusable(true);
        popupWindow.setWidth(-1);
        popupWindow.setHeight(-1);
        popupWindow.showAtLocation(inflate, 17, 0, 0);
        inflate.findViewById(R.id.tv_cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popupWindow.dismiss();
            }
        });
        inflate.findViewById(R.id.tv_ok).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                LeftLocalVideoFragment.this.isClickCancel = false;
                popupWindow.dismiss();
                if (HiTools.isSDCardExist()) {
                    String[] split = gridItem.getFileName().split("\\.");
                    File file = new File(HiDataValue.getConvertPath(LeftLocalVideoFragment.this.getActivity()) + LeftLocalVideoFragment.this.mMyCamera.getUid() + "/");
                    if (!file.exists()) {
                        file.mkdirs();
                    }
                    LeftLocalVideoFragment.this.mConverFile = new File(file.getAbsolutePath() + "/" + split[0] + ".mp4");
                    if (LeftLocalVideoFragment.this.mMyCamera.getdevDual()) {
                        LeftLocalVideoFragment.this.mConver2File = new File(file.getAbsolutePath() + "/" + split[0] + "-02.mp4");
                    }
                    if (LeftLocalVideoFragment.this.mMyCamera.getdevDual()) {
                        if (!LeftLocalVideoFragment.this.mConverFile.exists() || !LeftLocalVideoFragment.this.mConver2File.exists() || ((LeftLocalVideoFragment.this.mConverFile.exists() && LeftLocalVideoFragment.this.mConverFile.length() <= 1024) || (LeftLocalVideoFragment.this.mConver2File.exists() && LeftLocalVideoFragment.this.mConver2File.length() <= 1024))) {
                            try {
                                LeftLocalVideoFragment.this.mConverFile.createNewFile();
                                LeftLocalVideoFragment.this.mConver2File.createNewFile();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        } else {
                            if (LeftLocalVideoFragment.this.mConverFile.getAbsolutePath().contains(LeftLocalVideoFragment.this.getContext().getPackageName())) {
                                FileHelper.saveVideoToSystemAlbum(LeftLocalVideoFragment.this.mConverFile, LeftLocalVideoFragment.this.getContext());
                                FileHelper.saveVideoToSystemAlbum(LeftLocalVideoFragment.this.mConver2File, LeftLocalVideoFragment.this.getContext());
                                MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.success_to_album));
                                return;
                            }
                            MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.file_alearly_convert));
                            return;
                        }
                    } else if (!LeftLocalVideoFragment.this.mConverFile.exists()) {
                        try {
                            LeftLocalVideoFragment.this.mConverFile.createNewFile();
                        } catch (IOException e2) {
                            e2.printStackTrace();
                        }
                    } else if (LeftLocalVideoFragment.this.mConverFile.getAbsolutePath().contains(LeftLocalVideoFragment.this.getContext().getPackageName())) {
                        FileHelper.saveVideoToSystemAlbum(LeftLocalVideoFragment.this.mConverFile, LeftLocalVideoFragment.this.getContext());
                        MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.success_to_album));
                        return;
                    } else {
                        MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.file_alearly_convert));
                        return;
                    }
                    if (!gridItem.getPath().contains(HiDataValue.OSSFILEEnd)) {
                        if (HiTools.isNVRDev(LeftLocalVideoFragment.this.mMyCamera.getUid())) {
                            if (LeftLocalVideoFragment.this.mMyCamera.mhiNvrdev != null) {
                                LeftLocalVideoFragment.this.mMyCamera.mhiNvrdev.Start2Mp4(gridItem.getPath(), LeftLocalVideoFragment.this.mConverFile.getAbsolutePath());
                                return;
                            }
                            return;
                        } else if (!LeftLocalVideoFragment.this.mMyCamera.getdevDual()) {
                            if (LeftLocalVideoFragment.this.mPlayLocal != null) {
                                LeftLocalVideoFragment.this.mPlayLocal.Start2Mp4(gridItem.getPath(), LeftLocalVideoFragment.this.mConverFile.getAbsolutePath());
                                return;
                            }
                            return;
                        } else {
                            if (LeftLocalVideoFragment.this.mPlaydualLocal != null) {
                                LeftLocalVideoFragment.this.mPlaydualLocal.Start2Mp4(gridItem.getPath(), LeftLocalVideoFragment.this.mConverFile.getAbsolutePath(), LeftLocalVideoFragment.this.mConver2File.getAbsolutePath());
                                return;
                            }
                            return;
                        }
                    }
                    Message obtain = Message.obtain();
                    obtain.what = 131073;
                    obtain.arg1 = i;
                    obtain.obj = gridItem.getPath();
                    LeftLocalVideoFragment.this.mHandler.sendMessageDelayed(obtain, 1000L);
                }
            }
        });
    }

    protected void DumpDialogshow(final GridItem gridItem) {
        final NiftyDialogBuilder niftyDialogBuilder = NiftyDialogBuilder.getInstance(getContext());
        niftyDialogBuilder.isCancelable(false).withTitle(getContext().getString(R.string.to_album)).withMessage(getContext().getString(R.string.tint_to_album)).withButton1Text(getContext().getString(R.string.cancel)).withButton2Text(getContext().getString(R.string.sure)).setButton1Click(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                niftyDialogBuilder.dismiss();
            }
        }).setButton2Click(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                niftyDialogBuilder.dismiss();
                final File file = new File(HiDataValue.getConvertPath(LeftLocalVideoFragment.this.getActivity()) + LeftLocalVideoFragment.this.mMyCamera.getUid() + "/", gridItem.getFileName());
                if (HiTools.isSDCardExist() && file.exists()) {
                    if (file.getAbsolutePath().contains(LeftLocalVideoFragment.this.getContext().getPackageName())) {
                        FileHelper.saveVideoToSystemAlbum(file, LeftLocalVideoFragment.this.getContext());
                        MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.success_to_album));
                        return;
                    } else {
                        MyToast.showToast(LeftLocalVideoFragment.this.getContext(), LeftLocalVideoFragment.this.getContext().getString(R.string.file_alearly_convert));
                        return;
                    }
                }
                if (!file.getParentFile().exists()) {
                    file.getParentFile().mkdirs();
                }
                if (file.isFile() && file.exists()) {
                    file.delete();
                }
                new Thread() {
                    @Override
                    public void run() {
                        LeftLocalVideoFragment.this.copyFile(gridItem.getPath(), file.getAbsolutePath());
                        Message obtain = Message.obtain();
                        obtain.obj = file;
                        obtain.what = 2184;
                        LeftLocalVideoFragment.this.mHandler.sendMessage(obtain);
                    }
                }.start();
            }
        });
        niftyDialogBuilder.show();
    }

    public void copyFile(String str, String str2) {
        try {
            if (!new File(str).exists()) {
                return;
            }
            FileInputStream fileInputStream = new FileInputStream(str);
            FileOutputStream fileOutputStream = new FileOutputStream(str2);
            byte[] bArr = new byte[1444];
            while (true) {
                int read = fileInputStream.read(bArr);
                if (read != -1) {
                    fileOutputStream.write(bArr, 0, read);
                } else {
                    fileInputStream.close();
                    return;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void showTransPupwindow(int i) {
        View inflate = View.inflate(getContext(), R.layout.dialog_trans_pro, null);
        final PopupWindow popupWindow = new PopupWindow(inflate);
        popupWindow.setBackgroundDrawable(new ColorDrawable(0));
        popupWindow.setOutsideTouchable(true);
        popupWindow.setFocusable(true);
        popupWindow.setWidth(-1);
        popupWindow.setHeight(-1);
        popupWindow.showAtLocation(inflate, 17, 0, 0);
        TextView textView = (TextView) inflate.findViewById(R.id.tv_cancel);
        this.mTvCancel = textView;
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                popupWindow.dismiss();
            }
        });
        popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
            @Override
            public void onDismiss() {
                if (LeftLocalVideoFragment.this.getContext().getString(R.string.cancel).equals(LeftLocalVideoFragment.this.mTvCancel.getText().toString())) {
                    LeftLocalVideoFragment.this.isClickCancel = true;
                    if (HiTools.isNVRDev(LeftLocalVideoFragment.this.mMyCamera.getUid())) {
                        LeftLocalVideoFragment.this.mMyCamera.mhiNvrdev.Stop2Mp4();
                    } else if (!LeftLocalVideoFragment.this.mMyCamera.getdevDual()) {
                        LeftLocalVideoFragment.this.mPlayLocal.Stop2Mp4();
                    } else {
                        LeftLocalVideoFragment.this.mPlaydualLocal.Stop2Mp4();
                    }
                    if (LeftLocalVideoFragment.this.mMyCamera.mPlayOSS != null) {
                        LeftLocalVideoFragment.this.mMyCamera.mPlayOSS.Stop2Mp4();
                    }
                    if (LeftLocalVideoFragment.this.mMyCamera.mPlayDualOSS != null) {
                        LeftLocalVideoFragment.this.mMyCamera.mPlayDualOSS.Stop2Mp4();
                    }
                    if (LeftLocalVideoFragment.this.mConverFile.exists()) {
                        LeftLocalVideoFragment.this.mConverFile.delete();
                    }
                    if (LeftLocalVideoFragment.this.mMyCamera.getdevDual() && LeftLocalVideoFragment.this.mConver2File.exists()) {
                        LeftLocalVideoFragment.this.mConver2File.delete();
                    }
                }
            }
        });
        this.mTvTransRote = (TextView) inflate.findViewById(R.id.rate_loading_trances);
        SeekBar seekBar = (SeekBar) inflate.findViewById(R.id.sb_transd_video);
        this.mSeekBarTrans = seekBar;
        seekBar.setMax(i * 1000);
    }

    @Override
    public void callbackplaylocalExt(int i, int i2, int i3, long j, long j2, int i4, int i5, String str) {
        Message obtain = Message.obtain();
        if (i5 == -11) {
            MyToast.showToast(getContext(), getString(R.string.data_parsing_error));
            return;
        }
        if (i5 == 10) {
            obtain.what = 10;
            obtain.arg1 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 == 12) {
            if (this.mFirstTime == 0) {
                this.mFirstTime = j2;
            }
            int i6 = (int) (j2 - this.mFirstTime);
            obtain.what = 12;
            obtain.arg1 = i6;
            obtain.arg2 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 == 13 && getContext() != null) {
            if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
                this.mMyCamera.mhiNvrdev.Stop2Mp4();
            } else if (!this.mMyCamera.getdevDual()) {
                this.mPlayLocal.Stop2Mp4();
            } else {
                this.mPlaydualLocal.Stop2Mp4();
            }
            if (this.mMyCamera.mPlayOSS != null) {
                this.mMyCamera.mPlayOSS.Stop2Mp4();
            }
            if (this.mMyCamera.mPlayDualOSS != null) {
                this.mMyCamera.mPlayDualOSS.Stop2Mp4();
            }
            this.mHandler.sendEmptyMessage(13);
        }
    }

    @Override
    public void callbackplayDuallocalExt(int i, int i2, int i3, int i4, long j, long j2, int i5, int i6, String str) {
        if (i == 2) {
            return;
        }
        Message obtain = Message.obtain();
        if (i6 == -11) {
            MyToast.showToast(getContext(), getString(R.string.data_parsing_error));
            return;
        }
        if (i6 == 10) {
            obtain.what = 10;
            obtain.arg1 = i4;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i6 == 12) {
            if (this.mFirstTime == 0) {
                this.mFirstTime = j2;
            }
            int i7 = (int) (j2 - this.mFirstTime);
            obtain.what = 12;
            obtain.arg1 = i7;
            obtain.arg2 = i4;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i6 != 13) {
            return;
        }
        if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            this.mMyCamera.mhiNvrdev.Stop2Mp4();
        } else if (!this.mMyCamera.getdevDual()) {
            this.mPlayLocal.Stop2Mp4();
        } else {
            this.mPlaydualLocal.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayOSS != null) {
            this.mMyCamera.mPlayOSS.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayDualOSS != null) {
            this.mMyCamera.mPlayDualOSS.Stop2Mp4();
        }
        this.mHandler.sendEmptyMessage(13);
    }

    @Override
    public void callbackplaylocalDual(int i, int i2, int i3, int i4, long j, int i5, int i6) {
        if (i == 2) {
            return;
        }
        Message obtain = Message.obtain();
        if (i6 == -11) {
            MyToast.showToast(getContext(), getString(R.string.data_parsing_error));
            return;
        }
        if (i6 == 10) {
            obtain.what = 10;
            obtain.arg1 = i4;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i6 == 12) {
            if (this.mFirstTime == 0) {
                this.mFirstTime = j;
            }
            int i7 = (int) (j - this.mFirstTime);
            obtain.what = 12;
            obtain.arg1 = i7;
            obtain.arg2 = i4;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i6 != 13) {
            return;
        }
        if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            this.mMyCamera.mhiNvrdev.Stop2Mp4();
        } else if (!this.mMyCamera.getdevDual()) {
            this.mPlayLocal.Stop2Mp4();
        } else {
            this.mPlaydualLocal.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayOSS != null) {
            this.mMyCamera.mPlayOSS.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayDualOSS != null) {
            this.mMyCamera.mPlayDualOSS.Stop2Mp4();
        }
        this.mHandler.sendEmptyMessage(13);
    }

    @Override
    public void callbackplaylocal(int i, int i2, int i3, long j, int i4, int i5) {
        Message obtain = Message.obtain();
        if (i5 == -11) {
            MyToast.showToast(getContext(), getString(R.string.data_parsing_error));
            return;
        }
        if (i5 == 10) {
            obtain.what = 10;
            obtain.arg1 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 == 12) {
            if (this.mFirstTime == 0) {
                this.mFirstTime = j;
            }
            int i6 = (int) (j - this.mFirstTime);
            obtain.what = 12;
            obtain.arg1 = i6;
            obtain.arg2 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 != 13) {
            return;
        }
        if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            this.mMyCamera.mhiNvrdev.Stop2Mp4();
        } else if (!this.mMyCamera.getdevDual()) {
            this.mPlayLocal.Stop2Mp4();
        } else {
            this.mPlaydualLocal.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayOSS != null) {
            this.mMyCamera.mPlayOSS.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayDualOSS != null) {
            this.mMyCamera.mPlayDualOSS.Stop2Mp4();
        }
        this.mHandler.sendEmptyMessage(13);
    }

    @Override
    public void callbackplaylocal(HiCamera hiCamera, int i, int i2, int i3, long j, int i4, int i5) {
        Message obtain = Message.obtain();
        if (i5 == -11) {
            MyToast.showToast(getContext(), getString(R.string.data_parsing_error));
            return;
        }
        if (i5 == 10) {
            obtain.what = 10;
            obtain.arg1 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 == 12) {
            if (this.mFirstTime == 0) {
                this.mFirstTime = j;
            }
            int i6 = (int) (j - this.mFirstTime);
            obtain.what = 12;
            obtain.arg1 = i6;
            obtain.arg2 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 != 13) {
            return;
        }
        if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
            this.mMyCamera.mhiNvrdev.Stop2Mp4();
        } else if (!this.mMyCamera.getdevDual()) {
            this.mPlayLocal.Stop2Mp4();
        } else {
            this.mPlaydualLocal.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayOSS != null) {
            this.mMyCamera.mPlayOSS.Stop2Mp4();
        }
        if (this.mMyCamera.mPlayDualOSS != null) {
            this.mMyCamera.mPlayDualOSS.Stop2Mp4();
        }
        this.mHandler.sendEmptyMessage(13);
    }

    @Override
    public void callbackplaylocalExt(HiCamera hiCamera, int i, int i2, int i3, long j, int i4, int i5, String str) {
        Message obtain = Message.obtain();
        if (i5 == -11) {
            MyToast.showToast(getContext(), getString(R.string.data_parsing_error));
            return;
        }
        if (i5 == 10) {
            obtain.what = 10;
            obtain.arg1 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 == 12) {
            if (this.mFirstTime == 0) {
                this.mFirstTime = j;
            }
            int i6 = (int) (j - this.mFirstTime);
            obtain.what = 12;
            obtain.arg1 = i6;
            obtain.arg2 = i3;
            this.mHandler.sendMessage(obtain);
            return;
        }
        if (i5 == 13 && getContext() != null) {
            if (HiTools.isNVRDev(this.mMyCamera.getUid())) {
                this.mMyCamera.mhiNvrdev.Stop2Mp4();
            } else if (!this.mMyCamera.getdevDual()) {
                this.mPlayLocal.Stop2Mp4();
            } else {
                this.mPlaydualLocal.Stop2Mp4();
            }
            if (this.mMyCamera.mPlayOSS != null) {
                this.mMyCamera.mPlayOSS.Stop2Mp4();
            }
            if (this.mMyCamera.mPlayDualOSS != null) {
                this.mMyCamera.mPlayDualOSS.Stop2Mp4();
            }
            this.mHandler.sendEmptyMessage(13);
        }
    }
}