|  | @@ -5,53 +5,51 @@
 | 
											
												
													
														|  |  //  Created by ak on 2022/2/15.
 |  |  //  Created by ak on 2022/2/15.
 | 
											
												
													
														|  |  //  功能:发音人设置面板
 |  |  //  功能:发音人设置面板
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import Foundation
 |  | 
 | 
											
												
													
														|  |  import BFCommonKit
 |  |  import BFCommonKit
 | 
											
												
													
														|  | -import BFUIKit
 |  | 
 | 
											
												
													
														|  |  import BFMediaKit
 |  |  import BFMediaKit
 | 
											
												
													
														|  | 
 |  | +import BFUIKit
 | 
											
												
													
														|  | 
 |  | +import Foundation
 | 
											
												
													
														|  |  import UIKit
 |  |  import UIKit
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |  // 操作动作类型
 |  |  // 操作动作类型
 | 
											
												
													
														|  |  public enum VoiceSettingActionType: Int {
 |  |  public enum VoiceSettingActionType: Int {
 | 
											
												
													
														|  |      case voiceSettingActionCancel = 1 // 取消
 |  |      case voiceSettingActionCancel = 1 // 取消
 | 
											
												
													
														|  |      case voiceSettingActionDelete = 2 // 删除
 |  |      case voiceSettingActionDelete = 2 // 删除
 | 
											
												
													
														|  |      case VoiceSettingActionConfirm = 3 // 确认
 |  |      case VoiceSettingActionConfirm = 3 // 确认
 | 
											
												
													
														|  | 
 |  | +    case VoiceSettingActionSelected = 4 // 选择了一个发音人 如用于试听
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  class BFVoiceSettingView: UIView {
 |  |  class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  |      let itemSize = CGSize(width: adapterWidth(width: 52) + 9, height: 40)
 |  |      let itemSize = CGSize(width: adapterWidth(width: 52) + 9, height: 40)
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    //操作板背景
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 操作板背景
 | 
											
												
													
														|  |      let backView = UIButton()
 |  |      let backView = UIButton()
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    //保存所有发音人
 |  | 
 | 
											
												
													
														|  | -    public var voices: Dictionary = Dictionary<String, [PQVoiceModel]>.init(){
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 保存所有发音人
 | 
											
												
													
														|  | 
 |  | +    public var voices: Dictionary = Dictionary<String, [PQVoiceModel]>.init() {
 | 
											
												
													
														|  |          didSet {
 |  |          didSet {
 | 
											
												
													
														|  |              voicesCollectView.reloadData()
 |  |              voicesCollectView.reloadData()
 | 
											
												
													
														|  | -            
 |  | 
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    //所有分类
 |  | 
 | 
											
												
													
														|  | -    public var categorys: Array = Array<BFVoiceCategoryModel>.init(){
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 所有分类
 | 
											
												
													
														|  | 
 |  | +    public var categorys: Array = Array<BFVoiceCategoryModel>.init() {
 | 
											
												
													
														|  |          didSet {
 |  |          didSet {
 | 
											
												
													
														|  |              BFLog(message: "发音人分类数: \(categorys.count)")
 |  |              BFLog(message: "发音人分类数: \(categorys.count)")
 | 
											
												
													
														|  |              curretnCategory = categorys.first
 |  |              curretnCategory = categorys.first
 | 
											
												
													
														|  | 
 |  | +            curretnCategory?.isSelected = true
 | 
											
												
													
														|  |              catagaryCollectView.reloadData()
 |  |              catagaryCollectView.reloadData()
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    //操作回调
 |  | 
 | 
											
												
													
														|  | -    public var voiceSettingCallBack: ((_ actionType: VoiceSettingActionType,_ selectVoice:PQVoiceModel?) -> Void)?
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    //当前选择的分类
 |  | 
 | 
											
												
													
														|  | -    var curretnCategory:BFVoiceCategoryModel?
 |  | 
 | 
											
												
													
														|  | -    //当前选择的发音人
 |  | 
 | 
											
												
													
														|  | -    var selectVoice:PQVoiceModel?
 |  | 
 | 
											
												
													
														|  | 
 |  | +    // 操作回调
 | 
											
												
													
														|  | 
 |  | +    public var voiceSettingCallBack: ((_ actionType: VoiceSettingActionType, _ selectVoice: PQVoiceModel?) -> Void)?
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 当前选择的分类
 | 
											
												
													
														|  | 
 |  | +    var curretnCategory: BFVoiceCategoryModel?
 | 
											
												
													
														|  | 
 |  | +    // 当前选择的发音人
 | 
											
												
													
														|  | 
 |  | +    public var selectVoice: PQVoiceModel?
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  |      // 分类列表
 |  |      // 分类列表
 | 
											
												
													
														|  |      lazy var catagaryCollectView: UICollectionView = {
 |  |      lazy var catagaryCollectView: UICollectionView = {
 | 
											
												
													
														|  |          let layout = UICollectionViewFlowLayout()
 |  |          let layout = UICollectionViewFlowLayout()
 | 
											
										
											
												
													
														|  | @@ -78,18 +76,32 @@ class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return collectView
 |  |          return collectView
 | 
											
												
													
														|  |      }()
 |  |      }()
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 删除 btn
 | 
											
												
													
														|  | 
 |  | +    lazy var deleteBtn: UIButton = {
 | 
											
												
													
														|  | 
 |  | +        let deleteBtn = UIButton()
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.backgroundColor = .clear
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.setTitleColor(.white, for: .normal)
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.addTarget(self, action: #selector(deleteBtnAction), for: .touchUpInside)
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.setBackgroundImage(imageInRecordScreenKit(by: "voiceDeleteN"), for: .normal)
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.setBackgroundImage(imageInRecordScreenKit(by: "voiceDeleteS"), for: .selected)
 | 
											
												
													
														|  | 
 |  | +        deleteBtn.adjustsImageWhenHighlighted = false
 | 
											
												
													
														|  | 
 |  | +        return deleteBtn
 | 
											
												
													
														|  | 
 |  | +    }()
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      // 所有发音人列表
 |  |      // 所有发音人列表
 | 
											
												
													
														|  |      lazy var voicesCollectView: UICollectionView = {
 |  |      lazy var voicesCollectView: UICollectionView = {
 | 
											
												
													
														|  |          let layout = UICollectionViewFlowLayout()
 |  |          let layout = UICollectionViewFlowLayout()
 | 
											
												
													
														|  |          layout.scrollDirection = .vertical
 |  |          layout.scrollDirection = .vertical
 | 
											
												
													
														|  | -        layout.itemSize = CGSize(width: adapterWidth(width:60) , height: 78)
 |  | 
 | 
											
												
													
														|  | -        //每行最小边距
 |  | 
 | 
											
												
													
														|  | 
 |  | +        layout.itemSize = CGSize(width: adapterWidth(width: 60), height: 78)
 | 
											
												
													
														|  | 
 |  | +        // 每行最小边距
 | 
											
												
													
														|  |          layout.minimumLineSpacing = 10
 |  |          layout.minimumLineSpacing = 10
 | 
											
												
													
														|  | -        //每列最小边距
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // 每列最小边距
 | 
											
												
													
														|  |          layout.minimumInteritemSpacing = 0
 |  |          layout.minimumInteritemSpacing = 0
 | 
											
												
													
														|  |          layout.sectionInset = UIEdgeInsets.zero
 |  |          layout.sectionInset = UIEdgeInsets.zero
 | 
											
												
													
														|  | -     
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          let collectView = UICollectionView(frame: CGRect(x: 0, y: 98, width: cScreenWidth, height: 242 - cSafeAreaHeight), collectionViewLayout: layout)
 |  |          let collectView = UICollectionView(frame: CGRect(x: 0, y: 98, width: cScreenWidth, height: 242 - cSafeAreaHeight), collectionViewLayout: layout)
 | 
											
												
													
														|  |          collectView.isPagingEnabled = false
 |  |          collectView.isPagingEnabled = false
 | 
											
												
													
														|  |          collectView.showsHorizontalScrollIndicator = false
 |  |          collectView.showsHorizontalScrollIndicator = false
 | 
											
										
											
												
													
														|  | @@ -107,24 +119,20 @@ class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return collectView
 |  |          return collectView
 | 
											
												
													
														|  |      }()
 |  |      }()
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      required init?(coder _: NSCoder) {
 |  |      required init?(coder _: NSCoder) {
 | 
											
												
													
														|  |          fatalError("init(coder:) has not been implemented")
 |  |          fatalError("init(coder:) has not been implemented")
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      override func layoutSubviews() {
 |  |      override func layoutSubviews() {
 | 
											
												
													
														|  |          super.layoutSubviews()
 |  |          super.layoutSubviews()
 | 
											
												
													
														|  | -        self.backView.addCorner(roundingCorners: [.topLeft, .topRight], corner: 10)
 |  | 
 | 
											
												
													
														|  | 
 |  | +        backView.addCorner(roundingCorners: [.topLeft, .topRight], corner: 10)
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      override init(frame: CGRect) {
 |  |      override init(frame: CGRect) {
 | 
											
												
													
														|  |          super.init(frame: frame)
 |  |          super.init(frame: frame)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        backgroundColor = UIColor.clear
 |  | 
 | 
											
												
													
														|  | -        let view = UIView.init(frame: frame)
 |  | 
 | 
											
												
													
														|  | -        view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(hidden)))
 |  | 
 | 
											
												
													
														|  | -        addSubview(view)
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | 
 |  | +        backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
 | 
											
												
													
														|  |          backView.backgroundColor = UIColor.hexColor(hexadecimal: "#121212")
 |  |          backView.backgroundColor = UIColor.hexColor(hexadecimal: "#121212")
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          addSubview(backView)
 |  |          addSubview(backView)
 | 
											
										
											
												
													
														|  | @@ -135,8 +143,8 @@ class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  |              make.height.equalTo(340)
 |  |              make.height.equalTo(340)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          backView.setNeedsUpdateConstraints()
 |  |          backView.setNeedsUpdateConstraints()
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | -        //取消
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        // 取消
 | 
											
												
													
														|  |          let cancelBtn = UIButton()
 |  |          let cancelBtn = UIButton()
 | 
											
												
													
														|  |          cancelBtn.backgroundColor = .clear
 |  |          cancelBtn.backgroundColor = .clear
 | 
											
												
													
														|  |          cancelBtn.setTitle("取消", for: .normal)
 |  |          cancelBtn.setTitle("取消", for: .normal)
 | 
											
										
											
												
													
														|  | @@ -144,15 +152,15 @@ class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  |          cancelBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 17)
 |  |          cancelBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 17)
 | 
											
												
													
														|  |          cancelBtn.addTarget(self, action: #selector(cancelAction), for: .touchUpInside)
 |  |          cancelBtn.addTarget(self, action: #selector(cancelAction), for: .touchUpInside)
 | 
											
												
													
														|  |          backView.addSubview(cancelBtn)
 |  |          backView.addSubview(cancelBtn)
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          cancelBtn.snp.makeConstraints { make in
 |  |          cancelBtn.snp.makeConstraints { make in
 | 
											
												
													
														|  |              make.left.equalToSuperview().offset(18)
 |  |              make.left.equalToSuperview().offset(18)
 | 
											
												
													
														|  |              make.width.equalTo(35)
 |  |              make.width.equalTo(35)
 | 
											
												
													
														|  |              make.height.equalTo(24)
 |  |              make.height.equalTo(24)
 | 
											
												
													
														|  |              make.top.equalToSuperview().offset(18)
 |  |              make.top.equalToSuperview().offset(18)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | -        //确认
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        // 确认
 | 
											
												
													
														|  |          let okBtn = UIButton()
 |  |          let okBtn = UIButton()
 | 
											
												
													
														|  |          okBtn.backgroundColor = .clear
 |  |          okBtn.backgroundColor = .clear
 | 
											
												
													
														|  |          okBtn.setTitle("确认", for: .normal)
 |  |          okBtn.setTitle("确认", for: .normal)
 | 
											
										
											
												
													
														|  | @@ -166,9 +174,9 @@ class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  |              make.height.equalTo(24)
 |  |              make.height.equalTo(24)
 | 
											
												
													
														|  |              make.top.equalToSuperview().offset(18)
 |  |              make.top.equalToSuperview().offset(18)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | -        //删除发音设置
 |  | 
 | 
											
												
													
														|  | -        let catagaryBackView = UIView.init()
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        // 删除发音设置
 | 
											
												
													
														|  | 
 |  | +        let catagaryBackView = UIView()
 | 
											
												
													
														|  |          catagaryBackView.backgroundColor = UIColor.hexColor(hexadecimal: "#0B0B0B")
 |  |          catagaryBackView.backgroundColor = UIColor.hexColor(hexadecimal: "#0B0B0B")
 | 
											
												
													
														|  |          backView.addSubview(catagaryBackView)
 |  |          backView.addSubview(catagaryBackView)
 | 
											
												
													
														|  |          catagaryBackView.snp.makeConstraints { make in
 |  |          catagaryBackView.snp.makeConstraints { make in
 | 
											
										
											
												
													
														|  | @@ -177,66 +185,90 @@ class BFVoiceSettingView: UIView {
 | 
											
												
													
														|  |              make.height.equalTo(40)
 |  |              make.height.equalTo(40)
 | 
											
												
													
														|  |              make.top.equalToSuperview().offset(58)
 |  |              make.top.equalToSuperview().offset(58)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          catagaryBackView.addSubview(catagaryCollectView)
 |  |          catagaryBackView.addSubview(catagaryCollectView)
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | -        let deleteBtn = UIButton()
 |  | 
 | 
											
												
													
														|  | -        deleteBtn.backgroundColor = .clear
 |  | 
 | 
											
												
													
														|  | -        deleteBtn.setTitleColor(.white, for: .normal)
 |  | 
 | 
											
												
													
														|  | -        deleteBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
 |  | 
 | 
											
												
													
														|  | -        deleteBtn.addTarget(self, action: #selector(deleteBtnAction), for: .touchUpInside)
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          catagaryBackView.addSubview(deleteBtn)
 |  |          catagaryBackView.addSubview(deleteBtn)
 | 
											
												
													
														|  | -        deleteBtn.setBackgroundImage(imageInRecordScreenKit(by: "voiceDelete"), for: .normal)
 |  | 
 | 
											
												
													
														|  |          deleteBtn.snp.makeConstraints { make in
 |  |          deleteBtn.snp.makeConstraints { make in
 | 
											
												
													
														|  |              make.left.equalToSuperview().offset(16)
 |  |              make.left.equalToSuperview().offset(16)
 | 
											
												
													
														|  |              make.width.equalTo(24)
 |  |              make.width.equalTo(24)
 | 
											
												
													
														|  |              make.height.equalTo(24)
 |  |              make.height.equalTo(24)
 | 
											
												
													
														|  |              make.top.equalTo(cancelBtn.bottomY).offset(8)
 |  |              make.top.equalTo(cancelBtn.bottomY).offset(8)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -  
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          backView.addSubview(voicesCollectView)
 |  |          backView.addSubview(voicesCollectView)
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      
 |  |      
 | 
											
												
													
														|  | 
 |  | +    func show(){
 | 
											
												
													
														|  | 
 |  | +        isHidden = false
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      @objc func hidden() {
 |  |      @objc func hidden() {
 | 
											
												
													
														|  |          isHidden = true
 |  |          isHidden = true
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    
 |  | 
 | 
											
												
													
														|  | -    @objc func cancelAction(){
 |  | 
 | 
											
												
													
														|  | -        if(voiceSettingCallBack != nil){
 |  | 
 | 
											
												
													
														|  | -            voiceSettingCallBack!(.voiceSettingActionCancel,selectVoice)
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @objc func cancelAction() {
 | 
											
												
													
														|  | 
 |  | +        hidden()
 | 
											
												
													
														|  | 
 |  | +        selectVoice?.voiceStatue = .isSelected
 | 
											
												
													
														|  | 
 |  | +        voicesCollectView.reloadData()
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        if voiceSettingCallBack != nil {
 | 
											
												
													
														|  | 
 |  | +            voiceSettingCallBack!(.voiceSettingActionCancel, selectVoice)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      
 |  |      
 | 
											
												
													
														|  | -    @objc func okBtnAction(){
 |  | 
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | -        if(voiceSettingCallBack != nil){
 |  | 
 | 
											
												
													
														|  | -            voiceSettingCallBack!(.VoiceSettingActionConfirm,selectVoice)
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @objc func okBtnAction() {
 | 
											
												
													
														|  | 
 |  | +        hidden()
 | 
											
												
													
														|  | 
 |  | +        selectVoice?.voiceStatue = .isSelected
 | 
											
												
													
														|  | 
 |  | +        voicesCollectView.reloadData()
 | 
											
												
													
														|  | 
 |  | +        if voiceSettingCallBack != nil {
 | 
											
												
													
														|  | 
 |  | +            voiceSettingCallBack!(.VoiceSettingActionConfirm, selectVoice)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | -    @objc func deleteBtnAction(){
 |  | 
 | 
											
												
													
														|  | -        if(voiceSettingCallBack != nil){
 |  | 
 | 
											
												
													
														|  | -            voiceSettingCallBack!(.voiceSettingActionDelete,selectVoice)
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @objc func deleteBtnAction() {
 | 
											
												
													
														|  | 
 |  | +        // 说明已经选择过发音人
 | 
											
												
													
														|  | 
 |  | +        if selectVoice != nil {
 | 
											
												
													
														|  | 
 |  | +            // 删除选择的发音人
 | 
											
												
													
														|  | 
 |  | +            if deleteBtn.isSelected {
 | 
											
												
													
														|  | 
 |  | +                selectVoice?.voiceStatue = .isNormal
 | 
											
												
													
														|  | 
 |  | +                selectVoice = nil
 | 
											
												
													
														|  | 
 |  | +                voicesCollectView.reloadData()
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            deleteBtn.isSelected = !deleteBtn.isSelected
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +            cShowHUB(superView: nil, msg: "还没有选择发音人")
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        if voiceSettingCallBack != nil {
 | 
											
												
													
														|  | 
 |  | +            voiceSettingCallBack!(.voiceSettingActionDelete, selectVoice)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    
 | 
											
												
													
														|  | 
 |  | +    /// 刷新当前选择发音人显示状态
 | 
											
												
													
														|  | 
 |  | +    /// - Parameter voiceStatue: 状态值
 | 
											
												
													
														|  | 
 |  | +    public func flushSelectVoiceStatus(voiceStatue: voiceStatue){
 | 
											
												
													
														|  | 
 |  | +        selectVoice?.voiceStatue = voiceStatue
 | 
											
												
													
														|  | 
 |  | +        voicesCollectView.reloadData()
 | 
											
												
													
														|  | 
 |  | +        
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  extension BFVoiceSettingView: UICollectionViewDelegate, UICollectionViewDataSource, UIScrollViewDelegate, UICollectionViewDelegateFlowLayout {
 |  |  extension BFVoiceSettingView: UICollectionViewDelegate, UICollectionViewDataSource, UIScrollViewDelegate, UICollectionViewDelegateFlowLayout {
 | 
											
												
													
														|  |      func collectionView(_ collectionView: UICollectionView,
 |  |      func collectionView(_ collectionView: UICollectionView,
 | 
											
												
													
														|  |                          layout _: UICollectionViewLayout,
 |  |                          layout _: UICollectionViewLayout,
 | 
											
												
													
														|  | -                        sizeForItemAt indexPath: IndexPath) -> CGSize
 |  | 
 | 
											
												
													
														|  | -    {
 |  | 
 | 
											
												
													
														|  | -      
 |  | 
 | 
											
												
													
														|  | -        if(collectionView == catagaryCollectView){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                        sizeForItemAt indexPath: IndexPath) -> CGSize {
 | 
											
												
													
														|  | 
 |  | +        if collectionView == catagaryCollectView {
 | 
											
												
													
														|  |              return CGSize(width: adapterWidth(width: 52) + 9, height: 40)
 |  |              return CGSize(width: adapterWidth(width: 52) + 9, height: 40)
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        return CGSize(width: adapterWidth(width:60) , height: 78)
 |  | 
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | 
 |  | +        return CGSize(width: adapterWidth(width: 60), height: 78)
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection _: Int) -> Int {
 |  |      func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection _: Int) -> Int {
 | 
											
												
													
														|  | -   
 |  | 
 | 
											
												
													
														|  |          if collectionView == catagaryCollectView {
 |  |          if collectionView == catagaryCollectView {
 | 
											
												
													
														|  |              return categorys.count
 |  |              return categorys.count
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -244,15 +276,13 @@ extension BFVoiceSettingView: UICollectionViewDelegate, UICollectionViewDataSour
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
 |  |      func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
 | 
											
												
													
														|  | - 
 |  | 
 | 
											
												
													
														|  |          if collectionView == catagaryCollectView {
 |  |          if collectionView == catagaryCollectView {
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |              let cell = BFVoiceCategoryCell.setCategory(collectionView: collectionView, indexPath: indexPath)
 |  |              let cell = BFVoiceCategoryCell.setCategory(collectionView: collectionView, indexPath: indexPath)
 | 
											
												
													
														|  | - 
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |              cell.category = categorys[indexPath.item]
 |  |              cell.category = categorys[indexPath.item]
 | 
											
												
													
														|  |              return cell
 |  |              return cell
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -        
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          let cell = PQVoiceCell.voiceList(collectionView: collectionView, indexPath: indexPath)
 |  |          let cell = PQVoiceCell.voiceList(collectionView: collectionView, indexPath: indexPath)
 | 
											
												
													
														|  |          let model = voices[curretnCategory?.cateName ?? ""]?[indexPath.item]
 |  |          let model = voices[curretnCategory?.cateName ?? ""]?[indexPath.item]
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -261,18 +291,24 @@ extension BFVoiceSettingView: UICollectionViewDelegate, UICollectionViewDataSour
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
 |  |      func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
 | 
											
												
													
														|  | -     
 |  | 
 | 
											
												
													
														|  |          if collectionView == catagaryCollectView {
 |  |          if collectionView == catagaryCollectView {
 | 
											
												
													
														|  |              BFLog(message: "===开始点击\(curretnCategory?.cateName ?? "")")
 |  |              BFLog(message: "===开始点击\(curretnCategory?.cateName ?? "")")
 | 
											
												
													
														|  |              curretnCategory?.isSelected = false
 |  |              curretnCategory?.isSelected = false
 | 
											
												
													
														|  |              curretnCategory = categorys[indexPath.item]
 |  |              curretnCategory = categorys[indexPath.item]
 | 
											
												
													
														|  |              curretnCategory?.isSelected = true
 |  |              curretnCategory?.isSelected = true
 | 
											
												
													
														|  |              catagaryCollectView.reloadData()
 |  |              catagaryCollectView.reloadData()
 | 
											
												
													
														|  | -          
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |              voicesCollectView.reloadData()
 |  |              voicesCollectView.reloadData()
 | 
											
												
													
														|  | -        }else{
 |  | 
 | 
											
												
													
														|  | 
 |  | +        } else {
 | 
											
												
													
														|  | 
 |  | +            selectVoice?.voiceStatue = .isNormal
 | 
											
												
													
														|  |              selectVoice = voices[curretnCategory?.cateName ?? ""]?[indexPath.item]
 |  |              selectVoice = voices[curretnCategory?.cateName ?? ""]?[indexPath.item]
 | 
											
												
													
														|  | 
 |  | +            selectVoice?.voiceStatue = .isSelected
 | 
											
												
													
														|  | 
 |  | +            deleteBtn.isSelected = true
 | 
											
												
													
														|  | 
 |  | +            voicesCollectView.reloadData()
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            if voiceSettingCallBack != nil {
 | 
											
												
													
														|  | 
 |  | +                voiceSettingCallBack!(.VoiceSettingActionSelected, selectVoice)
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -   
 |  | 
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  }
 |  |  }
 |