|
|
|
@ -15,7 +15,7 @@
@@ -15,7 +15,7 @@
|
|
|
|
|
#import <UAProgressView.h> |
|
|
|
|
#import "GuShiScrollCellView.h" |
|
|
|
|
|
|
|
|
|
@interface GuShiViewController ()<AVPlayer_PlusDelegate,DZNEmptyDataSetSource,DZNEmptyDataSetDelegate> |
|
|
|
|
@interface GuShiViewController ()<AVPlayer_PlusDelegate,DZNEmptyDataSetSource,DZNEmptyDataSetDelegate,CommonTableViewDelegate> |
|
|
|
|
|
|
|
|
|
@property (nonatomic ,assign) NSInteger page; |
|
|
|
|
|
|
|
|
@ -45,6 +45,9 @@
@@ -45,6 +45,9 @@
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,strong) UIView *noModelView; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,strong) GuShiTableViewCell *tocell; |
|
|
|
|
|
|
|
|
|
@end |
|
|
|
|
|
|
|
|
|
@implementation GuShiViewController |
|
|
|
@ -62,26 +65,26 @@
@@ -62,26 +65,26 @@
|
|
|
|
|
make.top.equalTo(self.headerView.mas_bottom).offset(12); |
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
// [self.view addSubview:self.gushiTable]; |
|
|
|
|
// [self.gushiTable mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
// make.left.right.equalTo(self.view).inset(16); |
|
|
|
|
// make.top.equalTo(titleLabel.mas_bottom).offset(4); |
|
|
|
|
// make.bottom.equalTo(self.view.mas_bottom); |
|
|
|
|
// }]; |
|
|
|
|
|
|
|
|
|
[self.view addSubview:self.gushiScrollView]; |
|
|
|
|
[self.gushiScrollView mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
[self.view addSubview:self.gushiTable]; |
|
|
|
|
[self.gushiTable mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
make.left.right.equalTo(self.view).inset(16); |
|
|
|
|
make.top.equalTo(titleLabel.mas_bottom).offset(4); |
|
|
|
|
make.bottom.equalTo(self.view.mas_bottom).inset(iPhoneX_TabbarSafeBottomMargin > 0 ? iPhoneX_TabbarSafeBottomMargin : 20); |
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
[self.view addSubview:self.noModelView]; |
|
|
|
|
[self.noModelView mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
make.centerX.equalTo(self.view); |
|
|
|
|
make.centerY.equalTo(self.gushiScrollView).inset(30); |
|
|
|
|
make.size.mas_equalTo(CGSizeMake(280, 180)); |
|
|
|
|
}]; |
|
|
|
|
// [self.view addSubview:self.gushiScrollView]; |
|
|
|
|
// [self.gushiScrollView mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
// make.left.right.equalTo(self.view).inset(16); |
|
|
|
|
// make.top.equalTo(titleLabel.mas_bottom).offset(4); |
|
|
|
|
// make.bottom.equalTo(self.view.mas_bottom).inset(iPhoneX_TabbarSafeBottomMargin > 0 ? iPhoneX_TabbarSafeBottomMargin : 20); |
|
|
|
|
// }]; |
|
|
|
|
|
|
|
|
|
// [self.view addSubview:self.noModelView]; |
|
|
|
|
// [self.noModelView mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
// make.centerX.equalTo(self.view); |
|
|
|
|
// make.centerY.equalTo(self.gushiScrollView).inset(30); |
|
|
|
|
// make.size.mas_equalTo(CGSizeMake(280, 180)); |
|
|
|
|
// }]; |
|
|
|
|
|
|
|
|
|
[UICommon MessageUpload:@"加载中"]; |
|
|
|
|
[self getSwitch]; |
|
|
|
@ -133,6 +136,13 @@
@@ -133,6 +136,13 @@
|
|
|
|
|
cell.model = self.modelListArr[indexPath.row]; |
|
|
|
|
cell.PlaybtnTouchBack = ^(GuShiListModel * _Nonnull model){ |
|
|
|
|
[weakSelf playVoice:model]; |
|
|
|
|
weakSelf.tocell = [[GuShiTableViewCell alloc]init]; |
|
|
|
|
weakSelf.tocell = [weakSelf.gushiTable cellForRowAtIndexPath:indexPath]; |
|
|
|
|
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ |
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
|
weakSelf.tocell.playProgress = model.progress; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
} selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { |
|
|
|
@ -141,13 +151,48 @@
@@ -141,13 +151,48 @@
|
|
|
|
|
} DidscrollView:^(UIScrollView * _Nonnull scrollView) { |
|
|
|
|
|
|
|
|
|
}]; |
|
|
|
|
_gushiTable.delegates = self; |
|
|
|
|
_gushiTable.isEditing = YES; |
|
|
|
|
_gushiTable.backgroundColor = KKWhiteColorColor; |
|
|
|
|
_gushiTable.layer.cornerRadius = 12; |
|
|
|
|
_gushiTable.layer.masksToBounds = YES; |
|
|
|
|
_gushiTable.emptyDataSetSource = self; |
|
|
|
|
_gushiTable.emptyDataSetDelegate = self; |
|
|
|
|
// _gushiTable.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ |
|
|
|
|
// self.page = 0; |
|
|
|
|
// [self getModelList]; |
|
|
|
|
// }]; |
|
|
|
|
// _gushiTable.mj_footer = [MJRefreshFooter footerWithRefreshingBlock:^{ |
|
|
|
|
// [self getModelList]; |
|
|
|
|
// }]; |
|
|
|
|
|
|
|
|
|
[_gushiTable bindHeadRefreshHandler:^{ |
|
|
|
|
self.page = 0; |
|
|
|
|
[self getModelList]; |
|
|
|
|
} themeColor:mainColor refreshStyle:KafkaRefreshStyleReplicatorWoody]; |
|
|
|
|
|
|
|
|
|
[_gushiTable bindFootRefreshHandler:^{ |
|
|
|
|
[self getModelList]; |
|
|
|
|
} themeColor:mainColor refreshStyle:KafkaRefreshStyleReplicatorWoody]; |
|
|
|
|
} |
|
|
|
|
return _gushiTable; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)CommTableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath |
|
|
|
|
{ |
|
|
|
|
if (indexPath.row == self.playIndex) |
|
|
|
|
[self.player pause]; |
|
|
|
|
[UICommon MessageUpload:@"删除中"]; |
|
|
|
|
GuShiListModel *model = self.modelListArr[indexPath.row]; |
|
|
|
|
[cUser.cDevice DeleteStoryDataWithId:model.Id Success:^(id responseObject) { |
|
|
|
|
[UICommon HidenLoading]; |
|
|
|
|
[UICommon MessageSuccessText:@"删除成功" isImg:NO]; |
|
|
|
|
[self getModelList]; |
|
|
|
|
} failure:^(NSError *error) { |
|
|
|
|
|
|
|
|
|
}]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)playVoice:(GuShiListModel *)model |
|
|
|
|
{ |
|
|
|
@ -184,12 +229,12 @@
@@ -184,12 +229,12 @@
|
|
|
|
|
[self isUpdata:i isPlay:0 repModel:toModel]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < self.modelListArr.count; i++) |
|
|
|
|
{ |
|
|
|
|
GuShiScrollCellView *view = self.viewsArr[i]; |
|
|
|
|
GuShiListModel *gmodel = self.modelListArr[i]; |
|
|
|
|
view.model = gmodel; |
|
|
|
|
} |
|
|
|
|
// for (int i = 0; i < self.modelListArr.count; i++) |
|
|
|
|
// { |
|
|
|
|
// GuShiScrollCellView *view = self.viewsArr[i]; |
|
|
|
|
// GuShiListModel *gmodel = self.modelListArr[i]; |
|
|
|
|
// view.model = gmodel; |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)isUpdata:(NSInteger)index isPlay:(NSInteger)isplay repModel:(GuShiListModel *)model |
|
|
|
@ -201,8 +246,8 @@
@@ -201,8 +246,8 @@
|
|
|
|
|
self.playIndex = index; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0]; |
|
|
|
|
// [self.gushiTable reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationNone]; |
|
|
|
|
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:index inSection:0]; |
|
|
|
|
[self.gushiTable reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationNone]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (void)SubheaderView |
|
|
|
@ -293,38 +338,39 @@
@@ -293,38 +338,39 @@
|
|
|
|
|
[self.urlListArr addObject:[NSURL URLWithString:model.voice]]; |
|
|
|
|
[self.modelListArr addObject:model]; |
|
|
|
|
} |
|
|
|
|
self.player.playListArray = self.urlListArr; |
|
|
|
|
if (arr.count >= 20) |
|
|
|
|
weakSelf.page++; |
|
|
|
|
else |
|
|
|
|
[weakSelf.gushiScrollView.mj_footer endRefreshingWithNoMoreData]; |
|
|
|
|
// self.gushiTable.cellRow = self.modelListArr.count; |
|
|
|
|
// [self.gushiTable reloadData]; |
|
|
|
|
|
|
|
|
|
for (UIView *views in self.gushiScrollView.subviews) { |
|
|
|
|
if ([views isKindOfClass:GuShiScrollCellView.class]) |
|
|
|
|
[views removeFromSuperview]; |
|
|
|
|
} |
|
|
|
|
for (int i = 0; i < self.modelListArr.count; i++) |
|
|
|
|
{ |
|
|
|
|
GuShiScrollCellView *view = [[GuShiScrollCellView alloc] initWithFrame:CGRectMake(0, i*Adapted(55), ScreenWidth-32, Adapted(55))]; |
|
|
|
|
view.model = self.modelListArr[i]; |
|
|
|
|
view.PlaybtnTouchBack = ^(GuShiListModel * _Nonnull model, GuShiScrollCellView * _Nonnull toView) { |
|
|
|
|
self.toView = toView; |
|
|
|
|
[weakSelf playVoice:model]; |
|
|
|
|
}; |
|
|
|
|
[self.viewsArr addObject:view]; |
|
|
|
|
[self.gushiScrollView addSubview:view]; |
|
|
|
|
weakSelf.gushiTable.footRefreshControl.hidden = arr.count < 20 ? YES : NO; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
self.noModelView.hidden = self.modelListArr.count > 0 ? YES : NO; |
|
|
|
|
self.gushiScrollView.contentSize = CGSizeMake(ScreenWidth-32, self.modelListArr.count*Adapted(55)); |
|
|
|
|
[self.gushiScrollView.mj_header endRefreshing]; |
|
|
|
|
[self.gushiScrollView.mj_footer endRefreshing]; |
|
|
|
|
self.player.playListArray = self.urlListArr; |
|
|
|
|
self.gushiTable.cellRow = self.modelListArr.count; |
|
|
|
|
[self.gushiTable reloadData]; |
|
|
|
|
|
|
|
|
|
// for (UIView *views in self.gushiScrollView.subviews) { |
|
|
|
|
// if ([views isKindOfClass:GuShiScrollCellView.class]) |
|
|
|
|
// [views removeFromSuperview]; |
|
|
|
|
// } |
|
|
|
|
// for (int i = 0; i < self.modelListArr.count; i++) |
|
|
|
|
// { |
|
|
|
|
// GuShiScrollCellView *view = [[GuShiScrollCellView alloc] initWithFrame:CGRectMake(0, i*Adapted(55), ScreenWidth-32, Adapted(55))]; |
|
|
|
|
// view.model = self.modelListArr[i]; |
|
|
|
|
// view.PlaybtnTouchBack = ^(GuShiListModel * _Nonnull model, GuShiScrollCellView * _Nonnull toView) { |
|
|
|
|
// self.toView = toView; |
|
|
|
|
// [weakSelf playVoice:model]; |
|
|
|
|
// }; |
|
|
|
|
// [self.viewsArr addObject:view]; |
|
|
|
|
// [self.gushiScrollView addSubview:view]; |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// self.noModelView.hidden = self.modelListArr.count > 0 ? YES : NO; |
|
|
|
|
// self.gushiScrollView.contentSize = CGSizeMake(ScreenWidth-32, self.modelListArr.count*Adapted(55)); |
|
|
|
|
[weakSelf.gushiTable.headRefreshControl endRefreshingWithAlertText:@"已为你加载最新数据~" completion:^{}]; |
|
|
|
|
[weakSelf.gushiTable.footRefreshControl endRefreshing]; |
|
|
|
|
|
|
|
|
|
} failure:^(NSError *error) { |
|
|
|
|
[UICommon HidenLoading]; |
|
|
|
|
self.noModelView.hidden = self.modelListArr.count > 0 ? YES : NO; |
|
|
|
|
// self.noModelView.hidden = self.modelListArr.count > 0 ? YES : NO; |
|
|
|
|
}]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -401,16 +447,17 @@ WeakSelf
@@ -401,16 +447,17 @@ WeakSelf
|
|
|
|
|
[self.modelListArr replaceObjectAtIndex:self.playIndex withObject:toModel]; |
|
|
|
|
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ |
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
|
weakSelf.tocell.playProgress = progress; |
|
|
|
|
// NSIndexPath*indexPath = [NSIndexPath indexPathForRow:self.playIndex inSection:0]; |
|
|
|
|
// [self.gushiTable reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationNone]; |
|
|
|
|
// GuShiScrollCellView *view = self.viewsArr[self.playIndex]; |
|
|
|
|
// weakSelf.toView.playProgress = progress; |
|
|
|
|
for (int i = 0; i < self.modelListArr.count; i++) |
|
|
|
|
{ |
|
|
|
|
GuShiScrollCellView *view = self.viewsArr[i]; |
|
|
|
|
GuShiListModel *gmodel = self.modelListArr[i]; |
|
|
|
|
view.model = gmodel; |
|
|
|
|
} |
|
|
|
|
// for (int i = 0; i < self.modelListArr.count; i++) |
|
|
|
|
// { |
|
|
|
|
// GuShiScrollCellView *view = self.viewsArr[i]; |
|
|
|
|
// GuShiListModel *gmodel = self.modelListArr[i]; |
|
|
|
|
// view.model = gmodel; |
|
|
|
|
// } |
|
|
|
|
if (progress == 1) |
|
|
|
|
{ |
|
|
|
|
[weakSelf isUpdata:weakSelf.playIndex isPlay:0 repModel:toModel]; |
|
|
|
|