ソースを参照

1.修改背景色

wenweiwei 3 年 前
コミット
2196b28645

+ 56 - 14
.gitignore

@@ -1,8 +1,22 @@
-# OS X
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
 .DS_Store
-
+.atom/
+.buildlog/
+.history
+.svn/
 # Xcode
+#
+# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
+
+## Build generated
 build/
+DerivedData/
+
+## Various settings
 *.pbxuser
 !default.pbxuser
 *.mode1v3
@@ -12,26 +26,54 @@ build/
 *.perspectivev3
 !default.perspectivev3
 xcuserdata/
-*.xccheckout
-profile
+
+## Other
 *.moved-aside
-DerivedData
+*.xccheckout
+*.xcscmblueprint
+
+## Obj-C/Swift specific
 *.hmap
 *.ipa
+*.dSYM.zip
+*.dSYM
 
-# Bundler
-.bundle
+## Playgrounds
+timeline.xctimeline
+playground.xcworkspace
+
+# Swift Package Manager
+#
+# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
+# Packages/
+# Package.pins
+# Package.resolved
+.build/
 
+# CocoaPods
+#
+# We recommend against adding the Pods directory to your .gitignore. However
+# you should judge for yourself, the pros and cons are mentioned at:
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
+#
+Pods/
+Podfile.lock
+
+# Carthage
+#
 # Add this line if you want to avoid checking in source code from Carthage dependencies.
 # Carthage/Checkouts
 
 Carthage/Build
 
-# We recommend against adding the Pods directory to your .gitignore. However
-# you should judge for yourself, the pros and cons are mentioned at:
-# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
-# 
-# Note: if you ignore the Pods directory, make sure to uncomment
-# `pod install` in .travis.yml
+# fastlane
 #
-# Pods/
+# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
+# screenshots whenever they are needed.
+# For more information about the recommended setup visit:
+# https://docs.fastlane.tools/best-practices/source-control/#source-control
+
+fastlane/report.xml
+fastlane/Preview.html
+fastlane/screenshots/**/*.png
+fastlane/test_output

+ 1 - 1
BFFramework.podspec

@@ -64,5 +64,5 @@ TODO: Add long description of the pod here.
     s.dependency 'Bugly','2.5.71' # 奔溃分析组件
     s.dependency 'TXLiteAVSDK_Player','8.4.9944' # 腾讯播放器组件
     s.dependency "NXFramework-Swift"
-#    s.dependency 'KingfisherWebP','0.4.2' # 加载WebP格式图片库 使用https://github.com/webmproject/libwebp.git地址可以不翻
+    s.dependency 'KingfisherWebP','0.4.2' # 加载WebP格式图片库 使用https://github.com/webmproject/libwebp.git地址可以不翻
 end

+ 26 - 16
BFFramework/Classes/Base/Controller/PQBaseViewController.swift

@@ -8,8 +8,8 @@
 
 // import MediaPlayer
 import Alamofire
-import UIKit
 import NXFramework_Swift
+import UIKit
 public class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate {
     // 侧滑拦截返回
     public var popGestureHandle: (() -> Void)?
@@ -25,17 +25,15 @@ public class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate
         }
     }
 
-    lazy public var manager: NetworkReachabilityManager? = {
+    public lazy var manager: NetworkReachabilityManager? = {
         let manager = NetworkReachabilityManager(host: "www.baidu.com")
         manager?.listener = { status in
-            if status == .reachable(.wwan) || status == .reachable(.ethernetOrWiFi) {
-           
-            }
+            if status == .reachable(.wwan) || status == .reachable(.ethernetOrWiFi) {}
         }
         return manager
     }()
 
-     override public func viewDidLoad() {
+    override public func viewDidLoad() {
         super.viewDidLoad()
         navigationController?.isNavigationBarHidden = true
         view.backgroundColor = UIColor.black
@@ -72,11 +70,16 @@ public class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate
         leftButton(image: "icon_detail_back")
     }
 
-    func leftButton(image: String?) {
+    func leftButton(image: String?,tintColor:UIColor? = nil) {
         let leftButton = UIButton(type: .custom)
         leftButton.frame = CGRect(x: 0, y: cDevice_iPhoneStatusBarHei, width: cDefaultMargin * 4, height: cDefaultMargin * 4)
         leftButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: -5, right: 0)
-        leftButton.setImage(UIImage.init().BF_Image(named:  image ?? "icon_detail_back"), for: .normal)
+        if tintColor != nil {
+            leftButton.tintColor = tintColor
+            leftButton.setImage(UIImage().BF_Image(named: image ?? "icon_detail_back").withRenderingMode(.alwaysTemplate), for: .normal)
+        }else{
+            leftButton.setImage(UIImage().BF_Image(named: image ?? "icon_detail_back"), for: .normal)
+        }
         leftButton.addTarget(self, action: #selector(backBtnClick), for: .touchUpInside)
         navHeadImageView?.addSubview(leftButton)
         backButton = leftButton
@@ -122,19 +125,18 @@ public class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate
         navigationController?.popViewController(animated: true)
     }
 
-    public override func viewDidAppear(_ animated: Bool) {
+    override public func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
-      
     }
 
-    public override func viewWillDisappear(_ animated: Bool) {
+    override public func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
         PQLoadingHUB.shared.dismissHUB()
     }
 
-    public override func viewDidDisappear(_ animated: Bool) {
+    override public func viewDidDisappear(_ animated: Bool) {
         super.viewDidDisappear(animated)
-       
+
         if view.viewWithTag(cGuideTag) != nil {
             view.viewWithTag(cGuideTag)?.removeFromSuperview()
         }
@@ -145,11 +147,19 @@ public class PQBaseViewController: UIViewController, UIGestureRecognizerDelegate
         BFLog(message: "\(String(describing: type(of: self)))被销毁")
     }
 
-    public override var preferredStatusBarStyle: UIStatusBarStyle {
-        return .lightContent
+    override public var preferredStatusBarStyle: UIStatusBarStyle {
+        if PQBFConfig.shared.statusBarStyle == .dark {
+            if #available(iOS 13.0, *) {
+                return .darkContent
+            } else {
+                return .default
+            }
+        } else {
+            return .lightContent
+        }
     }
 
-    public override var prefersStatusBarHidden: Bool {
+    override public var prefersStatusBarHidden: Bool {
         return isHiddenStatus
     }
 

+ 2 - 2
BFFramework/Classes/Base/Controller/PQPhotoAlbumController.swift

@@ -37,7 +37,7 @@ class PQPhotoAlbumController: PQBaseViewController {
         } else {
             automaticallyAdjustsScrollViewInsets = false
         }
-        albaumCollectionView.backgroundColor = UIColor.hexColor(hexadecimal: "#111111")
+        albaumCollectionView.backgroundColor = UIColor.clear
         return albaumCollectionView
     }()
 
@@ -76,7 +76,7 @@ class PQPhotoAlbumController: PQBaseViewController {
         super.viewDidLoad()
 
         // Do any additional setup after loading the view.
-        view.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6)
+        view.backgroundColor = PQBFConfig.shared.styleBackGroundColor
         hiddenNavigation()
         loadPhotoData()
     }

+ 4 - 1
BFFramework/Classes/Base/Controller/PQPhotoMaterialController.swift

@@ -89,6 +89,7 @@ class PQPhotoMaterialController: PQBaseViewController {
         emptyData.title = "此相册中什么都没有"
         emptyData.isRefreshHidden = false
         emptyData.refreshTitle = NSMutableAttributedString(string: "刷新")
+        emptyData.refreshBgColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
         emptyData.emptyImage = "material_empty"
         return emptyData
     }()
@@ -97,7 +98,7 @@ class PQPhotoMaterialController: PQBaseViewController {
         let emptyRemindView = PQEmptyRemindView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height))
         emptyRemindView.isHidden = true
         photoCollectionView.addSubview(emptyRemindView)
-        emptyRemindView.backgroundColor = UIColor.hexColor(hexadecimal: "#242424")
+        emptyRemindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
         emptyRemindView.fullRefreshBloc = { [weak self] _, _ in
             if emptyRemindView.refreshBtn.currentTitle == "授予权限" {
                 openAppSetting()
@@ -115,6 +116,8 @@ class PQPhotoMaterialController: PQBaseViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         view.addSubview(photoCollectionView)
+        hiddenNavigation()
+        view.backgroundColor = PQBFConfig.shared.styleBackGroundColor
     }
 
     /// <#Description#>

+ 5 - 3
BFFramework/Classes/Base/View/PQAssetCategoryCell.swift

@@ -20,19 +20,21 @@ class PQAssetCategoryCell: UICollectionViewCell {
     lazy var categoryNameLab: UILabel = {
         let categoryNameLab = UILabel()
         categoryNameLab.font = UIFont.systemFont(ofSize: 14)
-        categoryNameLab.textColor = UIColor.white
+        categoryNameLab.textColor = PQBFConfig.shared.styleTitleColor
         return categoryNameLab
     }()
 
     lazy var countLab: UILabel = {
         let countLab = UILabel()
         countLab.font = UIFont.systemFont(ofSize: 14)
-        countLab.textColor = UIColor.white
+        countLab.textColor = PQBFConfig.shared.styleTitleColor
         return countLab
     }()
 
     lazy var seleImage: UIImageView = {
-        let seleImage = UIImageView(image: UIImage.init().BF_Image(named:  "icon_uploadVideo_do"))
+        let seleImage = UIImageView()
+        seleImage.tintColor = PQBFConfig.shared.styleTitleColor
+        seleImage.image = UIImage.init().BF_Image(named:  "icon_uploadVideo_do").withRenderingMode(.alwaysTemplate)
         seleImage.isHidden = true
         return seleImage
     }()

+ 8 - 0
BFFramework/Classes/Enums/Enums.swift

@@ -731,3 +731,11 @@ public enum styleColor: String {
     case green = "#3DC1C1"
     case red = "#EE0051"
 }
+
+// MARK: - statusBar
+
+/// statusBar
+public enum statusBarStyle {
+    case light
+    case dark
+}

+ 15 - 14
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMaterialController.swift

@@ -28,10 +28,11 @@ public class PQStuckPointMaterialController: PQBaseViewController {
     lazy var changeCollecBtn: UIButton = {
         let changeCollecBtn = UIButton(frame: CGRect(x: cDefaultMargin * 5, y: cDevice_iPhoneStatusBarHei, width: cScreenWidth - cDefaultMargin * 10, height: cDefaultMargin * 4))
         changeCollecBtn.titleLabel?.lineBreakMode = .byTruncatingTail
+        changeCollecBtn.tintColor = PQBFConfig.shared.styleTitleColor
         changeCollecBtn.setTitle("全部", for: .normal)
-        changeCollecBtn.setImage(UIImage.init().BF_Image(named:  "icon_selected_down"), for: .normal)
-        changeCollecBtn.setImage(UIImage.init().BF_Image(named:  "icon_selected_up"), for: .selected)
-        changeCollecBtn.setTitleColor(UIColor.white, for: .selected)
+        changeCollecBtn.setImage(UIImage.init().BF_Image(named:  "icon_selected_down").withRenderingMode(.alwaysTemplate), for: .normal)
+        changeCollecBtn.setImage(UIImage.init().BF_Image(named:  "icon_selected_up").withRenderingMode(.alwaysTemplate), for: .selected)
+        changeCollecBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .normal)
         changeCollecBtn.titleLabel?.font = UIFont.systemFont(ofSize: 18, weight: .medium)
         changeCollecBtn.tag = 1
         changeCollecBtn.imagePosition(at: .right, space: cDefaultMargin / 2)
@@ -55,7 +56,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
     lazy var choseLocalAllBtn: UIButton = {
         let choseLocalAllBtn = UIButton(frame: CGRect(x: (view.frame.width - choseBtnW * 3) / 4, y: cDevice_iPhoneNavBarAndStatusBarHei + margin, width: choseBtnW, height: choseBtnH))
         choseLocalAllBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
-        choseLocalAllBtn.setTitleColor(UIColor.white, for: .selected)
+        choseLocalAllBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .selected)
         choseLocalAllBtn.setTitle("全部", for: .normal)
         choseLocalAllBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17)
         choseLocalAllBtn.addCorner(corner: 6)
@@ -67,7 +68,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
     lazy var choseLocalVideoBtn: UIButton = {
         let choseLocalVideoBtn = UIButton(frame: CGRect(x: choseLocalAllBtn.frame.maxX + (view.frame.width - choseBtnW * 3) / 4, y: choseLocalAllBtn.frame.minY, width: choseBtnW, height: choseBtnH))
         choseLocalVideoBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
-        choseLocalVideoBtn.setTitleColor(UIColor.white, for: .selected)
+        choseLocalVideoBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .selected)
         choseLocalVideoBtn.setTitle("视频", for: .normal)
         choseLocalVideoBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17)
         choseLocalVideoBtn.addCorner(corner: 6)
@@ -80,7 +81,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
     lazy var choseLocalImageBtn: UIButton = {
         let choseLocalImageBtn = UIButton(frame: CGRect(x: choseLocalVideoBtn.frame.maxX + (view.frame.width - choseBtnW * 3) / 4, y: choseLocalAllBtn.frame.minY, width: choseBtnW, height: choseBtnH))
         choseLocalImageBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
-        choseLocalImageBtn.setTitleColor(UIColor.white, for: .selected)
+        choseLocalImageBtn.setTitleColor(PQBFConfig.shared.styleTitleColor, for: .selected)
         choseLocalImageBtn.setTitle("照片", for: .normal)
         choseLocalImageBtn.titleLabel?.font = UIFont.systemFont(ofSize: 17)
         choseLocalImageBtn.addCorner(corner: 6)
@@ -106,14 +107,14 @@ public class PQStuckPointMaterialController: PQBaseViewController {
     // 底部操作视图
     lazy var bottomRemindView: UIView = {
         let bottomRemindView = UIView(frame: CGRect(x: 0, y: view.frame.height - (bottomH + cSafeAreaHeight), width: view.frame.width, height: bottomH + cSafeAreaHeight))
-        bottomRemindView.backgroundColor = UIColor.hexColor(hexadecimal: "#191919")
+        bottomRemindView.backgroundColor = PQBFConfig.shared.styleBackGroundColor
         return bottomRemindView
     }()
 
     // 确定按钮
     lazy var confirmBtn: UIButton = {
         let confirmBtn = UIButton(frame: CGRect(x: bottomRemindView.frame.width - cDefaultMargin * 9 - margin, y: margin / 2, width: cDefaultMargin * 9, height: bottomH - margin))
-        confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+        confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#F2F2F2")
 //        confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#EE0051")
         confirmBtn.setTitle("确定", for: .normal)
         confirmBtn.setTitleColor(UIColor.hexColor(hexadecimal: "#999999"), for: .normal)
@@ -131,7 +132,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
         let bottomRemindLab = UILabel(frame: CGRect(x: margin, y: 0, width: bottomRemindView.frame.width - margin * 3 - confirmBtn.frame.width, height: bottomH))
         bottomRemindLab.attributedText = NSAttributedString(string: "至少选择 1 个视频或 2 张照片")
         bottomRemindLab.textAlignment = .left
-        bottomRemindLab.textColor = UIColor.white
+        bottomRemindLab.textColor = PQBFConfig.shared.styleTitleColor
         bottomRemindLab.font = UIFont.systemFont(ofSize: 14, weight: .medium)
         return bottomRemindLab
     }()
@@ -198,10 +199,10 @@ public class PQStuckPointMaterialController: PQBaseViewController {
 
     public override func viewDidLoad() {
         super.viewDidLoad()
-        view.backgroundColor = UIColor.hexColor(hexadecimal: "#191919")
-        navHeadImageView?.backgroundColor = UIColor.hexColor(hexadecimal: "#191919")
-        lineView?.backgroundColor = UIColor.hexColor(hexadecimal: "#191919")
-        leftButton(image: "upload_delete")
+        view.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        navHeadImageView?.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        lineView?.backgroundColor = PQBFConfig.shared.styleBackGroundColor
+        leftButton(image: "upload_delete",tintColor: PQBFConfig.shared.styleTitleColor)
         navHeadImageView?.addSubview(changeCollecBtn)
         navHeadImageView?.frame.size.height = cDevice_iPhoneNavBarAndStatusBarHei + margin * 2 + choseBtnH
         navHeadImageView?.addSubview(choseLocalAllBtn)
@@ -303,7 +304,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
 //                }
 //            }
         } else {
-            confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
+            confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#F2F2F2")
 //            if materialHeadView.isHidden {
 //                UIView.animate(withDuration: 0.5, delay: 0, options: .allowUserInteraction) { [weak self] in
 //                    // 调整位置

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

@@ -33,7 +33,7 @@ class PQSelectedMaterialListView: UIView {
 
     override init(frame: CGRect) {
         super.init(frame: frame)
-        backgroundColor = UIColor.hexColor(hexadecimal: "#191919")
+        backgroundColor = PQBFConfig.shared.styleBackGroundColor
         addSubview(photoCollectionView)
     }
 

+ 7 - 7
BFFramework/Classes/Stuckpoint/View/PQVideoCutingOprateView.swift

@@ -59,7 +59,7 @@ class PQVideoCutingOprateView: UIView {
     lazy var durationLabel: UILabel = {
         let durationLabel = UILabel()
         durationLabel.font = UIFont.systemFont(ofSize: 11, weight: .medium)
-        durationLabel.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        durationLabel.backgroundColor = PQBFConfig.shared.cutViewStyleColor
         durationLabel.alpha = 0.1
         durationLabel.textColor = UIColor.white
         durationLabel.textAlignment = .center
@@ -68,10 +68,10 @@ class PQVideoCutingOprateView: UIView {
 
     lazy var leftOprateView: UIImageView = {
         let leftOprateView = UIImageView(image:UIImage.init().BF_Image(named:  "videomk_crop_left").withRenderingMode(.alwaysTemplate))
-        leftOprateView.tintColor = UIColor.white
+        leftOprateView.tintColor = PQBFConfig.shared.cutViewTintColor
         leftOprateView.contentMode = .scaleAspectFill
         leftOprateView.isUserInteractionEnabled = true
-        leftOprateView.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        leftOprateView.backgroundColor = PQBFConfig.shared.cutViewStyleColor
         let panGes = UIPanGestureRecognizer(target: self, action: #selector(panGesture(gesture:)))
         panGes.maximumNumberOfTouches = 1
         panGes.minimumNumberOfTouches = 1
@@ -81,10 +81,10 @@ class PQVideoCutingOprateView: UIView {
 
     lazy var rightOprateView: UIImageView = {
         let rightOprateView = UIImageView(image: UIImage.init().BF_Image(named:  "videomk_crop_right").withRenderingMode(.alwaysTemplate))
-        rightOprateView.tintColor = UIColor.white
-        rightOprateView.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        rightOprateView.tintColor = PQBFConfig.shared.cutViewTintColor
         rightOprateView.contentMode = .scaleAspectFill
         rightOprateView.isUserInteractionEnabled = true
+        rightOprateView.backgroundColor = PQBFConfig.shared.cutViewStyleColor
         let panGes = UIPanGestureRecognizer(target: self, action: #selector(panGesture(gesture:)))
         panGes.maximumNumberOfTouches = 1
         panGes.minimumNumberOfTouches = 1
@@ -94,13 +94,13 @@ class PQVideoCutingOprateView: UIView {
 
     lazy var topLineView: UIImageView = {
         let topLineView = UIImageView()
-        topLineView.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        topLineView.backgroundColor = PQBFConfig.shared.cutViewStyleColor
         return topLineView
     }()
 
     lazy var bottomLineView: UIImageView = {
         let bottomLineView = UIImageView()
-        bottomLineView.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        bottomLineView.backgroundColor = PQBFConfig.shared.cutViewStyleColor
         return bottomLineView
     }()
 

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

@@ -9,8 +9,34 @@ import UIKit
 
 public class PQBFConfig: NSObject {
     public static let shared = PQBFConfig()
+    /**
+     // 主题适配方案一
+     styleColor = nomal
+     statusBarStyle = .light
+     backgroundColor = UIColor.hexColor(hexadecimal: "#191919")
+     styleTitleColor: UIColor = UIColor.white
+     cutViewStyleColor: UIColor = UIColor.white
+     cutViewTintColor: UIColor = UIColor.black
+     //主题适配方案二
+     styleColor = green
+     statusBarStyle = .dark
+     backgroundColor = UIColor.white
+     styleTitleColor: UIColor = UIColor.black
+     cutViewStyleColor: UIColor = UIColor.hexColor(hexadecimal: "#3DC1C1")
+     cutViewTintColor: UIColor = UIColor.white
+     */
     // 主题色
     public var styleColor: styleColor = .green
+    // statusBarStyle
+    public var statusBarStyle: statusBarStyle = .dark
+    // 背景色
+    public var styleBackGroundColor: UIColor = UIColor.white
+    // 主题标题色
+    public var styleTitleColor: UIColor = UIColor.black
+    // 裁剪主题色
+    public var cutViewStyleColor: UIColor = UIColor.hexColor(hexadecimal: "#3DC1C1")
+    // 裁剪主题色
+    public var cutViewTintColor: UIColor = UIColor.white
     // 微信登陆信息
     public var appInfo: WXApiInfo?
     // 渠道