Turn the star color to white if the article is selected. Issue #2364

This commit is contained in:
Maurice Parker 2020-08-19 20:00:34 -05:00
parent b0b2ab04fc
commit d3cebfaccb
10 changed files with 29 additions and 19 deletions

View File

@ -10,11 +10,6 @@ import AppKit
import RSCore import RSCore
import Account import Account
extension NSImage.Name {
static let star = NSImage.Name("star")
static let timelineStar = NSImage.Name("timelineStar")
}
struct AppAssets { struct AppAssets {
static var accountCloudKit: RSImage! = { static var accountCloudKit: RSImage! = {
@ -133,8 +128,12 @@ struct AppAssets {
return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!) return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!)
}() }()
static var timelineStar: RSImage! = { static var timelineStarSelected: RSImage! = {
return RSImage(named: .timelineStar) return RSImage(named: "timelineStar")?.tinted(with: .white)
}()
static var timelineStarUnselected: RSImage! = {
return RSImage(named: "timelineStar")?.tinted(with: starColor)
}() }()
static var todayFeedImage: IconImage = { static var todayFeedImage: IconImage = {
@ -161,8 +160,8 @@ struct AppAssets {
return RSImage(named: "swipeMarkUnstarred")! return RSImage(named: "swipeMarkUnstarred")!
}() }()
static var swipeMarkUnstarredColor: NSColor = { static var starColor: NSColor = {
return NSColor(named: NSColor.Name("swipeMarkUnstarredColor"))! return NSColor(named: NSColor.Name("starColor"))!
}() }()
static func image(for accountType: AccountType) -> NSImage? { static func image(for accountType: AccountType) -> NSImage? {

View File

@ -20,7 +20,7 @@ class TimelineTableCellView: NSTableCellView {
private lazy var iconView = IconView() private lazy var iconView = IconView()
private let starView = TimelineTableCellView.imageView(with: AppAssets.timelineStar, scaling: .scaleNone) private var starView = TimelineTableCellView.imageView(with: AppAssets.timelineStarUnselected, scaling: .scaleNone)
private let separatorView = TimelineTableCellView.separatorView() private let separatorView = TimelineTableCellView.separatorView()
private lazy var textFields = { private lazy var textFields = {
@ -52,12 +52,14 @@ class TimelineTableCellView: NSTableCellView {
var isEmphasized: Bool = false { var isEmphasized: Bool = false {
didSet { didSet {
unreadIndicatorView.isEmphasized = isEmphasized unreadIndicatorView.isEmphasized = isEmphasized
updateStarView()
} }
} }
var isSelected: Bool = false { var isSelected: Bool = false {
didSet { didSet {
unreadIndicatorView.isSelected = isSelected unreadIndicatorView.isSelected = isSelected
updateStarView()
} }
} }
@ -279,6 +281,11 @@ private extension TimelineTableCellView {
} }
func updateStarView() { func updateStarView() {
if isSelected && isEmphasized {
starView.image = AppAssets.timelineStarSelected
} else {
starView.image = AppAssets.timelineStarUnselected
}
showOrHideView(starView, !cellData.starred) showOrHideView(starView, !cellData.starred)
} }

View File

@ -910,7 +910,7 @@ extension TimelineViewController: NSTableViewDelegate {
self.toggleArticleStarred(article); self.toggleArticleStarred(article);
tableView.rowActionsVisible = false tableView.rowActionsVisible = false
} }
action.backgroundColor = AppAssets.swipeMarkUnstarredColor action.backgroundColor = AppAssets.starColor
action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage
return [action] return [action]

View File

@ -1,6 +1,6 @@
{ {
"info" : { "info" : {
"version" : 1, "author" : "xcode",
"author" : "xcode" "version" : 1
} }
} }

View File

@ -1,13 +1,13 @@
{ {
"images" : [ "images" : [
{ {
"filename" : "star.pdf",
"idiom" : "universal", "idiom" : "universal",
"filename" : "timelineStar.png",
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "star@2x.pdf",
"idiom" : "universal", "idiom" : "universal",
"filename" : "timelineStar@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
@ -16,7 +16,11 @@
} }
], ],
"info" : { "info" : {
"version" : 1, "author" : "xcode",
"author" : "xcode" "version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB