|
|
@@ -193,7 +193,7 @@
|
|
|
self.selectButton.hidden = YES;
|
|
|
|
|
|
if(_curShareFileDataModel.downloadBoxStateType == downloadBoxStateBegin
|
|
|
- ||_curShareFileDataModel.downloadBoxStateType == downloadBoxStateUploading
|
|
|
+ ||_curShareFileDataModel.downloadBoxStateType == downloadBoxStateDownloadloading
|
|
|
||_curShareFileDataModel.downloadBoxStateType == downloadBoxStateSuspend){
|
|
|
_upLoadStateButton.hidden = NO;
|
|
|
}
|
|
|
@@ -308,120 +308,124 @@
|
|
|
|
|
|
//HLog(@"1111111: %@ %@",curShareFileDataModel.fileUrl,curShareFileDataModel.fileSize);
|
|
|
|
|
|
-// //进度设置
|
|
|
-// CGRect frame = CGRectMake(0, 0, SCREEN_W - 15*2 - 34*2, 2);
|
|
|
-//
|
|
|
-// NSInteger totalSize = curCouldPhoneFileModel.length;
|
|
|
-// if(totalSize == 0.0){
|
|
|
-// totalSize += 0.0001;
|
|
|
-// }
|
|
|
-//
|
|
|
-// CGFloat curProgress = curCouldPhoneFileModel.didDownloadBytes/(totalSize*1.0);
|
|
|
-//
|
|
|
-// if(curProgress > 1){
|
|
|
-// curProgress = 1;
|
|
|
-// }
|
|
|
-//
|
|
|
-// frame.size.width = frame.size.width * curProgress;
|
|
|
-//
|
|
|
-// if (isnan(frame.size.width))
|
|
|
-// {
|
|
|
-// HLog(@"计算出错了");
|
|
|
-// frame.size.width = 10.0;
|
|
|
-// }
|
|
|
-//
|
|
|
-//// HLog(@"%f, %f, %f, %f,",frame.origin.x,frame.origin.y,frame.size.width,frame.size.height);
|
|
|
-//// HLog(@"%@",_progressSelectView);
|
|
|
-//
|
|
|
-// _progressSelectView.frame = frame;
|
|
|
-// //_glayer.frame = frame;
|
|
|
-//
|
|
|
-// NSString * totalSizeStr = nil;
|
|
|
-// NSInteger totalSize_k = totalSize / 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 = curCouldPhoneFileModel.didDownloadBytes / 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];
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(curCouldPhoneFileModel.curDownloadStateType == downloadStateWait){
|
|
|
-// [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_wait"] forState:UIControlStateNormal];
|
|
|
-// }
|
|
|
-// else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateUploading){
|
|
|
-// [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
|
|
|
-// _fileSpeedlabel.hidden = NO;
|
|
|
-//
|
|
|
-// //
|
|
|
-// _fileSpeedlabel.text = @"";
|
|
|
-//
|
|
|
-// if(curCouldPhoneFileModel.preTimeInterval <= 0){
|
|
|
-// _fileSpeedlabel.text = @"--";
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// NSTimeInterval timers = curCouldPhoneFileModel.curTimeInterval - curCouldPhoneFileModel.preTimeInterval;
|
|
|
-//
|
|
|
-// if(timers > 0){
|
|
|
-// //long speed= 1*1024*1024 / timers;
|
|
|
-//
|
|
|
-// long speed= (curCouldPhoneFileModel.didDownloadBytes - curCouldPhoneFileModel.preDownloadBytes) / timers;
|
|
|
-//
|
|
|
-// NSString * speedStr = nil;
|
|
|
-// NSInteger speed_k = speed / (1024);
|
|
|
-// if(speed_k < 1024){
|
|
|
-// speedStr = [[NSString alloc] initWithFormat:@"%ldKB/s",speed_k];
|
|
|
-// }
|
|
|
-// else {
|
|
|
-// speedStr = [[NSString alloc] initWithFormat:@"%.1fMB/s",speed_k/1024.0];
|
|
|
-// }
|
|
|
-//
|
|
|
-// _fileSpeedlabel.text = speedStr;
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// curCouldPhoneFileModel.preTimeInterval = curCouldPhoneFileModel.curTimeInterval;
|
|
|
-// curCouldPhoneFileModel.preDownloadBytes = curCouldPhoneFileModel.didDownloadBytes;
|
|
|
-// }
|
|
|
-// else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateSuspend){
|
|
|
-// [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
|
|
|
-// }
|
|
|
-// else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateFail){
|
|
|
-// [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_reStart"] forState:UIControlStateNormal];
|
|
|
-// _progressBgView.hidden = YES;
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// _upLoadStateButton.hidden = YES;
|
|
|
-// _progressBgView.hidden = YES;
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// if(curCouldPhoneFileModel.curDownloadStateType == downloadStateDone){
|
|
|
-// NSString*tipStr = NSLocalizedString(@"File_download_Path_default_done",nil);
|
|
|
-// _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@ %@",totalSizeStr,tipStr];
|
|
|
-// }
|
|
|
-// else if(curCouldPhoneFileModel.curDownloadStateType == downloadStateFail){
|
|
|
-// _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@",totalSizeStr];
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@/%@",didUploadStr,totalSizeStr];
|
|
|
-// }
|
|
|
+ //进度设置
|
|
|
+ CGRect frame = CGRectMake(0, 0, SCREEN_W - 15*2 - 34*2, 2);
|
|
|
+
|
|
|
+ if(curShareFileDataModel.totalSize == 0){
|
|
|
+ curShareFileDataModel.totalSize = curShareFileDataModel.fileSize.longLongValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ NSInteger totalSize = curShareFileDataModel.totalSize;
|
|
|
+ if(totalSize == 0.0){
|
|
|
+ totalSize += 0.0001;
|
|
|
+ }
|
|
|
+
|
|
|
+ CGFloat curProgress = curShareFileDataModel.currentSize/(totalSize*1.0);
|
|
|
+
|
|
|
+ if(curProgress > 1){
|
|
|
+ curProgress = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ frame.size.width = frame.size.width * curProgress;
|
|
|
+
|
|
|
+ if (isnan(frame.size.width))
|
|
|
+ {
|
|
|
+ HLog(@"计算出错了");
|
|
|
+ frame.size.width = 10.0;
|
|
|
+ }
|
|
|
+
|
|
|
+// HLog(@"%f, %f, %f, %f,",frame.origin.x,frame.origin.y,frame.size.width,frame.size.height);
|
|
|
+// HLog(@"%@",_progressSelectView);
|
|
|
+
|
|
|
+ _progressSelectView.frame = frame;
|
|
|
+ //_glayer.frame = frame;
|
|
|
+
|
|
|
+ NSString * totalSizeStr = nil;
|
|
|
+ NSInteger totalSize_k = totalSize / 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 = curShareFileDataModel.currentSize / 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];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(curShareFileDataModel.downloadBoxStateType == downloadBoxStateBegin){
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_wait"] forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+ else if(curShareFileDataModel.downloadBoxStateType == downloadBoxStateDownloadloading){
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_suspend"] forState:UIControlStateNormal];
|
|
|
+ _fileSpeedlabel.hidden = NO;
|
|
|
+
|
|
|
+ //
|
|
|
+ _fileSpeedlabel.text = @"";
|
|
|
+
|
|
|
+ if(curShareFileDataModel.preTimeInterval <= 0){
|
|
|
+ _fileSpeedlabel.text = @"--";
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ NSTimeInterval timers = curShareFileDataModel.curTimeInterval - curShareFileDataModel.preTimeInterval;
|
|
|
+
|
|
|
+ if(timers > 0){
|
|
|
+ //long speed= 1*1024*1024 / timers;
|
|
|
+
|
|
|
+ long speed= (curShareFileDataModel.currentSize - curShareFileDataModel.preDownloadBytes) / timers;
|
|
|
+
|
|
|
+ NSString * speedStr = nil;
|
|
|
+ NSInteger speed_k = speed / (1024);
|
|
|
+ if(speed_k < 1024){
|
|
|
+ speedStr = [[NSString alloc] initWithFormat:@"%ldKB/s",speed_k];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ speedStr = [[NSString alloc] initWithFormat:@"%.1fMB/s",speed_k/1024.0];
|
|
|
+ }
|
|
|
+
|
|
|
+ _fileSpeedlabel.text = speedStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ curShareFileDataModel.preTimeInterval = curShareFileDataModel.curTimeInterval;
|
|
|
+ curShareFileDataModel.preDownloadBytes = curShareFileDataModel.currentSize;
|
|
|
+ }
|
|
|
+ else if(curShareFileDataModel.downloadBoxStateType == downloadBoxStateSuspend){
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
|
|
|
+ }
|
|
|
+ else if(curShareFileDataModel.downloadBoxStateType == downloadBoxStateFail){
|
|
|
+ [_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_reStart"] forState:UIControlStateNormal];
|
|
|
+ _progressBgView.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _upLoadStateButton.hidden = YES;
|
|
|
+ _progressBgView.hidden = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(curShareFileDataModel.downloadBoxStateType == downloadBoxStateDone){
|
|
|
+ NSString*tipStr = NSLocalizedString(@"File_download_Path_default_done",nil);
|
|
|
+ _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@ %@",totalSizeStr,tipStr];
|
|
|
+ }
|
|
|
+ else if(curShareFileDataModel.downloadBoxStateType == downloadBoxStateFail){
|
|
|
+ _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@",totalSizeStr];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _fileProgresslabel.text = [[NSString alloc] initWithFormat:@"%@/%@",didUploadStr,totalSizeStr];
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -456,7 +460,7 @@
|
|
|
_didTapPressClick();
|
|
|
}
|
|
|
|
|
|
- if(_curShareFileDataModel.downloadBoxStateType == downloadBoxStateUploading){
|
|
|
+ if(_curShareFileDataModel.downloadBoxStateType == downloadBoxStateDownloadloading){
|
|
|
[_upLoadStateButton setImage:[UIImage imageNamed:@"uploadFile_start"] forState:UIControlStateNormal];
|
|
|
|
|
|
}
|