|
@@ -4,11 +4,19 @@
|
|
//
|
|
//
|
|
// Created by Christopher on 2019/7/3.
|
|
// Created by Christopher on 2019/7/3.
|
|
// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
-//
|
|
|
|
|
|
+// 视频播放列表のCell
|
|
|
|
|
|
import UIKit
|
|
import UIKit
|
|
import RxSwift
|
|
import RxSwift
|
|
|
|
|
|
|
|
+enum videoBtnClickType {
|
|
|
|
+ case typeComment
|
|
|
|
+ case typeLike
|
|
|
|
+ case typeCollect
|
|
|
|
+ case typePerson
|
|
|
|
+ case typeFollow
|
|
|
|
+}
|
|
|
|
+
|
|
class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
|
|
|
let disposeBag = DisposeBag()
|
|
let disposeBag = DisposeBag()
|
|
@@ -21,9 +29,14 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ typealias BackClosure = () -> Void
|
|
|
|
+ var backClosure : BackClosure?
|
|
|
|
+
|
|
|
|
+ typealias ShareClosure = () -> Void
|
|
|
|
+ var shareClosure : ShareClosure?
|
|
|
|
|
|
- typealias DelPicBlock = (_ idxRow:Int?) -> Void
|
|
|
|
- var delPicBlock : DelPicBlock?
|
|
|
|
|
|
+ typealias ButtonClickClosure = (_ clickType: videoBtnClickType) -> Void
|
|
|
|
+ var buttonClickClosure : ButtonClickClosure?
|
|
|
|
|
|
class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> CommunityVideoCoverCollectionCell {
|
|
class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> CommunityVideoCoverCollectionCell {
|
|
let ID = "CommunityVideoCoverCollectionCell"
|
|
let ID = "CommunityVideoCoverCollectionCell"
|
|
@@ -51,51 +64,424 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
fatalError("init(coder:) has not been implemented")
|
|
fatalError("init(coder:) has not been implemented")
|
|
}
|
|
}
|
|
|
|
|
|
- //MRAK: - 设置View
|
|
|
|
|
|
+ //MARK: - 设置View
|
|
private func setupViews() {
|
|
private func setupViews() {
|
|
- self.backgroundColor = kf7f8faColor
|
|
|
|
|
|
|
|
|
|
+ // 视频播放
|
|
addSubview(videoPlayView)
|
|
addSubview(videoPlayView)
|
|
|
|
+ videoPlayView.addTapGesture(1, target: self, action: #selector(videoTapAction))
|
|
|
|
+
|
|
|
|
+ // 顶部
|
|
|
|
+ addSubview(navBackView)
|
|
|
|
+ navBackView.addSubview(navBackBtn)
|
|
|
|
+ navBackView.addSubview(shareBtnRight)
|
|
|
|
+ navBackView.addSubview(shareBtnLeft)
|
|
|
|
+
|
|
|
|
+ // 底部
|
|
|
|
+ addSubview(bottomCommentView)
|
|
|
|
+ bottomCommentView.addSubview(bottomSepView)
|
|
|
|
+ bottomCommentView.addSubview(commentBtn)
|
|
|
|
+ bottomCommentView.addSubview(collectBtn)
|
|
|
|
+ bottomCommentView.addSubview(likeBtn)
|
|
|
|
+ bottomCommentView.addSubview(commentView)
|
|
|
|
+ commentView.addSubview(commentLabel)
|
|
|
|
+ commentView.addSubview(textBtn)
|
|
|
|
+
|
|
|
|
+ // 话题View
|
|
|
|
+ addSubview(topicView)
|
|
|
|
+
|
|
|
|
+ addSubview(personBackView)
|
|
|
|
+ personBackView.addSubview(personIconBtn)
|
|
|
|
+ personBackView.addSubview(personLabel)
|
|
|
|
+ personBackView.addSubview(followButton)
|
|
|
|
+
|
|
|
|
+ addSubview(rainbowBeanView)
|
|
|
|
+ rainbowBeanView.addSubview(beanIconImageView)
|
|
|
|
+ rainbowBeanView.addSubview(beanLabel)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ addSubview(playStatusImageView)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
- addSubview(delButton)
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private func setupLayouts() {
|
|
private func setupLayouts() {
|
|
|
|
|
|
|
|
+ // 视频播放
|
|
videoPlayView.snp.makeConstraints { (make) in
|
|
videoPlayView.snp.makeConstraints { (make) in
|
|
make.edges.equalToSuperview()
|
|
make.edges.equalToSuperview()
|
|
}
|
|
}
|
|
|
|
|
|
- delButton.snp.makeConstraints { (make) in
|
|
|
|
- make.top.right.equalToSuperview()
|
|
|
|
- make.size.equalTo(18)
|
|
|
|
|
|
+ // 顶部
|
|
|
|
+ navBackView.snp.makeConstraints { (make) in
|
|
|
|
+ make.top.equalTo(20)
|
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
|
+ make.height.equalTo(44)
|
|
|
|
+ }
|
|
|
|
+ navBackBtn.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(5)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.size.equalTo(40)
|
|
|
|
+ }
|
|
|
|
+ shareBtnRight.snp.makeConstraints { (make) in
|
|
|
|
+ make.right.equalTo(-6)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.size.equalTo(39)
|
|
|
|
+ }
|
|
|
|
+ shareBtnLeft.snp.makeConstraints { (make) in
|
|
|
|
+ make.right.equalTo(-52)
|
|
|
|
+ make.bottom.equalTo(-8)
|
|
|
|
+ make.width.equalTo(123)
|
|
|
|
+ make.height.equalTo(35)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 底部
|
|
|
|
+ bottomCommentView.snp.makeConstraints { (make) in
|
|
|
|
+ make.bottom.equalTo(-kSafeTabBarHeight)
|
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
|
+ make.height.equalTo(60)
|
|
|
|
+ }
|
|
|
|
+ bottomSepView.snp.makeConstraints { (make) in
|
|
|
|
+ make.top.left.right.equalToSuperview()
|
|
|
|
+ make.height.equalTo(1)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ commentBtn.snp.makeConstraints { (make) in
|
|
|
|
+ make.right.equalToSuperview().offset(-14)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.height.equalTo(24)
|
|
|
|
+ }
|
|
|
|
+ commentBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 5)
|
|
|
|
+
|
|
|
|
+ collectBtn.snp.makeConstraints { (make) in
|
|
|
|
+ make.right.equalTo(commentBtn.snp_left).offset(-15)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.height.equalTo(37)
|
|
|
|
+ }
|
|
|
|
+ collectBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 5)
|
|
|
|
+
|
|
|
|
+ likeBtn.snp.makeConstraints { (make) in
|
|
|
|
+ make.right.equalTo(collectBtn.snp_left).offset(-15)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.height.equalTo(37)
|
|
|
|
+ }
|
|
|
|
+ likeBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 5)
|
|
|
|
+
|
|
|
|
+ commentView.snp.makeConstraints { (make) in
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.left.equalToSuperview().offset(14)
|
|
|
|
+ make.right.equalTo(likeBtn.snp_left).offset(-10)
|
|
|
|
+ make.height.equalTo(28)
|
|
|
|
+ }
|
|
|
|
+ commentLabel.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(15)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.width.equalTo(70)
|
|
|
|
+ make.height.equalTo(28)
|
|
|
|
+ }
|
|
|
|
+ textBtn.snp.makeConstraints { (make) in
|
|
|
|
+ make.edges.equalToSuperview()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 话题View
|
|
|
|
+ topicView.snp.makeConstraints { (make) in
|
|
|
|
+ make.bottom.equalTo(bottomCommentView.snp_top)
|
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
|
+ make.height.equalTo(45)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // personView
|
|
|
|
+ personBackView.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(14)
|
|
|
|
+ make.height.equalTo(30)
|
|
|
|
+
|
|
|
|
+ // FIXME:待调整底约束
|
|
|
|
+ make.bottom.equalToSuperview().offset(-200)
|
|
|
|
+ }
|
|
|
|
+ personIconBtn.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.top.equalToSuperview()
|
|
|
|
+ make.size.equalTo(30)
|
|
|
|
+ }
|
|
|
|
+ personLabel.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(personIconBtn.snp_right).offset(10)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.height.equalTo(18)
|
|
|
|
+ }
|
|
|
|
+ followButton.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(personLabel.snp_right).offset(10)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.width.equalTo(64)
|
|
|
|
+ make.height.equalTo(20)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 彩虹豆View
|
|
|
|
+ rainbowBeanView.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(14)
|
|
|
|
+ make.height.equalTo(24)
|
|
|
|
+
|
|
|
|
+ // FIXME:待调整底约束
|
|
|
|
+ make.bottom.equalToSuperview().offset(-250)
|
|
|
|
+ }
|
|
|
|
+ beanIconImageView.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(6)
|
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
|
+ make.size.equalTo(19)
|
|
|
|
+ }
|
|
|
|
+ beanLabel.snp.makeConstraints { (make) in
|
|
|
|
+ make.left.equalTo(beanIconImageView.snp_right).offset(5)
|
|
|
|
+ make.top.bottom.equalToSuperview()
|
|
|
|
+ make.right.equalTo(-6)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //
|
|
|
|
+ playStatusImageView.snp.makeConstraints { (make) in
|
|
|
|
+ make.center.equalToSuperview()
|
|
|
|
+ make.width.equalTo(50)
|
|
|
|
+ make.height.equalTo(60)
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 视频播放View
|
|
private lazy var videoPlayView: CommunityVideoPlayView = {
|
|
private lazy var videoPlayView: CommunityVideoPlayView = {
|
|
let videoPlayView = CommunityVideoPlayView()
|
|
let videoPlayView = CommunityVideoPlayView()
|
|
videoPlayView.isUserInteractionEnabled = true
|
|
videoPlayView.isUserInteractionEnabled = true
|
|
return videoPlayView
|
|
return videoPlayView
|
|
}()
|
|
}()
|
|
|
|
|
|
- private lazy var picImageView: UIImageView = {
|
|
|
|
- let picImageView = UIImageView()
|
|
|
|
- picImageView.cornerRadius = 4
|
|
|
|
- picImageView.masksToBounds = true
|
|
|
|
- return picImageView
|
|
|
|
|
|
+ private lazy var navBackView: UIView = {
|
|
|
|
+ let navBackView = UIView()
|
|
|
|
+ navBackView.backgroundColor = UIColor.clear
|
|
|
|
+ return navBackView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var navBackBtn: UIButton = {
|
|
|
|
+ let navBackBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ navBackBtn.setImage(kImage(name: "navbar_back_white"), for: UIControl.State.normal)
|
|
|
|
+ navBackBtn.rx.tap.subscribe(onNext: {
|
|
|
|
+ [weak self] (data) in
|
|
|
|
+ if let backClosure = self?.backClosure {
|
|
|
|
+ backClosure()
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return navBackBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var shareBtnRight: UIButton = {
|
|
|
|
+ let shareBtnRight = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ shareBtnRight.setImage(kImage(name: "nav_share_white"), for: UIControl.State.normal)
|
|
|
|
+ shareBtnRight.rx.tap.subscribe(onNext: {
|
|
|
|
+ [weak self] (data) in
|
|
|
|
+ if let shareClosure = self?.shareClosure {
|
|
|
|
+ shareClosure()
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return shareBtnRight
|
|
}()
|
|
}()
|
|
|
|
|
|
- private lazy var delButton: UIButton = {
|
|
|
|
- let delButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
- delButton.setImage(kImage(name: "common_sku_cancel"), for: UIControl.State.normal)
|
|
|
|
- delButton.rx.tap.subscribe(onNext: {
|
|
|
|
|
|
+ private lazy var shareBtnLeft: UIButton = {
|
|
|
|
+ let shareBtnLeft = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ shareBtnLeft.setImage(kImage(name: "nav_share_poster"), for: UIControl.State.normal)
|
|
|
|
+ shareBtnLeft.rx.tap.subscribe(onNext: {
|
|
[weak self] (data) in
|
|
[weak self] (data) in
|
|
- let idxPath = self?.indexPath
|
|
|
|
- if let delPicBlock = self?.delPicBlock {
|
|
|
|
- delPicBlock(idxPath?.row)
|
|
|
|
|
|
+ if let shareClosure = self?.shareClosure {
|
|
|
|
+ shareClosure()
|
|
}
|
|
}
|
|
}).disposed(by: disposeBag)
|
|
}).disposed(by: disposeBag)
|
|
- return delButton
|
|
|
|
|
|
+ return shareBtnLeft
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
+ private lazy var bottomCommentView: UIView = {
|
|
|
|
+ let bottomCommentView = UIView()
|
|
|
|
+ bottomCommentView.backgroundColor = UIColor.clear
|
|
|
|
+ return bottomCommentView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var bottomSepView: UIView = {
|
|
|
|
+ let bottomSepView = UIView()
|
|
|
|
+ bottomSepView.backgroundColor = kDDDDDDColor
|
|
|
|
+ return bottomSepView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var commentBtn: UIButton = {
|
|
|
|
+ let commentBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ commentBtn.setTitle("5178", for: UIControl.State.normal)
|
|
|
|
+ commentBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
|
+ commentBtn.setImage(kImage(name: "video_btn_note_white"), for: UIControl.State.normal)
|
|
|
|
+ commentBtn.titleLabel?.font = kRegularFont14
|
|
|
|
+ commentBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
|
+ buttonClickClosure(videoBtnClickType.typeComment)
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return commentBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var collectBtn: UIButton = {
|
|
|
|
+ let collectBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ collectBtn.setTitle("6124", for: UIControl.State.normal)
|
|
|
|
+ collectBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
|
+ collectBtn.setImage(kImage(name: "video_btn_collect_white"), for: UIControl.State.normal)
|
|
|
|
+ collectBtn.setImage(kImage(name: "btn_collect_pre"), for: UIControl.State.selected)
|
|
|
|
+ collectBtn.titleLabel?.font = kRegularFont14
|
|
|
|
+ collectBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
|
+ collectBtn.isSelected = !collectBtn.isSelected
|
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
|
+ buttonClickClosure(videoBtnClickType.typeCollect)
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return collectBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var likeBtn: UIButton = {
|
|
|
|
+ let likeBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ likeBtn.setTitle("8844", for: UIControl.State.normal)
|
|
|
|
+ likeBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
|
+ likeBtn.setImage(kImage(name: "video_btn_praise_white"), for: UIControl.State.normal)
|
|
|
|
+ likeBtn.setImage(kImage(name: "btn_praise_pre_36px"), for: UIControl.State.selected)
|
|
|
|
+ likeBtn.titleLabel?.font = kRegularFont14
|
|
|
|
+ likeBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
|
+ likeBtn.isSelected = !likeBtn.isSelected
|
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
|
+ buttonClickClosure(videoBtnClickType.typeLike)
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return likeBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var commentView: UIView = {
|
|
|
|
+ let commentView = UIView()
|
|
|
|
+ commentView.backgroundColor = kRGBAColor(r: 0/255.0, g: 0/255.0, b: 0/255.0, a: 0.3)
|
|
|
|
+ commentView.cornerRadius = 15
|
|
|
|
+ commentView.masksToBounds = true
|
|
|
|
+ return commentView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var commentLabel: UILabel = {
|
|
|
|
+ let commentLabel = UILabel()
|
|
|
|
+ commentLabel.text = "添加评论..."
|
|
|
|
+ commentLabel.textColor = kffffffColor
|
|
|
|
+ commentLabel.font = kRegularFont14
|
|
|
|
+ return commentLabel
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var textBtn: UIButton = {
|
|
|
|
+ let textBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ textBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
|
+ buttonClickClosure(videoBtnClickType.typeComment)
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return textBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var topicView: CommunityVideoTopicView = {
|
|
|
|
+ let topicView = CommunityVideoTopicView()
|
|
|
|
+ topicView.backgroundColor = UIColor.clear
|
|
|
|
+ return topicView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var personBackView: UIView = {
|
|
|
|
+ let personBackView = UIView()
|
|
|
|
+ personBackView.backgroundColor = UIColor.clear
|
|
|
|
+ return personBackView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var personIconBtn: UIButton = {
|
|
|
|
+ let personIconBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ personIconBtn.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
|
|
|
|
+ personIconBtn.rx.tap.subscribe(onNext: {
|
|
|
|
+ [weak self] (data) in
|
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
|
+ buttonClickClosure(videoBtnClickType.typePerson)
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return personIconBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var personLabel: UILabel = {
|
|
|
|
+ let personLabel = UILabel()
|
|
|
|
+ personLabel.text = "林萌萌的萌萌哒"
|
|
|
|
+ personLabel.textColor = kffffffColor
|
|
|
|
+ personLabel.font = kRegularFont15
|
|
|
|
+ return personLabel
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var followButton: UIButton = {
|
|
|
|
+ let followButton = UIButton(type: UIButton.ButtonType.custom)
|
|
|
|
+ followButton.titleLabel?.font = kMediumFont13
|
|
|
|
+ followButton.layer.cornerRadius = 13
|
|
|
|
+ followButton.layer.masksToBounds = true
|
|
|
|
+ followButton.layer.borderWidth = 1
|
|
|
|
+ followButton.rx.tap.subscribe(onNext: {[weak self] (data) in
|
|
|
|
+ if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
|
+ buttonClickClosure(videoBtnClickType.typeFollow)
|
|
|
|
+ }
|
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
|
+ return followButton
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var rainbowBeanView: UIView = {
|
|
|
|
+ let rainbowBeanView = UIView()
|
|
|
|
+ rainbowBeanView.backgroundColor = kRGBAColor(r: 0/255.0, g: 0/255.0, b: 0/255.0, a: 0.3)
|
|
|
|
+ rainbowBeanView.cornerRadius = 12
|
|
|
|
+ rainbowBeanView.masksToBounds = true
|
|
|
|
+ return rainbowBeanView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var beanIconImageView: UIImageView = {
|
|
|
|
+ let beanIconImageView = UIImageView()
|
|
|
|
+ beanIconImageView.image = kImage(name: "ico_bean_white")
|
|
|
|
+ return beanIconImageView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var beanLabel: UILabel = {
|
|
|
|
+ let beanLabel = UILabel()
|
|
|
|
+ beanLabel.text = "xx彩虹豆待收获"
|
|
|
|
+ beanLabel.textColor = kffffffColor
|
|
|
|
+ beanLabel.font = kRegularFont13
|
|
|
|
+ return beanLabel
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ private lazy var videoTitleLabel: UILabel = {
|
|
|
|
+ let videoTitleLabel = UILabel()
|
|
|
|
+ videoTitleLabel.text = "我就是一个视频的Title"
|
|
|
|
+ videoTitleLabel.textColor = kffffffColor
|
|
|
|
+ videoTitleLabel.font = kMediumFont16
|
|
|
|
+ return videoTitleLabel
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 播放暂停icon
|
|
|
|
+ private lazy var playStatusImageView: UIImageView = {
|
|
|
|
+ let playStatusImageView = UIImageView()
|
|
|
|
+ playStatusImageView.image = kImage(name: "btn_pause")
|
|
|
|
+ return playStatusImageView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // MARK: - 播放动作
|
|
|
|
+ func play() {
|
|
|
|
+ playStatusImageView.isHidden = true
|
|
|
|
+ videoPlayView.play()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func pause() {
|
|
|
|
+ playStatusImageView.isHidden = false
|
|
|
|
+ videoPlayView.pause()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func videoTapAction(_ tap: UITapGestureRecognizer?) {
|
|
|
|
+ if videoPlayView.pauseFlag {
|
|
|
|
+ self.play()
|
|
|
|
+ } else {
|
|
|
|
+ self.pause()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|