diff --git a/IndieMusic/IndieMusic.xcodeproj/project.pbxproj b/IndieMusic/IndieMusic.xcodeproj/project.pbxproj index a359aa5..7da626b 100644 --- a/IndieMusic/IndieMusic.xcodeproj/project.pbxproj +++ b/IndieMusic/IndieMusic.xcodeproj/project.pbxproj @@ -11,6 +11,9 @@ 49330FC1492387B5155757F6 /* Pods_IndieMusic_IndieMusicUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA03C869C12FEE5FB3D835C2 /* Pods_IndieMusic_IndieMusicUITests.framework */; }; 7743999E2AFA18C3006F8EEA /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7743999D2AFA18C3006F8EEA /* PlayerViewController.swift */; }; 774399A02AFA1968006F8EEA /* PlayerTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7743999F2AFA1968006F8EEA /* PlayerTabBar.swift */; }; + 774399A62AFE036A006F8EEA /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 774399A52AFE036A006F8EEA /* PlayerView.swift */; }; + 774399A82AFE28BA006F8EEA /* BlurEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 774399A72AFE28BA006F8EEA /* BlurEffectView.swift */; }; + 774399AA2AFE3170006F8EEA /* PaddingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 774399A92AFE3170006F8EEA /* PaddingLabel.swift */; }; 778B8A212AF8E36D0034AFD4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778B8A202AF8E36D0034AFD4 /* AppDelegate.swift */; }; 778B8A232AF8E36D0034AFD4 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778B8A222AF8E36D0034AFD4 /* SceneDelegate.swift */; }; 778B8A282AF8E36D0034AFD4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 778B8A262AF8E36D0034AFD4 /* Main.storyboard */; }; @@ -95,6 +98,9 @@ 69F724137B8F9C1F7E51080D /* Pods-IndieMusicTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IndieMusicTests.release.xcconfig"; path = "Target Support Files/Pods-IndieMusicTests/Pods-IndieMusicTests.release.xcconfig"; sourceTree = ""; }; 7743999D2AFA18C3006F8EEA /* PlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerViewController.swift; sourceTree = ""; }; 7743999F2AFA1968006F8EEA /* PlayerTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerTabBar.swift; sourceTree = ""; }; + 774399A52AFE036A006F8EEA /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; + 774399A72AFE28BA006F8EEA /* BlurEffectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurEffectView.swift; sourceTree = ""; }; + 774399A92AFE3170006F8EEA /* PaddingLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaddingLabel.swift; sourceTree = ""; }; 778B8A1D2AF8E36D0034AFD4 /* IndieMusic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IndieMusic.app; sourceTree = BUILT_PRODUCTS_DIR; }; 778B8A202AF8E36D0034AFD4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 778B8A222AF8E36D0034AFD4 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -194,6 +200,7 @@ children = ( 7743999D2AFA18C3006F8EEA /* PlayerViewController.swift */, 7743999F2AFA1968006F8EEA /* PlayerTabBar.swift */, + 774399A52AFE036A006F8EEA /* PlayerView.swift */, ); path = Player; sourceTree = ""; @@ -286,6 +293,8 @@ 778B8AB72AF8ED280034AFD4 /* ViewController.swift */, 778B8AB52AF8ED280034AFD4 /* ViewModel.swift */, 778B8AB22AF8ED270034AFD4 /* WebViewController.swift */, + 774399A72AFE28BA006F8EEA /* BlurEffectView.swift */, + 774399A92AFE3170006F8EEA /* PaddingLabel.swift */, ); path = Common; sourceTree = ""; @@ -714,6 +723,7 @@ buildActionMask = 2147483647; files = ( 778B8A5D2AF8EC610034AFD4 /* Application.swift in Sources */, + 774399A62AFE036A006F8EEA /* PlayerView.swift in Sources */, 778B8A5F2AF8ECAB0034AFD4 /* Navigator.swift in Sources */, 778B8AA82AF8ED0E0034AFD4 /* Color.swift in Sources */, 778B8AAE2AF8ED0E0034AFD4 /* TextView.swift in Sources */, @@ -726,12 +736,14 @@ 778B8A9D2AF8ECFC0034AFD4 /* LibsManager.swift in Sources */, 778B8A832AF8ECE50034AFD4 /* HomeViewController.swift in Sources */, 778B8ABE2AF8ED280034AFD4 /* ViewModel.swift in Sources */, + 774399A82AFE28BA006F8EEA /* BlurEffectView.swift in Sources */, 778B8A852AF8ECE50034AFD4 /* SearchViewController.swift in Sources */, 778B8AAB2AF8ED0E0034AFD4 /* UIView+Borders.swift in Sources */, 778B8AC12AF8ED280034AFD4 /* TableView.swift in Sources */, 778B8A9C2AF8ECFC0034AFD4 /* LogManager.swift in Sources */, 778B8A992AF8ECFC0034AFD4 /* Reachability.swift in Sources */, 778B8ABF2AF8ED280034AFD4 /* NavigationController.swift in Sources */, + 774399AA2AFE3170006F8EEA /* PaddingLabel.swift in Sources */, 778B8A822AF8ECE50034AFD4 /* HomeViewModel.swift in Sources */, 778B8AAD2AF8ED0E0034AFD4 /* RxMJRefresh.swift in Sources */, 778B8A922AF8ECF20034AFD4 /* AudioTrack.swift in Sources */, diff --git a/IndieMusic/IndieMusic/Common/BlurEffectView.swift b/IndieMusic/IndieMusic/Common/BlurEffectView.swift new file mode 100644 index 0000000..920df85 --- /dev/null +++ b/IndieMusic/IndieMusic/Common/BlurEffectView.swift @@ -0,0 +1,53 @@ +// +// BlurEffectView.swift +// IndieMusic +// +// Created by WenLei on 2023/11/10. +// + +import UIKit + +class BlurEffectView: UIView { + + var blurView: UIVisualEffectView = { + let blurEffect = UIBlurEffect(style: .systemThickMaterialDark) + let blurView = UIVisualEffectView(effect: blurEffect) + + return blurView + }() + + var imageView: UIImageView = { + let imageView = UIImageView.init(image: UIImage.init(named: "cover")) + + return imageView + }() + + override init(frame: CGRect) { + super.init(frame: frame) + + makeUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func makeUI() { + addSubview(imageView) + addSubview(blurView) + + } + + override func layoutSubviews() { + super.layoutSubviews() + + imageView.snp.makeConstraints { make in + make.edges.equalTo(self) + } + + blurView.snp.makeConstraints { make in + make.edges.equalTo(self) + } + } + +} diff --git a/IndieMusic/IndieMusic/Common/PaddingLabel.swift b/IndieMusic/IndieMusic/Common/PaddingLabel.swift new file mode 100644 index 0000000..09bf743 --- /dev/null +++ b/IndieMusic/IndieMusic/Common/PaddingLabel.swift @@ -0,0 +1,54 @@ +// +// PaddingLabel.swift +// IndieMusic +// +// Created by WenLei on 2023/11/10. +// + +import UIKit + +class PaddingLabel: UILabel { +// var textInsets = UIEdgeInsets.init(top: 10, left: 10, bottom: 10, right: 0) { +// didSet { setNeedsDisplay() } +// } +// +// override func drawText(in rect: CGRect) { +// super.drawText(in: rect.inset(by: textInsets)) +// } + + var circularFillet = true + + var padding = UIEdgeInsets(top: 8, left: 10, bottom: 8, right: 10) + override func drawText(in rect: CGRect) { + super.drawText(in: rect.inset(by: padding)) + } + + + init(padding: UIEdgeInsets = UIEdgeInsets(top: 5, left: 10, bottom: 5, right: 10), frame: CGRect = CGRect.zero) { + self.padding = padding + super.init(frame: frame) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override var intrinsicContentSize : CGSize { + let superContentSize = super.intrinsicContentSize + let width = superContentSize.width + padding.left + padding.right + let heigth = superContentSize.height + padding.top + padding.bottom + return CGSize(width: width, height: heigth) + } + + override func layoutSubviews() { + super.layoutSubviews() + if circularFillet == true { + let h = self.frame.size.height + self.layer.cornerRadius = h / 2 + self.layer.masksToBounds = true + } + + + } + +} diff --git a/IndieMusic/IndieMusic/Extensions/UIColor+IndieMusic.swift b/IndieMusic/IndieMusic/Extensions/UIColor+IndieMusic.swift index adcb7eb..5ee3020 100644 --- a/IndieMusic/IndieMusic/Extensions/UIColor+IndieMusic.swift +++ b/IndieMusic/IndieMusic/Extensions/UIColor+IndieMusic.swift @@ -11,22 +11,25 @@ import UIKit extension UIColor { + /// 功能色 static func primary() -> UIColor { return themeService.type.associatedObject.primary } - + /// 主文本色 static func primaryText() -> UIColor { return themeService.type.associatedObject.primaryText } - + /// 副文本色 static func secondaryText() -> UIColor { return themeService.type.associatedObject.secondaryText } - + + /// 次级文本色 static func tertiaryText() -> UIColor { return themeService.type.associatedObject.tertiaryText } + /// 分割线色 static func separator() -> UIColor { return themeService.type.associatedObject.separator } diff --git a/IndieMusic/IndieMusic/Managers/ThemeManager.swift b/IndieMusic/IndieMusic/Managers/ThemeManager.swift index c9738ea..57eca5b 100644 --- a/IndieMusic/IndieMusic/Managers/ThemeManager.swift +++ b/IndieMusic/IndieMusic/Managers/ThemeManager.swift @@ -16,9 +16,13 @@ let globalStatusBarStyle = BehaviorRelay(value: .default) let themeService = ThemeType.service(initial: ThemeType.currentTheme()) protocol Theme { + // 功能色 var primary: UIColor { get } + // 主文本色 var primaryText: UIColor { get } + // 副文本色 var secondaryText: UIColor { get } + // 次级文本色 var tertiaryText: UIColor { get } var separator: UIColor { get } @@ -32,10 +36,14 @@ protocol Theme { } struct LightTheme: Theme { + // 功能色 let primary = UIColor.init(hex: 0xB44343) + // 主文本色 let primaryText = UIColor.init(hex: 0x000000, alpha: 0.9) - let secondaryText = UIColor.init(hex: 0xB44343, alpha: 0.6) - let tertiaryText = UIColor.init(hex: 0xB44343, alpha: 0.4) + // 副文本色 + let secondaryText = UIColor.init(hex: 0x000000, alpha: 0.6) + // 次级文本色 + let tertiaryText = UIColor.init(hex: 0x000000, alpha: 0.4) let separator = UIColor.init(hex: 0x000000, alpha: 0.1) @@ -54,8 +62,8 @@ struct DarkTheme: Theme { let primary = UIColor.init(hex: 0xB44343) let primaryText = UIColor.init(hex: 0x000000, alpha: 0.9) - let secondaryText = UIColor.init(hex: 0xB44343, alpha: 0.6) - let tertiaryText = UIColor.init(hex: 0xB44343, alpha: 0.4) + let secondaryText = UIColor.init(hex: 0x000000, alpha: 0.6) + let tertiaryText = UIColor.init(hex: 0x000000, alpha: 0.4) let separator = UIColor.init(hex: 0x000000, alpha: 0.1) diff --git a/IndieMusic/IndieMusic/Modules/Home/HomeViewController.swift b/IndieMusic/IndieMusic/Modules/Home/HomeViewController.swift index e01eec3..f5d4324 100644 --- a/IndieMusic/IndieMusic/Modules/Home/HomeViewController.swift +++ b/IndieMusic/IndieMusic/Modules/Home/HomeViewController.swift @@ -8,40 +8,19 @@ import UIKit class HomeViewController: ViewController { - - var button: UIButton = { - let button = UIButton.init() - button.setTitle("button 1", for: .normal) - button.backgroundColor = .red - button.addTarget(self, action: #selector(buttonClick), for: .touchUpInside) - return button - }() - - var button2: UIButton = { - let button = UIButton.init() - button.setTitle("button 2", for: .normal) - button.backgroundColor = .blue - - button.addTarget(self, action: #selector(buttonClick2), for: .touchUpInside) - return button - }() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. - self.navigationTitle = "123" } override func makeUI() { super.makeUI() - - view.backgroundColor = .white - - view.addSubview(button) - view.addSubview(button2) + view.backgroundColor = .white + } @@ -54,47 +33,14 @@ class HomeViewController: ViewController { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - button.snp.makeConstraints { make in - make.centerX.equalTo(view) - make.centerY.equalTo(view).offset(-100) - make.size.equalTo(CGSize.init(width: 100, height: 100)) - } - - button2.snp.makeConstraints { make in - make.centerX.equalTo(view) - make.centerY.equalTo(view).offset(100) - make.size.equalTo(CGSize.init(width: 100, height: 100)) - } - } - - @objc func buttonClick() { -// guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return } -// -// -// if let tabbar = UIApplication.shared.windows.first?.rootViewController as? IndieMusicViewController { -// tabbar.showTabBar(!tabbar.isTabBarShowing, animated: true) -// } -// - if let tabbar = self.tabBarController as? HomeTabBarController { - tabbar.showTabBar(!tabbar.isTabBarShowing, animated: true) - } - - } - - - @objc func buttonClick2() { - if let tabbar = self.tabBarController as? HomeTabBarController { - tabbar.showPlayerBar(!tabbar.isPlayerBarShowing, animated: true) - } + } override func touchesBegan(_ touches: Set, with event: UIEvent?) { - hidesBottomBarWhenPushed = false - - let vc = PlayerViewController.init(viewModel: viewModel, navigator: navigator) - vc.view.backgroundColor = .white - self.navigationController?.pushViewController(vc, animated: true) + let play = PlayerViewController.init(viewModel: viewModel, navigator: navigator) + play.modalPresentationStyle = .custom + self.present(play, animated: true) -// self.present(vc, animated: true) } + } diff --git a/IndieMusic/IndieMusic/Modules/Player/PlayerView.swift b/IndieMusic/IndieMusic/Modules/Player/PlayerView.swift new file mode 100644 index 0000000..7a480b4 --- /dev/null +++ b/IndieMusic/IndieMusic/Modules/Player/PlayerView.swift @@ -0,0 +1,423 @@ +// +// PlayerView.swift +// IndieMusic +// +// Created by WenLei on 2023/11/10. +// + +import UIKit + +class PlayerViewTopBar: UIView { + lazy var dropButton: UIButton = { + let dropButton = UIButton.init() + dropButton.setImage(UIImage.init(named: "play_drop_btn"), for: .normal) + + return dropButton + }() + + lazy var segementView: UIView = { + let segementView = UIView.init() + + return segementView + }() + + lazy var moreButton: UIButton = { + let moreButton = UIButton.init() + moreButton.setImage(UIImage.init(named: "play_more_btn"), for: .normal) + + return moreButton + }() + + + override init(frame: CGRect) { + super.init(frame: frame) + + makeUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func makeUI() { + addSubview(dropButton) + addSubview(segementView) + addSubview(moreButton) + } + + override func layoutSubviews() { + super.layoutSubviews() + + + dropButton.snp.makeConstraints { make in + make.left.equalTo(self).offset(18) + make.centerY.equalTo(self) + } + + + moreButton.snp.makeConstraints { make in + make.right.equalTo(self).offset(-18) + make.centerY.equalTo(self) + } + + segementView.snp.makeConstraints { make in + make.left.equalTo(dropButton.snp.right).offset(10) + make.right.equalTo(moreButton.snp.left).offset(-10) + make.top.equalTo(self) + make.bottom.equalTo(self) + + } + + } + +} + + +class PlayerControlView: UIView { + var playModesButton: UIButton = { + let playModesButton = UIButton.init() + playModesButton.setImage(UIImage.init(named: "play_single_modes_btn"), for: .normal) + + return playModesButton + }() + + + var lastButton: UIButton = { + let lastButton = UIButton.init() + lastButton.setImage(UIImage.init(named: "play_last_btn"), for: .normal) + + return lastButton + }() + + var playButton: UIButton = { + let playButton = UIButton.init() + playButton.setImage(UIImage.init(named: "play_pause_btn"), for: .normal) + + return playButton + }() + + var nextButton: UIButton = { + let nextButton = UIButton.init() + nextButton.setImage(UIImage.init(named: "play_next_btn"), for: .normal) + + return nextButton + }() + + var listButton: UIButton = { + let listButton = UIButton.init() + listButton.setImage(UIImage.init(named: "play_list_btn"), for: .normal) + + return listButton + }() + + + override init(frame: CGRect) { + super.init(frame: frame) + + + makeUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func makeUI() { + addSubview(playModesButton) + addSubview(lastButton) + addSubview(playButton) + addSubview(nextButton) + addSubview(listButton) + } + + + override func layoutSubviews() { + super.layoutSubviews() + + + playButton.snp.makeConstraints { make in + make.centerX.equalTo(self) + make.centerY.equalTo(self) + } + + lastButton.snp.makeConstraints { make in + make.right.equalTo(playButton.snp.left).offset(-40) + make.centerY.equalTo(self) + } + + playModesButton.snp.makeConstraints { make in + make.right.equalTo(lastButton.snp.left).offset(-40) + make.centerY.equalTo(self) + } + + nextButton.snp.makeConstraints { make in + make.left.equalTo(playButton.snp.right).offset(40) + make.centerY.equalTo(self) + } + + listButton.snp.makeConstraints { make in + make.left.equalTo(nextButton.snp.right).offset(40) + make.centerY.equalTo(self) + } + + } + +} + + + +class PlayerScrollView: UIScrollView { + var containerView: UIView = { + let containerView = UIView.init() + + return containerView + }() + + + var playerInfoView: PlayerInfoView = { + let playerInfoView = PlayerInfoView.init() + + return playerInfoView + }() + + var lyricsView: UIView = { + let lyricsView = UIView.init() + + return lyricsView + }() + + + override init(frame: CGRect) { + super.init(frame: frame) + + makeUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func makeUI() { + addSubview(containerView) + + containerView.addSubview(playerInfoView) + containerView.addSubview(lyricsView) + } + + override func layoutSubviews() { + super.layoutSubviews() + + containerView.snp.makeConstraints { make in + make.edges.equalTo(self) + make.height.equalToSuperview() + make.width.greaterThanOrEqualToSuperview() + } + + playerInfoView.snp.makeConstraints { make in + make.left.equalTo(containerView) + make.top.equalTo(containerView) + make.bottom.equalTo(containerView) + make.width.equalTo(BaseDimensions.screenWidth) + } + + lyricsView.snp.makeConstraints { make in + make.left.equalTo(playerInfoView.snp.right) + make.top.equalTo(containerView) + make.bottom.equalTo(containerView) + make.right.equalTo(containerView) + } + + + } + + +} + + +class PlayerInfoView: UIView { + var coverView: UIImageView = { + let coverView = UIImageView.init() + coverView.layer.cornerRadius = 6 + coverView.layer.masksToBounds = true + + return coverView + }() + + var pageControl: UIPageControl = { + let pageControl = UIPageControl.init() + pageControl.numberOfPages = 2 + + return pageControl + }() + + + + var numberLabel: PaddingLabel = { + let numberLabel = PaddingLabel.init() + numberLabel.font = UIFont.systemFont(ofSize: 12) + numberLabel.textColor = .init(hex: 0xFFFFFF) + numberLabel.backgroundColor = .init(hex: 0xFFFFFF, alpha: 0.1) +// numberLabel.layer.cornerRadius = 25 + + + return numberLabel + }() + + + var titleLabel: UILabel = { + let titleLabel = UILabel.init() + titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .medium) + titleLabel.textColor = .init(hex: 0xFFFFFF, alpha: 0.9) + + return titleLabel + }() + + var artistLabel: UILabel = { + let artistLabel = UILabel.init() + artistLabel.font = UIFont.systemFont(ofSize: 12) + artistLabel.textColor = .init(hex: 0xFFFFFF, alpha: 0.6) + + return artistLabel + }() + + + var shareButton: UIButton = { + let shareButton = UIButton.init() + shareButton.setImage(UIImage.init(named: "play_share_btn"), for: .normal) + shareButton.setContentHuggingPriority(.required, for: .horizontal) + shareButton.setContentCompressionResistancePriority(.required, for: .horizontal) + return shareButton + + }() + + var likeButton: UIButton = { + let likeButton = UIButton.init() + likeButton.setImage(UIImage.init(named: "play_like_on"), for: .normal) + likeButton.setContentHuggingPriority(.required, for: .horizontal) + likeButton.setContentCompressionResistancePriority(.required, for: .horizontal) + + return likeButton + }() + + var playerSlider: UISlider = { + let playerSlider = UISlider.init() + playerSlider.tintColor = .white + + + return playerSlider + }() + + + var startTimeLabel: UILabel = { + let startTimeLabel = UILabel.init() + startTimeLabel.font = UIFont.systemFont(ofSize: 12) + startTimeLabel.textColor = .init(hex: 0xFFFFFF, alpha: 0.4) + + return startTimeLabel + }() + + var endTimeLabel: UILabel = { + let endTimeLabel = UILabel.init() + endTimeLabel.font = UIFont.systemFont(ofSize: 12) + endTimeLabel.textColor = .init(hex: 0xFFFFFF, alpha: 0.4) + + return endTimeLabel + }() + + override init(frame: CGRect) { + super.init(frame: frame) + + makeUI() + + numberLabel.text = "VOL 1092" + titleLabel.text = "fdsfds" + artistLabel.text = "1233321" + startTimeLabel.text = "00:00" + endTimeLabel.text = "00:00" + + coverView.backgroundColor = .gray + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func makeUI() { + addSubview(coverView) + addSubview(pageControl) + + addSubview(numberLabel) + addSubview(titleLabel) + addSubview(artistLabel) + addSubview(shareButton) + addSubview(likeButton) + addSubview(playerSlider) + addSubview(startTimeLabel) + addSubview(endTimeLabel) + } + + override func layoutSubviews() { + super.layoutSubviews() + + coverView.snp.makeConstraints { make in + make.top.equalTo(self).offset(10) + make.left.equalTo(self).offset(18) + make.right.equalTo(self).offset(-18) + make.height.equalTo(coverView.snp.width) + } + + pageControl.snp.makeConstraints { make in + make.centerX.equalTo(self) + make.top.equalTo(coverView.snp.bottom).offset(10) + } + + + numberLabel.snp.makeConstraints { make in + make.left.equalTo(self).offset(18) + make.top.equalTo(pageControl.snp.bottom).offset(18) + } + + shareButton.snp.makeConstraints { make in + make.right.equalTo(self).offset(-18) + make.top.equalTo(pageControl.snp.bottom).offset(55) + } + + likeButton.snp.makeConstraints { make in + make.right.equalTo(shareButton.snp.left).offset(-15) + make.top.equalTo(pageControl.snp.bottom).offset(55) + } + + titleLabel.snp.makeConstraints { make in + make.right.equalTo(likeButton.snp.left).offset(-10) + make.left.equalTo(self).offset(18) + make.top.equalTo(numberLabel.snp.bottom).offset(15) + } + + artistLabel.snp.makeConstraints { make in + make.left.equalTo(self).offset(18) + make.right.equalTo(likeButton.snp.left).offset(-10) + make.top.equalTo(titleLabel.snp.bottom).offset(3) + } + + playerSlider.snp.makeConstraints { make in + make.left.equalTo(self).offset(18) + make.right.equalTo(self).offset(-18) + make.top.equalTo(artistLabel.snp.bottom).offset(18) + } + + startTimeLabel.snp.makeConstraints { make in + make.left.equalTo(self).offset(18) + make.top.equalTo(playerSlider.snp.bottom).offset(3) + make.bottom.equalTo(self).offset(-10) + } + + endTimeLabel.snp.makeConstraints { make in + make.right.equalTo(self).offset(-18) + make.top.equalTo(playerSlider.snp.bottom).offset(3) + make.bottom.equalTo(self).offset(-10) + } + } + +} + + diff --git a/IndieMusic/IndieMusic/Modules/Player/PlayerViewController.swift b/IndieMusic/IndieMusic/Modules/Player/PlayerViewController.swift index aa25249..429eca3 100644 --- a/IndieMusic/IndieMusic/Modules/Player/PlayerViewController.swift +++ b/IndieMusic/IndieMusic/Modules/Player/PlayerViewController.swift @@ -8,14 +8,42 @@ import UIKit class PlayerViewController: ViewController { + + var blurEffectView: BlurEffectView = { + let blurEffectView = BlurEffectView.init() + + return blurEffectView + }() + + var playerViewTopBar: PlayerViewTopBar = { + let playerViewTopBar = PlayerViewTopBar.init() + playerViewTopBar.setContentHuggingPriority(.required, for: .vertical) + playerViewTopBar.setContentCompressionResistancePriority(.required, for: .vertical) + + return playerViewTopBar + }() + + var playerScrollView: PlayerScrollView = { + let playerScrollView = PlayerScrollView.init() + + + return playerScrollView + }() + + + var playerControlView: PlayerControlView = { + let playerControlView = PlayerControlView.init() + playerControlView.setContentHuggingPriority(.required, for: .vertical) + playerControlView.setContentCompressionResistancePriority(.required, for: .vertical) + + return playerControlView + }() + + override func viewDidLoad() { super.viewDidLoad() -// hidesBottomBarWhenPushed = false - - self.navigationTitle = "1234" - self.navigationController?.setNavigationBarHidden(false, animated: true) } override func viewWillAppear(_ animated: Bool) { @@ -24,20 +52,54 @@ class PlayerViewController: ViewController { } + override func makeUI() { + super.makeUI() + + view.backgroundColor = .white + + view.addSubview(blurEffectView) + view.addSubview(playerViewTopBar) + view.addSubview(playerScrollView) + view.addSubview(playerControlView) + + } - override func touchesBegan(_ touches: Set, with event: UIEvent?) { - if let tabbar = self.tabBarController as? HomeTabBarController { - - + override func bindViewModel() { + super.bindViewModel() + + } + + override func viewDidLayoutSubviews() { + super.viewDidLayoutSubviews() + + blurEffectView.snp.makeConstraints { make in + make.edges.equalTo(view) } -// -// let vc = MineViewController.init(viewModel: viewModel, navigator: navigator) -// -// self.present(vc, animated: true) + playerViewTopBar.snp.makeConstraints { make in + make.left.equalTo(view) + make.right.equalTo(view) + make.top.equalTo(view).offset(BaseDimensions.statusBarHeight) + make.height.equalTo(BaseDimensions.navBarHeight) + } -// UIView.animate(withDuration: 0.3) { -// self.tabBarController?.tabBar.isHidden.toggle() -// } + playerControlView.snp.makeConstraints { make in + make.left.equalTo(view) + make.right.equalTo(view) + make.bottom.equalTo(view).offset(-BaseDimensions.bottomHeight).offset(-55) + } + + playerScrollView.snp.makeConstraints { make in + make.left.equalTo(view) + make.right.equalTo(view) + make.top.equalTo(playerViewTopBar.snp.bottom).priority(.high) + make.bottom.equalTo(playerControlView.snp.top).priority(.high) + } + + } + + + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + self.dismiss(animated: true) } } diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover.imageset/Contents.json new file mode 100644 index 0000000..c1fd1c5 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "cover.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover.imageset/cover.jpg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover.imageset/cover.jpg new file mode 100644 index 0000000..4a24314 Binary files /dev/null and b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover.imageset/cover.jpg differ diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover1.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover1.imageset/Contents.json new file mode 100644 index 0000000..c1fd1c5 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "cover.jpg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover1.imageset/cover.jpg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover1.imageset/cover.jpg new file mode 100644 index 0000000..bb76498 Binary files /dev/null and b/IndieMusic/IndieMusic/Resources/Assets.xcassets/cover1.imageset/cover.jpg differ diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_drop_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_drop_btn.imageset/Contents.json new file mode 100644 index 0000000..fcf9ec5 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_drop_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_drop_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_drop_btn.imageset/play_drop_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_drop_btn.imageset/play_drop_btn.svg new file mode 100644 index 0000000..0fabee6 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_drop_btn.imageset/play_drop_btn.svg @@ -0,0 +1,3 @@ + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_last_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_last_btn.imageset/Contents.json new file mode 100644 index 0000000..c4b910a --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_last_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_last_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_last_btn.imageset/play_last_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_last_btn.imageset/play_last_btn.svg new file mode 100644 index 0000000..2fb58a0 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_last_btn.imageset/play_last_btn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_like_on.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_like_on.imageset/Contents.json new file mode 100644 index 0000000..1cc2512 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_like_on.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_like_on.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_like_on.imageset/play_like_on.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_like_on.imageset/play_like_on.svg new file mode 100644 index 0000000..ebed06a --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_like_on.imageset/play_like_on.svg @@ -0,0 +1,4 @@ + + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_list_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_list_btn.imageset/Contents.json new file mode 100644 index 0000000..89463ee --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_list_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_list_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_list_btn.imageset/play_list_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_list_btn.imageset/play_list_btn.svg new file mode 100644 index 0000000..c56dece --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_list_btn.imageset/play_list_btn.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_more_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_more_btn.imageset/Contents.json new file mode 100644 index 0000000..0ea70da --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_more_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_more_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_more_btn.imageset/play_more_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_more_btn.imageset/play_more_btn.svg new file mode 100644 index 0000000..d7c6a7e --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_more_btn.imageset/play_more_btn.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_next_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_next_btn.imageset/Contents.json new file mode 100644 index 0000000..4a05a3c --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_next_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_next_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_next_btn.imageset/play_next_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_next_btn.imageset/play_next_btn.svg new file mode 100644 index 0000000..e73b766 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_next_btn.imageset/play_next_btn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_pause_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_pause_btn.imageset/Contents.json new file mode 100644 index 0000000..68af560 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_pause_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_pause_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_pause_btn.imageset/play_pause_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_pause_btn.imageset/play_pause_btn.svg new file mode 100644 index 0000000..0cb9b23 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_pause_btn.imageset/play_pause_btn.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_share_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_share_btn.imageset/Contents.json new file mode 100644 index 0000000..3ada103 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_share_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_share_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_share_btn.imageset/play_share_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_share_btn.imageset/play_share_btn.svg new file mode 100644 index 0000000..a241175 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_share_btn.imageset/play_share_btn.svg @@ -0,0 +1,3 @@ + + + diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_single_modes_btn.imageset/Contents.json b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_single_modes_btn.imageset/Contents.json new file mode 100644 index 0000000..3dd3e51 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_single_modes_btn.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "play_single_modes_btn.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_single_modes_btn.imageset/play_single_modes_btn.svg b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_single_modes_btn.imageset/play_single_modes_btn.svg new file mode 100644 index 0000000..8613fe1 --- /dev/null +++ b/IndieMusic/IndieMusic/Resources/Assets.xcassets/play/play_single_modes_btn.imageset/play_single_modes_btn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/IndieMusic/IndieMusic/Resources/Info.plist b/IndieMusic/IndieMusic/Resources/Info.plist index dd3c9af..8e6b5a8 100644 --- a/IndieMusic/IndieMusic/Resources/Info.plist +++ b/IndieMusic/IndieMusic/Resources/Info.plist @@ -21,5 +21,9 @@ + UIBackgroundModes + + audio + diff --git a/IndieMusic/Podfile b/IndieMusic/Podfile index b4a2c74..cf860a1 100644 --- a/IndieMusic/Podfile +++ b/IndieMusic/Podfile @@ -14,6 +14,7 @@ target 'IndieMusic' do pod 'CocoaLumberjack/Swift' pod 'KeychainAccess' + pod 'NSObject+Rx' pod 'RxViewController' pod 'RxSwift', '6.2.0'