Commit 12dcca73 cgx

完成播放列表按钮功能

1 个父辈 f20edd04
正在显示 16 个修改的文件 包含 115 行增加7 行删除
......@@ -13,6 +13,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 音频课程列表cell
@interface AudioCourseCell : UITableViewCell
- (void)updateUI:(SubAudioModel *)model indexPath:(NSIndexPath *)indexPath;
/// 音频列表正在播放的音频进行图标标记
- (void)updatePlayingAudio;
@end
NS_ASSUME_NONNULL_END
......@@ -143,4 +143,14 @@
}
}
- (void)updatePlayingAudio {
self.numberLb.hidden = YES;
#warning 需要提供夜间模式图标
self.playVedioImgV.image = [UIImage imageNamed:@"ic_list_playing_normal"];
self.tryLab.hidden = YES;
self.pleyerBtn.hidden = !self.tryLab.hidden;
[self.pleyerBtn setImage:[UIImage imageNamed:@"ic_list_suspend_normal"] forState:UIControlStateNormal];
}
@end
......@@ -10,9 +10,17 @@
NS_ASSUME_NONNULL_BEGIN
@protocol CourseDetailControllerDelegate <NSObject>
- (void)didSelectAudioWithIndex:(NSInteger)index;
@end
/// 课程详情页(音频列表)
@interface CourseDetailController : DSBaseViewController
@property (nonatomic, strong) CourseModel *courseModel;
@property (nonatomic, weak) id<CourseDetailControllerDelegate> delegate;
@property (nonatomic, assign) NSInteger playingIndex;
@property (nonatomic, assign) BOOL isFromPlayer;
@end
NS_ASSUME_NONNULL_END
......@@ -92,6 +92,12 @@
if (self.subAudioArr.count > indexPath.row) {
SubAudioModel *model = self.subAudioArr[indexPath.row];
[cell updateUI:model indexPath:indexPath];
// 标记已播放的音频
if (self.isFromPlayer) {
if (self.playingIndex == indexPath.row) {
[cell updatePlayingAudio];
}
}
}
return cell;
}
......@@ -108,7 +114,16 @@
[LoginUtils jumpToLoginControllerWithTarget:self selector:@selector(updateAfterLoginSuccess)];
}
} else {
// 跳转到播放页面
// 播放页面点击播放列表进入
if (self.isFromPlayer) {
if (self.delegate && [self.delegate respondsToSelector:@selector(didSelectAudioWithIndex:)]) {
[self.delegate didSelectAudioWithIndex:indexPath.row];
}
[self.navigationController popViewControllerAnimated:YES];
return;
}
// 课程列表跳转过来的(跳转到播放页面)
MusicPlayerController *playerVC = [[MusicPlayerController alloc] init];
playerVC.currentIndex = indexPath.row;
// 筛选已经解锁的音频
......@@ -119,6 +134,7 @@
}
}];
playerVC.playAudios = [tmpArr copy];
playerVC.courseModel = self.courseModel;
UINavigationController *naviVC = [[UINavigationController alloc] initWithRootViewController:playerVC];
[self presentViewController:naviVC animated:YES completion:nil];
}
......
......@@ -6,6 +6,7 @@
//
#import <UIKit/UIKit.h>
#import "CourseModel.h"
NS_ASSUME_NONNULL_BEGIN
......@@ -15,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) NSArray *playAudios;
/// 当前播放音频下标
@property (nonatomic, assign) NSInteger currentIndex;
/// 舒眠课程、助眠音乐列表点击进入详情页传递过来的
@property (nonatomic, strong) CourseModel *courseModel;
@end
NS_ASSUME_NONNULL_END
......@@ -9,8 +9,9 @@
#import "MusicPlayerView.h"
#import <FSAudioController.h>
#import "SubAudioModel.h"
#import "CourseDetailController.h"
@interface MusicPlayerController () <MusicPlayerViewDelegate>
@interface MusicPlayerController () <MusicPlayerViewDelegate, CourseDetailControllerDelegate>
@property (nonatomic, strong) MusicPlayerView *playerView;
/// AudioStream 播放器
@property (nonatomic, strong) FSAudioStream *audioStream;
......@@ -207,6 +208,22 @@
}
}
- (void)jumpToPlaylistController {
CourseDetailController *coureDetailVC = [[CourseDetailController alloc] init];
coureDetailVC.courseModel = self.courseModel;
coureDetailVC.playingIndex = self.currentIndex;
coureDetailVC.isFromPlayer = YES;
coureDetailVC.delegate = self;
[self.navigationController pushViewController:coureDetailVC animated:YES];
}
#pragma mark - CourseDetailControllerDelegate
- (void)didSelectAudioWithIndex:(NSInteger)index {
if (self.currentIndex == index) { return; }
self.currentIndex = index;
[self launchPlayer];
}
#pragma mark - 隐藏导航栏
- (BOOL)isShowNavigationBar {
return YES;
......
......@@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 定时器设置时间已经到了
- (void)timerHasCountDone;
/// 跳转到播放列表页面
- (void)jumpToPlaylistController;
@end
/// 音频播放页面
......
......@@ -128,10 +128,10 @@
}
- (void)dealloc {
[self.timer invalidate];
self.timer = nil;
[self.timingView removeFromSuperview];
self.timingView = nil;
[_timer invalidate];
_timer = nil;
[_timingView removeFromSuperview];
_timingView = nil;
}
- (void)dismiss {
......@@ -152,7 +152,9 @@
#pragma mark - 点击播放列表
- (void)didClickPlaylistAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(jumpToPlaylistController)]) {
[self.delegate jumpToPlaylistController];
}
}
#pragma mark - 切换播放模式
......
{
"images" : [
{
"filename" : "ic_list_playing_normal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_list_playing_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_list_playing_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "ic_list_suspend_normal.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_list_suspend_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_list_suspend_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!