Преглед изворни кода

1.修改音乐及预览页UI

wenweiwei пре 3 година
родитељ
комит
d8769c2785

+ 36 - 7
BFFramework/Classes/Base/View/PQLoadingHUB.swift

@@ -9,33 +9,60 @@
 import UIKit
 
 public class PQLoadingHUBView: UIView {
-    lazy public var loadingImage: UIImageView = {
+    // gif每一帧图
+    public var gifImages: [UIImage]?
+    // gif播放时长
+    public var duration: Double?
+
+    public lazy var loadingImage: UIImageView = {
         let loadingImage = UIImageView()
-        loadingImage.kf.setImage(with: URL(fileURLWithPath: Bundle.init().BF_mainbundle().path(forResource: "loading_pq", ofType: ".gif")!))
+        loadingImage.tintColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
         return loadingImage
     }()
 
-    public override init(frame: CGRect) {
+    override public init(frame: CGRect) {
         super.init(frame: frame)
         addSubview(loadingImage)
         isUserInteractionEnabled = false
+        let data = try? Data(contentsOf: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "stuckPoint_music_loading", ofType: ".gif")!))
+        if data != nil {
+            PQPHAssetVideoParaseUtil.parasGIFImage(data: data!, isRenderingColor: UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)) { [weak self] _, images, duration in
+                self?.gifImages = images
+                self?.duration = duration
+            }
+        }
     }
 
     required init?(coder _: NSCoder) {
         fatalError("init(coder:) has not been implemented")
     }
 
-    public override func layoutSubviews() {
+    override public func layoutSubviews() {
         super.layoutSubviews()
         // 334 * 307
         let imageW: CGFloat = 67
         let imageH: CGFloat = 62
         loadingImage.frame = CGRect(x: (frame.width - imageW) / 2, y: (frame.height - imageW) / 2, width: imageW, height: imageH)
     }
+
+    /// 开始加载
+    public func loading() {
+        loadingImage.displayGIF(data: nil, images: gifImages, repeatCount: .max, duration: duration ?? 2)
+    }
+
+    /// 停止加载
+    public func endLoading() {
+        loadingImage.removePlayGIF()
+    }
+
+    override public func removeFromSuperview() {
+        loadingImage.removePlayGIF()
+        loadingImage.removeFromSuperview()
+    }
 }
 
 public class PQLoadingHUB: NSObject {
-    static public let shared = PQLoadingHUB()
+    public static let shared = PQLoadingHUB()
     public let viewTag = 11111
     public var isLoading: Bool = false
 
@@ -47,6 +74,7 @@ public class PQLoadingHUB: NSObject {
                 loadingHUB.tag = self!.viewTag
                 window?.addSubview(loadingHUB)
                 loadingHUB.center = window?.center as! CGPoint
+                loadingHUB.loading()
                 self?.isLoading = true
             }
         }
@@ -73,6 +101,7 @@ public class PQLoadingHUB: NSObject {
                 let loadingHUB: PQLoadingHUBView = PQLoadingHUBView(frame: CGRect(x: hubX, y: hubY, width: 100, height: 100))
                 loadingHUB.tag = self!.viewTag
                 superView.addSubview(loadingHUB)
+                loadingHUB.loading()
                 self?.isLoading = true
             }
         }
@@ -91,11 +120,11 @@ public class PQLoadingHUB: NSObject {
         super.init()
     }
 
-    public override func copy() -> Any {
+    override public func copy() -> Any {
         return self
     }
 
-    public override func mutableCopy() -> Any {
+    override public func mutableCopy() -> Any {
         return self
     }
 }

+ 1 - 1
BFFramework/Classes/Base/View/PQRemindView.swift

@@ -262,7 +262,7 @@ public class PQEmptyRemindView: UIView {
         addSubview(refreshBtn)
         let ges = UITapGestureRecognizer(target: self, action: #selector(fullRefresh))
         addGestureRecognizer(ges)
-        backgroundColor = UIColor.black
+        backgroundColor = PQBFConfig.shared.styleBackGroundColor
     }
 
     required public init?(coder _: NSCoder) {

+ 6 - 0
BFFramework/Classes/Categorys/UIView+Ext.swift

@@ -455,6 +455,12 @@ extension UIImageView {
             }
         }
     }
+    
+    /// 移除
+    public func removePlayGIF() {
+        layer.removeAllAnimations()
+        stopAnimating()
+    }
 }
 
 extension UIButton {

+ 3 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -41,8 +41,8 @@ class PQStuckPointEditerController: PQBaseViewController {
     lazy var nextBtn: UIButton = {
         let nextBtn = UIButton(type: .custom)
         nextBtn.frame = CGRect(x: cScreenWidth - 16 - cDefaultMargin * 6, y: cDevice_iPhoneStatusBarHei + (cDevice_iPhoneNavBarHei - cDefaultMargin * 3) / 2, width: cDefaultMargin * 6, height: cDefaultMargin * 3)
-        nextBtn.setTitle("合成", for: .normal)
-        nextBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
+        nextBtn.setTitle("合成", for: .normal)
+        nextBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
         nextBtn.addTarget(self, action: #selector(nextBtnClick(sender:)), for: .touchUpInside)
         nextBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
         nextBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#FFFFFF"), for: .normal)
@@ -178,7 +178,7 @@ class PQStuckPointEditerController: PQBaseViewController {
         if nameWidth < cDefaultMargin * 4 {
             musicNameLab.text = " \(stuckPointMusicData?.musicName ?? "") "
         } else {
-            musicNameLab.text = "\(stuckPointMusicData?.musicName ?? "")"
+            musicNameLab.text = " \(stuckPointMusicData?.musicName ?? "") "
         }
         return musicNameLab
     }()

+ 3 - 3
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMaterialController.swift

@@ -58,7 +58,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
         choseLocalAllBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
         choseLocalAllBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .selected)
         choseLocalAllBtn.setTitle("全部", for: .normal)
-        choseLocalAllBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17,weight: .medium)
+        choseLocalAllBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .medium)
         choseLocalAllBtn.addCorner(corner: 6)
         choseLocalAllBtn.tag = 10
         choseLocalAllBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
@@ -70,7 +70,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
         choseLocalVideoBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
         choseLocalVideoBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .selected)
         choseLocalVideoBtn.setTitle("视频", for: .normal)
-        choseLocalVideoBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17,weight: .medium)
+        choseLocalVideoBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .medium)
         choseLocalVideoBtn.addCorner(corner: 6)
         choseLocalVideoBtn.tag = 11
         choseLocalVideoBtn.isSelected = true
@@ -83,7 +83,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
         choseLocalImageBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
         choseLocalImageBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .selected)
         choseLocalImageBtn.setTitle("照片", for: .normal)
-        choseLocalImageBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17,weight: .medium)
+        choseLocalImageBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .medium)
         choseLocalImageBtn.addCorner(corner: 6)
         choseLocalImageBtn.tag = 12
         choseLocalImageBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)

+ 10 - 2
BFFramework/Classes/Stuckpoint/View/PQCustomSwitchView.swift

@@ -28,7 +28,7 @@ class PQCustomSwitchView: UIView {
         fatalError("init(coder:) has not been implemented")
     }
 
-    init(frame: CGRect, titles: [String],defaultIndex : Int = 1) {
+    init(frame: CGRect, titles: [String], defaultIndex: Int = 1) {
         super.init(frame: frame)
         backgroundColor = PQBFConfig.shared.otherTintColor
         addCorner(corner: frame.height / 2)
@@ -44,7 +44,15 @@ class PQCustomSwitchView: UIView {
             itemBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
             itemBtn.isSelected = index == (defaultIndex - 1)
             if index == (defaultIndex - 1) {
-                slideView.frame = itemBtn.frame
+                slideView.frame = CGRect(origin: CGPoint.zero, size: CGSize(width: itemBtn.frame.width - 4, height: itemBtn.frame.height - 4))
+                slideView.center = itemBtn.center
+                slideView.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1).cgColor
+                slideView.layer.shadowOffset = CGSize.zero
+                // 设置偏移量为0,四周都有阴影
+                slideView.layer.shadowRadius = 1 // 阴影半径
+                slideView.layer.shadowOpacity = 1 // 阴影透明度
+                slideView.layer.masksToBounds = false
+                slideView.layer.shadowPath = UIBezierPath(roundedRect: slideView.bounds, cornerRadius: slideView.layer.cornerRadius).cgPath
                 slideView.addCorner(corner: slideView.frame.height / 2)
                 itemBtn.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .medium)
                 currentItemBtn = itemBtn

+ 1 - 1
BFFramework/Classes/Stuckpoint/View/PQStuckPointMusicContentCell.swift

@@ -110,7 +110,7 @@ class PQStuckPointMusicContentCell: UICollectionViewCell {
     }
 
     func addData() {
-        imageMaskView.isHidden = !(bgmData is PQVoiceModel)
+        imageMaskView.isHidden = !(bgmData is PQVoiceModel) || PQBFConfig.shared.hiddenMusicMask
         musicNameLab.isHidden = !(bgmData is PQVoiceModel)
         titleLab.isHidden = (bgmData is PQVoiceModel)
         if bgmData is PQVoiceModel {

+ 1 - 1
BFFramework/Classes/Stuckpoint/View/PQStuckPointSearchEmptyCell.swift

@@ -28,7 +28,7 @@ class PQStuckPointSearchEmptyCell: UICollectionViewCell {
 
     lazy var hotRemindLab: UILabel = {
         let hotRemindLab = UILabel()
-        hotRemindLab.textColor = UIColor.white
+        hotRemindLab.textColor = UIColor.hexColor(hexadecimal: "#999999")
         hotRemindLab.text = "试试热门音乐"
         hotRemindLab.font = UIFont.systemFont(ofSize: 15)
         hotRemindLab.numberOfLines = 1

+ 2 - 0
BFFramework/Classes/Utils/PQBFConfig.swift

@@ -45,6 +45,8 @@ public class PQBFConfig: NSObject {
     public var cutDurationColor: UIColor = UIColor(red: 61.0 / 255.0, green: 193.0 / 255.0, blue: 193.0 / 255.0, alpha: 0.1)
     // 裁剪主题色
     public var cutViewTintColor: UIColor = UIColor.white
+    // 裁剪主题色
+    public var hiddenMusicMask: Bool = true
     public var otherTintColor: UIColor = UIColor.hexColor(hexadecimal: "#F2F2F2")
 
     // 微信登陆信息

Разлика између датотеке није приказан због своје велике величине
+ 452 - 450
Example/Pods/Pods.xcodeproj/project.pbxproj


Неке датотеке нису приказане због велике количине промена