Make icon vibrancy deselections match the deselection animation

This commit is contained in:
Maurice Parker
2019-10-23 11:47:21 -05:00
parent 2e489d4093
commit eea450bee3
3 changed files with 26 additions and 13 deletions

View File

@@ -15,16 +15,25 @@ class SettingsAccountTableViewCell: VibrantTableViewCell {
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
super.setHighlighted(highlighted, animated: animated)
let tintColor = isHighlighted || isSelected ? AppAssets.vibrantTextColor : UIColor.label
accountImage?.tintColor = tintColor
accountNameLabel?.highlightedTextColor = tintColor
updateVibrancy(animated: animated)
}
override func setSelected(_ selected: Bool, animated: Bool) {
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
accountImage?.tintColor = tintColor
accountNameLabel?.highlightedTextColor = tintColor
let duration = animated ? 0.5 : 0.0
UIView.animate(withDuration: duration) {
self.accountImage?.tintColor = tintColor
}
}
}