You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
4.1 KiB
120 lines
4.1 KiB
![]()
2 years ago
|
//
|
||
|
// DeviceHeaderView.swift
|
||
![]()
1 year ago
|
// FireBoltt
|
||
![]()
2 years ago
|
//
|
||
|
// Created by lemo. on 2020/3/22.
|
||
|
// Copyright © 2020 Sheldon. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import UIKit
|
||
|
|
||
|
// MARK:- 常量
|
||
|
fileprivate struct Metric {
|
||
|
static let otherColor = kHexColor(0x000000)
|
||
|
static let otherFont = SystemRegularFont(10)
|
||
|
static let backgroundColor = kHexColor(0xFBFBFB)
|
||
|
static let titleFont = SystemRegularFont(18)
|
||
|
}
|
||
|
|
||
|
class DeviceHeaderView: UIView {
|
||
|
|
||
![]()
1 year ago
|
lazy var fbdeviceNameLabel: UILabel = {
|
||
![]()
2 years ago
|
let label = UILabel().then {
|
||
![]()
1 year ago
|
$0.textColor = ThemeManagerFrieBoltt.commonTextColor
|
||
![]()
2 years ago
|
$0.font = Metric.titleFont
|
||
|
addSubview($0)
|
||
|
}
|
||
|
label.text = "设备名称"
|
||
|
return label;
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fbdeviceIcon: UIImageView = {
|
||
|
let imageView = UIImageView(image: R.image.fb_icon_device()).then {
|
||
![]()
2 years ago
|
addSubview($0)
|
||
|
}
|
||
|
return imageView
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fbstatusBtn: UIButton = {
|
||
![]()
2 years ago
|
let btn = UIButton(type: .custom).then {
|
||
|
$0.setTitleColor(Metric.otherColor, for: .normal)
|
||
|
$0.titleLabel?.font = Metric.otherFont
|
||
|
$0.imageEdgeInsets = UIEdgeInsets(top: 0, left: -10, bottom: 0, right: 0)
|
||
|
addSubview($0)
|
||
|
}
|
||
![]()
1 year ago
|
btn.setImage(R.image.fb_icon_watch_notConnect(), for: .normal)
|
||
|
btn.setTitle(MultiLanguageKey_FB.disConnectedFB.localized, for: .normal)
|
||
|
btn.setImage(R.image.fb_icon_watch_connect(), for: .selected)
|
||
|
btn.setTitle(MultiLanguageKey_FB.coonectedFB.localized, for: .selected)
|
||
![]()
2 years ago
|
return btn
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fbpowerBtn: UIButton = {
|
||
![]()
2 years ago
|
let btn = UIButton(type: .custom).then {
|
||
|
$0.setTitleColor(Metric.otherColor, for: .normal)
|
||
|
$0.titleLabel?.font = Metric.otherFont;
|
||
|
$0.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: -10)
|
||
|
addSubview($0)
|
||
|
}
|
||
|
btn.setImage(R.image.power_0(), for: .normal)
|
||
![]()
1 year ago
|
btn.setTitle(MultiLanguageKey_FB.powerFB.localized, for: .normal)
|
||
![]()
2 years ago
|
return btn
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fbsyncBtn: UIButton = {
|
||
![]()
2 years ago
|
let btn = UIButton(type: .custom).then {
|
||
![]()
1 year ago
|
$0.setTitle(MultiLanguageKey_FB.syncDataFB.localized, for: .normal)
|
||
![]()
2 years ago
|
$0.setTitleColor(kHexColor(0x33D700), for: .normal)
|
||
![]()
2 years ago
|
$0.titleLabel?.font = Metric.otherFont
|
||
|
addSubview($0)
|
||
|
}
|
||
|
btn.layer.cornerRadius = kScaleWidth(15)
|
||
|
btn.layer.borderWidth = 1
|
||
![]()
2 years ago
|
btn.borderColor = kHexColor(0x33D700)
|
||
![]()
2 years ago
|
return btn
|
||
|
}()
|
||
![]()
1 year ago
|
lazy var fbbottomSection: UIView = {
|
||
![]()
2 years ago
|
let view = UIView()
|
||
|
view.backgroundColor = kHexColor(0xFAFAFA)
|
||
|
addSubview(view)
|
||
|
return view
|
||
|
}()
|
||
|
|
||
|
override init(frame: CGRect) {
|
||
|
super.init(frame: frame)
|
||
|
setUpUI()
|
||
|
}
|
||
|
|
||
|
func setUpUI() {
|
||
![]()
1 year ago
|
fbdeviceIcon.snp.makeConstraints { (make) in
|
||
![]()
2 years ago
|
make.left.equalTo(kNavBarItemMargin)
|
||
|
make.top.equalTo(15)
|
||
|
make.width.height.equalTo(kScaleWidth(30))
|
||
|
}
|
||
![]()
1 year ago
|
fbdeviceNameLabel.snp.makeConstraints { (make) in
|
||
|
make.centerY.equalTo(fbdeviceIcon.snp.centerY)
|
||
|
make.left.equalTo(fbdeviceIcon.snp.right).offset(kScaleWidth(10))
|
||
![]()
2 years ago
|
}
|
||
![]()
1 year ago
|
fbstatusBtn.snp.makeConstraints { (make) in
|
||
|
make.left.equalTo(fbdeviceNameLabel.snp.left)
|
||
|
make.top.equalTo(fbdeviceNameLabel.snp.bottom).offset(kScaleWidth(10))
|
||
![]()
2 years ago
|
}
|
||
![]()
1 year ago
|
fbpowerBtn.snp.makeConstraints { (make) in
|
||
|
make.left.equalTo(fbstatusBtn.snp.right).offset(kScaleWidth(13))
|
||
|
make.top.equalTo(fbdeviceNameLabel.snp.bottom).offset(kScaleWidth(10))
|
||
![]()
2 years ago
|
}
|
||
![]()
1 year ago
|
fbsyncBtn.snp.makeConstraints { (make) in
|
||
|
make.centerY.equalTo(fbdeviceIcon.snp.centerY)
|
||
![]()
2 years ago
|
make.right.equalTo(-kNavBarItemMargin)
|
||
|
make.width.equalTo(kScaleWidth(65))
|
||
|
make.height.equalTo(kScaleWidth(30))
|
||
|
}
|
||
![]()
1 year ago
|
fbbottomSection.snp.makeConstraints { (make) in
|
||
![]()
2 years ago
|
make.width.equalToSuperview()
|
||
|
make.bottom.equalToSuperview()
|
||
|
make.height.equalTo(10)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
required init?(coder: NSCoder) {
|
||
|
fatalError("init(coder:) has not been implemented")
|
||
|
}
|
||
|
|
||
|
}
|