Browse Source

feat:调整segement

kailen 2 months ago
parent
commit
6a69a7d6cc

BIN
.DS_Store


+ 1 - 0
Bridging-Header.h

@@ -3,3 +3,4 @@
 //
 
 #import "LivePhotoUtil.h"
+#import "SJIJKMediaPlaybackController.h"

+ 11 - 1
Podfile

@@ -13,10 +13,20 @@ target 'TSLiveWallpaper' do
   pod 'SnapKit'
   pod 'SVProgressHUD'
   pod 'Kingfisher', '7.10.0'
-  pod 'MJRefresh', '3.7.5'
   pod 'TYCyclePagerView'
   pod 'Google-Mobile-Ads-SDK'
   pod 'Alamofire'
+  
+  pod 'TZImagePickerController'
+  pod 'MarqueeLabel'
+  pod 'MJRefresh'
+  pod 'TSVideoKit',:path => '../tsvideo-kit'
+  pod "IJKMediaPlayerKit", :podspec => 'https://github.com/debugly/ijkplayer/releases/download/k0.11.8/IJKMediaPlayerKit.spec.json'
+  pod 'KLExtension',:git=>"https://gitee.com/WanlanNeel/klextension.git"
+  pod 'KLTips',:git=>"https://gitee.com/WanlanNeel/kltips.git"
+  pod 'Localize-Swift', '~> 3.2'
+  pod 'BetterSegmentedControl', '~> 2.0'
+
 end
 
 

+ 153 - 5
Podfile.lock

@@ -1,50 +1,198 @@
 PODS:
+  - AFNetworking (4.0.1):
+    - AFNetworking/NSURLSession (= 4.0.1)
+    - AFNetworking/Reachability (= 4.0.1)
+    - AFNetworking/Security (= 4.0.1)
+    - AFNetworking/Serialization (= 4.0.1)
+    - AFNetworking/UIKit (= 4.0.1)
+  - AFNetworking/NSURLSession (4.0.1):
+    - AFNetworking/Reachability
+    - AFNetworking/Security
+    - AFNetworking/Serialization
+  - AFNetworking/Reachability (4.0.1)
+  - AFNetworking/Security (4.0.1)
+  - AFNetworking/Serialization (4.0.1)
+  - AFNetworking/UIKit (4.0.1):
+    - AFNetworking/NSURLSession
   - Alamofire (5.10.2)
-  - Google-Mobile-Ads-SDK (11.13.0):
+  - BetterSegmentedControl (2.0.1)
+  - Google-Mobile-Ads-SDK (11.12.0):
     - GoogleUserMessagingPlatform (>= 1.1)
   - GoogleUserMessagingPlatform (2.7.0)
+  - IJKMediaPlayerKit (0.11.8)
   - Kingfisher (7.10.0)
+  - KLExtension (0.1.0)
+  - KLTips (0.1.0)
+  - Localize-Swift (3.2.0):
+    - Localize-Swift/LocalizeSwiftCore (= 3.2.0)
+    - Localize-Swift/UIKit (= 3.2.0)
+  - Localize-Swift/LocalizeSwiftCore (3.2.0)
+  - Localize-Swift/UIKit (3.2.0):
+    - Localize-Swift/LocalizeSwiftCore
+  - MarqueeLabel (4.5.0)
+  - Masonry (1.1.0)
   - MJRefresh (3.7.5)
   - ObjectMapper (4.2.0)
+  - SJBaseVideoPlayer (3.7.7.1):
+    - Masonry
+    - SJBaseVideoPlayer/AVPlayer (= 3.7.7.1)
+    - SJBaseVideoPlayer/Common (= 3.7.7.1)
+    - SJUIKit/AttributesFactory (>= 0.0.0.38)
+    - SJUIKit/ObserverHelper
+    - SJUIKit/Queues
+    - SJUIKit/SQLite3
+  - SJBaseVideoPlayer/AVPlayer (3.7.7.1):
+    - Masonry
+    - SJBaseVideoPlayer/Common
+    - SJUIKit/AttributesFactory (>= 0.0.0.38)
+    - SJUIKit/ObserverHelper
+    - SJUIKit/Queues
+    - SJUIKit/SQLite3
+  - SJBaseVideoPlayer/Common (3.7.7.1):
+    - Masonry
+    - SJBaseVideoPlayer/ResourceLoader
+    - SJUIKit/AttributesFactory (>= 0.0.0.38)
+    - SJUIKit/ObserverHelper
+    - SJUIKit/Queues
+    - SJUIKit/SQLite3
+  - SJBaseVideoPlayer/ResourceLoader (3.7.7.1):
+    - Masonry
+    - SJUIKit/AttributesFactory (>= 0.0.0.38)
+    - SJUIKit/ObserverHelper
+    - SJUIKit/Queues
+    - SJUIKit/SQLite3
+  - SJUIKit/AttributesFactory (0.0.0.59):
+    - SJUIKit/AttributesFactory/Deprecated (= 0.0.0.59)
+    - SJUIKit/AttributesFactory/UIKitText (= 0.0.0.59)
+  - SJUIKit/AttributesFactory/Deprecated (0.0.0.59)
+  - SJUIKit/AttributesFactory/UIKitText (0.0.0.59)
+  - SJUIKit/ObserverHelper (0.0.0.59)
+  - SJUIKit/Queues (0.0.0.59)
+  - SJUIKit/SQLite3 (0.0.0.59):
+    - SJUIKit/SQLite3/Core (= 0.0.0.59)
+    - SJUIKit/SQLite3/Protocol (= 0.0.0.59)
+    - YYModel
+  - SJUIKit/SQLite3/Core (0.0.0.59):
+    - SJUIKit/SQLite3/Protocol
+    - YYModel
+  - SJUIKit/SQLite3/Protocol (0.0.0.59):
+    - YYModel
+  - SJVideoPlayer (3.4.3):
+    - SJBaseVideoPlayer (>= 3.7.5)
+    - SJVideoPlayer/Common (= 3.4.3)
+    - SJVideoPlayer/ControlLayers (= 3.4.3)
+    - SJVideoPlayer/ResourceLoader (= 3.4.3)
+  - SJVideoPlayer/Common (3.4.3):
+    - Masonry
+    - SJBaseVideoPlayer (>= 3.7.5)
+    - SJUIKit/AttributesFactory
+    - SJVideoPlayer/ResourceLoader
+  - SJVideoPlayer/ControlLayers (3.4.3):
+    - SJBaseVideoPlayer (>= 3.7.5)
+    - SJVideoPlayer/Common
+  - SJVideoPlayer/ResourceLoader (3.4.3):
+    - SJBaseVideoPlayer (>= 3.7.5)
   - SnapKit (5.7.1)
   - SVProgressHUD (2.3.1):
     - SVProgressHUD/Core (= 2.3.1)
   - SVProgressHUD/Core (2.3.1)
+  - TSVideoKit (0.1.0):
+    - AFNetworking
+    - Alamofire
+    - Kingfisher
+    - SJVideoPlayer
+    - SnapKit
   - TYCyclePagerView (1.2.0)
+  - TZImagePickerController (3.8.8):
+    - TZImagePickerController/Basic (= 3.8.8)
+    - TZImagePickerController/Location (= 3.8.8)
+  - TZImagePickerController/Basic (3.8.8)
+  - TZImagePickerController/Location (3.8.8)
+  - YYModel (1.0.4)
 
 DEPENDENCIES:
   - Alamofire
+  - BetterSegmentedControl (~> 2.0)
   - Google-Mobile-Ads-SDK
+  - IJKMediaPlayerKit (from `https://github.com/debugly/ijkplayer/releases/download/k0.11.8/IJKMediaPlayerKit.spec.json`)
   - Kingfisher (= 7.10.0)
-  - MJRefresh (= 3.7.5)
+  - KLExtension (from `https://gitee.com/WanlanNeel/klextension.git`)
+  - KLTips (from `https://gitee.com/WanlanNeel/kltips.git`)
+  - Localize-Swift (~> 3.2)
+  - MarqueeLabel
+  - MJRefresh
   - ObjectMapper (= 4.2)
   - SnapKit
   - SVProgressHUD
+  - TSVideoKit (from `../tsvideo-kit`)
   - TYCyclePagerView
+  - TZImagePickerController
 
 SPEC REPOS:
   trunk:
+    - AFNetworking
     - Alamofire
+    - BetterSegmentedControl
     - Google-Mobile-Ads-SDK
     - GoogleUserMessagingPlatform
     - Kingfisher
+    - Localize-Swift
+    - MarqueeLabel
+    - Masonry
     - MJRefresh
     - ObjectMapper
+    - SJBaseVideoPlayer
+    - SJUIKit
+    - SJVideoPlayer
     - SnapKit
     - SVProgressHUD
     - TYCyclePagerView
+    - TZImagePickerController
+    - YYModel
+
+EXTERNAL SOURCES:
+  IJKMediaPlayerKit:
+    :podspec: https://github.com/debugly/ijkplayer/releases/download/k0.11.8/IJKMediaPlayerKit.spec.json
+  KLExtension:
+    :git: https://gitee.com/WanlanNeel/klextension.git
+  KLTips:
+    :git: https://gitee.com/WanlanNeel/kltips.git
+  TSVideoKit:
+    :path: "../tsvideo-kit"
+
+CHECKOUT OPTIONS:
+  KLExtension:
+    :commit: 227fcc71c8057c68631a9614265bd584c48ada34
+    :git: https://gitee.com/WanlanNeel/klextension.git
+  KLTips:
+    :commit: dc38e277b3d62f753ce6c73ec62c0f8ae29c1b36
+    :git: https://gitee.com/WanlanNeel/kltips.git
 
 SPEC CHECKSUMS:
+  AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58
   Alamofire: 7193b3b92c74a07f85569e1a6c4f4237291e7496
-  Google-Mobile-Ads-SDK: 14f57f2dc33532a24db288897e26494640810407
+  BetterSegmentedControl: 09607b27861d49cbce48b7673b74f9150a3d371a
+  Google-Mobile-Ads-SDK: 3a76704456669fbed2057efc8bdb99050ad0e3fb
   GoogleUserMessagingPlatform: a8b56893477f67212fbc8411c139e61d463349f5
+  IJKMediaPlayerKit: 3444702ec61bc649e7e81a9c0e19fda661bef1ce
   Kingfisher: a18f05d3b6d37d8650ee4a3e61d57a28fc6207f6
+  KLExtension: f8b2a92125ad4bbfc8920ed5e7269aefcdcaa0b3
+  KLTips: 5cf05efac78b9c813887460bebbf436582b20536
+  Localize-Swift: 6f4475136bdb0d7b2882ea3d4ea919d70142b232
+  MarqueeLabel: 4b46d196abd253448e830cbd976f9eacc3af0849
+  Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
   MJRefresh: fdf5e979eb406a0341468932d1dfc8b7f9fce961
   ObjectMapper: 1eb41f610210777375fa806bf161dc39fb832b81
+  SJBaseVideoPlayer: b3122de12225b27b71bd9a8a1f08f4dcf2f4e5ec
+  SJUIKit: a40111941e408cc17d4c1c23495aa92999e814b0
+  SJVideoPlayer: 4f09814f58522e0975cb2dccfda925f6c8643467
   SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
   SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
+  TSVideoKit: 16761d4bf8bb9e8af192459ae9eb01a213fc1531
   TYCyclePagerView: 2b051dade0615c70784aa34f40c646feeddb7344
+  TZImagePickerController: d084a7b97c82d387e7669dd86dc9a9057500aacf
+  YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
 
-PODFILE CHECKSUM: a73b9e35e8b283dec212694bae240b3aed332a59
+PODFILE CHECKSUM: 14a6abcd165658c5b5fb2dfe2df75f98fe20b0e0
 
-COCOAPODS: 1.16.2
+COCOAPODS: 1.15.2

+ 23 - 0
TSLiveWallpaper/Assets.xcassets/Music/ic_segment_bg.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "filename" : "ic_segment_bg@1x.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "ic_segment_bg@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "ic_segment_bg@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
TSLiveWallpaper/Assets.xcassets/Music/ic_segment_bg.imageset/ic_segment_bg@1x.png


BIN
TSLiveWallpaper/Assets.xcassets/Music/ic_segment_bg.imageset/ic_segment_bg@2x.png


BIN
TSLiveWallpaper/Assets.xcassets/Music/ic_segment_bg.imageset/ic_segment_bg@3x.png


+ 13 - 6
TSLiveWallpaper/Business/TSMusic/List/Controller/CustomSegementItem.swift

@@ -7,7 +7,7 @@
 
 import BetterSegmentedControl
 import Foundation
-LabelSegment
+
 class CustomSegementItem: BetterSegmentedControlSegment {
     // MARK: Constants
 
@@ -66,7 +66,7 @@ class CustomSegementItem: BetterSegmentedControlSegment {
                     backgroundColor: normalBackgroundColor,
                     font: normalFont,
                     textColor: normalTextColor,
-                    accessibilityIdentifier: accessibilityIdentifier)
+                    accessibilityIdentifier: accessibilityIdentifier, isSelected: false)
     }()
 
     public lazy var selectedView: UIView = {
@@ -74,23 +74,30 @@ class CustomSegementItem: BetterSegmentedControlSegment {
                     backgroundColor: selectedBackgroundColor,
                     font: selectedFont,
                     textColor: selectedTextColor,
-                    accessibilityIdentifier: accessibilityIdentifier)
+                    accessibilityIdentifier: accessibilityIdentifier, isSelected: true)
     }()
 
     open func createLabel(withText text: String?,
                           backgroundColor: UIColor,
                           font: UIFont,
                           textColor: UIColor,
-                          accessibilityIdentifier: String?) -> UILabel {
+                          accessibilityIdentifier: String?,
+                          isSelected: Bool) -> UIView {
+        let bgView: UIImageView = .simpleImage(imageName: "ic_segment_bg")
+        bgView.image = isSelected ?  UIImage(named: "ic_segment_bg") : nil
         let label = UILabel()
         label.text = text
         label.numberOfLines = numberOfLines
-        label.backgroundColor = backgroundColor
+        label.backgroundColor = .clear
         label.font = font
         label.textColor = textColor
         label.lineBreakMode = .byTruncatingTail
         label.textAlignment = .center
         label.accessibilityIdentifier = accessibilityIdentifier
-        return label
+        bgView.addSubview(label)
+        label.snp.makeConstraints { make in
+            make.edges.equalToSuperview()
+        }
+        return bgView
     }
 }

+ 1 - 2
TSLiveWallpaper/Business/TSMusic/List/Controller/SongListViewController+Target.swift

@@ -50,13 +50,12 @@ extension SongListViewController {
 
     @objc func showImportMenuView() {
         let menuView = BubbleMenuView()
-        menuView.position = FitManager.isAr ? .topRight : .topLeft
+        menuView.position = FitManager.isAr ? .topLeft : .topRight
         menuView.actionHanlder = { type in
             self.menuClick(type: type)
         }
         view.addSubview(menuView)
         menuView.snp.makeConstraints { make in
-            make.leading.equalTo(self.importButton).offset(-16)
             make.trailing.equalToSuperview().offset(-16)
             make.top.equalTo(self.importButton.snp.bottom).offset(0)
         }

+ 21 - 12
TSLiveWallpaper/Business/TSMusic/List/Controller/SongListViewController.swift

@@ -66,17 +66,25 @@ class SongListViewController: LWBGViewController {
     }()
 
     lazy var pageControl: BetterSegmentedControl = {
-        let tracks = IconSegment(icon: <#T##UIImage#>, iconSize: <#T##CGSize#>, normalIconTintColor: <#T##UIColor#>, selectedIconTintColor: <#T##UIColor#>)
-        let catalog = LabelSegment(text: "Catalog",
-                                   normalBackgroundColor: .clear,
-                                   normalFont: .systemFont14,
-                                   normalTextColor: .hexColor("#111111").withAlphaComponent(0.4),
-                                   selectedBackgroundColor: .hexColor("#111111"),
-                                   selectedFont: .systemFont14,
-                                   selectedTextColor: .white)
-        let page = BetterSegmentedControl(frame: CGRect(x: 0, y: 0, width: 300, height: 30), segments: [discover, catalog])
+        let tracks = CustomSegementItem(text: "Tracks",
+                                        normalBackgroundColor: .clear,
+                                        normalFont: .systemFont14,
+                                        normalTextColor: .white,
+                                        selectedBackgroundColor: .hexColor("#111111"),
+                                        selectedFont: .systemFont14,
+                                        selectedTextColor: .black)
+        let catalog = CustomSegementItem(text: "Catalog",
+                                         normalBackgroundColor: .clear,
+                                         normalFont: .systemFont14,
+                                         normalTextColor: .white,
+                                         selectedBackgroundColor: .hexColor("#111111"),
+                                         selectedFont: .systemFont14,
+                                         selectedTextColor: .black)
+        let page = BetterSegmentedControl(frame: CGRect(x: 0, y: 0, width: 200, height: 30), segments: [tracks, catalog])
         page.animationDuration = 0
-        page.backgroundColor = .white
+        page.indicatorViewBackgroundColor = .clear
+        page.backgroundColor = .white.withAlphaComponent(0.1)
+        page.layer.cornerRadius = 6
         return page
     }()
 
@@ -202,9 +210,10 @@ class SongListViewController: LWBGViewController {
         }
 
         pageControl.snp.makeConstraints { make in
-            make.horizontalEdges.equalToSuperview().inset(16)
+            make.width.equalTo(260)
+            make.centerX.equalToSuperview()
             make.top.equalTo(searchBar.snp.bottom).offset(20)
-            make.height.equalTo(44)
+            make.height.equalTo(32)
         }
 
         listView.snp.makeConstraints { make in

+ 5 - 5
TSLiveWallpaper/Business/TSMusic/Search/Controller/LocalSearchViewController.swift

@@ -14,7 +14,7 @@ class LocalSearchViewController: LWBGViewController {
 
     lazy var backButton: UIButton = {
         let btn = UIButton()
-        btn.setImage(UIImage(named: "ic_back"), for: .normal)
+        btn.setImage(UIImage(named: "navi_back_white"), for: .normal)
         btn.addTarget(self, action: #selector(popupCurrentVc), for: .touchUpInside)
         return btn
     }()
@@ -22,12 +22,12 @@ class LocalSearchViewController: LWBGViewController {
     lazy var searchBar: CWSearchTextBar = {
         let bar = CWSearchTextBar()
         bar.textFiled.delegate = self
-        bar.backgroundColor = .white
-        bar.textFiled.textColor = .black
+        bar.backgroundColor = .white.withAlphaComponent(0.1)
+        bar.textFiled.textColor = .white
         bar.textFiled.attributedPlaceholder = NSAttributedString(string: "Search Music".localized(), attributes: [
-            .foregroundColor: UIColor.hexColor("#A8ACAF"),
+            .foregroundColor: UIColor.hexColor("#FFFFFF").withAlphaComponent(0.4),
             .font: UIFont.systemFont(ofSize: 14)])
-        bar.customCornerRadius = 20
+        bar.customCornerRadius = 8
         return bar
     }()
 

+ 5 - 5
TSLiveWallpaper/Business/TSMusic/Search/Controller/SearchOnlineViewController.swift

@@ -17,18 +17,18 @@ class SearchOnlineViewController: LWBGViewController {
     lazy var searchBar: CWSearchTextBar = {
         let bar = CWSearchTextBar()
         bar.textFiled.delegate = self
-        bar.backgroundColor = .white
-        bar.textFiled.textColor = .black
+        bar.backgroundColor = .white.withAlphaComponent(0.1)
+        bar.textFiled.textColor = .white
         bar.textFiled.attributedPlaceholder = NSAttributedString(string: "Search Music".localized(), attributes: [
-            .foregroundColor: UIColor.hexColor("#A8ACAF"),
+            .foregroundColor: UIColor.hexColor("#FFFFFF").withAlphaComponent(0.4),
             .font: UIFont.systemFont(ofSize: 14)])
-        bar.customCornerRadius = 20
+        bar.customCornerRadius = 8
         return bar
     }()
 
     lazy var backButton: UIButton = {
         let btn = UIButton()
-        btn.setImage(UIImage(named: "ic_back"), for: .normal)
+        btn.setImage(UIImage(named: "navi_back_white"), for: .normal)
         btn.addTarget(self, action: #selector(popupCurrentVc), for: .touchUpInside)
         return btn
     }()

+ 2 - 6
TSLiveWallpaper/Business/TSMusic/Search/Views/CWSearchTextBar.swift

@@ -20,7 +20,7 @@ class CWSearchTextBar: UIView {
     lazy var textFiled: CustomTextField = {
         let text = CustomTextField()
         text.textAlignment = FitManager.isAr ? .right : .left
-        text.tintColor = .black
+        text.tintColor = .white
         text.textColor = .white
         text.clearButtonMode = .always
         return text
@@ -41,7 +41,7 @@ class CWSearchTextBar: UIView {
         searchView.snp.makeConstraints { make in
             make.edges.equalToSuperview()
         }
-        
+
         textFiled.snp.makeConstraints { make in
             make.leading.equalToSuperview().offset(12)
             make.trailing.equalToSuperview()
@@ -53,7 +53,3 @@ class CWSearchTextBar: UIView {
         fatalError("init(coder:) has not been implemented")
     }
 }
-
-
-
-