huangxiaodong пре 1 година
родитељ
комит
97a99e38dd

+ 3 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/view/filePathCreatPopView.h

@@ -11,7 +11,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface filePathCreatPopView : UIView
 @property(nonatomic,assign) NSInteger curType;// 1上传 2是备份
-@property (nonatomic,copy) void (^didClickOkBut)(NSString* folderName);
+@property(nonatomic,copy) NSArray *outSizeArr;//磁盘数据
+@property(nonatomic,copy) NSString *defaultSaveDiskStr;
+@property (nonatomic,copy) void (^didClickOkBut)(NSString* folderName,NSString* DiskPathStr);
 @end
 
 NS_ASSUME_NONNULL_END

+ 80 - 23
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/view/filePathCreatPopView.m

@@ -7,11 +7,12 @@
 
 #import "filePathCreatPopView.h"
 #import "filePathCreatTableViewCell.h"
-
+#import "cloudPhoneExtraFileListModel.h"
 
 @interface filePathCreatPopView ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
 {
     UIView *whiteBgView;
+    UILabel *titleLabel;
     UITextField *filePathNameTF;
     
     UIButton *canclButton;
@@ -19,6 +20,7 @@
 }
 
 @property (nonatomic, strong) UITableView *tableView;
+@property(nonatomic,copy) NSMutableArray *curDataArr;//磁盘数据 +默认
 @end
 
 @implementation filePathCreatPopView
@@ -46,8 +48,8 @@
     [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(0);
         make.right.mas_equalTo(0);
-        //make.height.mas_equalTo(418+ 10 + safeArea);
-        make.height.mas_equalTo(200+ 10 + safeArea);
+        make.height.mas_equalTo(418+ 10 + safeArea);
+        //make.height.mas_equalTo(200+ 10 + safeArea);
         make.bottom.mas_equalTo(10);
     }];
     
@@ -64,7 +66,7 @@
         make.bottom.mas_equalTo(whiteBgView.mas_top);
     }];
     
-    UILabel *titleLabel = [[UILabel alloc] init];
+    titleLabel = [[UILabel alloc] init];
     titleLabel.text = NSLocalizedString(@"File_upload_path_new",nil);
     titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
     titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
@@ -81,11 +83,11 @@
     [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(15);
         make.right.mas_equalTo(-15);
-        //make.height.mas_equalTo(70*2+50);
-        make.height.mas_equalTo(0.0);
+        make.height.mas_equalTo(70*2+50);
+        //make.height.mas_equalTo(0.0);
         make.top.equalTo(titleLabel.mas_bottom).offset(15.f);
     }];
-    self.tableView.hidden = YES;
+    //self.tableView.hidden = YES;
     
     UILabel *tipLabel = [[UILabel alloc] init];
     tipLabel.text = NSLocalizedString(@"File_upload_path_new_name_tip",nil);
@@ -200,7 +202,7 @@
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return 2;
+    return _curDataArr.count;
 }
 
 - (filePathCreatTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
@@ -224,24 +226,27 @@
         
     }
     
-    
-    if (row == 0){
-        //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
-        cell.titleLabel.text = @"云机系统名称";
-        
-        cell.checkButton.selected = YES;
-        
-    }else if (row == 1){
-        //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
- 
-        cell.titleLabel.text = @"云机系统名称";
-        
-       
+    if(row < _curDataArr.count){
+        cloudPhoneExtraFileModel *model = _curDataArr[row];
+        cell.curModel = model;
     }
+    
+//    if (row == 0){
+//        //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
+//        cell.titleLabel.text = @"云机系统名称";
+//
+//        cell.checkButton.selected = YES;
+//
+//    }else if (row == 1){
+//        //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
+//
+//        cell.titleLabel.text = @"云机系统名称";
+//
+//    }
 
     KWeakSelf
     cell.didClickSwitch = ^(BOOL SwitchOn) {
-        
+        [weakSelf setModelSelectInRow:row];
     };
     
     return cell;
@@ -277,6 +282,21 @@
     return headView;
 }
 
+- (void)setModelSelectInRow:(NSInteger)row
+{
+    for (int i=0; i<_curDataArr.count; i++) {
+        cloudPhoneExtraFileModel *model = _curDataArr[i];
+        model.isCheckType = NO;
+        
+        if(i == row){
+            model.isCheckType = YES;
+            _defaultSaveDiskStr = model.extraPath;
+        }
+    }
+    
+    [self.tableView reloadData];
+}
+
 //- (void)setFileTransferType:(NSInteger)fileTransferType
 //{
 //    _fileTransferType = fileTransferType;
@@ -351,6 +371,43 @@
 //}
 
 
+- (void)setOutSizeArr:(NSArray *)outSizeArr
+{
+    NSMutableArray *arr = [NSMutableArray new];
+    if(outSizeArr && outSizeArr.count >0){
+        [arr addObjectsFromArray:outSizeArr];
+    }
+    
+    cloudPhoneExtraFileModel *defModel = [cloudPhoneExtraFileModel new];
+    //defModel
+    defModel.extraPath = @"sdcard";
+    //defModel.extraTotalSize = ksharedAppDelegate.couldPhoneBaseInfoMod;
+    
+    [arr insertObject:defModel atIndex:0];
+    
+    NSInteger tableRowHeight = 70;
+    NSInteger allRow = arr.count;
+    
+    [whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.height.mas_equalTo(278 +tableRowHeight*allRow  + 10 + safeArea);
+        //make.height.mas_equalTo(418+ 10 + safeArea);
+        make.bottom.mas_equalTo(10);
+    }];
+    
+    [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(15);
+        make.right.mas_equalTo(-15);
+        make.height.mas_equalTo(tableRowHeight*allRow +50);
+        //make.height.mas_equalTo(0.0);
+        make.top.equalTo(titleLabel.mas_bottom).offset(15.f);
+    }];
+    
+    _curDataArr = arr;
+    [self.tableView reloadData];
+}
+
 - (void)tapUpFun:(UITapGestureRecognizer*)tap
 {
     //[self deleteFromSuperview];
@@ -384,7 +441,7 @@
         
         if(_didClickOkBut)
         {
-            _didClickOkBut(folderName);
+            _didClickOkBut(folderName,_defaultSaveDiskStr);
         }
     }
     

+ 3 - 1
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/view/filePathCreatTableViewCell.h

@@ -6,7 +6,7 @@
 //
 
 #import <UIKit/UIKit.h>
-
+#import "cloudPhoneExtraFileListModel.h"
 NS_ASSUME_NONNULL_BEGIN
 
 @interface filePathCreatTableViewCell : UITableViewCell
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property(nonatomic, strong) CALayer* bgViewLayer;
 @property(nonatomic, strong) UIButton *checkButton;
 
+@property(nonatomic, strong) cloudPhoneExtraFileModel *curModel;
+
 @property (nonatomic,copy) void (^didClickSwitch)(BOOL SwitchOn);
 @end
 

+ 19 - 4
创维盒子/双子星云手机/Class/Set/uploadFile/fileTransfeSet/view/filePathCreatTableViewCell.m

@@ -83,7 +83,7 @@
         make.height.mas_equalTo(36.f);
     }];
     
-    [checkButton addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventValueChanged)];
+    [checkButton addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventTouchUpInside)];
     
     
     /**标题*/
@@ -123,12 +123,27 @@
     }];
     
     
-    titleLabel2.text = @"30GB/128GB";
+    //titleLabel2.text = @"30GB/128GB";
 }
 
-- (void)maskSwitchPressed:(UISwitch *)maskSwitch{
+
+- (void)setCurModel:(cloudPhoneExtraFileModel *)curModel
+{
+    titleLabel.text = curModel.extraPath;
+    
+    CGFloat extraAvableSizeF = curModel.extraAvableSize / 1024.0 /1024.0/1024.0;
+    CGFloat extraTotalSizeF = curModel.extraTotalSize / 1024.0 /1024.0/1024.0;
+    
+    titleLabel2.text = [[NSString alloc] initWithFormat:@"%.1fGB/%.1fGB",extraAvableSizeF,extraTotalSizeF];
+    
+    checkButton.selected = curModel.isCheckType;
+}
+
+- (void)maskSwitchPressed:(UIButton *)maskSwitch{
+    maskSwitch.selected = !maskSwitch.selected;
+    
     if(_didClickSwitch){
-        _didClickSwitch(maskSwitch.on);
+        _didClickSwitch(maskSwitch.selected);
     }
 }