|
@@ -4,7 +4,7 @@
|
|
|
//
|
|
|
// Created by Christopher on 2019/7/3.
|
|
|
// Copyright © 2019 RainbowPlanet. All rights reserved.
|
|
|
-//
|
|
|
+// 视频播放列表のCell
|
|
|
|
|
|
import UIKit
|
|
|
import RxSwift
|
|
@@ -27,6 +27,9 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
typealias ShareClosure = () -> Void
|
|
|
var shareClosure : ShareClosure?
|
|
|
|
|
|
+ typealias BottomClickClosure = (_ clickType: BottomClickType) -> Void
|
|
|
+ var bottomClickClosure : BottomClickClosure?
|
|
|
+
|
|
|
class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> CommunityVideoCoverCollectionCell {
|
|
|
let ID = "CommunityVideoCoverCollectionCell"
|
|
|
collectionView.register(CommunityVideoCoverCollectionCell.self, forCellWithReuseIdentifier: ID)
|
|
@@ -56,14 +59,28 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
//MARK: - 设置View
|
|
|
private func setupViews() {
|
|
|
|
|
|
+ // 视频播放
|
|
|
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)
|
|
|
+
|
|
|
+ addSubview(topicView)
|
|
|
+
|
|
|
addSubview(playStatusImageView)
|
|
|
|
|
|
|
|
@@ -72,10 +89,12 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
|
|
|
private func setupLayouts() {
|
|
|
|
|
|
+ // 视频播放
|
|
|
videoPlayView.snp.makeConstraints { (make) in
|
|
|
make.edges.equalToSuperview()
|
|
|
}
|
|
|
|
|
|
+ // 顶部
|
|
|
navBackView.snp.makeConstraints { (make) in
|
|
|
make.top.equalTo(20)
|
|
|
make.left.right.equalToSuperview()
|
|
@@ -98,6 +117,64 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
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()
|
|
|
+ }
|
|
|
+
|
|
|
+ //
|
|
|
+ topicView.snp.makeConstraints { (make) in
|
|
|
+ make.bottom.equalTo(bottomCommentView.snp_top)
|
|
|
+ make.left.right.equalToSuperview()
|
|
|
+ make.height.equalTo(45)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //
|
|
|
playStatusImageView.snp.makeConstraints { (make) in
|
|
|
make.center.equalToSuperview()
|
|
|
make.width.equalTo(50)
|
|
@@ -133,7 +210,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
|
|
|
private lazy var shareBtnRight: UIButton = {
|
|
|
let shareBtnRight = UIButton(type: UIButton.ButtonType.custom)
|
|
|
- shareBtnRight.setImage(kImage(name: "btn_share_gray"), for: UIControl.State.normal)
|
|
|
+ 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 {
|
|
@@ -155,6 +232,99 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
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 bottomClickClosure = self?.bottomClickClosure {
|
|
|
+ bottomClickClosure(BottomClickType.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 bottomClickClosure = self?.bottomClickClosure {
|
|
|
+ bottomClickClosure(BottomClickType.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 bottomClickClosure = self?.bottomClickClosure {
|
|
|
+ bottomClickClosure(BottomClickType.typeLike)
|
|
|
+ }
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ return likeBtn
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var commentView: UIView = {
|
|
|
+ let commentView = UIView()
|
|
|
+ commentView.backgroundColor = kDDDDDDColor
|
|
|
+ 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 bottomClickClosure = self?.bottomClickClosure {
|
|
|
+ bottomClickClosure(BottomClickType.typeComment)
|
|
|
+ }
|
|
|
+ }).disposed(by: disposeBag)
|
|
|
+ return textBtn
|
|
|
+ }()
|
|
|
+
|
|
|
+ private lazy var topicView: CommunityVideoTopicView = {
|
|
|
+ let topicView = CommunityVideoTopicView()
|
|
|
+ topicView.backgroundColor = UIColor.clear
|
|
|
+ return topicView
|
|
|
+ }()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// 播放暂停icon
|
|
|
private lazy var playStatusImageView: UIImageView = {
|