Blame view

HDFwear/Setting/VIew/DailCell.swift 1.98 KB
f2cf74c7   yangbin   1.0.20(4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  //
  //  DailCell.swift
  //  Twear
  //
  //  Created by yangbin on 2021/12/21.
  //
  
  import UIKit
  
  class DailCell: UICollectionViewCell {
      
      @IBOutlet weak var progressView: CustomProgress!
      @IBOutlet weak var dailImageView: UIImageView!
      var isSync = false
      
      var cellClickClosure: (() -> ())?
      
      func updateProgressView(_ value: Int, isDownload: Bool = false) {
          progressView.value = value
          progressView.layer.borderWidth = 1
          progressView.layer.borderColor = UIColor.rgbColorFromHex(0x00993E).cgColor
          if isDownload {
              progressView.label.text = LocString("下载中...")
          } else {
              progressView.label.text = LocString("安装中...")
          }
         
          progressView.label.textColor = .black
      }
      
      func syncComplete() {
          progressView.value = 100
          progressView.trackView.backgroundColor = LineColor
          progressView.layer.borderColor = LineColor.cgColor
          progressView.layer.borderWidth = 0
          progressView.label.text = LocString("已安装")
          progressView.label.textColor = .black
      }
  
      func initProgressView() {
          progressView.value = 0
          progressView.label.text = LocString("安装")
          progressView.label.textColor = UIColor.rgbColorFromHex(0x00993E)
          progressView.trackView.backgroundColor = UIColor.rgbColorFromHex(0x00993E)
          progressView.layer.borderWidth = 1
          progressView.layer.borderColor = UIColor.rgbColorFromHex(0x00993E).cgColor
      }
  
  
      
      override func awakeFromNib() {
          super.awakeFromNib()
          initProgressView()
          if !(AppSettings.shared.language == .Chinese || AppSettings.shared.language == .English) {
              progressView.label.font = RegularFont(10)
          }
          progressView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickHeaderView(_:))))
      }
      
      @objc private func clickHeaderView(_ gestureRecognizer: UITapGestureRecognizer) {
          cellClickClosure?()
      }
  }