|
@@ -22,7 +22,7 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
|
|
|
|
|
|
lazy var imageMaskView: UIView = {
|
|
|
let imageMaskView = UIView()
|
|
|
- imageMaskView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
|
|
|
+ imageMaskView.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)
|
|
|
imageMaskView.addCorner(corner: 4)
|
|
|
return imageMaskView
|
|
|
}()
|
|
@@ -96,6 +96,11 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
|
|
|
contentView.addSubview(remindView)
|
|
|
contentView.addSubview(confirmContentView)
|
|
|
confirmContentView.addSubview(confirmBtn)
|
|
|
+ PQNotification.addObserver(forName: Notification.Name(rawValue: "MusicContentCellIconLoadingAnimationStop"), object: nil, queue: .main) { [weak self] notice in
|
|
|
+ if !(self?.imageMaskView.isHidden ?? true){
|
|
|
+ self?.stopLoadingAnimation()
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
required init?(coder _: NSCoder) {
|
|
@@ -117,10 +122,13 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
|
|
|
audioImageView.setNetImage(url: "\((bgmData as? PQVoiceModel)?.avatarUrl ?? "")", placeholder: UIImage().BF_Image(named: "videomk_music_default"))
|
|
|
confirmContentView.isHidden = !((bgmData as? PQVoiceModel)?.isSelected ?? false)
|
|
|
if (bgmData as? PQVoiceModel)?.isSelected ?? false {
|
|
|
+ imageMaskView.isHidden = false
|
|
|
playImageView.isHidden = false
|
|
|
if (bgmData as? PQVoiceModel)?.isPlaying ?? false {
|
|
|
- playImageView.image = nil
|
|
|
- playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
|
|
|
+ playImageView.image = UIImage().BF_Image(named: "loading")
|
|
|
+ startLoadingAnimation()
|
|
|
+
|
|
|
+// playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
|
|
|
musicNameLab.move()
|
|
|
} else {
|
|
|
playImageView.image = UIImage().BF_Image(named: "stuckPoint_music_pause")
|
|
@@ -226,4 +234,17 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
|
|
|
btnClickHandle!(confirmBtn, bgmData)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ func startLoadingAnimation(){
|
|
|
+ let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation")
|
|
|
+ rotateAnimation.toValue = Double.pi * 2
|
|
|
+ rotateAnimation.duration = 1
|
|
|
+ rotateAnimation.repeatCount = .infinity
|
|
|
+ playImageView.layer.add(rotateAnimation, forKey: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ func stopLoadingAnimation(){
|
|
|
+ playImageView.layer.removeAllAnimations()
|
|
|
+ playImageView.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_playing", ofType: ".gif")!))
|
|
|
+ }
|
|
|
}
|