From: liangzhenying <867174124@qq.com> Date: Sat, 28 Feb 2026 06:39:03 +0000 (+0800) Subject: playbooy UI修改 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=3e5b24b541c449699ffdbaae52b6f666418d8cc0;p=mirrors%2FShenYin.git playbooy UI修改 --- diff --git a/ShenYin/ShenYin.xcodeproj/project.pbxproj b/ShenYin/ShenYin.xcodeproj/project.pbxproj index 2c4d4fc..dd62d89 100644 --- a/ShenYin/ShenYin.xcodeproj/project.pbxproj +++ b/ShenYin/ShenYin.xcodeproj/project.pbxproj @@ -447,7 +447,6 @@ UI/Mine/UserInfo/UserInfoVC.swift, UI/Mine/UserManagerVC.swift, UI/Mode/CustomEqVC.swift, - UI/Mode/File.swift, UI/Mode/FindVC.swift, UI/Mode/GlassesFindVC.swift, UI/Mode/ModeControView.swift, @@ -1532,7 +1531,7 @@ CODE_SIGN_ENTITLEMENTS = ShenYin/PLAYBOY.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 202602271413; + CURRENT_PROJECT_VERSION = 202602271705; DEVELOPMENT_TEAM = JKLJ58J33Q; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1588,7 +1587,7 @@ CODE_SIGN_ENTITLEMENTS = ShenYin/PLAYBOY.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 202602271413; + CURRENT_PROJECT_VERSION = 202602271705; DEVELOPMENT_TEAM = JKLJ58J33Q; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/ShenYin/ShenYin/Sdk/DcSdk/VC/AiFunctionVC.swift b/ShenYin/ShenYin/Sdk/DcSdk/VC/AiFunctionVC.swift index df4e4bf..1d67bf2 100644 --- a/ShenYin/ShenYin/Sdk/DcSdk/VC/AiFunctionVC.swift +++ b/ShenYin/ShenYin/Sdk/DcSdk/VC/AiFunctionVC.swift @@ -96,7 +96,7 @@ class AiFunctionVC:BaseVC{ } fileprivate class AiFunctionHeadView: BaseView { - let connetedView = UIImageView(image: UIImage(named: "device_conneted_bg")) + let icon = CurrentDeviceView() let bottonView = UIView() let tipsIcon = UIImageView() @@ -106,27 +106,23 @@ fileprivate class AiFunctionHeadView: BaseView { var enable:Bool = false{ didSet{ if enable { - self.alpha = 1 - connetedView.isHidden = false + icon.connetedView.isHidden = false } else{ - self.alpha = 0.5 - connetedView.isHidden = true + icon.connetedView.isHidden = true } } } override func setupViews() { addSubviews([icon,bottonView]) - icon.addSubviews([connetedView]) + bottonView.addSubviews([titleLabel,valueLabel,tipsIcon,arrowIcon]) // backgroundColor = .blue icon.do { v in // v.backgroundColor = .lightGray } - connetedView.do { v in - v.isHidden = true - } + bottonView.do { v in v.backgroundColor = .color(.cellBg) v.yc.setCornerRadius(8) @@ -175,9 +171,6 @@ fileprivate class AiFunctionHeadView: BaseView { make.right.equalToSuperview().inset(16) make.centerY.equalToSuperview() } - connetedView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } } } fileprivate class AiFunctionView: BaseView { diff --git a/ShenYin/ShenYin/Sdk/DcSdk/VC/HomeDeviceVC.swift b/ShenYin/ShenYin/Sdk/DcSdk/VC/HomeDeviceVC.swift index 0f24292..3d1d90a 100644 --- a/ShenYin/ShenYin/Sdk/DcSdk/VC/HomeDeviceVC.swift +++ b/ShenYin/ShenYin/Sdk/DcSdk/VC/HomeDeviceVC.swift @@ -6,6 +6,7 @@ // import UIKit +import Kingfisher class HomeDeviceVC:BaseVC{ private var collectionView:UICollectionView! @@ -43,8 +44,10 @@ class HomeDeviceVC:BaseVC{ v.delegate = self v.backgroundColor = .clear v.bounces = true + v.isHidden = true v.contentInset = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18) - v.register(HomeDeviceCell.self, forCellWithReuseIdentifier: HomeDeviceCell.reuseID) + v.register(DcHomeDeviceCell.self, forCellWithReuseIdentifier: DcHomeDeviceCell.reuseID) + v.register(DcHomeAddCell.self, forCellWithReuseIdentifier: DcHomeAddCell.reuseID) v.register(HomeHeadInfoView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier:HomeHeadInfoView.reuseID ) v.register(HomeAddDeviceView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier:HomeAddDeviceView.reuseID ) } @@ -73,6 +76,7 @@ class HomeDeviceVC:BaseVC{ } func reloadData() { DeviceVM.shared.refresh {[weak self] result in + self?.collectionView.isHidden = false self?.collectionView.reloadData() if CCBleManager.shared.isConnetd{ return @@ -145,19 +149,35 @@ extension HomeDeviceVC:UICollectionViewDataSource,UICollectionViewDelegate,UICol return 1 } func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return DeviceVM.shared.dataList.count + if DeviceVM.shared.dataList.count > 0 { + return DeviceVM.shared.dataList.count + 1 + } + else{ + return 0 + } } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - let cell = HomeDeviceCell.cell(withCollectionView: collectionView, indexPath: indexPath) - cell.model = DeviceVM.shared.dataList[indexPath.row] - cell.longPress = {[weak self] model in - self?.unbindAction(model) + if DeviceVM.shared.dataList.count > 0 && indexPath.row == DeviceVM.shared.dataList.count { + let cell = DcHomeAddCell.cell(withCollectionView: collectionView, indexPath: indexPath) + return cell + } + else{ + let cell = DcHomeDeviceCell.cell(withCollectionView: collectionView, indexPath: indexPath) + cell.model = DeviceVM.shared.dataList[indexPath.row] + cell.longPress = {[weak self] model in + self?.unbindAction(model) + } + return cell } - return cell } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - let model = DeviceVM.shared.dataList[indexPath.row] - App.shared.goToPage(AiFunctionVC(device: model)) + if indexPath.row == DeviceVM.shared.dataList.count { + App.shared.goToPage(BleScanVC()) + } + else{ + let model = DeviceVM.shared.dataList[indexPath.row] + App.shared.goToPage(AiFunctionVC(device: model)) + } } func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView{ @@ -176,9 +196,149 @@ extension HomeDeviceVC:UICollectionViewDataSource,UICollectionViewDelegate,UICol } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { - return CGSize(width: kScreenWid, height: 160) + return CGSize(width: kScreenWid, height: 128) } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize { return CGSize(width: kScreenWid, height: 82) } } + + + +class DcHomeDeviceCell: BaseCollectionViewCell { + let bgView = UIView() + let icon = UIImageView() + let titleLabel = UILabel() + let valueLabel = UILabel() + var longPress:((_ model:HomeDeviceModel)->Void)? + + var model:HomeDeviceModel!{ + didSet{ + titleLabel.text = model.productName + + icon.kf.setImage(with: model.image.yc.asUrl) + + if CCBleManager.shared.isConected(mac: model.mac) { + valueLabel.text = "已连接".l10n + bgView.alpha = 1 + } + else{ + valueLabel.text = "未连接".l10n + bgView.alpha = 0.5 + } + } + } + var enable:Bool = false{ + didSet{ + if enable { + alpha = 1 + } + else{ + alpha = 0.5 + } + } + } + + override func setupViews() { + addSubview(bgView) + bgView.addSubviews([titleLabel,icon,valueLabel]) + bgView.do { v in + v.backgroundColor = .white + v.yc.setCornerRadius(20) + } + icon.do { v in + // v.backgroundColor = .lightGray + v.contentMode = .scaleAspectFit + } + titleLabel.do { (v) in + v.textColor = .rgb(0x121212) + v.font = .bold(14) + v.adjustsFontSizeToFitWidth = true + } + valueLabel.do { (v) in + v.textColor = .color(.placeholder) + v.font = .regular(12) + } + let longTap = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress(_:))) + bgView.addGestureRecognizer(longTap) + } + + override func setupLayout() { + bgView.snp.makeConstraints { make in + make.left.right.top.bottom.equalToSuperview() + } + + titleLabel.snp.makeConstraints { (m) in + m.top.equalToSuperview().inset(80) + m.left.right.equalToSuperview().inset(15) + } + valueLabel.snp.makeConstraints { (m) in + m.top.equalTo(titleLabel.snp.bottom).offset(2) + m.left.equalTo(titleLabel) + } + icon.snp.makeConstraints { (m) in + m.width.equalTo(80) + m.height.equalTo(60) + m.left.equalToSuperview().inset(0) + m.top.equalToSuperview().inset(17) + } + } + + @objc func handleLongPress(_ gesture: UILongPressGestureRecognizer) { + if gesture.state == .began { + CustomAlert.showWith(title: "提示".l10n, messgage: "确定要解绑该设备吗?".l10n, cancelCallback: {}) {[weak self] in + guard let self = self else{return} + longPress?(model) + } + } else if gesture.state == .ended { + print("长按结束") + } + } + +} +fileprivate class DcHomeAddCell: BaseCollectionViewCell { + let bgView = UIView() + let icon = UIImageView() + let titleLabel = UILabel() + + + override func setupViews() { + addSubview(bgView) + bgView.addSubviews([titleLabel,icon]) + bgView.do { v in + v.backgroundColor = .white + v.yc.setCornerRadius(20) + } + icon.do { v in + // v.backgroundColor = .lightGray + v.contentMode = .scaleAspectFit + v.image = UIImage(named: "add_device") + } + titleLabel.do { (v) in + v.textColor = .color(.secondary) + v.font = .semiBold(14) + v.adjustsFontSizeToFitWidth = true + v.text = "添加新设备".l10n + } + + } + + override func setupLayout() { + bgView.snp.makeConstraints { make in + make.left.right.top.bottom.equalToSuperview() + } + icon.snp.makeConstraints { (m) in + m.size.equalTo(24) + m.left.equalToSuperview().inset(30) + m.centerY.equalToSuperview() + } + titleLabel.snp.makeConstraints { (m) in + m.centerY.equalToSuperview() + m.right.equalToSuperview().inset(15) + m.left.equalTo(64) + } + + } + + +} diff --git a/ShenYin/ShenYin/Sdk/DcSdk/VC/ModeVC.swift b/ShenYin/ShenYin/Sdk/DcSdk/VC/ModeVC.swift index e27c0e1..22b9406 100644 --- a/ShenYin/ShenYin/Sdk/DcSdk/VC/ModeVC.swift +++ b/ShenYin/ShenYin/Sdk/DcSdk/VC/ModeVC.swift @@ -83,6 +83,8 @@ extension ModeVC{ func updateState(){ self.findView.alpha = CCBleManager.shared.isConnetd ? 1:0.5 self.navBar.title = CCBleManager.shared.connectPeripheral?.device.name ?? "" + + headerView.connetedView.isHidden = !CCBleManager.shared.isConnetd } diff --git a/ShenYin/ShenYin/UI/Home/Dialog/DialogRecordBar.swift b/ShenYin/ShenYin/UI/Home/Dialog/DialogRecordBar.swift index a0abc8a..a04156a 100644 --- a/ShenYin/ShenYin/UI/Home/Dialog/DialogRecordBar.swift +++ b/ShenYin/ShenYin/UI/Home/Dialog/DialogRecordBar.swift @@ -271,7 +271,7 @@ class DialogRecordBar: BaseView { v.language = CCAiLanguage.chinse v.yc.addTap(target: self, action: #selector(leftLanguageAction)) v.language = .chinse - v.valueLabel.text = "耳机".l10n + v.valueLabel.text = CCDevice.isJoy ? "耳机".l10n:"眼镜".l10n } rightItem.do { (v) in v.language = CCAiLanguage.english diff --git a/ShenYin/ShenYin/UI/Home/FieldRecording/RecordBar.swift b/ShenYin/ShenYin/UI/Home/FieldRecording/RecordBar.swift index 547d359..6595e20 100644 --- a/ShenYin/ShenYin/UI/Home/FieldRecording/RecordBar.swift +++ b/ShenYin/ShenYin/UI/Home/FieldRecording/RecordBar.swift @@ -174,7 +174,7 @@ class RecordBar: BaseView { valueLabel.do { v in v.textColor = .color(.secondary) v.font = .regular(10) - v.text = "耳机".l10n + v.text = CCDevice.isJoy ? "耳机".l10n:"眼镜".l10n } } diff --git a/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift b/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift index 731144f..eea4c97 100644 --- a/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift +++ b/ShenYin/ShenYin/UI/Home/RecordDetail/RecordDetailVC.swift @@ -485,7 +485,7 @@ extension RecordDetailVC{ self?.showUploadSuccess() } else{ - YLprogressHUD.showAutoHiden("请求失败".l10n) + YLprogressHUD.showAutoHiden(model.msg) } } } diff --git a/ShenYin/ShenYin/UI/Home/Root/CurrentDeviceView.swift b/ShenYin/ShenYin/UI/Home/Root/CurrentDeviceView.swift index 46d5ab9..ec3d5d0 100644 --- a/ShenYin/ShenYin/UI/Home/Root/CurrentDeviceView.swift +++ b/ShenYin/ShenYin/UI/Home/Root/CurrentDeviceView.swift @@ -6,13 +6,18 @@ // class CurrentDeviceView: BaseView { + let connetedView = UIImageView(image: UIImage(named: "device_conneted_bg")) let imageView = UIImageView() override func setupViews() { // backgroundColor = .blue addSubviews([imageView]) + addSubviews([connetedView]) imageView.do { v in v.image = UIImage(named: "home_header") } + connetedView.do { v in + v.isHidden = true + } NotificationManager.add(self, selector: #selector(deviceChange(_:)), forName: .deviceValidChange) updateUI() } @@ -36,6 +41,9 @@ class CurrentDeviceView: BaseView { make.bottom.equalToSuperview().inset(20) } } + connetedView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } } @objc func deviceChange(_ noti:Notification){ updateUI() diff --git a/ShenYin/ShenYin/UI/Mode/File.swift b/ShenYin/ShenYin/UI/Mode/File.swift deleted file mode 100644 index 97b11b6..0000000 --- a/ShenYin/ShenYin/UI/Mode/File.swift +++ /dev/null @@ -1,9 +0,0 @@ -// -// File.swift -// ShenYin -// -// Created by liangshi on 2025/9/9. -// - - - diff --git a/ShenYin/ShenYin/lan/chinese.swift b/ShenYin/ShenYin/lan/chinese.swift index 9625f10..ef71e3d 100644 --- a/ShenYin/ShenYin/lan/chinese.swift +++ b/ShenYin/ShenYin/lan/chinese.swift @@ -556,5 +556,7 @@ let chineseMap:[String:String] = "倒计时结束后关闭APP":"", "播放完整首后停止":"", "自定义时间":"", + + "眼镜" : "", ] diff --git a/ShenYin/ShenYin/lan/english.swift b/ShenYin/ShenYin/lan/english.swift index ddddc69..6d2bd92 100644 --- a/ShenYin/ShenYin/lan/english.swift +++ b/ShenYin/ShenYin/lan/english.swift @@ -554,4 +554,6 @@ let englishMap:[String:String] = "倒计时结束后关闭APP":"Close APP after countdown", "播放完整首后停止":"Stop after playing full song", "自定义时间":"Custom Time", + +"眼镜" : "glasses", ]