|
@@ -24,6 +24,12 @@ public class PQSlideView: UIView {
|
|
|
public var btnClickBloc: ((_ sender: UIButton) -> Void)?
|
|
|
public var isDragingProgressSlder: Bool = false
|
|
|
|
|
|
+ public var isHiddenPlayBtn: Bool = false {
|
|
|
+ didSet {
|
|
|
+ playerBtn.isHidden = isHiddenPlayBtn
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public lazy var playerBtn: UIButton = {
|
|
|
let playerBtn = UIButton()
|
|
|
playerBtn.setImage(UIImage(named: "icon_video_stop"), for: .normal)
|
|
@@ -49,8 +55,8 @@ public class PQSlideView: UIView {
|
|
|
sliderView.setMaximumTrackImage(thbImage, for: .normal)
|
|
|
sliderView.setThumbImage(thbImage, for: .highlighted)
|
|
|
sliderView.setThumbImage(thbImage, for: .normal)
|
|
|
- sliderView.maximumTrackTintColor = UIColor.hexColor(hexadecimal: "#666666")
|
|
|
- sliderView.minimumTrackTintColor = UIColor.white
|
|
|
+ sliderView.maximumTrackTintColor = UIColor.hexColor(hexadecimal: "#303030")
|
|
|
+ sliderView.minimumTrackTintColor = UIColor.hexColor(hexadecimal: "#FA6400")
|
|
|
sliderView.addTarget(self, action: #selector(sliderTouchBegan(sender:)), for: .touchDown)
|
|
|
sliderView.addTarget(self, action: #selector(sliderTouchEnded(sender:)), for: .touchUpInside)
|
|
|
sliderView.addTarget(self, action: #selector(sliderTouchEnded(sender:)), for: .touchUpOutside)
|
|
@@ -81,7 +87,6 @@ public class PQSlideView: UIView {
|
|
|
addSubview(sliderView)
|
|
|
addSubview(totalLab)
|
|
|
addSubview(fullScreenBtn)
|
|
|
- addLayout()
|
|
|
}
|
|
|
|
|
|
public required init?(coder _: NSCoder) {
|
|
@@ -106,6 +111,7 @@ public class PQSlideView: UIView {
|
|
|
|
|
|
override public func layoutSubviews() {
|
|
|
super.layoutSubviews()
|
|
|
+ addLayout()
|
|
|
}
|
|
|
|
|
|
public func addData() {
|
|
@@ -124,15 +130,26 @@ public class PQSlideView: UIView {
|
|
|
}
|
|
|
|
|
|
public func addLayout() {
|
|
|
- playerBtn.snp.makeConstraints { make in
|
|
|
- make.centerY.equalToSuperview()
|
|
|
- make.height.width.equalTo(cDefaultMargin * 4)
|
|
|
- make.left.equalTo(self)
|
|
|
- }
|
|
|
- currentTimeLab.snp.makeConstraints { make in
|
|
|
- make.left.equalTo(playerBtn.snp.right).offset(cDefaultMargin)
|
|
|
- make.width.greaterThanOrEqualTo(35)
|
|
|
- make.centerY.equalToSuperview()
|
|
|
+ if isHiddenPlayBtn {
|
|
|
+ playerBtn.snp.remakeConstraints { make in
|
|
|
+ make.size.equalTo(CGSize.zero)
|
|
|
+ }
|
|
|
+ currentTimeLab.snp.remakeConstraints { make in
|
|
|
+ make.left.equalToSuperview()
|
|
|
+ make.width.greaterThanOrEqualTo(35)
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ playerBtn.snp.remakeConstraints { make in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.height.width.equalTo(cDefaultMargin * 4)
|
|
|
+ make.left.equalTo(self)
|
|
|
+ }
|
|
|
+ currentTimeLab.snp.remakeConstraints { make in
|
|
|
+ make.left.equalTo(playerBtn.snp.right).offset(cDefaultMargin)
|
|
|
+ make.width.greaterThanOrEqualTo(35)
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ }
|
|
|
}
|
|
|
fullScreenBtn.snp.makeConstraints { make in
|
|
|
make.right.equalTo(self)
|