瀏覽代碼

musicVolumn -- to be continued

Chris 5 年之前
父節點
當前提交
7710e38bad
共有 12 個文件被更改,包括 358 次插入7 次删除
  1. 24 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 15 7
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m
  3. 239 0
      RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift
  4. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_finish_white.imageset/Contents.json
  5. 二進制
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_finish_white.imageset/nav_finish_white@2x.png
  6. 二進制
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_finish_white.imageset/nav_finish_white@3x.png
  7. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_ico_music_pre.imageset/Contents.json
  8. 二進制
      RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_ico_music_pre.imageset/video_ico_music_pre@2x.png
  9. 二進制
      RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_ico_music_pre.imageset/video_ico_music_pre@3x.png
  10. 1 0
      RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_pic_filter_artwork.imageset/Contents.json
  11. 二進制
      RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_pic_filter_artwork.imageset/video_pic_filter_artwork@3x.png
  12. 35 0
      RainbowPlanet/RainbowPlanet/Tools/CustomSlider/CustomSlider.swift

+ 24 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -544,6 +544,8 @@
 		BD477F6322C23D66008BE2CB /* AliyunReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BD477F6222C23D66008BE2CB /* AliyunReachability.m */; };
 		BD4B50AC22BC7DEA0073B516 /* FilterResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */; };
 		BD4B50AE22BC815F0073B516 /* PublishFilterCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD4B50AD22BC815F0073B516 /* PublishFilterCollectionCell.swift */; };
+		BD5CA89222DD73A500364A67 /* PublishMusicVolumnView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */; };
+		BD5CA89522DDA2A100364A67 /* CustomSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5CA89422DDA2A100364A67 /* CustomSlider.swift */; };
 		BD61225422C355C800D3F513 /* AliyunMagicCameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61225322C355C800D3F513 /* AliyunMagicCameraViewController.m */; };
 		BD61225E22C3561C00D3F513 /* AlivcRecordFocusView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61225722C3561B00D3F513 /* AlivcRecordFocusView.m */; };
 		BD61225F22C3561C00D3F513 /* AliyunMagicCameraView.m in Sources */ = {isa = PBXBuildFile; fileRef = BD61225822C3561B00D3F513 /* AliyunMagicCameraView.m */; };
@@ -1264,6 +1266,8 @@
 		BD477F6222C23D66008BE2CB /* AliyunReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunReachability.m; sourceTree = "<group>"; };
 		BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = FilterResource.bundle; sourceTree = "<group>"; };
 		BD4B50AD22BC815F0073B516 /* PublishFilterCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishFilterCollectionCell.swift; sourceTree = "<group>"; };
+		BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishMusicVolumnView.swift; sourceTree = "<group>"; };
+		BD5CA89422DDA2A100364A67 /* CustomSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSlider.swift; sourceTree = "<group>"; };
 		BD61225222C355C800D3F513 /* AliyunMagicCameraViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunMagicCameraViewController.h; sourceTree = "<group>"; };
 		BD61225322C355C800D3F513 /* AliyunMagicCameraViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunMagicCameraViewController.m; sourceTree = "<group>"; };
 		BD61225622C3561B00D3F513 /* MagicCameraPressCircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MagicCameraPressCircleView.h; sourceTree = "<group>"; };
@@ -3192,6 +3196,7 @@
 		A77F2CBC2232022A001BD3F6 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
+				BD5CA89322DDA27000364A67 /* CustomSlider */,
 				A7297C6422D72F7F001A7AE6 /* KeyBoardCommentView */,
 				A770E5E522D3421700CBD0A4 /* CommentInputView */,
 				A72623E222C39C6F00AEF875 /* FMLabel */,
@@ -4624,6 +4629,7 @@
 				BD12B67222B4E99800AEB10B /* PublishMediaPicker */,
 				BD01B1FC22BC677900CE9F36 /* PublishTakeVideo */,
 				BD01B1F722BC673900CE9F36 /* PublishTakePhoto */,
+				BD5CA89022DD719000364A67 /* PublishMusicAbout */,
 				BD13B69F22B9CE8D008BB323 /* PublishEditController */,
 				BD13B6CF22BA03BB008BB323 /* PublishAddTopic */,
 				BD13B6CB22BA03BB008BB323 /* PublishAddAddress */,
@@ -4977,6 +4983,22 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		BD5CA89022DD719000364A67 /* PublishMusicAbout */ = {
+			isa = PBXGroup;
+			children = (
+				BD5CA89122DD73A500364A67 /* PublishMusicVolumnView.swift */,
+			);
+			path = PublishMusicAbout;
+			sourceTree = "<group>";
+		};
+		BD5CA89322DDA27000364A67 /* CustomSlider */ = {
+			isa = PBXGroup;
+			children = (
+				BD5CA89422DDA2A100364A67 /* CustomSlider.swift */,
+			);
+			path = CustomSlider;
+			sourceTree = "<group>";
+		};
 		BD61224F22C31EE400D3F513 /* VideoEdit */ = {
 			isa = PBXGroup;
 			children = (
@@ -5888,6 +5910,7 @@
 				A7284A7322546460000BAEC4 /* SwiftMoyaServicePayApi.swift in Sources */,
 				BDE3045D22851E4F001D050F /* ProductCartListModel.swift in Sources */,
 				A73A56D322DC59A3004920FE /* PushModel.swift in Sources */,
+				BD5CA89222DD73A500364A67 /* PublishMusicVolumnView.swift in Sources */,
 				BD12B68822B4F28F00AEB10B /* KSExtension.swift in Sources */,
 				BD61229322C3605C00D3F513 /* AliyunEffectResourceModel.m in Sources */,
 				A7A98DFF227E8501005306E9 /* SwiftMoyaNetWorkServiceProduct.swift in Sources */,
@@ -5943,6 +5966,7 @@
 				A7A98E1D227EF1CB005306E9 /* SpecialBannerView.swift in Sources */,
 				BDF47D852282C59F00941AB9 /* ShoppingCartListTableViewCell.swift in Sources */,
 				BD01B20122BC677900CE9F36 /* PublishFilterView.swift in Sources */,
+				BD5CA89522DDA2A100364A67 /* CustomSlider.swift in Sources */,
 				A77F2CCA223209F2001BD3F6 /* BaseTabbarViewController.swift in Sources */,
 				BD61229A22C3605C00D3F513 /* AliyunEffectFilterCell.m in Sources */,
 				A7BF202B22B396F300396DB3 /* CardContentTitleTableViewCell.swift in Sources */,

+ 15 - 7
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoEdit/Controller/AliyunEditViewController.m

@@ -53,6 +53,8 @@
 //底部UI适配
 #import "AlivcEditItemModel.h"
 
+#import "RainbowPlanet-Swift.h"
+
 //用户操作事件,目前特效里长按特效和缩略图滑动互斥,长按特效优先
 typedef NS_ENUM(NSInteger, AliyunEditUserEvent) {
     AliyunEditUserEvent_None,             //当前用户无操作
@@ -132,6 +134,9 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 @property(nonatomic, strong) AliyunMusicPickModel *music; //之前应用的音乐
 @property(nonatomic, assign) NSInteger tab; //之前应用的音乐的所属
 
+// 配乐/音量のView
+@property (nonatomic, strong) PublishMusicVolumnView *volumnView;
+
 /**
  当前控制器是否可见
  */
@@ -1400,13 +1405,16 @@ AliyunIExporterCallback, AliyunIPlayerCallback, AliyunMusicPickViewControllerDel
 - (void)musicButtonClicked {
     //    [self enterEditWithActionType:AliyunEditSouceClickTypeMusic];
     //    [self pause];
-    AliyunMusicPickViewController *vc =
-    [[AliyunMusicPickViewController alloc] init];
-    vc.duration = [self.player getDuration];
-    vc.selectedMusic = self.music;
-    vc.selectedTab = self.tab;
-    vc.delegate = self;
-    [self.navigationController pushViewController:vc animated:YES];
+    
+//    AliyunMusicPickViewController *vc =
+//    [[AliyunMusicPickViewController alloc] init];
+//    vc.duration = [self.player getDuration];
+//    vc.selectedMusic = self.music;
+//    vc.selectedTab = self.tab;
+//    vc.delegate = self;
+//    [self.navigationController pushViewController:vc animated:YES];
+    
+    self.volumnView = [PublishMusicVolumnView publishMusicVolumnView];
 }
 
 //时间特效

+ 239 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishMusicVolumnView.swift

@@ -0,0 +1,239 @@
+//
+//  PublishMusicVolumnView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import FWPopupView
+import RxSwift
+
+class PublishMusicVolumnView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    var originVolumn: Float = 50
+    var backVolumn: Float   = 100
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupViews() {
+        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight)
+        backgroundColor = UIColor(hexString: "FFFFFF", alpha: 0.2)
+        
+        addSubview(controlBackView)
+        controlBackView.addSubview(cancelButton)
+        controlBackView.addSubview(applyButton)
+        
+        controlBackView.addSubview(originLabel)
+        controlBackView.addSubview(originSlider)
+        controlBackView.addSubview(backLabel)
+        controlBackView.addSubview(backSlider)
+        
+        controlBackView.addSubview(musicButton)
+        controlBackView.addSubview(volumnButton)
+        controlBackView.addSubview(v_lineLabel)
+    }
+    
+    func setupLayouts() {
+        
+        controlBackView.snp.makeConstraints { (make) in
+            make.left.right.equalToSuperview()
+            make.bottom.equalTo(-kSafeStatusBarHeight)
+            make.height.equalTo(177)
+        }
+        
+        cancelButton.snp.makeConstraints { (make) in
+            make.top.equalTo(2)
+            make.left.equalTo(3)
+            make.size.equalTo(44)
+        }
+        applyButton.snp.makeConstraints { (make) in
+            make.top.equalTo(2)
+            make.right.equalTo(-3)
+            make.size.equalTo(44)
+        }
+        
+        originLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(78)
+            make.left.equalTo(19)
+            make.width.equalTo(30)
+            make.height.equalTo(21)
+        }
+        
+        backLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(78)
+            make.left.equalTo(kScreenWidth/2 + 13)
+            make.width.equalTo(30)
+            make.height.equalTo(21)
+        }
+        
+        musicButton.snp.makeConstraints { (make) in
+            make.centerX.equalTo(controlBackView.snp_right).multipliedBy(0.25)
+            make.bottom.equalTo(-17)
+            make.width.equalTo(40)
+            make.height.equalTo(21)
+        }
+        volumnButton.snp.makeConstraints { (make) in
+            make.centerX.equalTo(controlBackView.snp_right).multipliedBy(0.75)
+            make.bottom.equalTo(-17)
+            make.width.equalTo(40)
+            make.height.equalTo(21)
+        }
+        v_lineLabel.snp.makeConstraints { (make) in
+            make.centerX.equalTo(volumnButton.snp_centerX)
+            make.width.equalTo(20)
+            make.height.equalTo(3)
+            make.bottom.equalTo(-11)
+        }
+    }
+    
+    lazy var controlBackView: UIView = {
+        let controlBackView = UIView()
+        controlBackView.backgroundColor = UIColor(hexString: "000000", alpha: 0.5)
+        controlBackView.configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
+        return controlBackView
+    }()
+    
+    lazy var cancelButton: UIButton = {
+        let cancelButton = UIButton(type: UIButton.ButtonType.custom)
+        cancelButton.setImage(kImage(name: "video_btn_close_white"), for: .normal)
+        return cancelButton
+    }()
+    
+    lazy var originLabel: UILabel = {
+        let originLabel = UILabel()
+        originLabel.text = "原声"
+        originLabel.textColor = kffffffColor
+        originLabel.font = kRegularFont15
+        return originLabel
+    }()
+    
+    lazy var originSlider: CustomSlider = {
+        let originSlider = CustomSlider()
+        originSlider.value = originVolumn
+        originSlider.thumbTintColor = kffffffColor
+        // 区域颜色
+        originSlider.minimumTrackTintColor = kffffffColor
+        originSlider.maximumTrackTintColor = UIColor(hexString: "000000", alpha: 0.3)
+        //
+        originSlider.setThumbImage(kImage(name: "music_btn_dot"), for: .normal)
+        originSlider.setThumbImage(kImage(name: "music_btn_dot"), for: .highlighted)
+        originSlider.addTarget(self, action: #selector(originValueChanged), for: .valueChanged)
+        return originSlider
+    }()
+    
+    lazy var backSlider: CustomSlider = {
+        let backSlider = CustomSlider()
+        backSlider.value = backVolumn
+        backSlider.thumbTintColor = kffffffColor
+        // 区域颜色
+        backSlider.minimumTrackTintColor = kffffffColor
+        backSlider.maximumTrackTintColor = UIColor(hexString: "000000", alpha: 0.3)
+        //
+        backSlider.setThumbImage(kImage(name: "music_btn_dot"), for: .normal)
+        backSlider.setThumbImage(kImage(name: "music_btn_dot"), for: .highlighted)
+        backSlider.addTarget(self, action: #selector(backValueChanged), for: .valueChanged)
+        return backSlider
+    }()
+    
+    lazy var backLabel: UILabel = {
+        let backLabel = UILabel()
+        backLabel.text = "配乐"
+        backLabel.textColor = kffffffColor
+        backLabel.font = kRegularFont15
+        return backLabel
+    }()
+    
+    lazy var applyButton: UIButton = {
+        let applyButton = UIButton(type: UIButton.ButtonType.custom)
+        applyButton.setImage(kImage(name: "nav_finish_white"), for: .normal)
+        return applyButton
+    }()
+    
+    lazy var musicButton: UIButton = {
+        let musicButton = UIButton(type: UIButton.ButtonType.custom)
+        musicButton.setTitle("配乐", for: UIControl.State.normal)
+        musicButton.setTitleColor(k999999Color, for: UIControl.State.normal)
+        musicButton.titleLabel?.font = kRegularFont16
+        return musicButton
+    }()
+    
+    lazy var volumnButton: UIButton = {
+        let volumnButton = UIButton(type: UIButton.ButtonType.custom)
+        volumnButton.setTitle("音量", for: UIControl.State.normal)
+        volumnButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        volumnButton.titleLabel?.font = kMediumFont17
+        return volumnButton
+    }()
+    
+    lazy var v_lineLabel: UILabel = {
+        let v_lineLabel = UILabel()
+        v_lineLabel.backgroundColor = kffffffColor
+        v_lineLabel.cornerRadius = 1
+        return v_lineLabel
+    }()
+    
+    @objc func originValueChanged(_ sender: Any?) {
+        let slider = sender as? UISlider
+        
+        let sliderRate = CGFloat((slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0))
+        print("\n-------- originSliderRate = \(sliderRate)")
+        
+    }
+    
+    @objc func backValueChanged(_ sender: Any?) {
+        let slider = sender as? UISlider
+        
+        let sliderRate = CGFloat((slider?.value ?? 0.0) / (slider?.maximumValue ?? 0.0))
+        
+        print("\n-------- backSliderRate = \(sliderRate)")
+    }
+    
+    /// 初始化View
+    @objc class func publishMusicVolumnView() -> PublishMusicVolumnView {
+        let view = PublishMusicVolumnView()
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.popupAnimationType = .scale
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
+        vProperty.touchWildToHide = "1"
+        view.vProperty = vProperty
+        view.show()
+        
+        view.cancelButton.rx.tap.subscribe(onNext: { (data) in
+            print("----点击了-取消")
+            view.hide()
+            
+        }).disposed(by: view.disposeBag)
+        
+        view.applyButton.rx.tap.subscribe(onNext: {(data) in
+            print("----点击了-应用")
+            view.hide()
+        }).disposed(by: view.disposeBag)
+        
+        view.musicButton.rx.tap.subscribe(onNext: { (data) in
+            print("----点击了-配乐")
+            
+        }).disposed(by: view.disposeBag)
+        
+        view.volumnButton.rx.tap.subscribe(onNext: { (data) in
+            print("----点击了-音量")
+            
+        }).disposed(by: view.disposeBag)
+        
+        return view
+    }
+    
+}

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_finish_white.imageset/Contents.json

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

二進制
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_finish_white.imageset/nav_finish_white@2x.png


二進制
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_finish_white.imageset/nav_finish_white@3x.png


+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_ico_music_pre.imageset/Contents.json

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

二進制
RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_ico_music_pre.imageset/video_ico_music_pre@2x.png


二進制
RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_ico_music_pre.imageset/video_ico_music_pre@3x.png


+ 1 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_pic_filter_artwork.imageset/Contents.json

@@ -11,6 +11,7 @@
     },
     {
       "idiom" : "universal",
+      "filename" : "video_pic_filter_artwork@3x.png",
       "scale" : "3x"
     }
   ],

二進制
RainbowPlanet/RainbowPlanet/Supporting Files/PublishModule.xcassets/video_pic_filter_artwork.imageset/video_pic_filter_artwork@3x.png


+ 35 - 0
RainbowPlanet/RainbowPlanet/Tools/CustomSlider/CustomSlider.swift

@@ -0,0 +1,35 @@
+//
+//  CustomSlider.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class CustomSlider: UISlider {
+    
+    var sliderHeight: CGFloat = 4.0
+    
+    override func minimumValueImageRect(forBounds bounds: CGRect) -> CGRect {
+        return self.bounds
+    }
+    
+    override func maximumValueImageRect(forBounds bounds: CGRect) -> CGRect {
+        return self.bounds
+    }
+    
+    // 控制slider的宽和高,这个方法才是真正的改变slider滑道的高的
+    override func trackRect(forBounds bounds: CGRect) -> CGRect {
+        let rect = super.trackRect(forBounds: bounds)
+        layer.cornerRadius = sliderHeight/2
+        return CGRect.init(x: rect.origin.x, y: (bounds.size.height-sliderHeight)/2, width: bounds.size.width, height: sliderHeight)
+    }
+    
+    // 改变滑块的触摸范围
+    override func thumbRect(forBounds bounds: CGRect, trackRect rect: CGRect, value: Float) -> CGRect {
+        return super.thumbRect(forBounds: bounds, trackRect: rect, value: value)
+    }
+    
+}