CloudPlaybackActivity.java 源代码
package activity.cloud;
import activity.ImagePagerActivity;
import activity.LocalFile.LocalFileActivity2;
import activity.cloud.CloudPlaybackActivity;
import activity.cloud.adapter.CloudMyFilePagerAdapter;
import activity.cloud.bean.CloudCalenderDay;
import activity.cloud.view.CloudNoSlidingViewPager;
import activity.video.adapter.VideoInfoAdapter;
import android.animation.ObjectAnimator;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.ColorDrawable;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.view.ViewPager;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import base.HiActivity;
import bean.MyCamera;
import bean.VideoInfo;
import com.heytap.mcssdk.a.b;
import com.hichip.base.HiLog;
import com.hichip.callback.ICameraDownloadCallback;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.callback.PlayOSSFileCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.hichip.sdk.HiPlayOSSSDK;
import com.hichip.tools.Packet;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.xiaomi.mipush.sdk.Constants;
import common.Constant;
import common.HiDataValue;
import custom.CircleProgressBar;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.apache.http.cookie.ClientCookie;
import org.greenrobot.eventbus.EventBus;
import service.DeleteCloudCacheFileService;
import timeaxis.calender.TitleGridAdapter;
import utils.FileSizeUtils;
import utils.HiLogcatUtil;
import utils.HiTools;
import utils.MyToast;
import utils.SharePreUtils;
import utils.SystemUtils;
public class CloudPlaybackActivity extends HiActivity implements AdapterView.OnItemClickListener, ICameraIOSessionCallback, ICameraDownloadCallback, View.OnClickListener, PlayOSSFileCallback {
public static final String FILE_PATH = "file_path";
public static final int HANDLE_MESSAGE_NETWORK_CHANGED = 1048577;
private static final int MY_PERMISSION_REQUEST_CODE = 10015;
public VideoInfoAdapter adapter;
ImageView btn_return;
private int calendarCurrentPage;
private CircleProgressBar circleprogressbar;
private byte[] cloudBuff;
private int cloudBuffLength;
private CloudMyFilePagerAdapter cloudPagerAdapter;
private long currentMills;
private ImageView iv_arrow;
ImageView iv_choose_data;
ImageView iv_left;
ImageView iv_package_info;
ImageView iv_right;
ListView list_video_online;
private MyCamera mCamera;
String moss_file_local_path;
String moss_file_play_path;
private ConnectionChangeReceiver myReceiver;
private String path;
private TextView popu_tips_down;
private PopupWindow progressPop;
RelativeLayout rl_calendar;
LinearLayout stc_calendar_layout;
private GridView title_gView;
private TextView tv_cancel_downloading_video;
private TextView tv_goto_downloading_video;
TextView tv_nothing;
private TextView tv_one;
private TextView tv_sort;
private TextView tv_two;
TextView tv_uid;
TextView tv_years_month;
TextView txtSearchTime;
CloudNoSlidingViewPager viewpager;
private View searchTimeView = null;
private View loadingView = null;
private List<VideoInfo> video_list = new ArrayList();
private ArrayList<String> day_list = new ArrayList<>();
private boolean isDownloading = false;
private int mType = 0;
private boolean mIsDataReceiveEnd = false;
private boolean mFirst = true;
private ArrayList<Integer> listDay = new ArrayList<>();
private int mCurrentPage = 999;
private boolean mIsDown = true;
private Handler handler = new AnonymousClass1();
private int firstReceive = 0;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message message) {
int i = message.what;
if (i == 300) {
if (CloudPlaybackActivity.this.day_list.size() > 0) {
CloudPlaybackActivity.this.mCamera.mPlayOSS.GetOSSFileList((String) CloudPlaybackActivity.this.day_list.get(CloudPlaybackActivity.this.day_list.size() - 1), 1, 0);
String str = (String) CloudPlaybackActivity.this.day_list.get(CloudPlaybackActivity.this.day_list.size() - 1);
int parseInt = Integer.parseInt(str.substring(0, 4));
int parseInt2 = Integer.parseInt(str.substring(4, 6));
Calendar calendar = Calendar.getInstance();
calendar.set(1, parseInt);
calendar.set(2, parseInt2 - 1);
calendar.set(5, 1);
CloudPlaybackActivity cloudPlaybackActivity = CloudPlaybackActivity.this;
cloudPlaybackActivity.initCalenderViewPager(cloudPlaybackActivity.day_list, str, calendar, CloudPlaybackActivity.this.mCurrentPage);
StringBuilder sb = new StringBuilder(str);
sb.insert(6, Constants.ACCEPT_TIME_SEPARATOR_SERVER);
sb.insert(4, Constants.ACCEPT_TIME_SEPARATOR_SERVER);
CloudPlaybackActivity.this.txtSearchTime.setText(sb.toString());
}
CloudPlaybackActivity.this.firstReceive = 0;
return;
}
if (i == 999998) {
synchronized (CloudPlaybackActivity.this.adapter) {
HiLog.e("9999-->" + CloudPlaybackActivity.this.video_list.size());
CloudPlaybackActivity.this.mIsDataReceiveEnd = true;
if (CloudPlaybackActivity.this.list_video_online != null && CloudPlaybackActivity.this.list_video_online.getFooterViewsCount() > 0) {
CloudPlaybackActivity.this.list_video_online.removeFooterView(CloudPlaybackActivity.this.loadingView);
}
if (CloudPlaybackActivity.this.adapter != null) {
CloudPlaybackActivity.this.adapter.notifyDataSetChanged();
}
}
CloudPlaybackActivity.this.firstReceive = 0;
return;
}
if (i == 12288) {
HiLog.e(message.arg1 + ":::" + message.arg2);
switch (message.arg1) {
case -7:
case -6:
if (CloudPlaybackActivity.this.mCamera != null && CloudPlaybackActivity.this.mCamera.mPlayOSS != null) {
CloudPlaybackActivity.this.mCamera.mPlayOSS = null;
}
CloudPlaybackActivity.this.Showclouderror_ext(0, message.arg1, message.arg2);
return;
case -5:
case -4:
case -3:
case -2:
case -1:
if (CloudPlaybackActivity.this.mCamera != null && CloudPlaybackActivity.this.mCamera.mPlayOSS != null) {
CloudPlaybackActivity.this.mCamera.mPlayOSS = null;
}
CloudPlaybackActivity.this.Showclouderror(0, message.arg1, message.arg2);
return;
case 0:
return;
default:
if (CloudPlaybackActivity.this.mCamera != null && CloudPlaybackActivity.this.mCamera.mPlayOSS != null) {
CloudPlaybackActivity.this.mCamera.mPlayOSS = null;
}
CloudPlaybackActivity.this.Showclouderror_ext(0, message.arg1, message.arg2);
return;
}
}
if (i == 12289) {
HiLog.e(message.arg1 + ":::" + message.arg2);
int i2 = message.arg1;
if (i2 != 0) {
switch (i2) {
case -107:
case -106:
CloudPlaybackActivity.this.Showclouderror_ext(1, message.arg1, message.arg2);
return;
case -105:
case -104:
case -103:
case -102:
case -101:
CloudPlaybackActivity.this.Showclouderror(1, message.arg1, message.arg2);
return;
default:
CloudPlaybackActivity.this.Showclouderror_ext(1, message.arg1, message.arg2);
return;
}
}
if (CloudPlaybackActivity.this.mFirst) {
CloudPlaybackActivity.this.mCamera.mPlayOSS.GetOSSFileTime(1, 0);
CloudPlaybackActivity.this.mFirst = false;
return;
}
return;
}
switch (i) {
case 24832:
HiLog.e(message.what + "::" + message.arg1 + ":::" + message.arg2 + "::" + ("本地异常,如网络异常等:" + message.what + "dd" + CloudPlaybackActivity.this.mType));
CloudPlaybackActivity cloudPlaybackActivity2 = CloudPlaybackActivity.this;
StringBuilder sb2 = new StringBuilder();
sb2.append(message.what);
sb2.append("");
cloudPlaybackActivity2.ShowOssError(1, sb2.toString());
return;
case HiChipDefines.HI_P2P_GET_SNAP_AUTO_PARAM:
HiLog.e(message.what + "::" + message.arg1 + ":::" + message.arg2 + "::" + ((String) message.obj));
if (message.what == 24833) {
CloudPlaybackActivity cloudPlaybackActivity3 = CloudPlaybackActivity.this;
cloudPlaybackActivity3.ShowOssError(0, cloudPlaybackActivity3.getString(R.string.no_record_file));
return;
} else {
if (message.what == 25089) {
CloudPlaybackActivity cloudPlaybackActivity4 = CloudPlaybackActivity.this;
cloudPlaybackActivity4.ShowOssError(0, cloudPlaybackActivity4.getString(R.string.no_record_file_1));
return;
}
CloudPlaybackActivity.this.ShowOssError(1, message.what + "");
return;
}
case HiChipDefines.HI_P2P_SET_SNAP_AUTO_PARAM:
CloudPlaybackActivity.this.showLocalError("Error03_-1");
return;
case HiChipDefines.HI_P2P_GET_SNAP_AUTO_SCHEDULE:
if (CloudPlaybackActivity.this.progressPop != null && CloudPlaybackActivity.this.progressPop.isShowing()) {
CloudPlaybackActivity.this.progressPop.dismiss();
CloudPlaybackActivity.this.deleteLoadingFile();
}
CloudPlaybackActivity.this.mIsDataReceiveEnd = true;
CloudPlaybackActivity.this.firstReceive = 0;
Toast.makeText(CloudPlaybackActivity.this, "Error" + CloudPlaybackActivity.toHex(message.what, 6), 1).show();
return;
case HiChipDefines.HI_P2P_SET_SNAP_AUTO_SCHEDULE:
if (CloudPlaybackActivity.this.progressPop != null && CloudPlaybackActivity.this.progressPop.isShowing()) {
CloudPlaybackActivity.this.progressPop.dismiss();
CloudPlaybackActivity.this.deleteLoadingFile();
}
CloudPlaybackActivity.this.mIsDataReceiveEnd = true;
CloudPlaybackActivity.this.firstReceive = 0;
Toast.makeText(CloudPlaybackActivity.this, "Error" + CloudPlaybackActivity.toHex(message.what, 6), 1).show();
return;
default:
switch (i) {
case 25088:
break;
case 25089:
break;
case 25090:
CloudPlaybackActivity.this.showLocalError("Error03_-2");
return;
case 25091:
break;
case 25092:
break;
default:
switch (i) {
case 25344:
break;
case 25345:
break;
case 25346:
CloudPlaybackActivity.this.showLocalError("Error03_-3");
return;
case 25347:
break;
case 25348:
break;
default:
switch (i) {
case 25600:
break;
case 25601:
break;
case 25602:
CloudPlaybackActivity.this.showLocalError("Error03_-4");
return;
case 25603:
break;
case 25604:
break;
default:
switch (i) {
case 25856:
break;
case 25857:
break;
case 25858:
CloudPlaybackActivity.this.showLocalError("Error03_-5");
return;
case 25859:
break;
case 25860:
break;
default:
switch (i) {
case 26112:
break;
case 26113:
break;
case 26114:
CloudPlaybackActivity.this.showLocalError("Error03_-6");
return;
case 26115:
break;
case 26116:
break;
default:
return;
}
}
}
}
}
}
}
};
@Override
public void callbackDownloadSnapData(HiCamera hiCamera, int i, byte[] bArr, int i2, int i3) {
}
@Override
public void callbackOSSOCloudReq(String str, int i, int i2, int i3, int i4, String str2) {
}
@Override
public void callbackplayDuallocalExt(int i, int i2, int i3, int i4, long j, long j2, int i5, int i6, String str) {
}
@Override
public void callbackplaylocal(int i, int i2, int i3, long j, int i4, int i5) {
}
@Override
public void callbackplaylocalExt(int i, int i2, int i3, long j, long j2, int i4, int i5, String str) {
}
@Override
protected int setLayoutId() {
return R.layout.activity_cloud_file_list;
}
@Override
protected void init(Bundle bundle) {
getIntentData();
if (HiTools.cameraWhetherNull(this.mCamera, this)) {
return;
}
initView();
setOnListeners();
GetOssCache();
searchVideo();
}
private void GetOssCache() {
if (Double.valueOf(FileSizeUtils.getFileOrFilesSize(HiDataValue.getPathCameraVideoOSSDownLoadcache(this), 3)).compareTo(Double.valueOf(HiDataValue.DelCacheMax)) > 0) {
startService(new Intent(this, (Class<?>) DeleteCloudCacheFileService.class));
}
}
private void getIntentData() {
String stringExtra = getIntent().getStringExtra(HiDataValue.EXTRAS_KEY_UID);
if (TextUtils.isEmpty(stringExtra)) {
return;
}
for (MyCamera myCamera : HiDataValue.CameraList) {
if (stringExtra.equals(myCamera.getUid())) {
this.mCamera = myCamera;
return;
}
}
}
private void setOnListeners() {
this.btn_return.setOnClickListener(this);
this.iv_choose_data.setOnClickListener(this);
this.iv_package_info.setOnClickListener(this);
this.tv_uid.setOnClickListener(this);
}
private void initView() {
this.tv_uid.setText(this.mCamera.getUid());
View findViewById = findViewById(R.id.search_layout);
this.searchTimeView = findViewById;
findViewById.setVisibility(0);
this.loadingView = LayoutInflater.from(this).inflate(R.layout.loading_events, (ViewGroup) null);
((LinearLayout) this.searchTimeView.findViewById(R.id.ll_sort)).setOnClickListener(this);
this.tv_sort = (TextView) this.searchTimeView.findViewById(R.id.tv_sort);
this.iv_arrow = (ImageView) this.searchTimeView.findViewById(R.id.iv_arrow);
}
private void searchVideo() {
this.list_video_online.addFooterView(this.loadingView);
VideoInfoAdapter videoInfoAdapter = new VideoInfoAdapter(this, this.video_list, this.mCamera);
this.adapter = videoInfoAdapter;
videoInfoAdapter.SetListType(true);
this.list_video_online.setAdapter((ListAdapter) this.adapter);
this.list_video_online.setOnItemClickListener(this);
TextView textView = (TextView) this.searchTimeView.findViewById(R.id.txtSearchTimeDuration);
this.txtSearchTime = textView;
textView.setText("");
this.adapter.setsubClickListener(new VideoInfoAdapter.SubClickListener() {
@Override
public final void OntopicClickListener(View view, int i, String str, int i2) {
HiLog.e(view + "::" + i + "::" + str + ":::" + i2);
}
});
if (this.mCamera.mPlayOSS == null) {
this.mCamera.mPlayOSS = new HiPlayOSSSDK();
boolean z = SharePreUtils.getBoolean(HiDataValue.CACHE, this, Constant.DEV_IsVivoMedia, false);
if (SystemUtils.isVIVOMobile(this) && Build.VERSION.SDK_INT > 29 && !z) {
this.mCamera.mPlayOSS.SetDecodeViVoVideoType(0);
} else {
this.mCamera.mPlayOSS.SetDecodeViVoVideoType(1);
}
this.mCamera.mPlayOSS.registerPlayOSSStateListener(this);
} else {
this.mCamera.mPlayOSS.registerPlayOSSStateListener(this);
}
if (this.mCamera.mPlayOSS.GetOSSisInfo()) {
this.mCamera.mPlayOSS.GetOSSFileTime(1, 0);
} else {
this.mCamera.mPlayOSS.SetContext(this, this.mCamera.getUid());
this.mCamera.mPlayOSS.GetOSSInfoOCloud(this.mCamera.getUsername(), this.mCamera.getPassword(), this.mCamera.getEcsIp(), this.mCamera.getEcsPort(), 1, 0);
}
}
@Override
public void onResume() {
super.onResume();
registerCompent();
if (this.mCamera == null) {
finish();
}
}
@Override
public void onPause() {
super.onPause();
unregisterCompent();
PopupWindow popupWindow = this.progressPop;
if (popupWindow == null || !popupWindow.isShowing()) {
return;
}
this.progressPop.dismiss();
deleteLoadingFile();
}
@Override
public void onDestroy() {
super.onDestroy();
this.isDownloading = false;
Handler handler = this.handler;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
}
private void unregisterCompent() {
HiLog.e("");
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
myCamera.unregisterIOSessionListener(this);
if (this.mCamera.mPlayOSS != null) {
this.mCamera.mPlayOSS.unregisterPlayOSSStateListener(this);
}
}
ConnectionChangeReceiver connectionChangeReceiver = this.myReceiver;
if (connectionChangeReceiver != null) {
try {
unregisterReceiver(connectionChangeReceiver);
} catch (Exception unused) {
}
}
}
private void registerCompent() {
HiLog.e("");
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
myCamera.registerIOSessionListener(this);
this.mCamera.registerDownloadListener(this);
if (this.mCamera.mPlayOSS != null) {
this.mCamera.mPlayOSS.registerPlayOSSStateListener(this);
}
}
IntentFilter intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
ConnectionChangeReceiver connectionChangeReceiver = new ConnectionChangeReceiver();
this.myReceiver = connectionChangeReceiver;
registerReceiver(connectionChangeReceiver, intentFilter);
}
@Override
public void onBackPressed() {
if (this.mIsDataReceiveEnd) {
finish();
} else {
MyToast.showToast(this, getString(R.string.data_get_wait));
}
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_return:
if (this.mIsDataReceiveEnd) {
finish();
return;
} else {
MyToast.showToast(this, getString(R.string.data_get_wait));
return;
}
case R.id.iv_choose_data:
if (System.currentTimeMillis() - this.currentMills < 500) {
return;
}
this.currentMills = System.currentTimeMillis();
if (this.day_list.size() <= 0) {
return;
}
if (this.mCamera.getConnectState() == 3) {
Toast.makeText(this, getString(R.string.tips_old_password_is_wrong), 0).show();
finish();
return;
} else {
if (!this.mIsDataReceiveEnd) {
MyToast.showToast(this, getString(R.string.data_get_wait));
return;
}
if (this.rl_calendar.getVisibility() == 8) {
CloudMyFilePagerAdapter cloudMyFilePagerAdapter = this.cloudPagerAdapter;
if (cloudMyFilePagerAdapter != null) {
cloudMyFilePagerAdapter.setSelectedDate(this.txtSearchTime.getText().toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, ""));
}
this.rl_calendar.setVisibility(0);
return;
}
this.rl_calendar.setVisibility(8);
return;
}
case R.id.iv_package_info:
if (this.mCamera != null && System.currentTimeMillis() - this.currentMills >= 500) {
this.currentMills = System.currentTimeMillis();
if (this.mCamera.getConnectState() == 3) {
Toast.makeText(this, getString(R.string.tips_old_password_is_wrong), 0).show();
finish();
return;
} else {
if (!this.mIsDataReceiveEnd) {
MyToast.showToast(this, getString(R.string.data_get_wait));
return;
}
Intent intent = new Intent(this, (Class<?>) CloudPackageInfoActivity.class);
intent.putExtra(HiDataValue.EXTRAS_KEY_UID, this.mCamera.getUid());
startActivity(intent);
return;
}
}
return;
case R.id.ll_sort:
if (this.mIsDataReceiveEnd) {
TextView textView = this.tv_sort;
if (textView == null || this.iv_arrow == null) {
return;
}
textView.setText(getString(this.mIsDown ? R.string.asce : R.string.desc));
this.iv_arrow.animate().rotation(this.mIsDown ? 180.0f : 0.0f).setDuration(400L).start();
Collections.reverse(this.video_list);
this.adapter.setClickItemPosition(-10);
this.adapter.notifyDataSetChanged();
this.mIsDown = !this.mIsDown;
return;
}
MyToast.showToast(this, getString(R.string.data_get_wait));
return;
default:
return;
}
}
public class ConnectionChangeReceiver extends BroadcastReceiver {
public ConnectionChangeReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
NetworkInfo networkInfo = connectivityManager.getNetworkInfo(0);
NetworkInfo networkInfo2 = connectivityManager.getNetworkInfo(1);
if (networkInfo == null || networkInfo.isConnected() || networkInfo2 == null || networkInfo2.isConnected() || !CloudPlaybackActivity.this.isDownloading) {
return;
}
CloudPlaybackActivity.this.handler.sendEmptyMessage(1048577);
}
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
if (this.mCamera.getConnectState() == 3) {
Toast.makeText(this, getString(R.string.tips_old_password_is_wrong), 0).show();
finish();
} else {
if (System.currentTimeMillis() - this.currentMills < 500) {
return;
}
this.currentMills = System.currentTimeMillis();
if (i >= 0) {
this.adapter.setClickItemPosition(i);
}
if (HiTools.isCustomFastClick(1000)) {
return;
}
popupMethod(i, view);
}
}
private void popupMethod(int i, View view) {
final int headerViewsCount = i - this.list_video_online.getHeaderViewsCount();
if (headerViewsCount < 0) {
return;
}
View inflate = View.inflate(this, R.layout.popview_video_online, null);
final PopupWindow popupWindow = new PopupWindow(inflate);
popupWindow.setBackgroundDrawable(new ColorDrawable(0));
popupWindow.setWidth(-1);
popupWindow.setHeight(-1);
popupWindow.setFocusable(true);
popupWindow.showAtLocation(inflate, 17, 0, 0);
TextView textView = (TextView) view.findViewById(R.id.txt_time);
TextView textView2 = (TextView) inflate.findViewById(R.id.pup_vo_item_tv_state);
TextView textView3 = (TextView) inflate.findViewById(R.id.pup_vo_item_tv_time);
textView2.setText(this.txtSearchTime.getText());
textView3.setText(textView.getText());
((TextView) inflate.findViewById(R.id.tv_play_video_online)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
CloudPlaybackActivity.this.lambda$popupMethod$2$CloudPlaybackActivity(popupWindow, headerViewsCount, view2);
}
});
((TextView) inflate.findViewById(R.id.tv_downlinad_video_online)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
CloudPlaybackActivity.this.lambda$popupMethod$3$CloudPlaybackActivity(popupWindow, headerViewsCount, view2);
}
});
((TextView) inflate.findViewById(R.id.tv_downlinad_video_cancel)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
popupWindow.dismiss();
}
});
this.adapter.notifyDataSetChanged();
}
public void lambda$popupMethod$2$CloudPlaybackActivity(PopupWindow popupWindow, final int i, View view) {
popupWindow.dismiss();
this.list_video_online.postDelayed(new Runnable() {
@Override
public final void run() {
CloudPlaybackActivity.this.lambda$popupMethod$1$CloudPlaybackActivity(i);
}
}, 100L);
}
public void lambda$popupMethod$3$CloudPlaybackActivity(PopupWindow popupWindow, int i, View view) {
popupWindow.dismiss();
if (HiTools.HiPermission(this, this, 1, 10015)) {
return;
}
downloadRecording(i);
}
public void lambda$popupMethod$1$CloudPlaybackActivity(int i) {
if (this.mCamera == null) {
return;
}
VideoInfo videoInfo = this.video_list.get(i);
Bundle bundle = new Bundle();
bundle.putString(HiDataValue.EXTRAS_KEY_UID, this.mCamera.getUid());
bundle.putString("file_path", videoInfo.filename);
bundle.putString(HiDataValue.EXTRAS_KEY_UID, this.mCamera.getUid());
bundle.putString("start_time", videoInfo.start_time);
bundle.putInt("filesize", videoInfo.fileLen);
bundle.putBoolean("needShowSnapshotButton", true);
bundle.putInt("iv_fastforward", 1);
HiLog.e("" + videoInfo.filename + ":::::" + videoInfo.fileLen);
Intent intent = new Intent();
intent.putExtras(bundle);
if (!this.mCamera.getdevSplice()) {
intent.setClass(this, OSSPlaybackLocalActivity.class);
} else {
intent.setClass(this, OSSPlaybackSpliceLocalActivity.class);
}
startActivity(intent);
}
private void downloadRecording(int i) {
VideoInfo videoInfo = this.video_list.get(i);
String str = videoInfo.filename;
int i2 = videoInfo.fileLen;
if (HiTools.isSDCardExist()) {
File file = new File(HiDataValue.getPathCameraVideoOSSDownLoadcache(this));
if (!file.exists()) {
file.mkdirs();
}
File file2 = new File(HiDataValue.getPathCameraVideoOnLineDownLoad(this.mCamera.getUid(), this));
if (!file2.exists()) {
file2.mkdirs();
}
String[] split = str.split("/");
String str2 = file.getAbsoluteFile() + "/" + this.mCamera.getUid().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "");
String str3 = split[1] + Constants.ACCEPT_TIME_SEPARATOR_SERVER + split[3];
HiLog.e("" + str + ":::" + str2 + ":::" + str3 + ":::" + i2);
StringBuilder sb = new StringBuilder();
sb.append(file.getAbsoluteFile());
sb.append("/");
sb.append(this.mCamera.getUid().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, ""));
sb.append(str3);
String sb2 = sb.toString();
this.moss_file_play_path = sb2;
boolean endsWith = sb2.endsWith(".rec");
if (endsWith) {
this.moss_file_play_path = this.moss_file_play_path.replace(HiDataValue.OSSFILEEn, HiDataValue.OSSFILEEnd);
this.moss_file_local_path = file2.getAbsoluteFile() + "/" + videoInfo.getRecType() + str3.replace(HiDataValue.OSSFILEEn, HiDataValue.OSSFILEEnd);
} else {
this.moss_file_play_path = this.moss_file_play_path.replace(HiDataValue.OSSFILEEn_HX, HiDataValue.OSSFILEEnd);
this.moss_file_local_path = file2.getAbsoluteFile() + "/" + videoInfo.getRecType() + str3.replace(HiDataValue.OSSFILEEn_HX, HiDataValue.OSSFILEEnd);
}
if (new File(this.moss_file_play_path).exists()) {
copyFile(this.moss_file_play_path, this.moss_file_local_path);
showPopPupProgress();
CircleProgressBar circleProgressBar = this.circleprogressbar;
if (circleProgressBar != null) {
circleProgressBar.setProgress(100);
}
this.isDownloading = false;
TextView textView = this.tv_cancel_downloading_video;
if (textView != null) {
textView.setText(R.string.continue_down);
}
TextView textView2 = this.tv_goto_downloading_video;
if (textView2 != null) {
textView2.setVisibility(0);
}
TextView textView3 = this.popu_tips_down;
if (textView3 != null) {
textView3.setText(getString(R.string.download_done));
}
CircleProgressBar circleProgressBar2 = this.circleprogressbar;
if (circleProgressBar2 != null) {
circleProgressBar2.setVisibility(8);
}
TextView textView4 = this.tv_one;
if (textView4 != null) {
textView4.setVisibility(0);
}
TextView textView5 = this.tv_two;
if (textView5 != null) {
textView5.setVisibility(0);
}
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.tv_one, "Alpha", 0.0f, 1.0f);
ofFloat.setDuration(300L);
ofFloat.start();
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.tv_two, "Alpha", 0.0f, 1.0f);
ofFloat2.setDuration(300L);
ofFloat2.start();
return;
}
if (endsWith) {
this.moss_file_play_path = this.moss_file_play_path.replaceAll(HiDataValue.OSSFILEEnd, HiDataValue.OSSFILEEn);
} else {
this.moss_file_play_path = this.moss_file_play_path.replaceAll(HiDataValue.OSSFILEEnd, HiDataValue.OSSFILEEn_HX);
}
MyCamera myCamera = this.mCamera;
if (myCamera == null || myCamera.mPlayOSS == null) {
return;
}
this.mCamera.mPlayOSS.OSSPlayDown(str, str2, str3, i2, 1);
}
}
public boolean copyFile(String str, String str2) {
try {
File file = new File(str);
if (!file.exists() || !file.isFile() || !file.canRead()) {
return false;
}
FileInputStream fileInputStream = new FileInputStream(str);
FileOutputStream fileOutputStream = new FileOutputStream(str2);
byte[] bArr = new byte[4096];
while (true) {
int read = fileInputStream.read(bArr);
if (-1 != read) {
fileOutputStream.write(bArr, 0, read);
} else {
fileInputStream.close();
fileOutputStream.flush();
fileOutputStream.close();
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@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 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 callbackDownloadState(HiCamera hiCamera, int i, int i2, int i3, String str) {
if (hiCamera != this.mCamera) {
return;
}
Bundle bundle = new Bundle();
bundle.putLong("total", i);
bundle.putLong("curSize", i2);
bundle.putString(ClientCookie.PATH_ATTR, str);
Message obtainMessage = this.handler.obtainMessage();
obtainMessage.what = HiDataValue.HANDLE_MESSAGE_DOWNLOAD_STATE;
obtainMessage.arg1 = i3;
obtainMessage.setData(bundle);
this.handler.sendMessage(obtainMessage);
}
public void handNETWORK_CHANGED() {
if (this.isDownloading) {
this.isDownloading = false;
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
if (myCamera.mPlayOSS != null) {
this.mCamera.mPlayOSS.StopPlayLocal();
}
deleteLoadingFile();
}
MyToast.showToast(this, getString(R.string.tips_network_disconnect));
}
}
public class AnonymousClass1 extends Handler {
AnonymousClass1() {
}
@Override
public void handleMessage(Message message) {
switch (message.what) {
case HiDataValue.HANDLE_MESSAGE_SESSION_STATE:
if (message.arg1 != 3) {
return;
}
CloudPlaybackActivity.this.handler.postDelayed(new Runnable() {
@Override
public final void run() {
CloudPlaybackActivity.AnonymousClass1.this.lambda$handleMessage$0$CloudPlaybackActivity$1();
}
}, 4000L);
return;
case HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL:
if (message.arg2 == -1) {
CloudPlaybackActivity cloudPlaybackActivity = CloudPlaybackActivity.this;
MyToast.showToast(cloudPlaybackActivity, cloudPlaybackActivity.getString(R.string.tips_update_system_failed));
return;
} else {
if (message.arg2 == 0) {
message.getData().getByteArray("data");
int i = message.arg1;
return;
}
return;
}
case HiDataValue.HANDLE_MESSAGE_DOWNLOAD_STATE:
CloudPlaybackActivity.this.handDownLoad(message);
return;
case 1048577:
CloudPlaybackActivity.this.handNETWORK_CHANGED();
return;
default:
return;
}
}
public void lambda$handleMessage$0$CloudPlaybackActivity$1() {
if (CloudPlaybackActivity.this.tv_nothing.getVisibility() == 8) {
CloudPlaybackActivity cloudPlaybackActivity = CloudPlaybackActivity.this;
Toast.makeText(cloudPlaybackActivity, cloudPlaybackActivity.getString(R.string.tips_old_password_is_wrong), 0).show();
CloudPlaybackActivity.this.finish();
}
}
}
public void handDownLoad(Message message) {
float f;
Bundle data = message.getData();
int i = message.arg1;
if (i == 0) {
showPopPupProgress();
this.isDownloading = true;
this.path = data.getString(ClientCookie.PATH_ATTR);
return;
}
if (i == 1) {
if (this.isDownloading) {
long j = data.getLong("total");
if (j == 0) {
f = (float) ((data.getLong("curSize") * 100) / 1048576);
} else {
f = (float) ((data.getLong("curSize") * 100) / j);
}
if (f >= 100.0f) {
f = 99.0f;
}
int i2 = (int) f;
CircleProgressBar circleProgressBar = this.circleprogressbar;
if (circleProgressBar != null) {
circleProgressBar.setProgress(i2);
return;
}
return;
}
return;
}
if (i != 2) {
if (i != 3) {
return;
}
MyToast.showToast(this, getString(R.string.tips_wifi_connect_failed));
return;
}
MyCamera myCamera = this.mCamera;
if (myCamera != null && myCamera.mPlayOSS != null) {
this.mCamera.mPlayOSS.StopPlayLocal();
}
if (this.moss_file_play_path != null && this.moss_file_local_path != null) {
HiLog.e(this.moss_file_play_path + "ddddddd" + this.moss_file_local_path);
if (this.moss_file_play_path.endsWith(".rec")) {
this.moss_file_play_path = this.moss_file_play_path.replace(".rec", ".ch26x");
}
if (this.moss_file_play_path.endsWith(".hx")) {
this.moss_file_play_path = this.moss_file_play_path.replace(".hx", ".ch26x");
}
HiLog.e(this.moss_file_play_path + "ddddddd" + this.moss_file_local_path);
copyFile(this.moss_file_play_path, this.moss_file_local_path);
}
HiLog.e(this.moss_file_play_path + "ddddddd" + this.moss_file_local_path);
CircleProgressBar circleProgressBar2 = this.circleprogressbar;
if (circleProgressBar2 != null) {
circleProgressBar2.setProgress(100);
}
this.isDownloading = false;
TextView textView = this.tv_cancel_downloading_video;
if (textView != null) {
textView.setText(R.string.continue_down);
}
TextView textView2 = this.tv_goto_downloading_video;
if (textView2 != null) {
textView2.setVisibility(0);
}
TextView textView3 = this.popu_tips_down;
if (textView3 != null) {
textView3.setText(getString(R.string.download_done));
}
CircleProgressBar circleProgressBar3 = this.circleprogressbar;
if (circleProgressBar3 != null) {
circleProgressBar3.setVisibility(8);
}
TextView textView4 = this.tv_one;
if (textView4 != null) {
textView4.setVisibility(0);
}
TextView textView5 = this.tv_two;
if (textView5 != null) {
textView5.setVisibility(0);
}
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.tv_one, "Alpha", 0.0f, 1.0f);
ofFloat.setDuration(300L);
ofFloat.start();
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.tv_two, "Alpha", 0.0f, 1.0f);
ofFloat2.setDuration(300L);
ofFloat2.start();
}
private void showPopPupProgress() {
View inflate = getLayoutInflater().inflate(R.layout.pup_loading_video, (ViewGroup) null, false);
this.progressPop = new PopupWindow(inflate);
this.progressPop.setBackgroundDrawable(new ColorDrawable(0));
this.progressPop.setFocusable(true);
this.progressPop.setWidth(-1);
this.progressPop.setHeight(-1);
this.circleprogressbar = (CircleProgressBar) inflate.findViewById(R.id.circleprogressbar);
this.popu_tips_down = (TextView) inflate.findViewById(R.id.popu_tips_down);
this.tv_one = (TextView) inflate.findViewById(R.id.tv_one);
this.tv_two = (TextView) inflate.findViewById(R.id.tv_two);
if (isFinishing()) {
return;
}
this.progressPop.showAtLocation(inflate, 17, 0, 0);
this.progressPop.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
CloudPlaybackActivity.this.isDownloading = false;
if (CloudPlaybackActivity.this.mCamera == null || CloudPlaybackActivity.this.mCamera.mPlayOSS == null) {
return;
}
CloudPlaybackActivity.this.mCamera.mPlayOSS.StopPlayLocal();
}
});
TextView textView = (TextView) inflate.findViewById(R.id.tv_cancel_downloading_video);
this.tv_cancel_downloading_video = textView;
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (CloudPlaybackActivity.this.getString(R.string.continue_down).equals(CloudPlaybackActivity.this.tv_cancel_downloading_video.getText().toString().trim())) {
CloudPlaybackActivity.this.progressPop.dismiss();
} else {
CloudPlaybackActivity.this.progressPop.dismiss();
CloudPlaybackActivity.this.deleteLoadingFile();
}
}
});
TextView textView2 = (TextView) inflate.findViewById(R.id.tv_goto_downloading_video);
this.tv_goto_downloading_video = textView2;
textView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CloudPlaybackActivity.this.progressPop.dismiss();
Intent intent = new Intent(CloudPlaybackActivity.this, (Class<?>) LocalFileActivity2.class);
intent.putExtra(HiDataValue.EXTRAS_KEY_UID, CloudPlaybackActivity.this.mCamera.getUid());
CloudPlaybackActivity.this.startActivity(intent);
}
});
}
public void deleteLoadingFile() {
new File(this.moss_file_play_path).delete();
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i2 == -1) {
this.tv_sort.setText(getString(R.string.desc));
this.mIsDown = true;
this.iv_arrow.animate().rotation(0.0f).setDuration(0L).start();
this.mType = intent.getIntExtra("type", 0);
if (this.day_list.size() > this.mType) {
this.video_list.clear();
}
this.adapter.setClickItemPosition(-10);
this.adapter.notifyDataSetChanged();
if (this.mCamera != null) {
this.mIsDataReceiveEnd = false;
if (this.day_list.size() > this.mType) {
ArrayList<String> arrayList = this.day_list;
HiLog.e(arrayList.get((arrayList.size() - this.mType) - 1));
HiPlayOSSSDK hiPlayOSSSDK = this.mCamera.mPlayOSS;
ArrayList<String> arrayList2 = this.day_list;
hiPlayOSSSDK.GetOSSFileList(arrayList2.get((arrayList2.size() - this.mType) - 1), 1, 0);
}
}
this.list_video_online.setVisibility(0);
this.tv_nothing.setVisibility(8);
if (this.list_video_online.getFooterViewsCount() == 0) {
this.list_video_online.addFooterView(this.loadingView);
}
TextView textView = (TextView) this.searchTimeView.findViewById(R.id.txtSearchTimeDuration);
ArrayList<String> arrayList3 = this.day_list;
textView.setText(arrayList3.get((arrayList3.size() - this.mType) - 1));
this.mCamera.registerIOSessionListener(this);
}
}
@Override
public void callbackOSSReq(String str, int i, int i2, int i3, String str2) {
HiLog.e(str + ":::" + i + ":::" + i2 + "::" + i3);
Message obtain = Message.obtain();
if (i == 1) {
obtain.what = b.l;
} else if (i == 2) {
obtain.what = b.m;
} else {
obtain.what = i;
}
obtain.obj = str;
obtain.arg1 = i2;
obtain.arg2 = i3;
this.mHandler.sendMessage(obtain);
}
@Override
public void callbackOSSData(int i, byte[] bArr, int i2, int i3, int i4, int i5, int i6, int i7, String str) {
int i8;
HiLog.e(i + ":::" + i7 + ":::" + i2);
Message obtain = Message.obtain();
if (i == 1) {
if (i7 != 0) {
if (i7 == 1) {
HiLog.e("::" + i2 + "::" + i3 + "::" + i4 + "::" + i5 + "::" + i6 + "::" + i7 + ":::" + this.video_list.size());
obtain.what = 1000000;
this.mHandler.sendMessage(obtain);
return;
}
return;
}
HiLog.e("" + new String(bArr).trim() + "::" + i2 + "::" + i3 + "::" + i4 + "::" + i5 + "::" + i6 + "::" + i7 + "::::" + this.video_list.size());
obtain.what = 999999;
Bundle bundle = new Bundle();
bundle.putInt("fileSize", i2);
bundle.putInt("StartTime", i4);
bundle.putInt("EndTime", i5);
bundle.putByteArray(ImagePagerActivity.FILENAME, bArr);
bundle.putInt("RecType", i3);
obtain.setData(bundle);
this.mHandler.sendMessage(obtain);
return;
}
if (i == 3) {
HiLog.e(i + ":::::" + new String(bArr) + ":::" + i7 + "::::" + this.day_list.size());
if (i7 == 1) {
this.day_list.add(new String(bArr));
}
if (i7 == 2) {
obtain.what = 301;
Bundle bundle2 = new Bundle();
bundle2.putByteArray("data", bArr);
obtain.setData(bundle2);
obtain.arg1 = this.day_list.size();
this.mHandler.sendMessage(obtain);
return;
}
return;
}
int i9 = 0;
if (i == 24837) {
if (i7 == 1) {
System.arraycopy(bArr, 0, this.cloudBuff, this.cloudBuffLength, i2);
this.cloudBuffLength += i2;
return;
}
if (i7 == 2) {
int i10 = this.cloudBuffLength / 12;
HiLog.e("" + this.cloudBuffLength + ":::::" + i10);
byte[] bArr2 = new byte[12];
byte[] bArr3 = new byte[8];
if (i10 > 0) {
for (int i11 = 0; i11 < i10; i11++) {
System.arraycopy(this.cloudBuff, i11 * 12, bArr2, 0, 12);
System.arraycopy(bArr2, 0, bArr3, 0, 8);
this.day_list.add(new String(bArr3));
}
}
obtain.what = 300;
this.mHandler.sendMessage(obtain);
return;
}
return;
}
if (i != 25093) {
return;
}
if (i7 == 1) {
System.arraycopy(bArr, 0, this.cloudBuff, this.cloudBuffLength, i2);
this.cloudBuffLength += i2;
}
if (i7 == 2) {
int i12 = 148;
int i13 = this.cloudBuffLength / 148;
HiLog.e("" + this.cloudBuffLength + ":::::" + i13);
byte[] bArr4 = new byte[148];
int i14 = 128;
byte[] bArr5 = new byte[128];
if (i13 > 0) {
int i15 = 0;
while (i15 < i13) {
System.arraycopy(this.cloudBuff, i15 * 148, bArr4, i9, i12);
System.arraycopy(bArr4, i9, bArr5, i9, i14);
int byteArrayToInt_Little = Packet.byteArrayToInt_Little(bArr4, i14);
int byteArrayToInt_Little2 = Packet.byteArrayToInt_Little(bArr4, 132);
int byteArrayToInt_Little3 = Packet.byteArrayToInt_Little(bArr4, 136);
int byteArrayToInt_Little4 = Packet.byteArrayToInt_Little(bArr4, 140);
HiLog.e("" + new String(bArr5).trim() + "::" + byteArrayToInt_Little + "::::" + this.video_list.size());
VideoInfo videoInfo = new VideoInfo(i9);
videoInfo.setRecType(byteArrayToInt_Little2);
videoInfo.filename = new String(bArr5).trim();
String[] split = videoInfo.filename.split("/");
if (split.length >= 4) {
StringBuilder sb = new StringBuilder();
i8 = i13;
sb.append(split[1]);
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
sb.append(split[3]);
videoInfo.start_time = sb.toString();
videoInfo.setTimeLength(Integer.toString((byteArrayToInt_Little4 - byteArrayToInt_Little3) / 1000));
videoInfo.fileLen = byteArrayToInt_Little;
videoInfo.setTime(byteArrayToInt_Little3);
this.video_list.add(videoInfo);
} else {
i8 = i13;
}
i15++;
i13 = i8;
i12 = 148;
i14 = 128;
i9 = 0;
}
Collections.reverse(this.video_list);
obtain.what = 999998;
this.mHandler.sendMessage(obtain);
}
}
}
@Override
public void CallBackOSSDownLoad(int i, int i2, int i3, String str) {
HiLog.e(i2 + ":::::" + i3 + ":::" + i);
Bundle bundle = new Bundle();
bundle.putLong("total", (long) i3);
bundle.putLong("curSize", (long) i2);
bundle.putString(ClientCookie.PATH_ATTR, this.path);
Message obtainMessage = this.handler.obtainMessage();
obtainMessage.what = HiDataValue.HANDLE_MESSAGE_DOWNLOAD_STATE;
obtainMessage.arg1 = i;
obtainMessage.setData(bundle);
this.handler.sendMessage(obtainMessage);
}
@Override
public void CallBackOSSDownLoadExt(int i, long j, long j2, String str) {
HiLog.e(j + ":::::" + j2 + ":::" + i);
if (i == 24831) {
if (this.firstReceive != 1) {
this.cloudBuffLength = 0;
this.firstReceive = 1;
this.cloudBuff = null;
this.cloudBuff = new byte[(int) j2];
return;
}
return;
}
if (i == 25087 && this.firstReceive != 1) {
this.cloudBuffLength = 0;
this.firstReceive = 1;
this.cloudBuff = null;
this.cloudBuff = new byte[(int) j2];
}
}
public void showLocalError(String str) {
PopupWindow popupWindow = this.progressPop;
if (popupWindow != null && popupWindow.isShowing()) {
this.progressPop.dismiss();
deleteLoadingFile();
}
this.mIsDataReceiveEnd = true;
this.firstReceive = 0;
Toast.makeText(this, str, 1).show();
}
public void ShowOssError(int i, String str) {
this.mIsDataReceiveEnd = true;
this.firstReceive = 0;
PopupWindow popupWindow = this.progressPop;
if (popupWindow != null && popupWindow.isShowing()) {
this.progressPop.dismiss();
}
this.list_video_online.setVisibility(8);
this.searchTimeView.setVisibility(8);
this.tv_nothing.setVisibility(0);
if (i == 1) {
try {
str = "error: " + toHex(Integer.parseInt(str), 6);
} catch (Exception unused) {
str = "-10001";
}
}
this.tv_nothing.setText(str);
}
public static String toHex(int i, int i2) {
return splicingZero(Integer.toHexString(i), i2);
}
public static String splicingZero(String str, int i) {
int length = str.length();
for (int i2 = 0; i2 < i - length; i2++) {
str = PushConstants.PUSH_TYPE_NOTIFY + str;
}
return str;
}
public void Showclouderror(int i, int i2, int i3) {
PopupWindow popupWindow = this.progressPop;
if (popupWindow != null && popupWindow.isShowing()) {
this.progressPop.dismiss();
deleteLoadingFile();
}
this.firstReceive = 0;
this.mIsDataReceiveEnd = true;
String str = "Error: " + i2 + Constants.COLON_SEPARATOR + i3;
this.list_video_online.setVisibility(8);
this.searchTimeView.setVisibility(8);
this.tv_nothing.setVisibility(0);
this.tv_nothing.setText(str);
}
public void Showclouderror_ext(int i, int i2, int i3) {
String str;
PopupWindow popupWindow = this.progressPop;
if (popupWindow != null && popupWindow.isShowing()) {
this.progressPop.dismiss();
deleteLoadingFile();
}
this.firstReceive = 0;
this.mIsDataReceiveEnd = true;
if (i3 == -6) {
this.iv_choose_data.setClickable(false);
this.iv_package_info.setClickable(false);
str = getString(R.string.tips_old_password_is_wrong);
} else {
str = "Error: " + i2 + Constants.COLON_SEPARATOR + i3;
}
this.list_video_online.setVisibility(8);
this.searchTimeView.setVisibility(8);
this.tv_nothing.setVisibility(0);
this.tv_nothing.setText(str);
}
public void initCalenderViewPager(List<String> list, String str, final Calendar calendar, int i) {
this.calendarCurrentPage = i;
int parseInt = Integer.parseInt(str.substring(0, 4));
int parseInt2 = Integer.parseInt(str.substring(4, 6));
this.tv_years_month.setText(parseInt + Constants.ACCEPT_TIME_SEPARATOR_SERVER + parseInt2);
this.viewpager.setScanScroll(true);
this.listDay.addAll(getDaysByTimeStamp(list, parseInt, parseInt2));
CloudMyFilePagerAdapter cloudMyFilePagerAdapter = new CloudMyFilePagerAdapter(this, this.listDay, str, calendar, i);
this.cloudPagerAdapter = cloudMyFilePagerAdapter;
this.viewpager.setAdapter(cloudMyFilePagerAdapter);
this.viewpager.setCurrentItem(this.calendarCurrentPage);
setTitleGirdView();
this.stc_calendar_layout.addView(this.title_gView, new LinearLayout.LayoutParams(-1, -2));
this.cloudPagerAdapter.setOnGridItemClickListener(new CloudMyFilePagerAdapter.OnGridItemClickListener() {
@Override
public final void onDayItemClick(int i2) {
CloudPlaybackActivity.this.lambda$initCalenderViewPager$6$CloudPlaybackActivity(calendar, i2);
}
});
setListeners(this.listDay, calendar);
}
public void lambda$initCalenderViewPager$6$CloudPlaybackActivity(Calendar calendar, int i) {
if (HiTools.isCustomFastClick(500)) {
return;
}
calendar.set(5, 1);
int i2 = (i - (calendar.get(7) - 1)) + 1;
int i3 = calendar.get(2) + 1;
int i4 = calendar.get(1);
final StringBuilder sb = new StringBuilder();
sb.append(i4);
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
if (i3 < 10) {
sb.append(0);
sb.append(i3);
} else {
sb.append(i3);
}
sb.append(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
if (i2 < 10) {
sb.append(0);
sb.append(i2);
} else {
sb.append(i2);
}
if (isContainDays(this.listDay, i2)) {
this.rl_calendar.setVisibility(8);
EventBus.getDefault().post(new CloudCalenderDay(this.listDay, i4, i3, this.calendarCurrentPage, sb.toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "")));
this.mIsDown = true;
this.mCurrentPage = this.calendarCurrentPage;
this.tv_sort.setText(getString(R.string.desc));
this.iv_arrow.animate().rotation(0.0f).setDuration(0L).start();
this.video_list.clear();
this.adapter.setClickItemPosition(-10);
this.adapter.notifyDataSetChanged();
this.handler.postDelayed(new Runnable() {
@Override
public final void run() {
CloudPlaybackActivity.this.lambda$initCalenderViewPager$5$CloudPlaybackActivity(sb);
}
}, 500L);
this.txtSearchTime.setText(sb.toString());
}
}
public void lambda$initCalenderViewPager$5$CloudPlaybackActivity(StringBuilder sb) {
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
this.mIsDataReceiveEnd = false;
if (myCamera.mPlayOSS != null) {
this.mCamera.mPlayOSS.GetOSSFileList(sb.toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, ""), 1, 0);
}
}
this.list_video_online.setVisibility(0);
this.tv_nothing.setVisibility(8);
if (this.list_video_online.getFooterViewsCount() == 0) {
this.list_video_online.addFooterView(this.loadingView);
}
}
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));
}
private boolean isContainDays(List<Integer> list, int i) {
Iterator<Integer> it = list.iterator();
while (it.hasNext()) {
if (it.next().intValue() == i) {
return true;
}
}
return false;
}
public List<Integer> getDaysByTimeStamp(List<String> list, int i, int i2) {
ArrayList arrayList = new ArrayList();
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(i);
if (i2 < 10) {
stringBuffer.append(0);
}
stringBuffer.append(i2);
for (String str : list) {
if (str.startsWith(stringBuffer.toString())) {
arrayList.add(Integer.valueOf(str.replace(stringBuffer, "")));
}
}
return arrayList;
}
private GridView setGirdView() {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
GridView gridView = new GridView(this);
gridView.setLayoutParams(layoutParams);
gridView.setNumColumns(7);
gridView.setGravity(16);
gridView.setVerticalSpacing(1);
gridView.setHorizontalSpacing(1);
gridView.setBackgroundColor(0);
gridView.setSelector(new ColorDrawable(0));
return gridView;
}
private void setListeners(final List<Integer> list, final Calendar calendar) {
this.iv_left.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CloudPlaybackActivity.this.lambda$setListeners$7$CloudPlaybackActivity(view);
}
});
this.iv_right.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
CloudPlaybackActivity.this.lambda$setListeners$8$CloudPlaybackActivity(view);
}
});
this.viewpager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrollStateChanged(int i) {
}
@Override
public void onPageScrolled(int i, float f, int i2) {
}
@Override
public void onPageSelected(int i) {
calendar.add(2, i - CloudPlaybackActivity.this.calendarCurrentPage);
calendar.set(5, 1);
CloudPlaybackActivity.this.calendarCurrentPage = i;
CloudPlaybackActivity.this.tv_years_month.setText(calendar.get(1) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + (calendar.get(2) + 1));
list.clear();
List list2 = list;
CloudPlaybackActivity cloudPlaybackActivity = CloudPlaybackActivity.this;
list2.addAll(cloudPlaybackActivity.getDaysByTimeStamp(cloudPlaybackActivity.day_list, calendar.get(1), calendar.get(2) + 1));
EventBus.getDefault().post(new CloudCalenderDay(list, calendar.get(1), calendar.get(2) + 1, CloudPlaybackActivity.this.calendarCurrentPage, CloudPlaybackActivity.this.txtSearchTime.getText().toString().replace(Constants.ACCEPT_TIME_SEPARATOR_SERVER, "")));
}
});
}
public void lambda$setListeners$7$CloudPlaybackActivity(View view) {
showPreMonth(this.calendarCurrentPage);
}
public void lambda$setListeners$8$CloudPlaybackActivity(View view) {
showNextMonth(this.calendarCurrentPage);
}
private void showPreMonth(int i) {
this.viewpager.setCurrentItem(i - 1, true);
}
private void showNextMonth(int i) {
this.viewpager.setCurrentItem(i + 1, true);
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
boolean z = true;
HiLogcatUtil.e("" + i);
int length = strArr.length;
for (int i2 = 0; i2 < length; i2++) {
HiLogcatUtil.e(strArr.length + Constants.COLON_SEPARATOR + strArr[i2]);
}
for (int i3 : iArr) {
HiLogcatUtil.e(iArr.length + Constants.COLON_SEPARATOR + i3);
}
if (i == 10015) {
int length2 = iArr.length;
int i4 = 0;
while (true) {
if (i4 >= length2) {
break;
}
if (iArr[i4] != 0) {
z = false;
break;
}
i4++;
}
if (z) {
return;
}
HiTools.Hi_GoToSetting(strArr, this, this);
}
}
}