Parcourir la source

1.update resources

wenweiwei il y a 3 ans
Parent
commit
65d1946af1

+ 7 - 4
BFCommonKit.podspec

@@ -8,7 +8,7 @@
 
 Pod::Spec.new do |s|
   s.name             = 'BFCommonKit'
-  s.version          = '1.1.2'
+  s.version          = '1.1.3'
   s.summary          = 'A short description of BFCommonKit.'
   s.swift_version    = '5.0'
 # This description is used to generate tags and improve search results.
@@ -72,11 +72,14 @@ TODO: Add long description of the pod here.
     dd.frameworks = 'UIKit','MessageUI','WebKit'
     dd.dependency 'BFCommonKit/BFCategorys'
   end
-  s.subspec 'Resources' do |rr|
-    rr.resource_bundles = {
+#  s.subspec 'Resources' do |rr|
+#    rr.resource_bundles = {
+#      'BFCommonKit_Resources' => ['BFCommonKit/Assets/Resources/*']
+#    }
+#  end
+   s.resource_bundles = {
       'BFCommonKit_Resources' => ['BFCommonKit/Assets/Resources/*']
     }
-  end
   # s.resources = 'BFCommonKit/Assets/Resources/*.png'
   # s.public_header_files = 'Pod/Classes/**/*.h'
   # s.frameworks = 'UIKit', 'AVFoundation','CoreMedia', 'QuartzCore'

+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/Contents.json → BFCommonKit/Assets/Resources/Material.xcassets/Contents.json


+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/icon_detail_back.imageset/Contents.json → BFCommonKit/Assets/Resources/Material.xcassets/icon_detail_back.imageset/Contents.json


+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/icon_detail_back.imageset/icon_detail_back@2x.png → BFCommonKit/Assets/Resources/Material.xcassets/icon_detail_back.imageset/icon_detail_back@2x.png


+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/icon_detail_back.imageset/icon_detail_back@3x.png → BFCommonKit/Assets/Resources/Material.xcassets/icon_detail_back.imageset/icon_detail_back@3x.png


+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/placehold_image.imageset/Contents.json → BFCommonKit/Assets/Resources/Material.xcassets/placehold_image.imageset/Contents.json


+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/placehold_image.imageset/placehold_image@2x.png → BFCommonKit/Assets/Resources/Material.xcassets/placehold_image.imageset/placehold_image@2x.png


+ 0 - 0
BFCommonKit/Assets/Resources/Xcassets.xcassets/placehold_image.imageset/placehold_image@3x.png → BFCommonKit/Assets/Resources/Material.xcassets/placehold_image.imageset/placehold_image@3x.png


+ 171 - 0
BFCommonKit/Classes/BFBase/View/PQSlideView.swift

@@ -0,0 +1,171 @@
+//
+//  PQSlideView.swift
+//  PQSpeed
+//
+//  Created by SanW on 2020/6/3.
+//  Copyright © 2020 BytesFlow. All rights reserved.
+//
+
+import UIKit
+
+class PQPlayerSlider: UISlider {
+    override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect {
+        var newRect = rect
+
+        newRect.origin.x = newRect.origin.x - 5
+        newRect.size.width = newRect.size.width + 10
+        return super.thumbRect(forBounds: bounds, trackRect: newRect, value: value)
+    }
+}
+
+class PQSlideView: UIView {
+    /// 拖动进度
+    public var valueChangeBloc: ((_ slideer: UISlider) -> Void)?
+    public var btnClickBloc: ((_ sender: UIButton) -> Void)?
+    public var isDragingProgressSlder: Bool = false
+
+    public lazy var playerBtn: UIButton = {
+        let playerBtn = UIButton()
+        playerBtn.setImage(UIImage(named: "icon_video_stop"), for: .normal)
+        playerBtn.setImage(UIImage(named: "icon_video_play"), for: .selected)
+        playerBtn.tag = 1
+        playerBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        return playerBtn
+    }()
+
+    public lazy var fullScreenBtn: UIButton = {
+        let fullScreenBtn = UIButton()
+        fullScreenBtn.setImage(UIImage(named: "icon_video_narrow"), for: .selected)
+        fullScreenBtn.setImage(UIImage(named: "icon_video_amplification"), for: .normal)
+        fullScreenBtn.tag = 2
+        fullScreenBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        return fullScreenBtn
+    }()
+
+    public lazy var sliderView: PQPlayerSlider = {
+        let sliderView = PQPlayerSlider()
+        let thbImage = UIImage(named: "icon_point")
+        sliderView.setMinimumTrackImage(thbImage, for: .normal)
+        sliderView.setMaximumTrackImage(thbImage, for: .normal)
+        sliderView.setThumbImage(thbImage, for: .highlighted)
+        sliderView.setThumbImage(thbImage, for: .normal)
+        sliderView.maximumTrackTintColor = UIColor.hexColor(hexadecimal: "#666666")
+        sliderView.minimumTrackTintColor = UIColor.white
+        sliderView.addTarget(self, action: #selector(sliderTouchBegan(sender:)), for: .touchDown)
+        sliderView.addTarget(self, action: #selector(sliderTouchEnded(sender:)), for: .touchUpInside)
+        sliderView.addTarget(self, action: #selector(sliderTouchEnded(sender:)), for: .touchUpOutside)
+        sliderView.addTarget(self, action: #selector(sliderTouchEnded(sender:)), for: .touchCancel)
+        return sliderView
+    }()
+
+    public lazy var currentTimeLab: UILabel = {
+        let currentTimeLab = UILabel()
+        currentTimeLab.text = "00:00"
+        currentTimeLab.textColor = UIColor.white
+        currentTimeLab.font = UIFont.systemFont(ofSize: 12)
+        return currentTimeLab
+    }()
+
+    public lazy var totalLab: UILabel = {
+        let totalLab = UILabel()
+        totalLab.textColor = UIColor.white
+        totalLab.text = "00:00"
+        totalLab.font = UIFont.systemFont(ofSize: 12)
+        return totalLab
+    }()
+
+    override public init(frame: CGRect) {
+        super.init(frame: frame)
+        addSubview(playerBtn)
+        addSubview(currentTimeLab)
+        addSubview(sliderView)
+        addSubview(totalLab)
+        addSubview(fullScreenBtn)
+        addLayout()
+    }
+
+    public required init?(coder _: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+
+    public var progressValue: Float = 0 {
+        didSet {
+            if !isDragingProgressSlder {
+                addData()
+            }
+        }
+    }
+
+    public var duration: Float = 0 {
+        didSet {
+            if !isDragingProgressSlder {
+                addData()
+            }
+        }
+    }
+
+    override public func layoutSubviews() {
+        super.layoutSubviews()
+    }
+
+    public func addData() {
+        if progressValue >= 3600 {
+            currentTimeLab.snp.updateConstraints { make in
+                make.width.greaterThanOrEqualTo(54)
+            }
+        } else {
+            currentTimeLab.snp.updateConstraints { make in
+                make.width.greaterThanOrEqualTo(35)
+            }
+        }
+        sliderView.setValue(progressValue / duration, animated: false)
+        currentTimeLab.text = Float64(progressValue).formatDurationToHMS()
+        totalLab.text = Float64(duration).formatDurationToHMS()
+    }
+
+    public func addLayout() {
+        playerBtn.snp.makeConstraints { make in
+            make.centerY.equalToSuperview()
+            make.height.width.equalTo(cDefaultMargin * 4)
+            make.left.equalTo(self)
+        }
+        currentTimeLab.snp.makeConstraints { make in
+            make.left.equalTo(playerBtn.snp.right).offset(cDefaultMargin)
+            make.width.greaterThanOrEqualTo(35)
+            make.centerY.equalToSuperview()
+        }
+        fullScreenBtn.snp.makeConstraints { make in
+            make.right.equalTo(self)
+            make.centerY.equalToSuperview()
+            make.width.height.equalTo(cDefaultMargin * 4)
+        }
+        totalLab.snp.makeConstraints { make in
+            make.right.equalTo(fullScreenBtn.snp.left).offset(-cDefaultMargin)
+            make.centerY.equalToSuperview()
+        }
+        sliderView.snp.makeConstraints { make in
+            make.left.equalTo(currentTimeLab.snp.right).offset(cDefaultMargin)
+            make.right.equalTo(totalLab.snp.left).offset(-cDefaultMargin)
+            make.centerY.equalToSuperview()
+            make.height.equalTo(cDefaultMargin * 4)
+        }
+    }
+
+    @objc public func sliderTouchBegan(sender _: UISlider) {
+        isDragingProgressSlder = true
+    }
+
+    @objc public func sliderTouchEnded(sender: UISlider) {
+        if valueChangeBloc != nil {
+            valueChangeBloc!(sender)
+        }
+        isDragingProgressSlder = false
+    }
+
+    @objc public func btnClick(sender: UIButton) {
+        if btnClickBloc != nil {
+            sender.isSelected = !sender.isSelected
+            btnClickBloc!(sender)
+        }
+    }
+}

+ 14 - 16
Example/Podfile.lock

@@ -1,14 +1,13 @@
 PODS:
   - Alamofire (4.9.1)
-  - BFCommonKit (1.1.1):
-    - BFCommonKit/BFBase (= 1.1.1)
-    - BFCommonKit/BFCategorys (= 1.1.1)
-    - BFCommonKit/BFConfig (= 1.1.1)
-    - BFCommonKit/BFDebug (= 1.1.1)
-    - BFCommonKit/BFEnums (= 1.1.1)
-    - BFCommonKit/BFUtility (= 1.1.1)
-    - BFCommonKit/Resources (= 1.1.1)
-  - BFCommonKit/BFBase (1.1.1):
+  - BFCommonKit (1.1.3):
+    - BFCommonKit/BFBase (= 1.1.3)
+    - BFCommonKit/BFCategorys (= 1.1.3)
+    - BFCommonKit/BFConfig (= 1.1.3)
+    - BFCommonKit/BFDebug (= 1.1.3)
+    - BFCommonKit/BFEnums (= 1.1.3)
+    - BFCommonKit/BFUtility (= 1.1.3)
+  - BFCommonKit/BFBase (1.1.3):
     - Alamofire (= 4.9.1)
     - BFCommonKit/BFCategorys
     - BFCommonKit/BFConfig
@@ -16,13 +15,13 @@ PODS:
     - FDFullscreenPopGesture (= 1.1)
     - RealmSwift (= 10.7.6)
     - SnapKit (= 5.0.1)
-  - BFCommonKit/BFCategorys (1.1.1):
+  - BFCommonKit/BFCategorys (1.1.3):
     - KingfisherWebP (= 1.3.0)
-  - BFCommonKit/BFConfig (1.1.1)
-  - BFCommonKit/BFDebug (1.1.1):
+  - BFCommonKit/BFConfig (1.1.3)
+  - BFCommonKit/BFDebug (1.1.3):
     - BFCommonKit/BFCategorys
-  - BFCommonKit/BFEnums (1.1.1)
-  - BFCommonKit/BFUtility (1.1.1):
+  - BFCommonKit/BFEnums (1.1.3)
+  - BFCommonKit/BFUtility (1.1.3):
     - Alamofire (= 4.9.1)
     - BFCommonKit/BFCategorys
     - BFCommonKit/BFConfig
@@ -30,7 +29,6 @@ PODS:
     - Kingfisher (= 6.3.0)
     - KingfisherWebP (= 1.3.0)
     - Toast-Swift (= 5.0.1)
-  - BFCommonKit/Resources (1.1.1)
   - FDFullscreenPopGesture (1.1)
   - KeychainAccess (4.2.2)
   - Kingfisher (6.3.0)
@@ -76,7 +74,7 @@ EXTERNAL SOURCES:
 
 SPEC CHECKSUMS:
   Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
-  BFCommonKit: b58e30bb0cefb7925fd35c949009b467582067e5
+  BFCommonKit: 8076582aa47b2a02f40cdeff90f45f83fad8ab10
   FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
   KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
   Kingfisher: 6c3df386db71d82c0817a429d2c9421a77396529

+ 7 - 10
Example/Pods/Local Podspecs/BFCommonKit.podspec.json

@@ -1,6 +1,6 @@
 {
   "name": "BFCommonKit",
-  "version": "1.1.1",
+  "version": "1.1.3",
   "summary": "A short description of BFCommonKit.",
   "swift_versions": "5.0",
   "description": "TODO: Add long description of the pod here.",
@@ -14,11 +14,16 @@
   },
   "source": {
     "git": "https://git.yishihui.com/wenweiwei/BFCommonKit.git",
-    "tag": "1.1.1"
+    "tag": "1.1.3"
   },
   "platforms": {
     "ios": "10.0"
   },
+  "resource_bundles": {
+    "BFCommonKit_Resources": [
+      "BFCommonKit/Assets/Resources/*"
+    ]
+  },
   "subspecs": [
     {
       "name": "BFConfig",
@@ -123,14 +128,6 @@
 
         ]
       }
-    },
-    {
-      "name": "Resources",
-      "resource_bundles": {
-        "BFCommonKit_Resources": [
-          "BFCommonKit/Assets/Resources/*"
-        ]
-      }
     }
   ],
   "swift_version": "5.0"

+ 14 - 16
Example/Pods/Manifest.lock

@@ -1,14 +1,13 @@
 PODS:
   - Alamofire (4.9.1)
-  - BFCommonKit (1.1.1):
-    - BFCommonKit/BFBase (= 1.1.1)
-    - BFCommonKit/BFCategorys (= 1.1.1)
-    - BFCommonKit/BFConfig (= 1.1.1)
-    - BFCommonKit/BFDebug (= 1.1.1)
-    - BFCommonKit/BFEnums (= 1.1.1)
-    - BFCommonKit/BFUtility (= 1.1.1)
-    - BFCommonKit/Resources (= 1.1.1)
-  - BFCommonKit/BFBase (1.1.1):
+  - BFCommonKit (1.1.3):
+    - BFCommonKit/BFBase (= 1.1.3)
+    - BFCommonKit/BFCategorys (= 1.1.3)
+    - BFCommonKit/BFConfig (= 1.1.3)
+    - BFCommonKit/BFDebug (= 1.1.3)
+    - BFCommonKit/BFEnums (= 1.1.3)
+    - BFCommonKit/BFUtility (= 1.1.3)
+  - BFCommonKit/BFBase (1.1.3):
     - Alamofire (= 4.9.1)
     - BFCommonKit/BFCategorys
     - BFCommonKit/BFConfig
@@ -16,13 +15,13 @@ PODS:
     - FDFullscreenPopGesture (= 1.1)
     - RealmSwift (= 10.7.6)
     - SnapKit (= 5.0.1)
-  - BFCommonKit/BFCategorys (1.1.1):
+  - BFCommonKit/BFCategorys (1.1.3):
     - KingfisherWebP (= 1.3.0)
-  - BFCommonKit/BFConfig (1.1.1)
-  - BFCommonKit/BFDebug (1.1.1):
+  - BFCommonKit/BFConfig (1.1.3)
+  - BFCommonKit/BFDebug (1.1.3):
     - BFCommonKit/BFCategorys
-  - BFCommonKit/BFEnums (1.1.1)
-  - BFCommonKit/BFUtility (1.1.1):
+  - BFCommonKit/BFEnums (1.1.3)
+  - BFCommonKit/BFUtility (1.1.3):
     - Alamofire (= 4.9.1)
     - BFCommonKit/BFCategorys
     - BFCommonKit/BFConfig
@@ -30,7 +29,6 @@ PODS:
     - Kingfisher (= 6.3.0)
     - KingfisherWebP (= 1.3.0)
     - Toast-Swift (= 5.0.1)
-  - BFCommonKit/Resources (1.1.1)
   - FDFullscreenPopGesture (1.1)
   - KeychainAccess (4.2.2)
   - Kingfisher (6.3.0)
@@ -76,7 +74,7 @@ EXTERNAL SOURCES:
 
 SPEC CHECKSUMS:
   Alamofire: 85e8a02c69d6020a0d734f6054870d7ecb75cf18
-  BFCommonKit: b58e30bb0cefb7925fd35c949009b467582067e5
+  BFCommonKit: 8076582aa47b2a02f40cdeff90f45f83fad8ab10
   FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
   KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
   Kingfisher: 6c3df386db71d82c0817a429d2c9421a77396529

Fichier diff supprimé car celui-ci est trop grand
+ 697 - 696
Example/Pods/Pods.xcodeproj/project.pbxproj


+ 1 - 1
Example/Pods/Target Support Files/BFCommonKit/BFCommonKit-Info.plist

@@ -15,7 +15,7 @@
   <key>CFBundlePackageType</key>
   <string>FMWK</string>
   <key>CFBundleShortVersionString</key>
-  <string>1.1.1</string>
+  <string>1.1.3</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleVersion</key>

+ 1 - 1
Example/Pods/Target Support Files/BFCommonKit/ResourceBundle-BFCommonKit_Resources-BFCommonKit-Info.plist

@@ -13,7 +13,7 @@
   <key>CFBundlePackageType</key>
   <string>BNDL</string>
   <key>CFBundleShortVersionString</key>
-  <string>1.1.1</string>
+  <string>1.1.3</string>
   <key>CFBundleSignature</key>
   <string>????</string>
   <key>CFBundleVersion</key>

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff