|
@@ -7,7 +7,9 @@
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
+import Photos
|
|
|
import BFCommonKit
|
|
|
+import BFMaterialKit
|
|
|
|
|
|
public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
|
|
@@ -41,8 +43,8 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
return changeCollecBtn
|
|
|
}()
|
|
|
|
|
|
- lazy var albumController: PQPhotoAlbumController = {
|
|
|
- let albumController = PQPhotoAlbumController()
|
|
|
+ lazy var albumController: BFPhotoAlbumController = {
|
|
|
+ let albumController = BFPhotoAlbumController()
|
|
|
albumController.isTopShow = true
|
|
|
albumController.categoryH = cDefaultMargin * 40
|
|
|
addChild(albumController)
|
|
@@ -138,14 +140,14 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
}()
|
|
|
|
|
|
|
|
|
- lazy var materialListView: PQSelectedMaterialListView = {
|
|
|
- let materialListView = PQSelectedMaterialListView(frame: CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: 88))
|
|
|
+ lazy var materialListView: BFSelectedMaterialListView = {
|
|
|
+ let materialListView = BFSelectedMaterialListView(frame: CGRect(x: 0, y: cScreenHeigth, width: cScreenWidth, height: 88))
|
|
|
materialListView.deletedMaterialHandle = { [weak self] materialData, isDissmiss in
|
|
|
|
|
|
self?.dealWithSelectedMaterials(isDissmiss: isDissmiss, isChose: false, materialData: materialData)
|
|
|
}
|
|
|
materialListView.detailMaterialHandle = { [weak self] _, materialData in
|
|
|
- let detailVc: PQStuckPointMaterialDetailController = PQStuckPointMaterialDetailController()
|
|
|
+ let detailVc: BFMaterialDetailController = BFMaterialDetailController()
|
|
|
detailVc.materialDetailClickHandle = { [weak self] isMaterialSelected, materialData in
|
|
|
if isMaterialSelected != materialData?.isSelected {
|
|
|
self?.photoMaterialVc.updateMaterials(isSelected:!(isMaterialSelected ?? false), materialData: materialData)
|
|
@@ -154,6 +156,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
if !(materialData?.isSelected ?? false) {
|
|
|
materialData?.selectedIndex = (self?.selectedDataCount ?? 0) + 1
|
|
|
}
|
|
|
+ detailVc.isStuckPoint = true
|
|
|
detailVc.materialData = materialData
|
|
|
self?.navigationController?.pushViewController(detailVc, animated: true)
|
|
|
}
|
|
@@ -161,13 +164,12 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
}()
|
|
|
|
|
|
|
|
|
- lazy var photoMaterialVc: PQPhotoMaterialController = {
|
|
|
- let photoMaterialVc = PQPhotoMaterialController()
|
|
|
+ lazy var photoMaterialVc: BFPhotosMaterialController = {
|
|
|
+ let photoMaterialVc = BFPhotosMaterialController()
|
|
|
photoMaterialVc.isShowMediaTag = false
|
|
|
photoMaterialVc.imageDuration = 1
|
|
|
addChild(photoMaterialVc)
|
|
|
view.insertSubview(photoMaterialVc.view, belowSubview: bottomRemindView)
|
|
|
-
|
|
|
photoMaterialVc.updateFrame(newFrame: CGRect(x: 0, y: (navHeadImageView?.frame.maxY ?? cDevice_iPhoneNavBarAndStatusBarHei) + margin / 2, width: view.frame.width, height: view.frame.height - ((navHeadImageView?.frame.maxY ?? cDevice_iPhoneNavBarAndStatusBarHei) + margin + bottomRemindView.frame.height)))
|
|
|
photoMaterialVc.selectedMaterialHandle = { [weak self] currentMaterialData, selectedPhotoData, selectedTotalDuration, imageCount in
|
|
|
self?.dealWithSelectedMaterial(materialData: currentMaterialData, selectedDatas: selectedPhotoData, totalDuration: selectedTotalDuration, imageCount: imageCount)
|
|
@@ -175,7 +177,8 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
self?.dealWithSelectedMaterials(isDissmiss: selectedPhotoData.count <= 0, isChose: true, materialData: currentMaterialData)
|
|
|
}
|
|
|
photoMaterialVc.detailMaterialHandle = { [weak self] _, currentMaterialData in
|
|
|
- let detailVc: PQStuckPointMaterialDetailController = PQStuckPointMaterialDetailController()
|
|
|
+ let detailVc: BFMaterialDetailController = BFMaterialDetailController()
|
|
|
+ detailVc.isStuckPoint = true
|
|
|
detailVc.materialDetailClickHandle = { [weak self] isMaterialSelected, materialData in
|
|
|
if isMaterialSelected != materialData?.isSelected {
|
|
|
self?.photoMaterialVc.updateMaterials(isSelected:!(isMaterialSelected ?? false), materialData: materialData)
|
|
@@ -229,7 +232,6 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
if sender?.isSelected ?? false {
|
|
|
albumController.showCategoryView()
|
|
|
} else {
|
|
|
- albumController.albaumCollectionView.reloadData()
|
|
|
albumController.dismissCategoryView()
|
|
|
}
|
|
|
case 10, 11, 12:
|
|
@@ -290,28 +292,29 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
|
|
|
|
|
|
|
|
|
- func albumSelectedHandle(seletedData: PQUploadModel?) {
|
|
|
- changeCollecBtn.isSelected = false
|
|
|
- if seletedData == nil {
|
|
|
- return
|
|
|
- }
|
|
|
+ func albumSelectedHandle(seletedData: PHAsset?) {
|
|
|
changeCollecBtn.setTitle(seletedData?.title ?? "全部", for: .normal)
|
|
|
+ changeCollecBtn.isSelected = false
|
|
|
changeCollecBtn.imagePosition(at: .right, space: cDefaultMargin / 2)
|
|
|
photoMaterialVc.assetCollection = seletedData?.assetCollection
|
|
|
photoMaterialVc.msgType = photoMaterialVc.msgType
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- func dealWithSelectedMaterial(materialData _: PQEditVisionTrackMaterialsModel?, selectedDatas: [PQEditVisionTrackMaterialsModel]?, totalDuration: Float64, imageCount: Int) {
|
|
|
+ func dealWithSelectedMaterial(materialData _: PHAsset?, selectedDatas: [PHAsset]?, totalDuration: Float64, imageCount: Int) {
|
|
|
selectedDataCount = selectedDatas?.count ?? 0
|
|
|
selectedImageDataCount = imageCount
|
|
|
confirmBtn.isSelected = (selectedDataCount > 0 && (imageCount >= 2 || selectedDataCount > imageCount))
|
|
|
if confirmBtn.isSelected {
|
|
|
- confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
|
|
|
+ confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#EE0051")
|
|
|
} else {
|
|
|
- confirmBtn.backgroundColor = PQBFConfig.shared.otherTintColor
|
|
|
+ confirmBtn.backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
|
|
|
}
|
|
|
if selectedDataCount <= 0 {
|
|
|
bottomRemindLab.attributedText = NSAttributedString(string: "至少选择 1 个视频或 2 张照片")
|
|
@@ -320,7 +323,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
bottomRemindLab.attributedText = att
|
|
|
} else {
|
|
|
let att = NSMutableAttributedString(string: "素材总时长 \(totalDuration.formatDurationToHMS())")
|
|
|
- att.setAttributes([.foregroundColor: UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)], range: NSRange(location: 6, length: "\(totalDuration.formatDurationToHMS())".count))
|
|
|
+ att.setAttributes([.foregroundColor: UIColor.hexColor(hexadecimal: "#EE0051")], range: NSRange(location: 6, length: "\(totalDuration.formatDurationToHMS())".count))
|
|
|
bottomRemindLab.attributedText = att
|
|
|
}
|
|
|
confirmBtn.setTitle(selectedDataCount > 0 ? "确定(\(selectedDataCount))" : "确定", for: .normal)
|
|
@@ -328,7 +331,7 @@ public class PQStuckPointMaterialController: PQBaseViewController {
|
|
|
|
|
|
|
|
|
|
|
|
- func dealWithSelectedMaterials(isDissmiss: Bool, isChose: Bool, materialData: PQEditVisionTrackMaterialsModel?) {
|
|
|
+ func dealWithSelectedMaterials(isDissmiss: Bool, isChose: Bool, materialData: PHAsset?) {
|
|
|
|
|
|
if materialData != nil {
|
|
|
if isChose {
|