|
@@ -13,8 +13,16 @@
|
|
#import "recordFileCell.h"
|
|
#import "recordFileCell.h"
|
|
#import "reNameRecordFileView.h"
|
|
#import "reNameRecordFileView.h"
|
|
#import "ComontAlretViewController.h"
|
|
#import "ComontAlretViewController.h"
|
|
|
|
+#import "editTypeHeadView.h"
|
|
|
|
+#import "recordEditBottomView.h"
|
|
|
|
|
|
@interface recordViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
@interface recordViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
|
+@property (nonatomic, strong) UIButton *rightButton;//编辑
|
|
|
|
+@property(nonatomic,strong) editTypeHeadView*curEditTypeHeadView;
|
|
|
|
+@property(nonatomic,strong) recordEditBottomView*curEditTypeBottomView;
|
|
|
|
+@property(nonatomic,strong) NSMutableArray* didSelectListArr;
|
|
|
|
+@property(nonatomic,assign) BOOL isEditType;
|
|
|
|
+
|
|
@property (nonatomic, strong) UITableView *tableView;
|
|
@property (nonatomic, strong) UITableView *tableView;
|
|
@property(nonatomic,strong)NSMutableArray *audioArr;//音频数据
|
|
@property(nonatomic,strong)NSMutableArray *audioArr;//音频数据
|
|
@property(nonatomic,strong)recordBottomView *recordBottomV;//底部视图
|
|
@property(nonatomic,strong)recordBottomView *recordBottomV;//底部视图
|
|
@@ -29,6 +37,7 @@
|
|
// Do any additional setup after loading the view.
|
|
// Do any additional setup after loading the view.
|
|
|
|
|
|
_audioArr = [NSMutableArray new];
|
|
_audioArr = [NSMutableArray new];
|
|
|
|
+ _didSelectListArr = [NSMutableArray new];
|
|
[self drawAnyView];
|
|
[self drawAnyView];
|
|
[self getRecordDataFun];
|
|
[self getRecordDataFun];
|
|
}
|
|
}
|
|
@@ -40,7 +49,71 @@
|
|
[self.navigationBar setHidden:YES];
|
|
[self.navigationBar setHidden:YES];
|
|
[self.toolBar setHidden:YES];
|
|
[self.toolBar setHidden:YES];
|
|
[self.titleLabel setText:NSLocalizedString(@"mine_record_title",nil)];
|
|
[self.titleLabel setText:NSLocalizedString(@"mine_record_title",nil)];
|
|
|
|
+
|
|
|
|
+ self.navBarBGView.backgroundColor = [UIColor whiteColor];
|
|
|
|
+ //编辑
|
|
|
|
+ _rightButton = [[UIButton alloc] init];
|
|
|
|
+ [_rightButton setTitle:NSLocalizedString(@"edit_common",nil) forState:UIControlStateNormal];
|
|
|
|
+ [_rightButton setTitleColor:[UIColor hwColor:@"#01B7EA"] forState:UIControlStateNormal];
|
|
|
|
+ _rightButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
|
+ _rightButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
|
|
|
|
+ [_rightButton addTarget:self action:@selector(didClickEditFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
+ [self.navBarBGView addSubview:_rightButton];
|
|
|
|
+
|
|
|
|
+ [_rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.right.mas_equalTo(-15.f);
|
|
|
|
+ make.width.mas_equalTo(40.f);
|
|
|
|
+ make.centerY.equalTo(self.titleLabel.mas_centerY).offset(0.0);
|
|
|
|
+ make.height.mas_equalTo(30);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
|
|
|
|
+ _curEditTypeHeadView = [[editTypeHeadView alloc] init];
|
|
|
|
+ _curEditTypeHeadView.hidden = YES;
|
|
|
|
+ [self.navBarBGView addSubview:_curEditTypeHeadView];
|
|
|
|
+
|
|
|
|
+ [_curEditTypeHeadView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
|
+ make.height.mas_equalTo(NAVIHEIGHT - AdaptNaviHeight);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+#pragma mark 编辑状态的 取消 和全选按钮 响应事件
|
|
|
|
+ KWeakSelf
|
|
|
|
+ _curEditTypeHeadView.didClickButtonFun = ^(NSInteger tag) {
|
|
|
|
+ if(tag==1){
|
|
|
|
+ [weakSelf userCancelEditTypeFun];
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ _curEditTypeHeadView.didClickSelectAllFun = ^(UIButton * _Nonnull but) {
|
|
|
|
+ [weakSelf didClickSelectAllButton:but];
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ _curEditTypeBottomView = [[recordEditBottomView alloc] init];
|
|
|
|
+ _curEditTypeBottomView.hidden = YES;
|
|
|
|
+ [self.view addSubview:_curEditTypeBottomView];
|
|
|
|
+
|
|
|
|
+ [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
|
+ make.height.mas_equalTo(60 + AdaptTabHeight);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+#pragma mark 编辑状态的 下载 删除 响应事件
|
|
|
|
+ _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
|
|
|
|
+ if(tag==1){
|
|
|
|
+ //[weakSelf gotoDownLoadFileFun];
|
|
|
|
+ }
|
|
|
|
+ else if(tag==3){
|
|
|
|
+ [weakSelf showDeleteAlearViewFun];
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+
|
|
//底部视图
|
|
//底部视图
|
|
_recordBottomV = [[recordBottomView alloc] init];
|
|
_recordBottomV = [[recordBottomView alloc] init];
|
|
[self.view addSubview:_recordBottomV];
|
|
[self.view addSubview:_recordBottomV];
|
|
@@ -51,7 +124,7 @@
|
|
make.height.mas_equalTo(100.f + AdaptTabHeight);
|
|
make.height.mas_equalTo(100.f + AdaptTabHeight);
|
|
}];
|
|
}];
|
|
|
|
|
|
- KWeakSelf
|
|
|
|
|
|
+ //KWeakSelf
|
|
_recordBottomV.didClickRecordFun = ^{
|
|
_recordBottomV.didClickRecordFun = ^{
|
|
[weakSelf didClickRecordFun];
|
|
[weakSelf didClickRecordFun];
|
|
};
|
|
};
|
|
@@ -139,6 +212,10 @@
|
|
[weakSelf didClickCellFunBy:index withRow:row];
|
|
[weakSelf didClickCellFunBy:index withRow:row];
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
|
+ [weakSelf userCheckFilePreviewByRow:row];
|
|
|
|
+ };
|
|
|
|
+
|
|
}
|
|
}
|
|
return cell;
|
|
return cell;
|
|
}
|
|
}
|
|
@@ -169,6 +246,10 @@
|
|
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
|
{
|
|
{
|
|
|
|
+ if (_isEditType) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
NSInteger row = indexPath.section;
|
|
NSInteger row = indexPath.section;
|
|
if(row < _audioArr.count){
|
|
if(row < _audioArr.count){
|
|
recordFileModel *model = _audioArr[row];
|
|
recordFileModel *model = _audioArr[row];
|
|
@@ -484,6 +565,12 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+#pragma mark 文件删除弹框
|
|
|
|
+- (void)showDeleteAlearViewFun
|
|
|
|
+{
|
|
|
|
+ [self deleteFileByRow:-1];
|
|
|
|
+}
|
|
|
|
+
|
|
#pragma mark 文件删除
|
|
#pragma mark 文件删除
|
|
- (void)deleteFileByRow:(NSInteger)row
|
|
- (void)deleteFileByRow:(NSInteger)row
|
|
{
|
|
{
|
|
@@ -510,6 +597,11 @@
|
|
#pragma mark 文件删除
|
|
#pragma mark 文件删除
|
|
- (void)sureDeleteFileByRow:(NSInteger)row
|
|
- (void)sureDeleteFileByRow:(NSInteger)row
|
|
{
|
|
{
|
|
|
|
+ if (row == -1) {//删除编辑状态选中的旋转
|
|
|
|
+ [self deleteSelectFileFun];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
recordFileModel *model = nil;
|
|
recordFileModel *model = nil;
|
|
if (_audioArr.count > row) {
|
|
if (_audioArr.count > row) {
|
|
model = _audioArr[row];
|
|
model = _audioArr[row];
|
|
@@ -540,4 +632,138 @@
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+#pragma mark 删除编辑状态选中的旋转
|
|
|
|
+- (void)deleteSelectFileFun
|
|
|
|
+{
|
|
|
|
+ NSFileManager *fileManager = [NSFileManager defaultManager];
|
|
|
|
+
|
|
|
|
+ for (recordFileModel*delModel in _didSelectListArr) {
|
|
|
|
+ NSString *filePath = delModel.filePath; // 获取要删除的文件路径
|
|
|
|
+
|
|
|
|
+ NSError *error = nil;
|
|
|
|
+ BOOL success = [fileManager removeItemAtPath:filePath error:&error];
|
|
|
|
+
|
|
|
|
+ if (!success) {
|
|
|
|
+ //NSLog(@"删除文件失败: %@", error.localizedDescription);
|
|
|
|
+ //[[iToast makeText:NSLocalizedString(@"record_deleteFile_fail",nil)] show];
|
|
|
|
+ } else {
|
|
|
|
+ //NSLog(@"文件删除成功");
|
|
|
|
+ //[[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
|
|
|
|
+
|
|
|
|
+ [_audioArr removeObject:delModel];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// recordFileModel *firstModel = _audioArr.firstObject;
|
|
|
|
+// firstModel.showAllType = YES;
|
|
|
|
+ [_tableView reloadData];
|
|
|
|
+ [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
|
|
|
|
+
|
|
|
|
+ [_didSelectListArr removeAllObjects];
|
|
|
|
+ [self setEditTypeTitleFun];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#pragma mark 点击了编辑按钮
|
|
|
|
+- (void)didClickEditFun
|
|
|
|
+{
|
|
|
|
+ _isEditType = YES;
|
|
|
|
+
|
|
|
|
+ _curEditTypeHeadView.hidden = NO;
|
|
|
|
+ _curEditTypeBottomView.hidden = NO;
|
|
|
|
+ _recordBottomV.hidden = YES;
|
|
|
|
+
|
|
|
|
+ for (recordFileModel*model in _audioArr) {
|
|
|
|
+ model.showAllType = NO;
|
|
|
|
+ model.isEditType = YES;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
|
+ make.bottom.mas_equalTo(_curEditTypeBottomView.mas_top);
|
|
|
|
+ make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ [self.tableView reloadData];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#pragma mark 用户取消编辑编辑
|
|
|
|
+- (void)userCancelEditTypeFun
|
|
|
|
+{
|
|
|
|
+ //数据还原
|
|
|
|
+ for (recordFileModel*model in _didSelectListArr) {
|
|
|
|
+ model.isSelectType = NO;
|
|
|
|
+ }
|
|
|
|
+ [_didSelectListArr removeAllObjects];
|
|
|
|
+
|
|
|
|
+ for (recordFileModel*model in _audioArr) {
|
|
|
|
+ model.isEditType = NO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ recordFileModel*firstModel = _audioArr.firstObject;
|
|
|
|
+ firstModel.showAllType = YES;
|
|
|
|
+
|
|
|
|
+ _isEditType = NO;
|
|
|
|
+ [self.tableView reloadData];
|
|
|
|
+
|
|
|
|
+ _curEditTypeHeadView.hidden = YES;
|
|
|
|
+ _curEditTypeBottomView.hidden = YES;
|
|
|
|
+ _recordBottomV.hidden = NO;
|
|
|
|
+
|
|
|
|
+ [self.tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
|
+ make.bottom.equalTo(self.recordBottomV.mas_top).offset(0.f);
|
|
|
|
+ make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);;
|
|
|
|
+ }];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)didClickSelectAllButton:(UIButton*)button
|
|
|
|
+{
|
|
|
|
+ //button.selected = !button.selected;
|
|
|
|
+
|
|
|
|
+ [_didSelectListArr removeAllObjects];
|
|
|
|
+
|
|
|
|
+ for (recordFileModel* dataModel in _audioArr) {
|
|
|
|
+
|
|
|
|
+ if(!button.selected){
|
|
|
|
+ dataModel.isSelectType = button.selected;
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ [_didSelectListArr addObject:dataModel];
|
|
|
|
+ dataModel.isSelectType = button.selected;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [self.tableView reloadData];
|
|
|
|
+ [self setEditTypeTitleFun];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)userCheckFilePreviewByRow:(NSInteger)row
|
|
|
|
+{
|
|
|
|
+ if(row < _audioArr.count){
|
|
|
|
+ recordFileModel* dataModel = _audioArr[row];
|
|
|
|
+
|
|
|
|
+ if(dataModel.isSelectType){
|
|
|
|
+ [_didSelectListArr removeObject:dataModel];
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ [_didSelectListArr addObject:dataModel];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dataModel.isSelectType = !dataModel.isSelectType;
|
|
|
|
+
|
|
|
|
+ [self setEditTypeTitleFun];
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+#pragma mark 设置选中标题
|
|
|
|
+- (void)setEditTypeTitleFun
|
|
|
|
+{
|
|
|
|
+ [_curEditTypeHeadView setTitleLabetextByNumbers:_didSelectListArr.count];
|
|
|
|
+}
|
|
|
|
+
|
|
@end
|
|
@end
|