chat setting voice actor

This commit is contained in:
mh 2025-11-03 17:55:18 +08:00
parent 3ca9d1a516
commit b893526abe
4 changed files with 58 additions and 23 deletions

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "role_voice_play@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "role_voice_play@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -55,7 +55,7 @@ class VoiceActorContainerCell: UITableViewCell, CellConfigurable {
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
tableView.dataSource = self tableView.dataSource = self
tableView.backgroundColor = UIColor(hex: "#F5F5FF") tableView.backgroundColor = .clear
tableView.showsVerticalScrollIndicator = true tableView.showsVerticalScrollIndicator = true
tableView.isScrollEnabled = true tableView.isScrollEnabled = true
tableView.register(VoiceActorItemCell.self, forCellReuseIdentifier: "VoiceActorItemCell") tableView.register(VoiceActorItemCell.self, forCellReuseIdentifier: "VoiceActorItemCell")
@ -180,17 +180,17 @@ extension VoiceActorContainerCell: UITableViewDataSource, UITableViewDelegate {
selectedItemChanged?(item) selectedItemChanged?(item)
} }
func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) { // func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath) as? VoiceActorItemCell { // if let cell = tableView.cellForRow(at: indexPath) as? VoiceActorItemCell {
cell.isHovered = true // cell.isHovered = true
} // }
} // }
//
func tableView(_ tableView: UITableView, didUnhighlightRowAt indexPath: IndexPath) { // func tableView(_ tableView: UITableView, didUnhighlightRowAt indexPath: IndexPath) {
if let cell = tableView.cellForRow(at: indexPath) as? VoiceActorItemCell { // if let cell = tableView.cellForRow(at: indexPath) as? VoiceActorItemCell {
cell.isHovered = false // cell.isHovered = false
} // }
} // }
} }
// MARK: - VoiceActorFilterView // MARK: - VoiceActorFilterView
@ -368,17 +368,13 @@ class VoiceActorItemCell: UITableViewCell {
private lazy var playButton: UIButton = { private lazy var playButton: UIButton = {
let btn = UIButton(type: .custom) let btn = UIButton(type: .custom)
if let playImage = UIImage(named: "voice_play") { if let playImage = UIImage(named: "role_voice_play") {
btn.setImage(playImage, for: .normal) btn.setImage(playImage, for: .normal)
} else { } else {
let config = UIImage.SymbolConfiguration(pointSize: 10, weight: .bold) let config = UIImage.SymbolConfiguration(pointSize: 10, weight: .bold)
btn.setImage(UIImage(systemName: "play.fill", withConfiguration: config), for: .normal) btn.setImage(UIImage(systemName: "play.fill", withConfiguration: config), for: .normal)
btn.tintColor = .white btn.tintColor = .white
} }
btn.backgroundColor = UIColor(hex: "#0066FF")
btn.layer.cornerRadius = 12
btn.imageEdgeInsets = UIEdgeInsets(top: 6, left: 8, bottom: 6, right: 8)
btn.imageView?.contentMode = .scaleAspectFit
return btn return btn
}() }()
@ -398,8 +394,16 @@ class VoiceActorItemCell: UITableViewCell {
private lazy var selectionIndicator: UIView = { private lazy var selectionIndicator: UIView = {
let view = UIView() let view = UIView()
view.layer.cornerRadius = 10 view.layer.cornerRadius = 6.5
view.backgroundColor = UIColor.black view.backgroundColor = UIColor(hex: "#020025")
return view
}()
private lazy var selectIndicator: UIView = {
let view = UIView()
view.layer.cornerRadius = 4.5
view.backgroundColor = UIColor(hex: "#00CC88")
view.isHidden = true
return view return view
}() }()
@ -425,12 +429,15 @@ class VoiceActorItemCell: UITableViewCell {
backgroundColor = .clear backgroundColor = .clear
selectionStyle = .none selectionStyle = .none
self.cornerRadius = 10.0
contentView.addSubview(containerView) contentView.addSubview(containerView)
containerView.addSubview(avatarImageView) containerView.addSubview(avatarImageView)
containerView.addSubview(playButton) containerView.addSubview(playButton)
containerView.addSubview(titleLabel) containerView.addSubview(titleLabel)
containerView.addSubview(subTitleLab) containerView.addSubview(subTitleLab)
containerView.addSubview(selectionIndicator) containerView.addSubview(selectionIndicator)
selectionIndicator.addSubview(selectIndicator)
containerView.snp.makeConstraints { make in containerView.snp.makeConstraints { make in
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
@ -444,14 +451,19 @@ class VoiceActorItemCell: UITableViewCell {
} }
playButton.snp.makeConstraints { make in playButton.snp.makeConstraints { make in
make.bottom.right.equalTo(avatarImageView).offset(2) make.top.right.equalTo(avatarImageView).offset(0)
make.width.height.equalTo(24) make.width.height.equalTo(20)
} }
selectionIndicator.snp.makeConstraints { make in selectionIndicator.snp.makeConstraints { make in
make.centerY.equalToSuperview() make.centerY.equalToSuperview()
make.right.equalToSuperview().inset(10) make.right.equalToSuperview().inset(10)
make.width.height.equalTo(20) make.width.height.equalTo(13)
}
selectIndicator.snp.makeConstraints { make in
make.centerY.centerX.equalToSuperview()
make.width.height.equalTo(9)
} }
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
@ -493,7 +505,8 @@ class VoiceActorItemCell: UITableViewCell {
} }
func updateSelectionState(isSelected: Bool) { func updateSelectionState(isSelected: Bool) {
selectionIndicator.backgroundColor = isSelected ? UIColor(hex: "#00CC88") : UIColor.black // selectionIndicator.backgroundColor = isSelected ? UIColor(hex: "#00CC88") : UIColor(hex: "#020025")
selectIndicator.isHidden = !isSelected
} }
private func updateHoverState() { private func updateHoverState() {