mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-23 16:20:53 +01:00
Turn the star color to white if the article is selected. Issue #2364
This commit is contained in:
parent
b0b2ab04fc
commit
d3cebfaccb
@ -10,11 +10,6 @@ import AppKit
|
||||
import RSCore
|
||||
import Account
|
||||
|
||||
extension NSImage.Name {
|
||||
static let star = NSImage.Name("star")
|
||||
static let timelineStar = NSImage.Name("timelineStar")
|
||||
}
|
||||
|
||||
struct AppAssets {
|
||||
|
||||
static var accountCloudKit: RSImage! = {
|
||||
@ -133,8 +128,12 @@ struct AppAssets {
|
||||
return IconImage(RSImage(named: NSImage.smartBadgeTemplateName)!)
|
||||
}()
|
||||
|
||||
static var timelineStar: RSImage! = {
|
||||
return RSImage(named: .timelineStar)
|
||||
static var timelineStarSelected: RSImage! = {
|
||||
return RSImage(named: "timelineStar")?.tinted(with: .white)
|
||||
}()
|
||||
|
||||
static var timelineStarUnselected: RSImage! = {
|
||||
return RSImage(named: "timelineStar")?.tinted(with: starColor)
|
||||
}()
|
||||
|
||||
static var todayFeedImage: IconImage = {
|
||||
@ -161,8 +160,8 @@ struct AppAssets {
|
||||
return RSImage(named: "swipeMarkUnstarred")!
|
||||
}()
|
||||
|
||||
static var swipeMarkUnstarredColor: NSColor = {
|
||||
return NSColor(named: NSColor.Name("swipeMarkUnstarredColor"))!
|
||||
static var starColor: NSColor = {
|
||||
return NSColor(named: NSColor.Name("starColor"))!
|
||||
}()
|
||||
|
||||
static func image(for accountType: AccountType) -> NSImage? {
|
||||
|
@ -20,7 +20,7 @@ class TimelineTableCellView: NSTableCellView {
|
||||
|
||||
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 lazy var textFields = {
|
||||
@ -52,12 +52,14 @@ class TimelineTableCellView: NSTableCellView {
|
||||
var isEmphasized: Bool = false {
|
||||
didSet {
|
||||
unreadIndicatorView.isEmphasized = isEmphasized
|
||||
updateStarView()
|
||||
}
|
||||
}
|
||||
|
||||
var isSelected: Bool = false {
|
||||
didSet {
|
||||
unreadIndicatorView.isSelected = isSelected
|
||||
updateStarView()
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,6 +281,11 @@ private extension TimelineTableCellView {
|
||||
}
|
||||
|
||||
func updateStarView() {
|
||||
if isSelected && isEmphasized {
|
||||
starView.image = AppAssets.timelineStarSelected
|
||||
} else {
|
||||
starView.image = AppAssets.timelineStarUnselected
|
||||
}
|
||||
showOrHideView(starView, !cellData.starred)
|
||||
}
|
||||
|
||||
|
@ -910,7 +910,7 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
self.toggleArticleStarred(article);
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
action.backgroundColor = AppAssets.swipeMarkUnstarredColor
|
||||
action.backgroundColor = AppAssets.starColor
|
||||
action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage
|
||||
return [action]
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "star.pdf",
|
||||
"idiom" : "universal",
|
||||
"filename" : "timelineStar.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "star@2x.pdf",
|
||||
"idiom" : "universal",
|
||||
"filename" : "timelineStar@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
@ -16,7 +16,11 @@
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"preserves-vector-representation" : true,
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
Mac/Resources/Assets.xcassets/timelineStar.imageset/star.pdf
vendored
Normal file
BIN
Mac/Resources/Assets.xcassets/timelineStar.imageset/star.pdf
vendored
Normal file
Binary file not shown.
BIN
Mac/Resources/Assets.xcassets/timelineStar.imageset/star@2x.pdf
vendored
Normal file
BIN
Mac/Resources/Assets.xcassets/timelineStar.imageset/star@2x.pdf
vendored
Normal file
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 |
Loading…
Reference in New Issue
Block a user