Make icon vibrancy deselections match the deselection animation
This commit is contained in:
parent
2e489d4093
commit
eea450bee3
@ -133,18 +133,12 @@ class MasterFeedTableViewCell : VibrantTableViewCell {
|
|||||||
|
|
||||||
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
||||||
super.setHighlighted(highlighted, animated: animated)
|
super.setHighlighted(highlighted, animated: animated)
|
||||||
|
updateVibrancy(animated: animated)
|
||||||
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor
|
|
||||||
disclosureButton?.tintColor = tintColor
|
|
||||||
faviconImageView.tintColor = tintColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||||
super.setSelected(selected, animated: animated)
|
super.setSelected(selected, animated: animated)
|
||||||
|
updateVibrancy(animated: animated)
|
||||||
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor
|
|
||||||
disclosureButton?.tintColor = tintColor
|
|
||||||
faviconImageView.tintColor = tintColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func willTransition(to state: UITableViewCell.StateMask) {
|
override func willTransition(to state: UITableViewCell.StateMask) {
|
||||||
@ -201,5 +195,14 @@ private extension MasterFeedTableViewCell {
|
|||||||
disclosureButton?.isHidden = !isDisclosureAvailable
|
disclosureButton?.isHidden = !isDisclosureAvailable
|
||||||
separatorInset = layout.separatorInsets
|
separatorInset = layout.separatorInsets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateVibrancy(animated: Bool) {
|
||||||
|
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : AppAssets.secondaryAccentColor
|
||||||
|
let duration = animated ? 0.5 : 0.0
|
||||||
|
UIView.animate(withDuration: duration) {
|
||||||
|
self.disclosureButton?.tintColor = tintColor
|
||||||
|
self.faviconImageView.tintColor = tintColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,16 +15,25 @@ class SettingsAccountTableViewCell: VibrantTableViewCell {
|
|||||||
|
|
||||||
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
|
||||||
super.setHighlighted(highlighted, animated: animated)
|
super.setHighlighted(highlighted, animated: animated)
|
||||||
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
|
updateVibrancy(animated: animated)
|
||||||
accountImage?.tintColor = tintColor
|
|
||||||
accountNameLabel?.highlightedTextColor = tintColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||||
super.setSelected(selected, animated: animated)
|
super.setSelected(selected, animated: animated)
|
||||||
|
updateVibrancy(animated: animated)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func applyThemeProperties() {
|
||||||
|
super.applyThemeProperties()
|
||||||
|
accountNameLabel?.highlightedTextColor = AppAssets.vibrantTextColor
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateVibrancy(animated: Bool) {
|
||||||
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
|
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
|
||||||
accountImage?.tintColor = tintColor
|
let duration = animated ? 0.5 : 0.0
|
||||||
accountNameLabel?.highlightedTextColor = tintColor
|
UIView.animate(withDuration: duration) {
|
||||||
|
self.accountImage?.tintColor = tintColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,7 @@ class SettingsViewController: UITableViewController {
|
|||||||
cell.textLabel?.text = NSLocalizedString("Add Account", comment: "Accounts")
|
cell.textLabel?.text = NSLocalizedString("Add Account", comment: "Accounts")
|
||||||
} else {
|
} else {
|
||||||
let acctCell = tableView.dequeueReusableCell(withIdentifier: "SettingsAccountTableViewCell", for: indexPath) as! SettingsAccountTableViewCell
|
let acctCell = tableView.dequeueReusableCell(withIdentifier: "SettingsAccountTableViewCell", for: indexPath) as! SettingsAccountTableViewCell
|
||||||
|
acctCell.applyThemeProperties()
|
||||||
let account = sortedAccounts[indexPath.row]
|
let account = sortedAccounts[indexPath.row]
|
||||||
acctCell.accountImage?.image = AppAssets.image(for: account.type)
|
acctCell.accountImage?.image = AppAssets.image(for: account.type)
|
||||||
acctCell.accountNameLabel?.text = account.nameForDisplay
|
acctCell.accountNameLabel?.text = account.nameForDisplay
|
||||||
|
Loading…
x
Reference in New Issue
Block a user