|
@@ -34,39 +34,17 @@ class TSGeneratorloadingView: TSBaseView {
|
|
|
|
|
|
|
|
|
|
|
|
- lazy var timeLabelBgView: UIView = {
|
|
|
- let view = UIView()
|
|
|
- view.clipsToBounds = true
|
|
|
- view.addSubview(timeLabel)
|
|
|
- timeLabel.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(0)
|
|
|
- make.leading.equalTo(16)
|
|
|
- make.trailing.equalTo(-16)
|
|
|
- make.height.equalTo(27)
|
|
|
- make.bottom.equalTo(-17)
|
|
|
- }
|
|
|
- return view
|
|
|
+ lazy var cusStackView: TSCustomStackView = {
|
|
|
+ let cusStackView = TSCustomStackView(axis: .vertical,spacing: 0)
|
|
|
+ cusStackView.scrollView.isScrollEnabled = false
|
|
|
+ return cusStackView
|
|
|
}()
|
|
|
-
|
|
|
+
|
|
|
lazy var timeLabel: UILabel = {
|
|
|
let textLabel = UILabel.createLabel(font: .font(size: 18,weight: .semibold),textColor: .white,textAlignment: .center)
|
|
|
return textLabel
|
|
|
}()
|
|
|
|
|
|
- lazy var textLabelBgView: UIView = {
|
|
|
- let view = UIView()
|
|
|
- view.clipsToBounds = true
|
|
|
- view.addSubview(textLabel)
|
|
|
- textLabel.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(0)
|
|
|
- make.leading.equalTo(16)
|
|
|
- make.trailing.equalTo(-16)
|
|
|
- make.height.equalTo(27)
|
|
|
- make.bottom.equalTo(-8)
|
|
|
- }
|
|
|
- return view
|
|
|
- }()
|
|
|
-
|
|
|
lazy var textLabel: UILabel = {
|
|
|
let textLabel = UILabel.createLabel(font: .font(size: 18),textColor: .white,textAlignment: .center)
|
|
|
return textLabel
|
|
@@ -101,6 +79,7 @@ class TSGeneratorloadingView: TSBaseView {
|
|
|
return xBtn
|
|
|
}()
|
|
|
|
|
|
+
|
|
|
override func creatUI() {
|
|
|
|
|
|
contentView.addSubview(blurEffect)
|
|
@@ -119,35 +98,48 @@ class TSGeneratorloadingView: TSBaseView {
|
|
|
make.top.equalTo(250.0)
|
|
|
}
|
|
|
|
|
|
- contentView.addSubview(timeLabel)
|
|
|
- timeLabel.snp.makeConstraints { make in
|
|
|
+
|
|
|
+ contentView.addSubview(cusStackView)
|
|
|
+ cusStackView.snp.makeConstraints { make in
|
|
|
make.top.equalTo(imageView.snp.bottom).offset(-20)
|
|
|
+ make.leading.equalTo(0)
|
|
|
+ make.trailing.equalTo(0)
|
|
|
+ make.bottom.equalTo(0)
|
|
|
+ }
|
|
|
+
|
|
|
+ cusStackView.addSubviewToStackWhiteBoard(timeLabel)
|
|
|
+ timeLabel.snp.makeConstraints { make in
|
|
|
+ make.top.equalTo(0)
|
|
|
make.leading.equalTo(16)
|
|
|
make.trailing.equalTo(-16)
|
|
|
make.height.equalTo(27)
|
|
|
+ make.bottom.equalTo(-17)
|
|
|
}
|
|
|
|
|
|
- contentView.addSubview(textLabel)
|
|
|
+ cusStackView.addSubviewToStackWhiteBoard(textLabel)
|
|
|
textLabel.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(timeLabel.snp.bottom).offset(17)
|
|
|
+ make.top.equalTo(0)
|
|
|
make.leading.equalTo(16)
|
|
|
make.trailing.equalTo(-16)
|
|
|
make.height.equalTo(27)
|
|
|
+ make.bottom.equalTo(-8)
|
|
|
}
|
|
|
|
|
|
- contentView.addSubview(infoLabel)
|
|
|
+ cusStackView.addSubviewToStackWhiteBoard(infoLabel)
|
|
|
infoLabel.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(textLabel.snp.bottom).offset(8)
|
|
|
+ make.top.equalTo(0)
|
|
|
make.leading.equalTo(16)
|
|
|
make.trailing.equalTo(-16)
|
|
|
+ make.bottom.equalTo(-20)
|
|
|
}
|
|
|
|
|
|
- contentView.addSubview(regenerateBtn)
|
|
|
+ cusStackView.addSubview(regenerateBtn)
|
|
|
regenerateBtn.snp.makeConstraints { make in
|
|
|
- make.top.equalTo(infoLabel.snp.bottom).offset(20)
|
|
|
+ make.top.equalTo(0)
|
|
|
make.centerX.equalToSuperview()
|
|
|
make.height.equalTo(44)
|
|
|
make.width.equalTo(126*kDesignScale)
|
|
|
+ make.bottom.equalTo(0)
|
|
|
}
|
|
|
|
|
|
//关闭按钮
|
|
@@ -158,23 +150,27 @@ class TSGeneratorloadingView: TSBaseView {
|
|
|
make.width.equalTo(36)
|
|
|
make.height.equalTo(36)
|
|
|
}
|
|
|
+
|
|
|
+ timeLabel.superview?.isHidden = true
|
|
|
+ infoLabel.superview?.isHidden = true
|
|
|
+
|
|
|
}
|
|
|
|
|
|
override func dealThings() {
|
|
|
- // 监听应用生命周期事件
|
|
|
- NotificationCenter.default.addObserver(
|
|
|
- self,
|
|
|
- selector: #selector(handleAppDidEnterBackground),
|
|
|
- name: UIApplication.didEnterBackgroundNotification,
|
|
|
- object: nil
|
|
|
- )
|
|
|
-
|
|
|
- NotificationCenter.default.addObserver(
|
|
|
- self,
|
|
|
- selector: #selector(handleAppWillEnterForeground),
|
|
|
- name: UIApplication.willEnterForegroundNotification,
|
|
|
- object: nil
|
|
|
- )
|
|
|
+// // 监听应用生命周期事件
|
|
|
+// NotificationCenter.default.addObserver(
|
|
|
+// self,
|
|
|
+// selector: #selector(handleAppDidEnterBackground),
|
|
|
+// name: UIApplication.didEnterBackgroundNotification,
|
|
|
+// object: nil
|
|
|
+// )
|
|
|
+//
|
|
|
+// NotificationCenter.default.addObserver(
|
|
|
+// self,
|
|
|
+// selector: #selector(handleAppWillEnterForeground),
|
|
|
+// name: UIApplication.willEnterForegroundNotification,
|
|
|
+// object: nil
|
|
|
+// )
|
|
|
}
|
|
|
|
|
|
|
|
@@ -232,3 +228,50 @@ class TSGeneratorloadingView: TSBaseView {
|
|
|
contentView.backgroundColor = color
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+extension TSGeneratorloadingView{
|
|
|
+
|
|
|
+ func updateShowProgress(text:String) {
|
|
|
+ isHidden = false
|
|
|
+ showLoading(text: text)
|
|
|
+ isRotating = true
|
|
|
+
|
|
|
+ if timeLabel.text?.count ?? 0 > 0 {
|
|
|
+ timeLabel.superview?.isHidden = false
|
|
|
+ }
|
|
|
+
|
|
|
+ if infoLabel.text?.count ?? 0 > 0 {
|
|
|
+ infoLabel.superview?.isHidden = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func updateShowLoading(text:String){
|
|
|
+ isHidden = false
|
|
|
+ showLoading(text: text)
|
|
|
+ isRotating = true
|
|
|
+
|
|
|
+ if timeLabel.text?.count ?? 0 > 0 {
|
|
|
+ timeLabel.superview?.isHidden = false
|
|
|
+ }
|
|
|
+
|
|
|
+ if infoLabel.text?.count ?? 0 > 0 {
|
|
|
+ infoLabel.superview?.isHidden = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func updateShowError(text:String?){
|
|
|
+ let msg = "Failed to generate, please try later".localized
|
|
|
+ isHidden = false
|
|
|
+ showError(text: msg)
|
|
|
+ isRotating = false
|
|
|
+ timeLabel.superview?.isHidden = true
|
|
|
+ infoLabel.superview?.isHidden = true
|
|
|
+ }
|
|
|
+
|
|
|
+ func updateShowSuccess(){
|
|
|
+ isHidden = true
|
|
|
+ isRotating = false
|
|
|
+ }
|
|
|
+
|
|
|
+}
|