TimePlaybackNewFragment.java 源代码
package timeaxis;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.v4.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.PopupWindow;
import android.widget.RadioButton;
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.ICameraPlayStateCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.hichip.tools.Packet;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.xiaomi.mipush.sdk.Constants;
import common.HiDataValue;
import common.MyPlaybackGLMonitor;
import custom.NoSlidingViewPager;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import main.MainActivity;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import timeaxis.TimePlaybackNewFragment;
import timeaxis.bean.FilePlaybackModel;
import timeaxis.bean.MsyIsStop;
import timeaxis.bean.PlaybackVo;
import timeaxis.bean.ResetSizeModel;
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.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;
import utils.OrientationWatchDog;
import utils.SharePreUtils;
public class TimePlaybackNewFragment extends HiFragment implements ICameraIOSessionCallback, ICameraPlayStateCallback, View.OnTouchListener, View.OnClickListener, OrientationWatchDog.OnOrientationListener {
private static final int HANDLE_VIDEO_RUN = -1879048183;
public static int mMonth;
public static int mYear;
private int PictureRealHeight;
private int PictureRealWidth;
private float action_down_x;
private float action_down_y;
public float bottom;
ImageView bt_landdualswitch;
private int currentPlayPosition;
private long currentPlayVideoStartTime;
boolean currentTypeIs2;
int fileType;
private long firstVideoStartTime;
public float height;
private boolean isCalenderChangedMonth;
private boolean isNeedShowProgress;
private boolean isOtherDay;
private boolean isQuit;
ImageView iv_adaption;
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 TimeAxisActivity mAct;
private int mHeight;
private boolean mIsDataReceveEnd;
ImageView mIvLoading;
private MyCamera mMyCamera;
private OrientationWatchDog mOrientationWatchDog;
private PopupWindow mPopupWindow;
public MyPlaybackGLMonitor monitor;
int moveX;
int moveY;
float move_x;
float move_y;
TimeLineNew myTimeLineView;
private int nearVideoDay;
private boolean noFileNeedJump;
private MyPagerAdapter pagerAdapter;
private int preModle;
RadioButton rb_alarm;
RadioButton rb_all;
private int recentHaveVideoDay;
RelativeLayout rl_monitor;
public LinearLayout root_lock_screen;
private HiChipDefines.SD_FILEDAY sd_fileday;
View shadowView;
LinearLayout stc_calendar_layout;
private TimeAxisActivity timeAxisActivity;
public boolean timePlayStart;
private GridView title_gView;
private boolean todayHasVideo;
private TextView tvAdaption;
private TextView tvFill;
TextView tv_time;
TextView tv_years_month;
private boolean videoIsPause;
private boolean videoIsPlaying;
private int video_height;
private int video_width;
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 int mPictureSize = 0;
private boolean isLeft = true;
private boolean isFirstRevolveLand = false;
private boolean isReadyPlay = false;
private int isLarge = 0;
public boolean mIsClickReturn = false;
private boolean isPlayEnd = false;
private boolean mIsCallStop = false;
private boolean mIsVisibleToUser = true;
private boolean isFirstIn = true;
private boolean mIsPlayback = false;
private boolean mIsResetSize = false;
private boolean mBackToNoFile = false;
private Handler lineHandler = new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == -1879048183 && TimePlaybackNewFragment.this.myTimeLineView.isCanPlay) {
if (TimePlaybackNewFragment.this.tv_time.getVisibility() == 0) {
TimePlaybackNewFragment.this.tv_time.setVisibility(8);
}
if (!TimePlaybackNewFragment.this.mIsVisibleToUser) {
if (TimePlaybackNewFragment.this.mMyCamera != null) {
if (TimePlaybackNewFragment.this.myTimeLineView != null) {
HiLog.e("tedG--....()....--" + TimePlaybackNewFragment.this.mTimeInMicros + ";;;;");
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.mTimeInMicros = timePlaybackNewFragment.myTimeLineView.getCurrentValue();
HiLog.e("tedG--....()....--" + TimePlaybackNewFragment.this.mTimeInMicros + ";;;;");
}
if (TimePlaybackNewFragment.this.videoIsPause || !TimePlaybackNewFragment.this.videoIsPlaying) {
return;
}
TimePlaybackNewFragment.this.pausePlayVideo();
TimePlaybackNewFragment.this.videoIsPause = true;
TimePlaybackNewFragment.this.videoIsPlaying = false;
return;
}
return;
}
TimePlaybackNewFragment.this.myTimeLineView.setValue(TimePlaybackNewFragment.this.firstVideoStartTime + Long.parseLong(message.arg1 + "000000"));
if (TimePlaybackNewFragment.this.timePlayStart) {
return;
}
TimePlaybackNewFragment.this.timePlayStart = true;
}
}
};
private Handler handler = new AnonymousClass8();
double nLenStart = 0.0d;
private Handler mHandler_lockScreen = new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
TimePlaybackNewFragment.this.root_lock_screen.setVisibility(0);
TimePlaybackNewFragment.this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
} else {
TimePlaybackNewFragment.this.root_lock_screen.setVisibility(8);
TimePlaybackNewFragment.this.mHandler_lockScreen.removeCallbacksAndMessages(null);
}
}
};
@Override
public void callbackPlayUTC2(HiCamera hiCamera, int i, int i2) {
}
@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 void onAttach(Context context) {
super.onAttach(context);
HiLog.e("tedG--....onResume()....--");
this.mAct = (TimeAxisActivity) context;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
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_time_playback_new, (ViewGroup) null);
getActivity().getWindow().addFlags(128);
ButterKnife.bind(this, this.view);
getIntentData();
initViewAndData();
initViewPager();
setListeners();
initOrientationWatchdog();
return this.view;
}
private void setListeners() {
this.iv_adaption.setOnClickListener(this);
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.setOnClickListener(this);
this.monitor.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) {
TimePlaybackNewFragment.this.calStartDate.add(2, i - TimePlaybackNewFragment.this.perPager);
TimePlaybackNewFragment.this.calStartDate.set(5, 1);
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.perPager = timePlaybackNewFragment.currPager = i;
TimePlaybackNewFragment.this.tv_years_month.setText(TimePlaybackNewFragment.this.calStartDate.get(1) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + (TimePlaybackNewFragment.this.calStartDate.get(2) + 1));
if (TimePlaybackNewFragment.this.calStartDate.get(1) != TimePlaybackNewFragment.mYear || TimePlaybackNewFragment.this.calStartDate.get(2) + 1 != TimePlaybackNewFragment.mMonth) {
TimePlaybackNewFragment.this.isCalenderChangedMonth = true;
TimePlaybackNewFragment.this.otherMonthAllHaveVideoDayList.clear();
TimePlaybackNewFragment.this.viewpager.setScanScroll(false);
TimePlaybackNewFragment.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLDAY, HiChipDefines.SD_YEARMONTH.parseContent(TimePlaybackNewFragment.this.calStartDate.get(1), TimePlaybackNewFragment.this.calStartDate.get(2) + 1));
return;
}
HiLog.e("MsgCalenderDay:");
EventBus.getDefault().post(new MsgCalenderDay(TimePlaybackNewFragment.this.allHaveVideoDayList, TimePlaybackNewFragment.this.alreadyGetVideoDay, TimePlaybackNewFragment.this.mSelectPosition, TimePlaybackNewFragment.this.currPager));
}
});
this.rb_all.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TimePlaybackNewFragment.this.onClick(view);
}
});
this.rb_alarm.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
TimePlaybackNewFragment.this.onClick(view);
}
});
this.bt_landdualswitch.setVisibility(8);
}
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(HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL);
}
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.setCamera(this.mMyCamera);
this.monitor.setVisibility(0);
this.mMyCamera.setLiveShowMonitor(this.monitor);
DisplayMetrics displayMetrics = new DisplayMetrics();
this.mAct.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
this.mHeight = HiTools.dip2px(getContext(), 250.0f);
this.rl_monitor.setLayoutParams(new LinearLayout.LayoutParams(-1, this.mHeight));
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) {
TimePlaybackNewFragment.this.iv_placeholder.setImageBitmap(bitmap);
}
});
}
setListenerTimeView();
String[] stringArray = getResources().getStringArray(R.array.event_type);
this.rb_all.setText(stringArray[0]);
this.rb_alarm.setText(stringArray[2]);
this.rb_all.setEnabled(false);
this.rb_alarm.setEnabled(false);
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
this.monitor.screen_height = displayMetrics.heightPixels;
this.monitor.screen_width = displayMetrics.widthPixels;
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
this.monitor.setState(0);
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
myPlaybackGLMonitor.setMatrix(myPlaybackGLMonitor.left, this.monitor.bottom, this.monitor.width, this.monitor.height);
resetMonitorSize(false, 10000.0d);
}
private void initViewPager() {
MyPagerAdapter myPagerAdapter = new MyPagerAdapter(this.mAct, false);
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;
}
TimePlaybackNewFragment.this.calStartDate.set(5, 1);
int i2 = TimePlaybackNewFragment.this.calStartDate.get(7) - 1;
int i3 = TimePlaybackNewFragment.this.calStartDate.get(2) + 1;
int i4 = (i - i2) + 1;
if (i4 == TimePlaybackNewFragment.this.nearVideoDay && i3 == TimePlaybackNewFragment.mMonth) {
return;
}
int i5 = TimePlaybackNewFragment.this.calStartDate.get(2) + 1;
TimePlaybackNewFragment.this.myTimeLineView.handler.removeMessages(1);
TimePlaybackNewFragment.this.myTimeLineView.handler.removeMessages(0);
if (i5 == TimePlaybackNewFragment.mMonth) {
Iterator it = TimePlaybackNewFragment.this.allHaveVideoDayList.iterator();
while (true) {
if (it.hasNext()) {
if (((Integer) it.next()).intValue() == i4) {
z2 = true;
break;
}
} else {
z2 = false;
break;
}
}
if (z2) {
TimePlaybackNewFragment.this.nearVideoDay = i4;
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.mSelectPosition = timePlaybackNewFragment.nearVideoDay;
HiLog.e("MsgCalenderDay:");
EventBus.getDefault().post(new MsgCalenderDay(TimePlaybackNewFragment.this.allHaveVideoDayList, TimePlaybackNewFragment.this.alreadyGetVideoDay, TimePlaybackNewFragment.this.mSelectPosition, TimePlaybackNewFragment.this.currPager));
if (!TimePlaybackNewFragment.this.alreadyGetVideoDay.contains(Integer.valueOf(TimePlaybackNewFragment.this.nearVideoDay))) {
TimePlaybackNewFragment.this.mMyCamera.stopPlaybackNew();
TimePlaybackNewFragment.this.videoIsPlaying = false;
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = false;
TimePlaybackNewFragment.this.one_day_file_list.clear();
TimePlaybackNewFragment.this.file_list.clear();
TimePlaybackNewFragment.this.file_list1.clear();
TimePlaybackNewFragment.this.isOtherDay = true;
TimePlaybackNewFragment.this.videoIsPause = false;
TimePlaybackNewFragment timePlaybackNewFragment2 = TimePlaybackNewFragment.this;
timePlaybackNewFragment2.removeVideoList(timePlaybackNewFragment2.nearVideoDay);
TimePlaybackNewFragment.this.showLoadingView();
TimePlaybackNewFragment.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, TimePlaybackNewFragment.mYear, TimePlaybackNewFragment.mMonth, TimePlaybackNewFragment.this.nearVideoDay, TimePlaybackNewFragment.this.getFileType()));
TimePlaybackNewFragment.this.alreadyGetVideoDay.add(Integer.valueOf(TimePlaybackNewFragment.this.nearVideoDay));
return;
}
TimePlaybackNewFragment.this.mMyCamera.stopPlaybackNew();
TimePlaybackNewFragment.this.videoIsPlaying = false;
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = false;
TimePlaybackNewFragment.this.one_day_file_list.clear();
TimePlaybackNewFragment timePlaybackNewFragment3 = TimePlaybackNewFragment.this;
timePlaybackNewFragment3.removeVideoList(timePlaybackNewFragment3.nearVideoDay);
TimePlaybackNewFragment.this.videoIsPause = false;
TimePlaybackNewFragment.this.showLoadingView();
TimePlaybackNewFragment.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, TimePlaybackNewFragment.mYear, TimePlaybackNewFragment.mMonth, TimePlaybackNewFragment.this.nearVideoDay, TimePlaybackNewFragment.this.getFileType()));
return;
}
return;
}
Iterator it2 = TimePlaybackNewFragment.this.otherMonthAllHaveVideoDayList.iterator();
while (true) {
if (it2.hasNext()) {
if (((Integer) it2.next()).intValue() == i4) {
z = true;
break;
}
} else {
z = false;
break;
}
}
if (z) {
TimePlaybackNewFragment.this.showLoadingView();
TimePlaybackNewFragment.this.mMyCamera.stopPlaybackNew();
TimePlaybackNewFragment.this.reset();
TimePlaybackNewFragment.this.nearVideoDay = i4;
TimePlaybackNewFragment timePlaybackNewFragment4 = TimePlaybackNewFragment.this;
timePlaybackNewFragment4.mSelectPosition = timePlaybackNewFragment4.nearVideoDay;
TimePlaybackNewFragment.this.allHaveVideoDayList.addAll(TimePlaybackNewFragment.this.otherMonthAllHaveVideoDayList);
for (int i6 = 0; i6 < TimePlaybackNewFragment.this.allHaveVideoDayList.size(); i6++) {
TimePlaybackNewFragment.this.myTimeLineView.date[((Integer) TimePlaybackNewFragment.this.allHaveVideoDayList.get(i6)).intValue() - 1] = 1;
}
TimePlaybackNewFragment.mYear = TimePlaybackNewFragment.this.calStartDate.get(1);
TimePlaybackNewFragment.mMonth = TimePlaybackNewFragment.this.calStartDate.get(2) + 1;
TimePlaybackNewFragment.this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, TimePlaybackNewFragment.mYear, TimePlaybackNewFragment.mMonth, TimePlaybackNewFragment.this.nearVideoDay, TimePlaybackNewFragment.this.getFileType()));
TimePlaybackNewFragment.this.alreadyGetVideoDay.add(Integer.valueOf(TimePlaybackNewFragment.this.nearVideoDay));
if (TimePlaybackNewFragment.this.allHaveVideoDayList == null || TimePlaybackNewFragment.this.allHaveVideoDayList.size() <= 0) {
return;
}
TimePlaybackNewFragment timePlaybackNewFragment5 = TimePlaybackNewFragment.this;
timePlaybackNewFragment5.recentHaveVideoDay = ((Integer) timePlaybackNewFragment5.allHaveVideoDayList.get(TimePlaybackNewFragment.this.allHaveVideoDayList.size() - 1)).intValue();
}
}
});
}
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 && TimePlaybackNewFragment.this.isNeedShowProgress) {
TimePlaybackNewFragment.this.tv_time.setVisibility(0);
TimePlaybackNewFragment.this.timePlayStart = false;
}
TimePlaybackNewFragment.this.tv_time.setText(str);
if (str.contains("23:59:59")) {
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = false;
}
}
@Override
public void onVideoStart(String str, long j, int i) {
TimePlaybackNewFragment.this.tv_time.setVisibility(8);
TimePlaybackNewFragment.this.handler.postDelayed(new Runnable() {
@Override
public final void run() {
TimePlaybackNewFragment.AnonymousClass4.this.lambda$onVideoStart$0$TimePlaybackNewFragment$4();
}
}, 500L);
if (TimePlaybackNewFragment.this.getDay(j) != -1) {
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.nearVideoDay = timePlaybackNewFragment.getDay(j);
}
if (TimePlaybackNewFragment.this.isDrag) {
if (TimePlaybackNewFragment.this.mBackToNoFile) {
final int findVideoFile = TimePlaybackNewFragment.this.findVideoFile(j, i);
if (findVideoFile == -1) {
TimePlaybackNewFragment.this.myTimeLineView.listener.onNoneVideo(str, j);
return;
}
if (TimePlaybackNewFragment.this.myTimeLineView.isScroll()) {
return;
}
final PlaybackVo playbackVo = (PlaybackVo) TimePlaybackNewFragment.this.curentDayVideo.get(findVideoFile);
TimePlaybackNewFragment.this.oldTime = 0L;
TimePlaybackNewFragment.this.firstVideoStartTime = j;
TimePlaybackNewFragment.this.setpos = 1;
TimePlaybackNewFragment.this.currentPlayPosition = findVideoFile;
final byte[] bArr = new byte[8];
System.arraycopy(playbackVo.getTest(), 0, bArr, 0, 8);
final long startTime = playbackVo.getStartTime() / 1000;
final long endTime = playbackVo.getEndTime() / 1000;
final byte flag = playbackVo.getFlag();
new Thread() {
@Override
public void run() {
super.run();
if (TimePlaybackNewFragment.this.isQuit) {
return;
}
TimePlaybackNewFragment.this.mBackToNoFile = false;
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), startTime, endTime, 0, TimePlaybackNewFragment.this.curentDayVideo.size() - findVideoFile, 0, flag, TimePlaybackNewFragment.this.monitor);
TimePlaybackNewFragment.this.myTimeLineView.moveToValue(playbackVo.getStartTime());
}
}.start();
TimePlaybackNewFragment.this.videoIsPause = false;
TimePlaybackNewFragment.this.videoIsPlaying = true;
return;
}
TimePlaybackNewFragment.this.handPlayStart(str, j, i);
return;
}
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = true;
TimePlaybackNewFragment.this.isPlayEnd = false;
if (TimePlaybackNewFragment.this.one_day_file_list.size() > 0) {
PlaybackVo playbackVo2 = (PlaybackVo) TimePlaybackNewFragment.this.one_day_file_list.get(0);
TimePlaybackNewFragment.this.setpos = 0;
TimePlaybackNewFragment.this.oldTime = 0L;
TimePlaybackNewFragment.this.firstVideoStartTime = playbackVo2.getStartTime();
TimePlaybackNewFragment.this.currentPlayVideoStartTime = playbackVo2.getStartTime();
byte[] bArr2 = new byte[8];
System.arraycopy(playbackVo2.getTest(), 0, bArr2, 0, 8);
TimePlaybackNewFragment.this.startPlayBack(bArr2, playbackVo2.getStartTime() / 1000, playbackVo2.getEndTime() / 1000, 0L, 0, 0, playbackVo2.getFlag());
TimePlaybackNewFragment.this.isDrag = true;
TimePlaybackNewFragment.this.isNeedShowProgress = true;
}
}
public void lambda$onVideoStart$0$TimePlaybackNewFragment$4() {
TimePlaybackNewFragment.this.iv_full_screen.setEnabled(true);
TimePlaybackNewFragment.this.iv_snapshot.setEnabled(true);
}
@Override
public void onNoneVideo(String str, long j) {
final int i;
TimePlaybackNewFragment.this.dismissLoadingView();
if (TimePlaybackNewFragment.this.videoIsPlaying && TimePlaybackNewFragment.this.one_day_file_list.size() > 0) {
TimePlaybackNewFragment.this.tv_time.postDelayed(new Runnable() {
@Override
public void run() {
TimePlaybackNewFragment.this.iv_placeholder.setVisibility(0);
TimePlaybackNewFragment.this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, TimePlaybackNewFragment.this.mHeight));
if (TimePlaybackNewFragment.this.mAct != null && !TimePlaybackNewFragment.this.mAct.isFinishing()) {
Toast.makeText(TimePlaybackNewFragment.this.mAct, TimePlaybackNewFragment.this.getString(R.string.current_not_video), 1).show();
}
if (TimePlaybackNewFragment.this.videoIsPause || !TimePlaybackNewFragment.this.videoIsPlaying) {
return;
}
TimePlaybackNewFragment.this.pausePlayVideo();
TimePlaybackNewFragment.this.videoIsPlaying = false;
TimePlaybackNewFragment.this.videoIsPause = true;
}
}, 500L);
} else if (TimePlaybackNewFragment.this.iv_placeholder.getVisibility() == 0) {
if (TimePlaybackNewFragment.this.curentDayVideo.size() > 0) {
i = TimePlaybackNewFragment.this.myTimeLineView.getCurrentValue() / 1000000 < ((PlaybackVo) TimePlaybackNewFragment.this.curentDayVideo.get(0)).getStartTime() / 1000000 ? 0 : TimePlaybackNewFragment.this.myTimeLineView.getCurrentValue() / 1000000 > ((PlaybackVo) TimePlaybackNewFragment.this.curentDayVideo.get(TimePlaybackNewFragment.this.curentDayVideo.size() - 1)).getEndTime() / 1000000 ? TimePlaybackNewFragment.this.curentDayVideo.size() - 1 : -1;
} else {
i = -1;
}
if (i != -1) {
final PlaybackVo playbackVo = (PlaybackVo) TimePlaybackNewFragment.this.curentDayVideo.get(i);
if (TimePlaybackNewFragment.this.mBackToNoFile) {
TimePlaybackNewFragment.this.oldTime = 0L;
TimePlaybackNewFragment.this.firstVideoStartTime = j;
TimePlaybackNewFragment.this.setpos = 1;
TimePlaybackNewFragment.this.currentPlayPosition = i;
final byte[] bArr = new byte[8];
System.arraycopy(playbackVo.getTest(), 0, bArr, 0, 8);
final long startTime = playbackVo.getStartTime() / 1000;
final long endTime = playbackVo.getEndTime() / 1000;
final byte flag = playbackVo.getFlag();
new Thread() {
@Override
public void run() {
super.run();
if (TimePlaybackNewFragment.this.isQuit) {
return;
}
TimePlaybackNewFragment.this.mBackToNoFile = false;
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), startTime, endTime, 0, TimePlaybackNewFragment.this.curentDayVideo.size() - i, 0, flag, TimePlaybackNewFragment.this.monitor);
TimePlaybackNewFragment.this.myTimeLineView.moveToValue(playbackVo.getStartTime());
}
}.start();
} else {
TimePlaybackNewFragment.this.myTimeLineView.moveToValue(playbackVo.getStartTime());
}
}
}
if (TimePlaybackNewFragment.this.videoIsPause && !TimePlaybackNewFragment.this.videoIsPlaying && TimePlaybackNewFragment.this.iv_placeholder.getVisibility() != 0) {
TimePlaybackNewFragment.this.iv_placeholder.setVisibility(0);
TimePlaybackNewFragment.this.iv_placeholder.setLayoutParams(new RelativeLayout.LayoutParams(-1, TimePlaybackNewFragment.this.mHeight));
}
TimePlaybackNewFragment.this.timePlayStart = true;
}
@Override
public void onChangedScaleMode() {
if (TimePlaybackNewFragment.this.myTimeLineView.getScaleMode() == 120 || TimePlaybackNewFragment.this.myTimeLineView.getScaleMode() == 600) {
if (TimePlaybackNewFragment.this.preModle != TimePlaybackNewFragment.this.myTimeLineView.getScaleMode()) {
TimePlaybackNewFragment.this.myTimeLineView.setVideos(TimePlaybackNewFragment.this.file_list, false, 0L);
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.preModle = timePlaybackNewFragment.myTimeLineView.getScaleMode();
return;
}
return;
}
if (TimePlaybackNewFragment.this.preModle != TimePlaybackNewFragment.this.myTimeLineView.getScaleMode()) {
TimePlaybackNewFragment.this.myTimeLineView.setVideos(TimePlaybackNewFragment.this.file_list1, false, 0L);
TimePlaybackNewFragment timePlaybackNewFragment2 = TimePlaybackNewFragment.this;
timePlaybackNewFragment2.preModle = timePlaybackNewFragment2.myTimeLineView.getScaleMode();
}
}
}
private void setListenerTimeView() {
this.myTimeLineView.setOnPlaybackViewListener(new AnonymousClass4());
}
public void handPlayStart(String str, long j, int i) {
int findVideoFile = findVideoFile(j, i);
if (findVideoFile == -1) {
this.myTimeLineView.listener.onNoneVideo(str, j);
return;
}
if (this.myTimeLineView.isScroll()) {
return;
}
PlaybackVo playbackVo = this.curentDayVideo.get(findVideoFile);
if (this.noFileNeedJump) {
this.myTimeLineView.moveToValue(playbackVo.getStartTime());
return;
}
this.oldTime = 0L;
this.firstVideoStartTime = j;
this.setpos = 1;
this.currentPlayPosition = findVideoFile;
byte[] bArr = new byte[8];
System.arraycopy(playbackVo.getTest(), 0, bArr, 0, 8);
if (this.videoIsPlaying || this.videoIsPause) {
this.iv_placeholder.setVisibility(4);
startPlayBack(bArr, playbackVo.getStartTime() / 1000, playbackVo.getEndTime() / 1000, (j - playbackVo.getStartTime()) / 1000, findVideoFile, 1, playbackVo.getFlag());
} else {
this.iv_placeholder.setVisibility(4);
startPlayBack(bArr, playbackVo.getStartTime() / 1000, playbackVo.getEndTime() / 1000, (j - playbackVo.getStartTime()) / 1000, findVideoFile, 0, playbackVo.getFlag());
}
this.videoIsPause = false;
this.videoIsPlaying = true;
}
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() {
MyCamera myCamera = this.mMyCamera;
if (myCamera != null) {
myCamera.sendIOCtrl(HiChipDefines.HI_P2P_RECORD_PLAY, HiChipDefines.PB_RECORDPLAY_REQ.parseContent(0, (short) 3, 0L, 0L, 0, 0, 0, 0));
this.mMyCamera.SetPlaybackTimePause();
}
}
protected int findVideoFile(long j, int i) {
HiLog.e("tedG--....()....--" + j + ";;;;" + i);
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;
}
int size = this.curentDayVideo.size() - 1;
int i3 = 0;
while (i3 <= size) {
int i4 = (i3 + size) / 2;
long j2 = j / 1000000;
if (this.curentDayVideo.get(i4).getStartTime() / 1000000 <= j2 && this.curentDayVideo.get(i4).getEndTime() / 1000000 >= j2) {
this.noFileNeedJump = false;
return i4;
}
if (this.curentDayVideo.get(i4).getEndTime() / 1000000 <= j2) {
i3 = i4 + 1;
} else if (this.curentDayVideo.get(i4).getStartTime() / 1000000 > j2) {
size = i4 - 1;
}
}
int i5 = (i3 + size) / 2;
HiLog.e("tedG--....()....--" + size + "::" + i3 + ":::" + this.curentDayVideo.size());
if (size < 0 || i3 > this.curentDayVideo.size() - 1) {
HiLog.e("tedG--....()....--");
return -1;
}
if (i == 1) {
this.noFileNeedJump = true;
return i5 + 1;
}
if (i == 0) {
this.noFileNeedJump = true;
return i5;
}
HiLog.e("tedG--....()....--");
return -1;
}
public void startPlayBack(final byte[] bArr, final long j, final long j2, final long j3, final int i, final int i2, final byte b) {
new Thread() {
@Override
public void run() {
super.run();
if (TimePlaybackNewFragment.this.curentDayVideo.size() == 0) {
if (TimePlaybackNewFragment.this.isQuit) {
return;
}
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), j, j2, (int) (j3 / 1000), TimePlaybackNewFragment.this.one_day_file_list.size() - i, i2, b, TimePlaybackNewFragment.this.monitor);
} else {
if (TimePlaybackNewFragment.this.isQuit) {
return;
}
if (!TimePlaybackNewFragment.this.isPlayEnd || !TimePlaybackNewFragment.this.mIsPlayback) {
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), j, j2, (int) (j3 / 1000), TimePlaybackNewFragment.this.curentDayVideo.size() - i, i2, b, TimePlaybackNewFragment.this.monitor);
return;
}
TimePlaybackNewFragment.this.isPlayEnd = false;
TimePlaybackNewFragment.this.mIsPlayback = false;
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), j, j2, (int) (j3 / 1000), TimePlaybackNewFragment.this.one_day_file_list.size() - i, 0, b, TimePlaybackNewFragment.this.monitor);
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), j, j2, (int) (j3 / 1000), TimePlaybackNewFragment.this.curentDayVideo.size() - i, 1, b, TimePlaybackNewFragment.this.monitor);
}
}
}.start();
}
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;
}
pausePlayVideo();
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;
}
pausePlayVideo();
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()....--");
if (!((TimeAxisActivity) getActivity()).isDoPause) {
((TimeAxisActivity) getActivity()).isDoPause = true;
return;
}
MyCamera myCamera = this.mMyCamera;
if (myCamera != null) {
myCamera.registerIOSessionListener(this);
this.mMyCamera.registerPlayStateListener(this);
this.mMyCamera.setLiveShowMonitor(this.monitor);
int i = SharePreUtils.getInt(HiDataValue.CACHE, getActivity(), "pictureSize" + HiDataValue.userAccount + this.mMyCamera.getUid());
this.mPictureSize = i;
if (i == -1) {
this.mPictureSize = 0;
}
}
if (this.videoIsPause && !this.videoIsPlaying && this.mIsVisibleToUser) {
HiLog.i("tedG--....onResume() 我去暂停了....--" + this.mTimeInMicros);
if (findVideoFile(this.mTimeInMicros, -1) == -1) {
return;
}
HiLog.i("tedG--....onResume() 我去暂停了....--");
pausePlayVideo();
this.videoIsPause = false;
this.videoIsPlaying = true;
}
TimeAxisActivity timeAxisActivity = this.mAct;
if (timeAxisActivity instanceof TimeAxisActivity) {
this.timeAxisActivity = timeAxisActivity;
}
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.mPictureSize);
}
this.monitor.setVisibility(0);
}
@Override
public void onPause() {
super.onPause();
if (((TimeAxisActivity) getActivity()).isDoPause) {
HiLog.e("tedG--....onResume() 我去暂停了....--" + this.mTimeInMicros);
if (this.mMyCamera != null) {
if (this.myTimeLineView != null) {
HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
this.mTimeInMicros = this.myTimeLineView.getCurrentValue();
HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
}
this.mMyCamera.unregisterIOSessionListener(this);
this.mMyCamera.unregisterPlayStateListener(this);
if (!this.videoIsPause && this.videoIsPlaying) {
pausePlayVideo();
this.videoIsPlaying = false;
this.videoIsPause = true;
}
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
if (myPlaybackGLMonitor != null) {
myPlaybackGLMonitor.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();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void getIsResetSize(ResetSizeModel resetSizeModel) {
this.mIsResetSize = resetSizeModel.ismIsResetSize();
}
@Override
public void setUserVisibleHint(boolean z) {
super.setUserVisibleHint(z);
HiLog.e("tedG--....onResume()....--");
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;
}
Log.e("test111", "mIsCallStop: " + this.mIsCallStop);
if (this.mIsCallStop) {
this.videoIsPause = false;
this.videoIsPlaying = true;
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
if (myPlaybackGLMonitor != null) {
myPlaybackGLMonitor.setmIsFullScreen(0);
this.mHeight = HiTools.dip2px(getContext(), 250.0f);
resetMonitorSize(false, 10000.0d);
}
hand0And1();
this.mIsCallStop = false;
return;
}
if (this.mIsResetSize) {
this.mIsResetSize = false;
MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor;
if (myPlaybackGLMonitor2 != null) {
myPlaybackGLMonitor2.setmIsFullScreen(0);
this.mHeight = HiTools.dip2px(getContext(), 250.0f);
resetMonitorSize(false, 10000.0d);
}
}
if (this.isPlayEnd) {
this.timePlayStart = true;
return;
}
if (!this.videoIsPause || this.videoIsPlaying) {
return;
}
HiLog.e("tedG--....()....--" + this.mTimeInMicros + ";;;;");
int findVideoFile = findVideoFile(this.mTimeInMicros, -1);
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) {
return;
}
pausePlayVideo();
this.videoIsPause = true;
this.videoIsPlaying = false;
}
}
private void hand0And1() {
if (this.isPlayEnd) {
this.timePlayStart = true;
return;
}
long j = this.mTimeInMicros;
final int findVideoFile = findVideoFile(j, -1);
if (findVideoFile == -1) {
this.myTimeLineView.listener.onNoneVideo("", j);
this.mBackToNoFile = true;
return;
}
if (this.myTimeLineView.isScroll()) {
return;
}
PlaybackVo playbackVo = this.curentDayVideo.get(findVideoFile);
this.oldTime = 0L;
this.firstVideoStartTime = j;
this.setpos = 1;
this.currentPlayPosition = findVideoFile;
final byte[] bArr = new byte[8];
System.arraycopy(playbackVo.getTest(), 0, bArr, 0, 8);
final long startTime = playbackVo.getStartTime() / 1000;
final long endTime = playbackVo.getEndTime() / 1000;
final int startTime2 = (int) ((j - playbackVo.getStartTime()) / 1000);
final byte flag = playbackVo.getFlag();
showLoadingView();
new Thread() {
@Override
public void run() {
super.run();
if (TimePlaybackNewFragment.this.isQuit) {
return;
}
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), startTime, endTime, startTime2 / 1000, TimePlaybackNewFragment.this.one_day_file_list.size() - findVideoFile, 0, flag, TimePlaybackNewFragment.this.monitor);
TimePlaybackNewFragment.this.mMyCamera.startPlaybackNew(new HiChipDefines.STimeDay(bArr, 0), startTime, endTime, startTime2 / 1000, TimePlaybackNewFragment.this.curentDayVideo.size() - findVideoFile, 1, flag, TimePlaybackNewFragment.this.monitor);
}
}.start();
}
@Override
public void onDestroyView() {
super.onDestroyView();
HiLog.e("tedG--....onResume()....--");
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
if (myPlaybackGLMonitor != null) {
myPlaybackGLMonitor.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 AnonymousClass8 extends Handler {
AnonymousClass8() {
}
@Override
public void handleMessage(Message message) {
int i = message.what;
if (i == -1879048191) {
int i2 = message.arg1;
if ((i2 == 0 || i2 == 5) && TimePlaybackNewFragment.this.mIsVisibleToUser) {
Log.i("tedu", "--CAMERA_CONNECTION_STATE_DISCONNECTED--");
TimePlaybackNewFragment.this.dismissLoadingView();
MyToast.showToast(TimePlaybackNewFragment.this.mAct, TimePlaybackNewFragment.this.getString(R.string.disconnect));
HiLogcatUtil.e("############################# mMyCamera.stopPlaybackNew ###################### ");
TimePlaybackNewFragment.this.mMyCamera.stopPlaybackNew();
TimePlaybackNewFragment.this.mAct.finish();
return;
}
return;
}
if (i == -1879048189) {
if (message.arg2 == 0) {
TimePlaybackNewFragment.this.handIOCTRLSuccess(message);
return;
}
TimePlaybackNewFragment.this.dismissLoadingView();
MyToast.showToast(TimePlaybackNewFragment.this.mAct, TimePlaybackNewFragment.this.getString(R.string.get_data_fail));
if (message.arg1 != 16779) {
return;
}
TimePlaybackNewFragment.this.mAct.iv_return.setEnabled(true);
return;
}
if (i == -6) {
HiLogcatUtil.e("################# timeline PLAY_ONLINESTATE_ERROR ############## ");
if (TimePlaybackNewFragment.this.getActivity() != null) {
Toast.makeText(TimePlaybackNewFragment.this.getActivity(), TimePlaybackNewFragment.this.getString(R.string.play_4k_sd_error), 1).show();
}
TimePlaybackNewFragment.this.mMyCamera.stopPlaybackNew();
TimePlaybackNewFragment.this.mMyCamera.setReconnectTimes(10);
TimePlaybackNewFragment.this.startActivity(new Intent(TimePlaybackNewFragment.this.mAct, (Class<?>) MainActivity.class));
return;
}
if (i == 0) {
TimePlaybackNewFragment.this.isReadyPlay = true;
Log.i("tedu", "-播放开始-PLAY_STATE_START--");
TimePlaybackNewFragment.this.handler.postDelayed(new Runnable() {
@Override
public final void run() {
TimePlaybackNewFragment.AnonymousClass8.this.lambda$handleMessage$0$TimePlaybackNewFragment$8();
}
}, 100L);
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = true;
TimePlaybackNewFragment.this.isPlayEnd = false;
TimePlaybackNewFragment.this.videoIsPlaying = true;
TimePlaybackNewFragment.this.video_width = message.arg1;
TimePlaybackNewFragment.this.video_height = message.arg2;
TimePlaybackNewFragment.this.iv_placeholder.setVisibility(8);
if (TimePlaybackNewFragment.this.getResources().getConfiguration().orientation == 1) {
TimePlaybackNewFragment.this.iv_full_screen.setVisibility(0);
TimePlaybackNewFragment.this.iv_snapshot.setVisibility(0);
}
TimePlaybackNewFragment.this.dismissLoadingView();
TimePlaybackNewFragment.this.startWatchOrientation();
TimePlaybackNewFragment.this.rb_all.setEnabled(true);
TimePlaybackNewFragment.this.rb_alarm.setEnabled(true);
return;
}
if (i != 1) {
if (i != 2) {
return;
}
Log.i("tedu", "--PLAY_STATE_POS--");
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = true;
TimePlaybackNewFragment.this.isPlayEnd = false;
TimePlaybackNewFragment.this.dismissLoadingView();
return;
}
Log.i("tedu", "--PLAY_STATE_EDN--");
MyToast.showToast(TimePlaybackNewFragment.this.mAct, TimePlaybackNewFragment.this.getString(R.string.tips_stop_video));
TimePlaybackNewFragment.this.myTimeLineView.isCanPlay = false;
TimePlaybackNewFragment.this.isPlayEnd = true;
if (!TimePlaybackNewFragment.this.videoIsPause && TimePlaybackNewFragment.this.videoIsPlaying) {
TimePlaybackNewFragment.this.pausePlayVideo();
TimePlaybackNewFragment.this.videoIsPause = true;
TimePlaybackNewFragment.this.videoIsPlaying = false;
}
TimePlaybackNewFragment.this.shadowView.setVisibility(8);
TimePlaybackNewFragment.this.rb_all.setEnabled(true);
TimePlaybackNewFragment.this.rb_alarm.setEnabled(true);
}
public void lambda$handleMessage$0$TimePlaybackNewFragment$8() {
TimePlaybackNewFragment.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;
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()) {
Log.i("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;
}
HiChipDefines.Record_FILE_INFO record_FILE_INFO = new HiChipDefines.Record_FILE_INFO(byteArray);
long timeInMillis2 = record_FILE_INFO.sStartTime.getTimeInMillis2() / 1000;
this.video_height = record_FILE_INFO.videoh;
this.video_width = record_FILE_INFO.videow;
if (this.currentPlayVideoStartTime / 1000000 != timeInMillis2) {
if (this.setpos == 0 || this.isOtherDay) {
this.firstVideoStartTime = timeInMillis2 * 1000000;
this.currentPlayPosition = findVideoFile(timeInMillis2 * 1000, -1);
}
this.oldTime = 0L;
}
this.setpos = 0;
this.isOtherDay = false;
this.currentPlayVideoStartTime = timeInMillis2 * 1000000;
if (getResources().getConfiguration().orientation == 2) {
handLandscapeForNextFile(this.mPictureSize);
return;
}
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(), 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(), 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(), 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.rb_all.setEnabled(true);
this.rb_alarm.setEnabled(true);
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 = HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL;
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) {
if (HiTools.mDualvalue == 0 || HiTools.mDualvalue == 1) {
if (i == 2) {
return;
}
} else if (HiTools.mDualvalue == 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 onClick(View view) {
switch (view.getId()) {
case R.id.iv_adaption:
handPictureSize();
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.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, 10046)) {
return;
}
clickSnapshot();
return;
case R.id.monitor_1dual:
if (getResources().getConfiguration().orientation == 2) {
LinearLayout linearLayout = this.ll_top;
linearLayout.setVisibility(linearLayout.getVisibility() != 0 ? 0 : 8);
this.iv_snapshot_land.setVisibility(this.ll_top.getVisibility());
return;
} else if (this.iv_full_screen.getVisibility() != 0) {
this.iv_full_screen.setVisibility(0);
this.iv_snapshot.setVisibility(0);
return;
} else {
this.iv_full_screen.setVisibility(8);
this.iv_snapshot.setVisibility(8);
return;
}
case R.id.rb_alarm:
if (this.mIsDataReceveEnd && !this.currentTypeIs2) {
this.currentTypeIs2 = true;
this.rb_alarm.setChecked(true);
this.rb_all.setChecked(false);
this.rb_all.setEnabled(false);
this.rb_alarm.setEnabled(false);
resetRequestData();
showLoadingView();
this.mMyCamera.stopPlaybackNew();
this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, mYear, mMonth, this.nearVideoDay, getFileType()));
return;
}
return;
case R.id.rb_all:
if (this.mIsDataReceveEnd && this.currentTypeIs2) {
this.currentTypeIs2 = false;
this.rb_alarm.setChecked(false);
this.rb_all.setChecked(true);
this.rb_all.setEnabled(false);
this.rb_alarm.setEnabled(false);
resetRequestData();
showLoadingView();
this.mMyCamera.stopPlaybackNew();
this.mMyCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_RECORD_ALLFILE_ONEDAY, HiChipDefines.RECORD_ALLFILE.parseContent(0, mYear, mMonth, this.nearVideoDay, getFileType()));
return;
}
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 handPictureSize() {
View inflate = View.inflate(getActivity(), R.layout.pup_landscape_adaption, null);
this.mPopupWindow = new PopupWindow(inflate);
this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(0));
this.mPopupWindow.setOutsideTouchable(true);
this.mPopupWindow.setHeight(-1);
this.mPopupWindow.setWidth(HiTools.dip2px(getActivity(), 250.0f));
this.mPopupWindow.setAnimationStyle(R.style.AnimTopRight);
this.mPopupWindow.showAtLocation(inflate, 17, getActivity().getWindowManager().getDefaultDisplay().getWidth(), 0);
this.tvFill = (TextView) inflate.findViewById(R.id.tv_fill);
this.tvAdaption = (TextView) inflate.findViewById(R.id.tv_adaption);
int i = this.mPictureSize;
if (i == 0) {
this.tvFill.setSelected(true);
this.tvAdaption.setSelected(false);
} else if (i == 1) {
this.tvFill.setSelected(false);
this.tvAdaption.setSelected(true);
}
this.tvFill.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TimePlaybackNewFragment.this.tvFill.setSelected(true);
TimePlaybackNewFragment.this.tvAdaption.setSelected(false);
if (TimePlaybackNewFragment.this.mMyCamera != null) {
SharePreUtils.putInt(HiDataValue.CACHE, TimePlaybackNewFragment.this.getActivity(), "pictureSize" + HiDataValue.userAccount + TimePlaybackNewFragment.this.mMyCamera.getUid(), 0);
}
TimePlaybackNewFragment.this.mPictureSize = 0;
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.handLandscape(timePlaybackNewFragment.mPictureSize);
}
});
this.tvAdaption.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
TimePlaybackNewFragment.this.tvFill.setSelected(false);
TimePlaybackNewFragment.this.tvAdaption.setSelected(true);
if (TimePlaybackNewFragment.this.mMyCamera != null) {
SharePreUtils.putInt(HiDataValue.CACHE, TimePlaybackNewFragment.this.getActivity(), "pictureSize" + HiDataValue.userAccount + TimePlaybackNewFragment.this.mMyCamera.getUid(), 1);
}
TimePlaybackNewFragment.this.mPictureSize = 1;
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.handLandscape(timePlaybackNewFragment.mPictureSize);
}
});
}
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);
TimeAxisActivity timeAxisActivity = this.mAct;
if (timeAxisActivity instanceof TimeAxisActivity) {
this.timeAxisActivity = timeAxisActivity;
}
if (getResources().getConfiguration().orientation == 1) {
setDefaultFull_Portrait();
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.mPictureSize);
}
if (this.timeAxisActivity.isShowPermissionDialog) {
HiTools.dialogUtilsAgreements.build().show();
}
this.monitor.setVisibility(0);
}
private void handPortrait() {
if (getActivity() == null || this.monitor == null) {
return;
}
PopupWindow popupWindow = this.mPopupWindow;
if (popupWindow != null && popupWindow.isShowing()) {
this.mPopupWindow.dismiss();
}
this.iv_snapshot_land.setVisibility(8);
showBottomUIMenu(getActivity());
this.monitor.setmIsFullScreen(0);
this.mAct.getWindow().clearFlags(1024);
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_monitor.setLayoutParams(new LinearLayout.LayoutParams(-1, this.mHeight));
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, this.mHeight);
this.iv_placeholder.setLayoutParams(layoutParams);
DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
this.monitor.screen_height = displayMetrics.heightPixels;
this.monitor.screen_width = displayMetrics.widthPixels;
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
this.monitor.setLayoutParams(layoutParams);
this.monitor.setState(0);
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
myPlaybackGLMonitor.setMatrix(myPlaybackGLMonitor.left, this.monitor.bottom, this.monitor.width, this.monitor.height);
resetMonitorSize(false, 10000.0d);
}
public void handLandscape(int i) {
RelativeLayout.LayoutParams layoutParams;
LinearLayout.LayoutParams layoutParams2;
if (getActivity() == null || this.monitor == null) {
return;
}
this.iv_snapshot_land.setVisibility(0);
boolean hideBottomUIMenu = hideBottomUIMenu(getActivity());
this.monitor.setmIsFullScreen(1);
this.mAct.getWindow().setFlags(1024, 1024);
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);
DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
int i2 = displayMetrics.heightPixels;
myPlaybackGLMonitor.screen_height = i2;
this.PictureRealHeight = i2;
MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor;
int i3 = displayMetrics.widthPixels;
myPlaybackGLMonitor2.screen_width = i3;
this.PictureRealWidth = i3;
if (HiTools.isAllScreenDevice(getActivity())) {
layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams2 = new LinearLayout.LayoutParams(-1, -1);
if (hideBottomUIMenu) {
MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor;
int navigationBarHeight = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(getActivity());
myPlaybackGLMonitor3.screen_width = navigationBarHeight;
this.PictureRealWidth = navigationBarHeight;
}
} else {
layoutParams = new RelativeLayout.LayoutParams(this.mAct.getWindowManager().getDefaultDisplay().getWidth(), this.mAct.getWindowManager().getDefaultDisplay().getHeight());
layoutParams2 = new LinearLayout.LayoutParams(this.mAct.getWindowManager().getDefaultDisplay().getWidth(), this.mAct.getWindowManager().getDefaultDisplay().getHeight());
}
if (i == 1) {
int Getwh = HiTools.Getwh(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
if (Getwh == 2) {
this.monitor.screen_height = HiTools.getVideoshowh(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
layoutParams.setMargins(0, (this.PictureRealHeight - this.monitor.screen_height) / 2, 0, (this.PictureRealHeight - this.monitor.screen_height) / 2);
} else if (Getwh == 3) {
this.monitor.screen_width = HiTools.getVideoshoww(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
layoutParams.setMargins((this.PictureRealWidth - this.monitor.screen_width) / 2, 0, (this.PictureRealWidth - this.monitor.screen_width) / 2, 0);
} else {
layoutParams.setMargins(0, 0, 0, 0);
}
}
this.monitor.setLayoutParams(layoutParams);
this.rl_monitor.setLayoutParams(layoutParams2);
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
this.monitor.setState(0);
MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor;
myPlaybackGLMonitor4.setMatrix(myPlaybackGLMonitor4.left, this.monitor.bottom, this.monitor.width, this.monitor.height);
}
private void handLandscapeForNextFile(int i) {
RelativeLayout.LayoutParams layoutParams;
LinearLayout.LayoutParams layoutParams2;
if (getActivity() == null || this.monitor == null) {
return;
}
boolean hideBottomUIMenu = hideBottomUIMenu(getActivity());
DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
int i2 = displayMetrics.heightPixels;
myPlaybackGLMonitor.screen_height = i2;
this.PictureRealHeight = i2;
MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor;
int i3 = displayMetrics.widthPixels;
myPlaybackGLMonitor2.screen_width = i3;
this.PictureRealWidth = i3;
if (HiTools.isAllScreenDevice(getActivity())) {
layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams2 = new LinearLayout.LayoutParams(-1, -1);
if (hideBottomUIMenu) {
MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor;
int navigationBarHeight = displayMetrics.widthPixels + HiTools.getNavigationBarHeight(getActivity());
myPlaybackGLMonitor3.screen_width = navigationBarHeight;
this.PictureRealWidth = navigationBarHeight;
}
} else {
layoutParams = new RelativeLayout.LayoutParams(this.mAct.getWindowManager().getDefaultDisplay().getWidth(), this.mAct.getWindowManager().getDefaultDisplay().getHeight());
layoutParams2 = new LinearLayout.LayoutParams(this.mAct.getWindowManager().getDefaultDisplay().getWidth(), this.mAct.getWindowManager().getDefaultDisplay().getHeight());
}
if (i == 1) {
int Getwh = HiTools.Getwh(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
if (Getwh == 2) {
this.monitor.screen_height = HiTools.getVideoshowh(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
layoutParams.setMargins(0, (this.PictureRealHeight - this.monitor.screen_height) / 2, 0, (this.PictureRealHeight - this.monitor.screen_height) / 2);
} else if (Getwh == 3) {
this.monitor.screen_width = HiTools.getVideoshoww(this.PictureRealWidth, this.PictureRealHeight, this.video_width, this.video_height);
layoutParams.setMargins((this.PictureRealWidth - this.monitor.screen_width) / 2, 0, (this.PictureRealWidth - this.monitor.screen_width) / 2, 0);
} else {
layoutParams.setMargins(0, 0, 0, 0);
}
}
this.monitor.setLayoutParams(layoutParams);
this.rl_monitor.setLayoutParams(layoutParams2);
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
this.monitor.setState(0);
MyPlaybackGLMonitor myPlaybackGLMonitor4 = this.monitor;
myPlaybackGLMonitor4.setMatrix(myPlaybackGLMonitor4.left, this.monitor.bottom, this.monitor.width, this.monitor.height);
}
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() {
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() {
this.loadingViewIsShowing = false;
this.mIvLoading.clearAnimation();
this.mIvLoading.setVisibility(8);
this.shadowView.setVisibility(8);
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (view.getId() == R.id.monitor_1dual) {
int pointerCount = motionEvent.getPointerCount();
if ((motionEvent.getAction() & 255) == 5 && 2 == pointerCount) {
this.monitor.setTouchMove(2);
for (int i = 0; i < pointerCount; i++) {
new Point((int) motionEvent.getX(i), (int) motionEvent.getY(i));
}
this.xlenOld = Math.abs(((int) motionEvent.getX(0)) - ((int) motionEvent.getX(1)));
int abs = Math.abs(((int) motionEvent.getY(0)) - ((int) motionEvent.getY(1)));
this.ylenOld = abs;
int i2 = this.xlenOld;
this.nLenStart = Math.sqrt((i2 * i2) + (abs * abs));
} else {
if ((motionEvent.getAction() & 255) == 2 && 2 == pointerCount) {
this.monitor.setTouchMove(2);
for (int i3 = 0; i3 < pointerCount; i3++) {
new Point((int) motionEvent.getX(i3), (int) motionEvent.getY(i3));
}
int abs2 = Math.abs(((int) motionEvent.getX(0)) - ((int) motionEvent.getX(1)));
int abs3 = Math.abs(((int) motionEvent.getY(0)) - ((int) motionEvent.getY(1)));
int abs4 = Math.abs(abs2 - this.xlenOld);
int abs5 = Math.abs(abs3 - this.ylenOld);
double d = abs2;
double d2 = abs3;
double sqrt = Math.sqrt((d * d) + (d2 * d2));
if (abs4 < 20 && abs5 < 20) {
return false;
}
if (sqrt > this.nLenStart) {
resetMonitorSize(true, sqrt);
} else {
resetMonitorSize(false, sqrt);
}
this.xlenOld = abs2;
this.ylenOld = abs3;
this.nLenStart = sqrt;
return true;
}
if (pointerCount == 1) {
int action = motionEvent.getAction();
if (action == 0) {
this.monitor.setTouchMove(0);
} else if (action == 2 && this.monitor.getTouchMove() == 0 && (Math.abs(this.move_x - this.action_down_x) > 40.0f || Math.abs(this.move_y - this.action_down_y) > 40.0f)) {
this.monitor.setTouchMove(1);
}
}
}
}
return false;
}
public void resetMonitorSize(boolean z, double d) {
this.isLarge = z ? 1 : 2;
if (this.monitor.getmIsFullScreen() == 0) {
this.monitor.screen_height = this.mHeight;
}
if (this.monitor.height == 0 && this.monitor.width == 0) {
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
}
this.moveX = (int) (d / 2.0d);
this.moveY = (int) (((d * this.monitor.screen_height) / this.monitor.screen_width) / 2.0d);
if (z) {
if (this.monitor.width <= this.monitor.screen_width * 2 && this.monitor.height <= this.monitor.screen_height * 2) {
this.monitor.left -= this.moveX / 2;
this.monitor.bottom -= this.moveY / 2;
this.monitor.width += this.moveX;
this.monitor.height += this.moveY;
}
} else {
this.monitor.left += this.moveX / 2;
this.monitor.bottom += this.moveY / 2;
this.monitor.width -= this.moveX;
this.monitor.height -= this.moveY;
if (this.monitor.bottom + this.monitor.height < this.monitor.screen_height) {
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
myPlaybackGLMonitor.bottom = myPlaybackGLMonitor.screen_height - this.monitor.height;
}
if (this.monitor.left + this.monitor.width < this.monitor.screen_width) {
MyPlaybackGLMonitor myPlaybackGLMonitor2 = this.monitor;
myPlaybackGLMonitor2.left = myPlaybackGLMonitor2.screen_width - this.monitor.width;
}
}
if (this.monitor.left > 0 || this.monitor.width < this.monitor.screen_width || this.monitor.height < this.monitor.screen_height || this.monitor.bottom > 0) {
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
}
if (this.monitor.width > this.monitor.screen_width) {
this.monitor.setState(1);
} else {
this.monitor.setState(0);
}
MyPlaybackGLMonitor myPlaybackGLMonitor3 = this.monitor;
myPlaybackGLMonitor3.setMatrix(myPlaybackGLMonitor3.left, this.monitor.bottom, this.monitor.width, this.monitor.height);
if (getResources().getConfiguration().orientation == 1) {
this.isLarge = 0;
}
}
private void initMatrix(int i, int i2) {
this.monitor.left = 0;
this.monitor.bottom = 0;
this.monitor.width = i;
this.monitor.height = i2;
}
private void setDefaultFull_Portrait() {
PopupWindow popupWindow = this.mPopupWindow;
if (popupWindow != null) {
popupWindow.dismiss();
}
if (this.monitor != null) {
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(this.monitor.getLayoutParams());
this.monitor.screen_width = this.PictureRealWidth;
this.monitor.screen_height = this.PictureRealHeight;
layoutParams.setMargins(0, 0, 0, 0);
this.monitor.setLayoutParams(layoutParams);
HiLogcatUtil.e("" + this.monitor.screen_width + "::" + this.monitor.screen_height + "::" + HiTools.isAllScreenDevice(getActivity()));
initMatrix(this.monitor.screen_width, this.monitor.screen_height);
this.monitor.setState(0);
MyPlaybackGLMonitor myPlaybackGLMonitor = this.monitor;
myPlaybackGLMonitor.setMatrix(myPlaybackGLMonitor.left, this.monitor.bottom, this.monitor.width, this.monitor.height);
}
}
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.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 && !this.mIsClickReturn) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (TimePlaybackNewFragment.this.isLarge != 1) {
if (TimePlaybackNewFragment.this.isLarge == 2) {
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.resetMonitorSize(false, timePlaybackNewFragment.nLenStart);
return;
}
return;
}
TimePlaybackNewFragment timePlaybackNewFragment2 = TimePlaybackNewFragment.this;
timePlaybackNewFragment2.resetMonitorSize(true, timePlaybackNewFragment2.nLenStart);
}
}, 200L);
}
if (!this.mIsClickReturn) {
getActivity().setRequestedOrientation(8);
}
if (!this.isFirstRevolveLand) {
this.isFirstRevolveLand = true;
}
if (this.mIsClickReturn) {
return;
}
if (this.root_lock_screen.getVisibility() == 0) {
this.mHandler_lockScreen.removeCallbacksAndMessages(null);
this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
return;
} else {
this.mHandler_lockScreen.removeCallbacksAndMessages(null);
this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
return;
}
}
return;
}
if (i == 270) {
if (this.myTimeLineView.isCanPlay) {
if (this.mOrientationWatchDog.getLastOrientation() == 90 && !this.mIsClickReturn) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (TimePlaybackNewFragment.this.isLarge != 1) {
if (TimePlaybackNewFragment.this.isLarge == 2) {
TimePlaybackNewFragment timePlaybackNewFragment = TimePlaybackNewFragment.this;
timePlaybackNewFragment.resetMonitorSize(false, timePlaybackNewFragment.nLenStart);
return;
}
return;
}
TimePlaybackNewFragment timePlaybackNewFragment2 = TimePlaybackNewFragment.this;
timePlaybackNewFragment2.resetMonitorSize(true, timePlaybackNewFragment2.nLenStart);
}
}, 200L);
}
if (!this.mIsClickReturn) {
getActivity().setRequestedOrientation(0);
}
if (!this.isFirstRevolveLand) {
this.isFirstRevolveLand = true;
return;
}
if (this.mIsClickReturn) {
return;
}
if (this.root_lock_screen.getVisibility() == 0) {
this.mHandler_lockScreen.removeCallbacksAndMessages(null);
this.mHandler_lockScreen.sendEmptyMessageDelayed(1, 3000L);
return;
} else {
this.mHandler_lockScreen.removeCallbacksAndMessages(null);
this.mHandler_lockScreen.sendEmptyMessageDelayed(0, 3000L);
return;
}
}
return;
}
this.mIsClickReturn = false;
getActivity().setRequestedOrientation(1);
this.root_lock_screen.setVisibility(8);
this.mHandler_lockScreen.removeCallbacksAndMessages(null);
}
}
public void clickSnapshot() {
if (this.mMyCamera != null) {
if (HiTools.isSDCardValid()) {
File file = new File(HiDataValue.getPathCameraSnapshot(this.mMyCamera.getUid(), getActivity()));
if (!file.exists()) {
file.mkdirs();
}
String fileNameWithTime = HiTools.getFileNameWithTime(0);
String str = file.getAbsoluteFile() + "/" + fileNameWithTime;
MyCamera myCamera = this.mMyCamera;
Bitmap snapshot = myCamera != null ? myCamera.getSnapshot() : null;
if (snapshot != null && HiTools.saveImage(str, snapshot)) {
SaveToPhone(str, fileNameWithTime);
Toast.makeText(getActivity(), getText(R.string.tips_snapshot_success), 0).show();
return;
} else {
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(TimePlaybackNewFragment.this.getActivity().getContentResolver(), str, str2, (String) null);
} catch (Exception e) {
e.printStackTrace();
}
TimePlaybackNewFragment.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;
if (myPlaybackGLMonitor != null) {
myPlaybackGLMonitor.FreeMonitor();
}
MyCamera myCamera = this.mMyCamera;
if (myCamera != null) {
myCamera.clearMonitor(this.monitor);
}
if (HiTools.dialogUtilsAgreements != null) {
HiTools.dialogUtilsAgreements.build().dismiss();
}
}
}