|
@@ -6,9 +6,13 @@
|
|
|
//
|
|
|
|
|
|
#import "downLoadPreviewViewController.h"
|
|
|
+#import "couldPhoneFileListModel.h"
|
|
|
+#import "downLoadPreViewCell.h"
|
|
|
|
|
|
-@interface downLoadPreviewViewController ()
|
|
|
-
|
|
|
+@interface downLoadPreviewViewController ()<UITableViewDelegate,UITableViewDataSource>
|
|
|
+@property (nonatomic, strong) UITableView *tableView;
|
|
|
+@property (nonatomic, strong) UIButton *rightButton;
|
|
|
+@property(nonatomic,strong) couldPhoneFileListModel *curCouldPhoneFileListMod;
|
|
|
@end
|
|
|
|
|
|
@implementation downLoadPreviewViewController
|
|
@@ -17,19 +21,155 @@
|
|
|
[super viewDidLoad];
|
|
|
// Do any additional setup after loading the view.
|
|
|
|
|
|
- self.titleLabel.text = NSLocalizedString(@"my_set_no_File_Transfer_List",nil) ;
|
|
|
-
|
|
|
[self.toolBar setHidden:YES];
|
|
|
[self.navigationBar setHidden:YES];
|
|
|
[self.navBarBGView setHidden:NO];
|
|
|
self.navBarBGView.backgroundColor = [UIColor whiteColor];
|
|
|
[self.view setBackgroundColor:[UIColor whiteColor]];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(searchFileListDoneFun:) name:searchFileListDoneNotification object:nil];
|
|
|
+
|
|
|
+ [self drawAnyView];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)drawAnyView{
|
|
|
+
|
|
|
+ _rightButton = [[UIButton alloc] init];
|
|
|
+ [_rightButton setTitle:NSLocalizedString(@"File_upload_Record_select_all",nil) forState:UIControlStateNormal];
|
|
|
+ [_rightButton setTitle:NSLocalizedString(@"File_upload_cancel_select_all",nil) forState:UIControlStateSelected];
|
|
|
+
|
|
|
+ [_rightButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
|
|
|
+ _rightButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
|
|
|
+ _rightButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
|
|
|
+ [_rightButton addTarget:self action:@selector(didClickSelectAllButton:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.navBarBGView addSubview:_rightButton];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(120);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.view addSubview:self.tableView];
|
|
|
+ [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
+ make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - 懒加载
|
|
|
+- (UITableView *)tableView{
|
|
|
+ if (!_tableView) {
|
|
|
+ _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
|
|
|
+ _tableView.delegate = self;
|
|
|
+ _tableView.dataSource = self;
|
|
|
+ _tableView.showsVerticalScrollIndicator = NO;
|
|
|
+ _tableView.showsHorizontalScrollIndicator = NO;
|
|
|
+// _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
|
|
|
+ [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
|
|
|
+ [_tableView setSeparatorColor:[UIColor clearColor]];
|
|
|
+ [_tableView setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [_tableView setTableFooterView:[UIView new]];
|
|
|
+ [_tableView setBounces:YES];
|
|
|
+
|
|
|
+ if (@available(iOS 15.0, *)) {
|
|
|
+ _tableView.sectionHeaderTopPadding = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return _tableView;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark - 列表委托
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
+ if(!_curCouldPhoneFileListMod){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return _curCouldPhoneFileListMod.data.list.count;
|
|
|
+}
|
|
|
+
|
|
|
+- (downLoadPreViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+
|
|
|
+ __block NSInteger row = indexPath.row;
|
|
|
+ static NSString *identifier = @"downLoadPreViewCell";
|
|
|
+
|
|
|
+ downLoadPreViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
|
|
|
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
+ if (!cell){
|
|
|
+ cell = [[downLoadPreViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
|
|
|
+ [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
|
|
+ [cell setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [cell setAccessoryType:(UITableViewCellAccessoryNone)];
|
|
|
+
|
|
|
+ [cell.bgViewLayer removeFromSuperlayer];
|
|
|
+ [cell.titleLabel2 setHidden:NO];
|
|
|
+ [cell.rightImage setHidden:YES];
|
|
|
+ [cell.lineView setHidden:YES];
|
|
|
+ [cell.checkButton setHidden:NO];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(row < _curCouldPhoneFileListMod.data.list.count){
|
|
|
+ couldPhoneFileModel* fileModel = _curCouldPhoneFileListMod.data.list[row];
|
|
|
+ cell.curFileModel = fileModel;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
+ [weakSelf userCheckFilePreviewByRow:row];
|
|
|
+ };
|
|
|
+
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+ return 70;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)userCheckFilePreviewByRow:(NSInteger)row
|
|
|
+{
|
|
|
+ if(row < _curCouldPhoneFileListMod.data.list.count){
|
|
|
+ couldPhoneFileModel* fileModel = _curCouldPhoneFileListMod.data.list[row];
|
|
|
+ fileModel.isSelectType = YES;
|
|
|
+ [self.tableView reloadData];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)didClickSelectAllButton:(UIButton*)button
|
|
|
+{
|
|
|
+ button.selected = !button.selected;
|
|
|
+
|
|
|
+ for (couldPhoneFileModel* fileModel in _curCouldPhoneFileListMod.data.list) {
|
|
|
+ fileModel.isSelectType = button.selected;
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
}
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated
|
|
|
{
|
|
|
[super viewWillAppear:animated];
|
|
|
|
|
|
+ if(_isPhotoType){
|
|
|
+ self.titleLabel.text = NSLocalizedString(@"my_set_no_image_upload",nil) ;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ self.titleLabel.text = NSLocalizedString(@"my_set_no_video_upload",nil) ;
|
|
|
+ }
|
|
|
+
|
|
|
[self searchFileListFun];
|
|
|
}
|
|
|
|
|
@@ -39,4 +179,17 @@
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:searchFileListBeginNotification object:curNum];/*发送通知*/
|
|
|
}
|
|
|
|
|
|
+- (void)searchFileListDoneFun:(NSNotification*)notification
|
|
|
+{
|
|
|
+ NSDictionary *dataDict = [notification object];
|
|
|
+
|
|
|
+ if(!dataDict || ![dataDict isKindOfClass:[NSDictionary class]]){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ _curCouldPhoneFileListMod = [[couldPhoneFileListModel alloc] initWithDictionary:dataDict error:nil];
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
+}
|
|
|
+
|
|
|
@end
|