我的列表开发
@ -176,5 +176,9 @@ extension UIColor {
|
|||||||
static func colorCCCCCC(alpha: CGFloat = 1) -> UIColor {
|
static func colorCCCCCC(alpha: CGFloat = 1) -> UIColor {
|
||||||
return color(hex: 0xCCCCCC, alpha: alpha)
|
return color(hex: 0xCCCCCC, alpha: alpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func color6D7A8F(alpha: CGFloat = 1) -> UIColor {
|
||||||
|
return color(hex: 0x6D7A8F, alpha: alpha)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +143,9 @@ extension SPAllShortViewController: UICollectionViewDelegate, UICollectionViewDa
|
|||||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
||||||
let model = dataArr[indexPath.row]
|
let model = dataArr[indexPath.row]
|
||||||
|
|
||||||
|
let vc = SPPlayerDetailViewController()
|
||||||
|
vc.shortPlayId = model.short_play_id
|
||||||
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,14 +17,14 @@ class SPCollectListViewController: SPMyListChildViewController {
|
|||||||
|
|
||||||
//MARK: UI属性
|
//MARK: UI属性
|
||||||
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
||||||
let itemWidth = floor((kSPScreenWidth - 30 - 9 * 2) / 3)
|
let itemWidth = floor((kSPScreenWidth - 32 - 8 * 2) / 3)
|
||||||
let itemHeight = 146 / 109 * itemWidth + 36
|
let itemHeight = 145 / 109 * itemWidth + 36
|
||||||
|
|
||||||
let layout = UICollectionViewFlowLayout()
|
let layout = UICollectionViewFlowLayout()
|
||||||
layout.itemSize = .init(width: itemWidth, height: itemHeight)
|
layout.itemSize = .init(width: itemWidth, height: itemHeight)
|
||||||
layout.minimumLineSpacing = 10
|
layout.minimumLineSpacing = 18
|
||||||
layout.minimumInteritemSpacing = 9
|
layout.minimumInteritemSpacing = 8
|
||||||
layout.sectionInset = .init(top: 0, left: 15, bottom: 0, right: 15)
|
layout.sectionInset = .init(top: 0, left: 16, bottom: 0, right: 16)
|
||||||
|
|
||||||
return layout
|
return layout
|
||||||
}()
|
}()
|
||||||
@ -132,6 +132,11 @@ extension SPCollectListViewController: UICollectionViewDelegate, UICollectionVie
|
|||||||
let cell = SPCollectListCell.dequeueReusableCell(collectionView: collectionView, indexPath: indexPath)
|
let cell = SPCollectListCell.dequeueReusableCell(collectionView: collectionView, indexPath: indexPath)
|
||||||
cell.sp_isEditing = self.sp_isEditing
|
cell.sp_isEditing = self.sp_isEditing
|
||||||
cell.model = dataArr[indexPath.row]
|
cell.model = dataArr[indexPath.row]
|
||||||
|
cell.clickDeleteButton = { [weak self] cell in
|
||||||
|
guard let self = self else { return }
|
||||||
|
guard let indexPath = self.collectionView.indexPath(for: cell) else { return }
|
||||||
|
self.deleteShort(indexPath: indexPath)
|
||||||
|
}
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +169,19 @@ extension SPCollectListViewController: UICollectionViewDelegate, UICollectionVie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func deleteShort(indexPath: IndexPath) {
|
||||||
|
let model = self.dataArr[indexPath.row]
|
||||||
|
guard let id = model.short_play_id else { return }
|
||||||
|
|
||||||
|
|
||||||
|
SPVideoAPI.requestCollectShort(isCollect: false, shortPlayId: id, videoId: nil) { [weak self] in
|
||||||
|
guard let self = self else { return }
|
||||||
|
self.requestDataList(page: 1, completer: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SPCollectListViewController {
|
extension SPCollectListViewController {
|
||||||
|
@ -11,7 +11,7 @@ class SPMyListChildViewController: SPViewController {
|
|||||||
|
|
||||||
var sp_isEditing = false {
|
var sp_isEditing = false {
|
||||||
didSet {
|
didSet {
|
||||||
deleteButton.isHidden = !sp_isEditing
|
// deleteButton.isHidden = !sp_isEditing
|
||||||
if sp_isEditing {
|
if sp_isEditing {
|
||||||
self.view.bringSubviewToFront(deleteButton)
|
self.view.bringSubviewToFront(deleteButton)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import UIKit
|
|||||||
class SPMyListViewController: SPViewController {
|
class SPMyListViewController: SPViewController {
|
||||||
|
|
||||||
|
|
||||||
private lazy var titles = ["Follow List".localized, "Play List".localized]
|
private lazy var titles = ["Watch list".localized, "Recently viewed".localized]
|
||||||
|
|
||||||
private lazy var viewControllers: [SPMyListChildViewController] = {
|
private lazy var viewControllers: [SPMyListChildViewController] = {
|
||||||
let vc1 = SPCollectListViewController()
|
let vc1 = SPCollectListViewController()
|
||||||
@ -50,18 +50,18 @@ class SPMyListViewController: SPViewController {
|
|||||||
let pageView = JYPageController()
|
let pageView = JYPageController()
|
||||||
pageView.delegate = self
|
pageView.delegate = self
|
||||||
pageView.dataSource = self
|
pageView.dataSource = self
|
||||||
pageView.config.indicatorWidth = 20
|
// pageView.config.indicatorWidth = 20
|
||||||
pageView.config.indicatorHeight = 4
|
pageView.config.indicatorHeight = 2
|
||||||
pageView.config.indicatorCornerRadius = 2
|
pageView.config.indicatorCornerRadius = 0
|
||||||
pageView.config.indicatorColor = .colorFFFFFF(alpha: 0.9)
|
pageView.config.indicatorColor = .colorFF0000()
|
||||||
pageView.config.selectedTitleColor = .colorFFFFFF(alpha: 0.9)
|
pageView.config.selectedTitleColor = .colorFFFFFF()
|
||||||
pageView.config.selectedTitleFont = 16
|
pageView.config.selectedTitleFont = 16
|
||||||
pageView.config.selectedTitleFontWeight = .medium
|
pageView.config.selectedTitleFontWeight = .medium
|
||||||
pageView.config.normalTitleColor = .color888888()
|
pageView.config.normalTitleColor = .colorA8A5AA()
|
||||||
pageView.config.normalTitleFont = 15
|
pageView.config.normalTitleFont = 16
|
||||||
pageView.config.normalTitleFontWeight = .regular
|
pageView.config.normalTitleFontWeight = .medium
|
||||||
pageView.config.leftPadding = 15
|
pageView.config.leftPadding = 16
|
||||||
pageView.config.itemsMargin = 40
|
pageView.config.itemsMargin = 22
|
||||||
return pageView
|
return pageView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -74,9 +74,10 @@ class SPMyListViewController: SPViewController {
|
|||||||
|
|
||||||
private lazy var cancelButton: UIButton = {
|
private lazy var cancelButton: UIButton = {
|
||||||
let button = UIButton(type: .custom)
|
let button = UIButton(type: .custom)
|
||||||
button.setTitle("Cancel".localized, for: .normal)
|
// button.setTitle("Cancel".localized, for: .normal)
|
||||||
button.setTitleColor(.colorFFFFFF(alpha: 0.9), for: .normal)
|
button.setImage(UIImage(named: "cancel_icon_01"), for: .normal)
|
||||||
button.titleLabel?.font = .fontRegular(ofSize: 15)
|
// button.setTitleColor(.colorFFFFFF(alpha: 0.9), for: .normal)
|
||||||
|
// button.titleLabel?.font = .fontRegular(ofSize: 15)
|
||||||
button.addTarget(self, action: #selector(handleCancelButton), for: .touchUpInside)
|
button.addTarget(self, action: #selector(handleCancelButton), for: .touchUpInside)
|
||||||
button.isHidden = true
|
button.isHidden = true
|
||||||
return button
|
return button
|
||||||
@ -98,6 +99,12 @@ class SPMyListViewController: SPViewController {
|
|||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
private lazy var lineView: UIView = {
|
||||||
|
let view = UIView()
|
||||||
|
view.backgroundColor = .color5A5C67()
|
||||||
|
return view
|
||||||
|
}()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
@ -112,7 +119,9 @@ class SPMyListViewController: SPViewController {
|
|||||||
|
|
||||||
override func viewDidDisappear(_ animated: Bool) {
|
override func viewDidDisappear(_ animated: Bool) {
|
||||||
super.viewDidDisappear(animated)
|
super.viewDidDisappear(animated)
|
||||||
self.sp_isEditing = false
|
if self.sp_isEditing {
|
||||||
|
self.sp_isEditing = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func handleEditButton() {
|
@objc private func handleEditButton() {
|
||||||
@ -136,10 +145,18 @@ class SPMyListViewController: SPViewController {
|
|||||||
extension SPMyListViewController {
|
extension SPMyListViewController {
|
||||||
private func _setupUI() {
|
private func _setupUI() {
|
||||||
addChild(pageView)
|
addChild(pageView)
|
||||||
|
|
||||||
|
view.addSubview(lineView)
|
||||||
view.addSubview(pageView.view)
|
view.addSubview(pageView.view)
|
||||||
view.addSubview(editButton)
|
view.addSubview(editButton)
|
||||||
view.addSubview(cancelButton)
|
view.addSubview(cancelButton)
|
||||||
view.addSubview(allSelectedButton)
|
// view.addSubview(allSelectedButton)
|
||||||
|
|
||||||
|
lineView.snp.makeConstraints { make in
|
||||||
|
make.left.right.equalToSuperview()
|
||||||
|
make.height.equalTo(1)
|
||||||
|
make.top.equalToSuperview().offset(kSPStatusbarHeight + 10 + 34)
|
||||||
|
}
|
||||||
|
|
||||||
pageView.view.snp.makeConstraints { make in
|
pageView.view.snp.makeConstraints { make in
|
||||||
make.edges.equalToSuperview()
|
make.edges.equalToSuperview()
|
||||||
@ -153,14 +170,15 @@ extension SPMyListViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cancelButton.snp.makeConstraints { make in
|
cancelButton.snp.makeConstraints { make in
|
||||||
make.top.bottom.equalTo(editButton)
|
make.edges.equalTo(editButton)
|
||||||
make.right.equalTo(editButton)
|
// make.top.bottom.equalTo(editButton)
|
||||||
|
// make.right.equalTo(editButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
allSelectedButton.snp.makeConstraints { make in
|
// allSelectedButton.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview().offset(15)
|
// make.left.equalToSuperview().offset(15)
|
||||||
make.top.bottom.equalTo(editButton)
|
// make.top.bottom.equalTo(editButton)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@ class SPPlayHistoryViewController: SPMyListChildViewController {
|
|||||||
|
|
||||||
//MARK: UI属性
|
//MARK: UI属性
|
||||||
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
|
||||||
let itemWidth = floor((kSPScreenWidth - 30 - 9 * 2) / 3)
|
let itemWidth = kSPScreenWidth - 32
|
||||||
let itemHeight = 146 / 109 * itemWidth + 36
|
let itemHeight = 151.0
|
||||||
|
|
||||||
let layout = UICollectionViewFlowLayout()
|
let layout = UICollectionViewFlowLayout()
|
||||||
layout.itemSize = .init(width: itemWidth, height: itemHeight)
|
layout.itemSize = .init(width: itemWidth, height: itemHeight)
|
||||||
layout.minimumLineSpacing = 10
|
layout.minimumLineSpacing = 18
|
||||||
layout.minimumInteritemSpacing = 9
|
layout.minimumInteritemSpacing = 9
|
||||||
layout.sectionInset = .init(top: 0, left: 15, bottom: 0, right: 15)
|
layout.sectionInset = .init(top: 0, left: 16, bottom: 0, right: 16)
|
||||||
|
|
||||||
return layout
|
return layout
|
||||||
}()
|
}()
|
||||||
@ -39,7 +39,7 @@ class SPPlayHistoryViewController: SPMyListChildViewController {
|
|||||||
collectionView.sp_addRefreshBackFooter { [weak self] in
|
collectionView.sp_addRefreshBackFooter { [weak self] in
|
||||||
self?.handleFooterRefresh(nil)
|
self?.handleFooterRefresh(nil)
|
||||||
}
|
}
|
||||||
SPCollectListCell.registerCell(collectionView: collectionView)
|
SPPlayHistoryCell.registerCell(collectionView: collectionView)
|
||||||
return collectionView
|
return collectionView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -130,8 +130,7 @@ extension SPPlayHistoryViewController {
|
|||||||
extension SPPlayHistoryViewController: UICollectionViewDelegate, UICollectionViewDataSource {
|
extension SPPlayHistoryViewController: UICollectionViewDelegate, UICollectionViewDataSource {
|
||||||
|
|
||||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||||
let cell = SPCollectListCell.dequeueReusableCell(collectionView: collectionView, indexPath: indexPath)
|
let cell = SPPlayHistoryCell.dequeueReusableCell(collectionView: collectionView, indexPath: indexPath)
|
||||||
cell.sp_isEditing = self.sp_isEditing
|
|
||||||
cell.model = dataArr[indexPath.row]
|
cell.model = dataArr[indexPath.row]
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
|
@ -9,45 +9,59 @@ import UIKit
|
|||||||
|
|
||||||
class SPCollectListCell: SPCollectionViewCell {
|
class SPCollectListCell: SPCollectionViewCell {
|
||||||
|
|
||||||
|
var clickDeleteButton: ((_ cell: SPCollectListCell) -> Void)?
|
||||||
|
|
||||||
var model: SPShortModel? {
|
var model: SPShortModel? {
|
||||||
didSet {
|
didSet {
|
||||||
coverImageView.sp_setImage(url: model?.image_url)
|
coverImageView.sp_setImage(url: model?.image_url)
|
||||||
titleLabel.text = model?.name
|
titleLabel.text = model?.name
|
||||||
|
|
||||||
selectedButton.isSelected = model?.sp_isSelected ?? false
|
// selectedButton.isSelected = model?.sp_isSelected ?? false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var sp_isEditing: Bool = false {
|
var sp_isEditing: Bool = false {
|
||||||
didSet {
|
didSet {
|
||||||
selectedButton.isHidden = !sp_isEditing
|
deleteButton.isHidden = !sp_isEditing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private lazy var coverImageView: SPImageView = {
|
private lazy var coverImageView: SPImageView = {
|
||||||
let imageView = SPImageView()
|
let imageView = SPImageView()
|
||||||
imageView.layer.cornerRadius = 7
|
imageView.layer.cornerRadius = 6
|
||||||
imageView.layer.masksToBounds = true
|
imageView.layer.masksToBounds = true
|
||||||
|
imageView.layer.borderColor = UIColor.colorFFFFFF(alpha: 0.15).cgColor
|
||||||
|
imageView.layer.borderWidth = 1
|
||||||
|
imageView.isUserInteractionEnabled = true
|
||||||
return imageView
|
return imageView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private lazy var titleLabel: UILabel = {
|
private lazy var titleLabel: UILabel = {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.font = .fontRegular(ofSize: 13)
|
label.font = .fontMedium(ofSize: 12)
|
||||||
label.textColor = .colorFFFFFF(alpha: 0.9)
|
label.textColor = .colorFFFFFF()
|
||||||
label.numberOfLines = 2
|
label.numberOfLines = 2
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private lazy var selectedButton: UIButton = {
|
private lazy var deleteButton: UIButton = {
|
||||||
let button = UIButton(type: .custom)
|
let button = UIButton(type: .custom)
|
||||||
button.isHidden = true
|
// button.isUserInteractionEnabled = false
|
||||||
button.isUserInteractionEnabled = false
|
button.setImage(UIImage(named: "delete_icon_04"), for: .normal)
|
||||||
button.setImage(UIImage(named: "check_icon_01"), for: .normal)
|
button.backgroundColor = .color000000(alpha: 0.68)
|
||||||
button.setImage(UIImage(named: "check_icon_01_selected"), for: .selected)
|
button.addTarget(self, action: #selector(handleDeleteButton), for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
// private lazy var selectedButton: UIButton = {
|
||||||
|
// let button = UIButton(type: .custom)
|
||||||
|
// button.isHidden = true
|
||||||
|
// button.isUserInteractionEnabled = false
|
||||||
|
// button.setImage(UIImage(named: "check_icon_01"), for: .normal)
|
||||||
|
// button.setImage(UIImage(named: "check_icon_01_selected"), for: .selected)
|
||||||
|
// return button
|
||||||
|
// }()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
@ -59,6 +73,10 @@ class SPCollectListCell: SPCollectionViewCell {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc private func handleDeleteButton() {
|
||||||
|
self.clickDeleteButton?(self)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SPCollectListCell {
|
extension SPCollectListCell {
|
||||||
@ -66,7 +84,7 @@ extension SPCollectListCell {
|
|||||||
private func _setupUI() {
|
private func _setupUI() {
|
||||||
contentView.addSubview(coverImageView)
|
contentView.addSubview(coverImageView)
|
||||||
contentView.addSubview(titleLabel)
|
contentView.addSubview(titleLabel)
|
||||||
coverImageView.addSubview(selectedButton)
|
coverImageView.addSubview(deleteButton)
|
||||||
|
|
||||||
coverImageView.snp.makeConstraints { make in
|
coverImageView.snp.makeConstraints { make in
|
||||||
make.left.right.top.equalToSuperview()
|
make.left.right.top.equalToSuperview()
|
||||||
@ -75,13 +93,12 @@ extension SPCollectListCell {
|
|||||||
|
|
||||||
titleLabel.snp.makeConstraints { make in
|
titleLabel.snp.makeConstraints { make in
|
||||||
make.left.equalToSuperview()
|
make.left.equalToSuperview()
|
||||||
make.top.equalTo(coverImageView.snp.bottom).offset(5)
|
make.top.equalTo(coverImageView.snp.bottom).offset(8)
|
||||||
make.right.lessThanOrEqualToSuperview()
|
make.right.lessThanOrEqualToSuperview()
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedButton.snp.makeConstraints { make in
|
deleteButton.snp.makeConstraints { make in
|
||||||
make.right.equalToSuperview().offset(-5)
|
make.edges.equalToSuperview()
|
||||||
make.top.equalToSuperview().offset(5)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
127
Thimra/Class/MyList/View/SPPlayHistoryCell.swift
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
//
|
||||||
|
// SPPlayHistoryCell.swift
|
||||||
|
// Thimra
|
||||||
|
//
|
||||||
|
// Created by Overseas on 2025/4/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class SPPlayHistoryCell: SPCollectionViewCell {
|
||||||
|
|
||||||
|
var model: SPShortModel? {
|
||||||
|
didSet {
|
||||||
|
coverImageView.sp_setImage(url: model?.image_url)
|
||||||
|
titleLabel.text = model?.name
|
||||||
|
|
||||||
|
let episode = String(format: "EP.%@".localized, model?.current_episode ?? "")
|
||||||
|
let totalEpisode = "/\(model?.episode_total ?? 0)"
|
||||||
|
let range = NSRange(location: episode.length(), length: totalEpisode.length())
|
||||||
|
|
||||||
|
let episodeString = NSMutableAttributedString(string: episode + totalEpisode)
|
||||||
|
episodeString.color = .colorEC3324()
|
||||||
|
episodeString.setColor(.color6D7A8F(), range: range)
|
||||||
|
|
||||||
|
episodeLabel.attributedText = episodeString
|
||||||
|
|
||||||
|
collectButton.isSelected = model?.is_collect ?? false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private lazy var coverImageView: SPImageView = {
|
||||||
|
let imageView = SPImageView()
|
||||||
|
imageView.layer.cornerRadius = 6
|
||||||
|
imageView.layer.masksToBounds = true
|
||||||
|
imageView.layer.borderColor = UIColor.colorFFFFFF(alpha: 0.15).cgColor
|
||||||
|
imageView.layer.borderWidth = 1
|
||||||
|
imageView.isUserInteractionEnabled = true
|
||||||
|
return imageView
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var titleLabel: UILabel = {
|
||||||
|
let label = UILabel()
|
||||||
|
label.font = .fontMedium(ofSize: 16)
|
||||||
|
label.textColor = .colorFFFFFF()
|
||||||
|
label.numberOfLines = 2
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var episodeLabel: UILabel = {
|
||||||
|
let label = UILabel()
|
||||||
|
label.font = .fontMedium(ofSize: 12)
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
|
||||||
|
private lazy var collectButton: UIButton = {
|
||||||
|
let button = UIButton(type: .custom)
|
||||||
|
button.setImage(UIImage(named: "collect_icon_02"), for: .normal)
|
||||||
|
button.setImage(UIImage(named: "collect_icon_02_selected"), for: .selected)
|
||||||
|
button.setImage(UIImage(named: "collect_icon_02_selected"), for: [.selected, .highlighted])
|
||||||
|
button.addTarget(self, action: #selector(handleCollectButton), for: .touchUpInside)
|
||||||
|
return button
|
||||||
|
}()
|
||||||
|
|
||||||
|
override init(frame: CGRect) {
|
||||||
|
super.init(frame: frame)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(updateShortCollectStateNotification), name: SPVideoAPI.updateShortCollectStateNotification, object: nil)
|
||||||
|
|
||||||
|
_setupUI()
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func handleCollectButton() {
|
||||||
|
let isCollect = !(self.model?.is_collect ?? false)
|
||||||
|
guard let shortPlayId = self.model?.short_play_id else { return }
|
||||||
|
|
||||||
|
SPVideoAPI.requestCollectShort(isCollect: isCollect, shortPlayId: shortPlayId, videoId: nil) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func updateShortCollectStateNotification(sender: Notification) {
|
||||||
|
guard let userInfo = sender.userInfo else { return }
|
||||||
|
guard let shortPlayId = userInfo["id"] as? String else { return }
|
||||||
|
guard let isCollect = userInfo["state"] as? Bool else { return }
|
||||||
|
guard shortPlayId == self.model?.short_play_id else { return }
|
||||||
|
|
||||||
|
self.model?.is_collect = isCollect
|
||||||
|
collectButton.isSelected = isCollect
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension SPPlayHistoryCell {
|
||||||
|
|
||||||
|
private func _setupUI() {
|
||||||
|
contentView.addSubview(coverImageView)
|
||||||
|
contentView.addSubview(titleLabel)
|
||||||
|
contentView.addSubview(episodeLabel)
|
||||||
|
contentView.addSubview(collectButton)
|
||||||
|
|
||||||
|
coverImageView.snp.makeConstraints { make in
|
||||||
|
make.left.top.bottom.equalToSuperview()
|
||||||
|
make.width.equalTo(109)
|
||||||
|
}
|
||||||
|
|
||||||
|
titleLabel.snp.makeConstraints { make in
|
||||||
|
make.left.equalTo(coverImageView.snp.right).offset(14)
|
||||||
|
make.top.equalToSuperview().offset(3)
|
||||||
|
make.right.lessThanOrEqualToSuperview().offset(-40)
|
||||||
|
}
|
||||||
|
|
||||||
|
episodeLabel.snp.makeConstraints { make in
|
||||||
|
make.left.equalTo(titleLabel)
|
||||||
|
make.top.equalTo(titleLabel.snp.bottom).offset(12)
|
||||||
|
}
|
||||||
|
|
||||||
|
collectButton.snp.makeConstraints { make in
|
||||||
|
make.right.equalToSuperview()
|
||||||
|
make.top.equalToSuperview().offset(3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -5,12 +5,12 @@
|
|||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "组件 67 – 2@2x.png",
|
"filename" : "Frame@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "组件 67 – 2@3x.png",
|
"filename" : "Frame@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
BIN
Thimra/Source/Assets.xcassets/icon/cancel_icon_01.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 295 B |
BIN
Thimra/Source/Assets.xcassets/icon/cancel_icon_01.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 377 B |
Before Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.9 KiB |
@ -5,12 +5,12 @@
|
|||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "组件 67 – 9@2x.png",
|
"filename" : "Frame@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "组件 67 – 9@3x.png",
|
"filename" : "Frame@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
BIN
Thimra/Source/Assets.xcassets/icon/collect_icon_02.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 685 B |
BIN
Thimra/Source/Assets.xcassets/icon/collect_icon_02.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 1012 B |
22
Thimra/Source/Assets.xcassets/icon/collect_icon_02_selected.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Thimra/Source/Assets.xcassets/icon/collect_icon_02_selected.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 741 B |
BIN
Thimra/Source/Assets.xcassets/icon/collect_icon_02_selected.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -5,12 +5,12 @@
|
|||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "delet-选中@2x.png",
|
"filename" : "Frame@2x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "delet-选中@3x.png",
|
"filename" : "Frame@3x.png",
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
|
BIN
Thimra/Source/Assets.xcassets/icon/delete_icon_01.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 371 B |
BIN
Thimra/Source/Assets.xcassets/icon/delete_icon_01.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 492 B |
Before Width: | Height: | Size: 871 B |
Before Width: | Height: | Size: 1.6 KiB |
22
Thimra/Source/Assets.xcassets/icon/delete_icon_04.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Frame@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
Thimra/Source/Assets.xcassets/icon/delete_icon_04.imageset/Frame@2x.png
vendored
Normal file
After Width: | Height: | Size: 658 B |
BIN
Thimra/Source/Assets.xcassets/icon/delete_icon_04.imageset/Frame@3x.png
vendored
Normal file
After Width: | Height: | Size: 954 B |
@ -27,8 +27,8 @@
|
|||||||
"Help Center" = "Help Center";
|
"Help Center" = "Help Center";
|
||||||
"About Us" = "About Us";
|
"About Us" = "About Us";
|
||||||
"My list" = "My list";
|
"My list" = "My list";
|
||||||
"Follow List" = "Follow List";
|
"Watch list" = "Watch list";
|
||||||
"Play List" = "Play List";
|
"Recently viewed" = "Recently viewed";
|
||||||
"Cancel" = "Cancel";
|
"Cancel" = "Cancel";
|
||||||
"Select All" = "Select All";
|
"Select All" = "Select All";
|
||||||
"Delet (%@)" = "Delet (%@)";
|
"Delet (%@)" = "Delet (%@)";
|
||||||
@ -43,5 +43,6 @@
|
|||||||
"Full Episodes" = "Full Episodes";
|
"Full Episodes" = "Full Episodes";
|
||||||
"All" = "All";
|
"All" = "All";
|
||||||
"Shorts" = "Shorts";
|
"Shorts" = "Shorts";
|
||||||
|
"EP.%@" = "EP.%@";
|
||||||
|
|
||||||
|
|
||||||
|