|
@@ -32,7 +32,6 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
}
|
|
|
|
|
|
- var JXheightForHeaderInSection: Int = 44
|
|
|
var categoryTitleArr = Array<String>()
|
|
|
|
|
|
var categoryListMdlArr : Array<MusicCategoryItemModel>? {
|
|
@@ -126,15 +125,14 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
func setupSegmentedView() {
|
|
|
addSubview(segmentedView)
|
|
|
addSubview(listContainerView)
|
|
|
- reloadData()
|
|
|
+// reloadData()
|
|
|
}
|
|
|
|
|
|
/// 刷新页面
|
|
|
func reloadData() {
|
|
|
segmentedDataSource.titles = categoryTitleArr
|
|
|
segmentedView.indicators = [indicator]
|
|
|
-
|
|
|
- JXheightForHeaderInSection = 44
|
|
|
+
|
|
|
|
|
|
// self.segmentedDataSource.reloadData(selectedIndex: shoppingMallListVCType)
|
|
|
// self.segmentedView.defaultSelectedIndex = shoppingMallListVCType
|
|
@@ -197,14 +195,18 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
//MARK: -
|
|
|
//1.初始化JXSegmentedView
|
|
|
lazy var segmentedView: JXSegmentedView = {
|
|
|
- let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: CGFloat(JXheightForHeaderInSection)))
|
|
|
+ let segmentedView = JXSegmentedView(frame: CGRect(x: 0, y: 48, width: kScreenWidth, height: 44))
|
|
|
segmentedView.delegate = self
|
|
|
segmentedView.dataSource = segmentedDataSource
|
|
|
segmentedView.indicators = [indicator]
|
|
|
segmentedView.contentScrollView = listContainerView.scrollView
|
|
|
- segmentedView.selectItemAt(index: 0)
|
|
|
segmentedView.defaultSelectedIndex = 0
|
|
|
- segmentedView.backgroundColor = UIColor.yellow
|
|
|
+
|
|
|
+ let lineWidth: CGFloat = 0.5
|
|
|
+ let lineLayer = CALayer()
|
|
|
+ lineLayer.backgroundColor = k999999Color.cgColor
|
|
|
+ lineLayer.frame = CGRect(x: 0, y: segmentedView.bounds.height - lineWidth, width: segmentedView.bounds.width, height: lineWidth)
|
|
|
+ segmentedView.layer.addSublayer(lineLayer)
|
|
|
return segmentedView
|
|
|
}()
|
|
|
|
|
@@ -214,8 +216,9 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
segmentedDataSource.titles = categoryTitleArr
|
|
|
segmentedDataSource.isTitleColorGradientEnabled = true
|
|
|
segmentedDataSource.isItemSpacingAverageEnabled = true
|
|
|
- segmentedDataSource.titleNormalColor = kffffffColor
|
|
|
- segmentedDataSource.titleSelectedColor = kbbbbbbColor
|
|
|
+ segmentedDataSource.isTitleZoomEnabled = true
|
|
|
+ segmentedDataSource.titleNormalColor = kbbbbbbColor
|
|
|
+ segmentedDataSource.titleSelectedColor = kffffffColor
|
|
|
segmentedDataSource.titleNormalFont = kRegularFont14!
|
|
|
segmentedDataSource.titleSelectedFont = kMediumFont14
|
|
|
|
|
@@ -227,9 +230,11 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
//3.初始化指示器indicator
|
|
|
lazy var indicator: JXSegmentedIndicatorLineView = {
|
|
|
let indicator = JXSegmentedIndicatorLineView()
|
|
|
- indicator.indicatorColor = kFFA42FColor
|
|
|
- indicator.indicatorHeight = 4
|
|
|
- indicator.indicatorWidth = 34
|
|
|
+ indicator.indicatorColor = kffffffColor
|
|
|
+ indicator.indicatorHeight = 3
|
|
|
+ indicator.indicatorWidth = 20
|
|
|
+ indicator.cornerRadius = 1.5
|
|
|
+ indicator.masksToBounds = true
|
|
|
return indicator
|
|
|
}()
|
|
|
|
|
@@ -238,8 +243,7 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
let listContainerView = JXSegmentedListContainerView(dataSource: self)
|
|
|
listContainerView.didAppearPercent = 0.01
|
|
|
listContainerView.defaultSelectedIndex = 0
|
|
|
- listContainerView.scrollView.isScrollEnabled = true
|
|
|
- listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114)
|
|
|
+ listContainerView.frame = CGRect(x: 0, y: 48+44, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 103 - 114)
|
|
|
return listContainerView
|
|
|
}()
|
|
|
|
|
@@ -252,12 +256,15 @@ class PublishMusicChooseView: FWPopupView {
|
|
|
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"
|
|
|
+ // 用户点击外部遮罩层页面是否可以消失
|
|
|
+ vProperty.touchWildToHide = "0"
|
|
|
view.vProperty = vProperty
|
|
|
view.show()
|
|
|
|
|
|
view.cancelButton.rx.tap.subscribe(onNext: { (data) in
|
|
|
view.hide()
|
|
|
+ MusicPlayManager.shared().destroyPlayer()
|
|
|
+ MusicPlayManager.shared().curPlayingId = -1
|
|
|
|
|
|
}).disposed(by: view.disposeBag)
|
|
|
|
|
@@ -315,7 +322,10 @@ extension PublishMusicChooseView : JXSegmentedViewDelegate {
|
|
|
extension PublishMusicChooseView :JXSegmentedListContainerViewDataSource {
|
|
|
|
|
|
func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
|
|
|
- return categoryTitleArr.count
|
|
|
+ if let titleDataSource = segmentedView.dataSource as? JXSegmentedBaseDataSource {
|
|
|
+ return titleDataSource.dataSource.count
|
|
|
+ }
|
|
|
+ return 0
|
|
|
}
|
|
|
func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
|
|
|
let listVc = PublishMusicListController()
|
|
@@ -324,6 +334,12 @@ extension PublishMusicChooseView :JXSegmentedListContainerViewDataSource {
|
|
|
} else {
|
|
|
listVc.categoryItemMdl = categoryListMdlArr![index-1]
|
|
|
}
|
|
|
+ listVc.selMusicClosure = {
|
|
|
+ [weak self] (musicUrl) in
|
|
|
+ MusicPlayManager.shared().initPlay()
|
|
|
+ MusicPlayManager.shared().audioUrl = musicUrl
|
|
|
+ MusicPlayManager.shared().playAudio()
|
|
|
+ }
|
|
|
return listVc
|
|
|
}
|
|
|
}
|