|
@@ -21,6 +21,7 @@
|
|
|
@property(nonatomic,strong) CAGradientLayer *glayer;
|
|
|
|
|
|
@property(nonatomic,strong) UILabel *fileNamelabel;
|
|
|
+@property(nonatomic,strong) UILabel *fileTimelabel;
|
|
|
@property(nonatomic,strong) UILabel *fileProgresslabel;
|
|
|
@property(nonatomic,strong) UILabel *fileSpeedlabel;
|
|
|
|
|
@@ -127,16 +128,32 @@
|
|
|
_fileNamelabel = [[UILabel alloc] init];
|
|
|
_fileNamelabel.font = [UIFont boldSystemFontOfSize:16.0];
|
|
|
_fileNamelabel.textColor = [UIColor blackColor];
|
|
|
- //_fileNamelabel.backgroundColor = [UIColor greenColor];
|
|
|
+ //_fileNamelabel.backgroundColor = [UIColor orangeColor];
|
|
|
[self.contentView addSubview:_fileNamelabel];
|
|
|
|
|
|
[_fileNamelabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(_fileImageView.mas_right).offset(10);
|
|
|
- make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
|
|
|
+ make.right.mas_equalTo(self.mas_centerX).offset(-20);
|
|
|
make.height.mas_equalTo(19);
|
|
|
make.bottom.mas_equalTo(_progressBgView.mas_top).offset(-3);
|
|
|
}];
|
|
|
|
|
|
+
|
|
|
+ _fileTimelabel = [[UILabel alloc] init];
|
|
|
+ //_fileTimelabel.font = [UIFont systemFontOfSize:13.0];
|
|
|
+ _fileTimelabel.adjustsFontSizeToFitWidth = YES;
|
|
|
+ _fileTimelabel.textColor = [UIColor blackColor];
|
|
|
+ _fileTimelabel.textAlignment = NSTextAlignmentRight;
|
|
|
+ //_fileTimelabel.backgroundColor = [UIColor greenColor];
|
|
|
+ [self.contentView addSubview:_fileTimelabel];
|
|
|
+ //_fileTimelabel.text = @"当前文件预计需20分";
|
|
|
+ [_fileTimelabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(self.mas_centerX).offset(-20);
|
|
|
+ make.right.mas_equalTo(_upLoadStateButton.mas_left).offset(-10);
|
|
|
+ make.height.mas_equalTo(15);
|
|
|
+ make.bottom.mas_equalTo(_progressBgView.mas_top).offset(-3);
|
|
|
+ }];
|
|
|
+
|
|
|
_fileProgresslabel = [[UILabel alloc] init];
|
|
|
_fileProgresslabel.font = [UIFont systemFontOfSize:12.0];
|
|
|
_fileProgresslabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
|
|
@@ -253,6 +270,7 @@
|
|
|
|
|
|
if(_curPhotosBackupsTaskModel.preTimeInterval <= 0){
|
|
|
_fileSpeedlabel.text = @"--";
|
|
|
+ [self handlFileTimelabelFunBy:0];
|
|
|
}
|
|
|
else{
|
|
|
NSTimeInterval timers = _curPhotosBackupsTaskModel.curTimeInterval - _curPhotosBackupsTaskModel.preTimeInterval;
|
|
@@ -270,6 +288,8 @@
|
|
|
}
|
|
|
|
|
|
_fileSpeedlabel.text = speedStr;
|
|
|
+
|
|
|
+ [self handlFileTimelabelFunBy:speed];
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -282,14 +302,17 @@
|
|
|
_fileSpeedlabel.hidden = NO;
|
|
|
|
|
|
_upLoadStateButton.hidden = NO;
|
|
|
+ [self handlFileTimelabelFunBy:-1];
|
|
|
}
|
|
|
else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateFail){
|
|
|
_upLoadStateButton.hidden = YES;
|
|
|
_progressBgView.hidden = YES;
|
|
|
+ [self handlFileTimelabelFunBy:-1];
|
|
|
}
|
|
|
else{
|
|
|
_upLoadStateButton.hidden = YES;
|
|
|
_progressBgView.hidden = YES;
|
|
|
+ [self handlFileTimelabelFunBy:-1];
|
|
|
}
|
|
|
|
|
|
_fileNamelabel.text = NSLocalizedString(@"set_Privacy_title_image",nil);
|
|
@@ -310,7 +333,7 @@
|
|
|
|
|
|
_rightTiplabel.hidden = NO;
|
|
|
|
|
|
- _rightTiplabel.text = [[NSString alloc] initWithFormat:@"%@:%ld",NSLocalizedString(@"File_Transfer_List_head_title_done",nil),_curPhotosBackupsTaskModel.didBackupsCount];
|
|
|
+ _rightTiplabel.text = [[NSString alloc] initWithFormat:@"%@:%ld",NSLocalizedString(@"backups_cur_task_done_numbers",nil),_curPhotosBackupsTaskModel.didBackupsCount];
|
|
|
}
|
|
|
else if(_curPhotosBackupsTaskModel.curBackupsState == backupsStateFail){
|
|
|
|
|
@@ -322,7 +345,9 @@
|
|
|
_rightTiplabel.text = _curPhotosBackupsTaskModel.backupsTipMsg;
|
|
|
}
|
|
|
else{
|
|
|
- _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%ld/%ld",_curPhotosBackupsTaskModel.didBackupsCount,_curPhotosBackupsTaskModel.count - _curPhotosBackupsTaskModel.failCount];
|
|
|
+ //_fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%ld/%ld",_curPhotosBackupsTaskModel.didBackupsCount,_curPhotosBackupsTaskModel.count - _curPhotosBackupsTaskModel.failCount];
|
|
|
+
|
|
|
+ [self handlFileProgresslabelFun];
|
|
|
|
|
|
//进度设置
|
|
|
CGRect frame = CGRectMake(0, 0, SCREEN_W - 15*2 - 34*2, 2);
|
|
@@ -346,6 +371,83 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+- (void)handlFileTimelabelFunBy:(NSInteger)speed
|
|
|
+{
|
|
|
+ NSString * timeStr = @"--";
|
|
|
+ CGFloat estimateTime = 0.0;
|
|
|
+ if(speed < 0){
|
|
|
+ _fileTimelabel.text = @"";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (speed == 0){
|
|
|
+ //不处理
|
|
|
+ //estimateTime = 0.0;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ if(_curPhotosBackupsTaskModel.totalBytes >0
|
|
|
+ && _curPhotosBackupsTaskModel.didUploadBytes>0
|
|
|
+ && _curPhotosBackupsTaskModel.totalBytes > _curPhotosBackupsTaskModel.didUploadBytes){
|
|
|
+ estimateTime = (_curPhotosBackupsTaskModel.totalBytes - _curPhotosBackupsTaskModel.didUploadBytes)/speed;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(estimateTime>0){
|
|
|
+ NSInteger seconds = (NSInteger)estimateTime;
|
|
|
+ if(seconds >= 60){
|
|
|
+ timeStr = [[NSString alloc] initWithFormat:@"%ld%@",seconds/60,NSLocalizedString(@"common_minute",nil)];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ timeStr = [[NSString alloc] initWithFormat:@"%ld%@",seconds,NSLocalizedString(@"common_minute",nil)];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ _fileTimelabel.text = [[NSString alloc] initWithFormat:@"%@%@",NSLocalizedString(@"Estimated_time",nil),timeStr];
|
|
|
+
|
|
|
+
|
|
|
+// "Estimated_time" = "当前文件预计需";
|
|
|
+// "common_minute" = "分";
|
|
|
+// "common_second" = "秒";
|
|
|
+}
|
|
|
+
|
|
|
+- (void)handlFileProgresslabelFun
|
|
|
+{
|
|
|
+ if(_curPhotosBackupsTaskModel.totalBytes == 0
|
|
|
+ || _curPhotosBackupsTaskModel.didUploadBytes == 0){
|
|
|
+ _fileProgresslabel.text = @"";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString * totalSizeStr = nil;
|
|
|
+ NSInteger totalSize_k = _curPhotosBackupsTaskModel.totalBytes / 1024;
|
|
|
+ if(totalSize_k < 1024){
|
|
|
+ totalSizeStr = [[NSString alloc] initWithFormat:@"%ldKB",totalSize_k];
|
|
|
+ }
|
|
|
+ else if( totalSize_k >= 1024 && totalSize_k < 1024*1024){
|
|
|
+ totalSizeStr = [[NSString alloc] initWithFormat:@"%.1fMB",totalSize_k/1024.0];
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fG",totalSize_k/1024.0/1024.0];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString * didUploadStr = nil;
|
|
|
+ NSInteger didUploadSize_k = _curPhotosBackupsTaskModel.didUploadBytes / 1024;
|
|
|
+ if(didUploadSize_k < 1024){
|
|
|
+ didUploadStr = [[NSString alloc] initWithFormat:@"%ldKB",didUploadSize_k];
|
|
|
+ }
|
|
|
+ else if( didUploadSize_k >= 1024 && didUploadSize_k < 1024*1024){
|
|
|
+ didUploadStr = [[NSString alloc] initWithFormat:@"%.1fMB",didUploadSize_k/1024.0];
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ didUploadStr = [[NSString alloc] initWithFormat:@"%.2fG",didUploadSize_k/1024.0/1024.0];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@/%@",didUploadStr,totalSizeStr];
|
|
|
+}
|
|
|
|
|
|
-(void)longPressClick:(UILongPressGestureRecognizer *)press{
|
|
|
//state属性是所有手势父类提供的方法,用于记录手势的状态
|