Show feed icons and avatars in the timeline.
This commit is contained in:
parent
b35193b823
commit
867e775e69
@ -40,6 +40,7 @@ struct TimelineCellAppearance {
|
|||||||
let avatarSize: NSSize
|
let avatarSize: NSSize
|
||||||
let avatarMarginRight: CGFloat
|
let avatarMarginRight: CGFloat
|
||||||
let avatarAdjustmentTop: CGFloat
|
let avatarAdjustmentTop: CGFloat
|
||||||
|
let avatarCornerRadius: CGFloat
|
||||||
|
|
||||||
init(theme: VSTheme, fontSize: FontSize) {
|
init(theme: VSTheme, fontSize: FontSize) {
|
||||||
|
|
||||||
@ -72,8 +73,9 @@ struct TimelineCellAppearance {
|
|||||||
self.avatarSize = theme.size(forKey: "MainWindow.Timeline.cell.avatar")
|
self.avatarSize = theme.size(forKey: "MainWindow.Timeline.cell.avatar")
|
||||||
self.avatarMarginRight = theme.float(forKey: "MainWindow.Timeline.cell.avatarMarginRight")
|
self.avatarMarginRight = theme.float(forKey: "MainWindow.Timeline.cell.avatarMarginRight")
|
||||||
self.avatarAdjustmentTop = theme.float(forKey: "MainWindow.Timeline.cell.avatarAdjustmentTop")
|
self.avatarAdjustmentTop = theme.float(forKey: "MainWindow.Timeline.cell.avatarAdjustmentTop")
|
||||||
|
self.avatarCornerRadius = theme.float(forKey: "MainWindow.Timeline.cell.avatarCornerRadius")
|
||||||
|
|
||||||
self.boxLeftMargin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight //+ self.avatarSize.width + self.avatarMarginRight
|
self.boxLeftMargin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight + self.avatarSize.width + self.avatarMarginRight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
let imageView = NSImageView(frame: NSRect.zero)
|
let imageView = NSImageView(frame: NSRect.zero)
|
||||||
imageView.imageScaling = .scaleProportionallyDown
|
imageView.imageScaling = .scaleProportionallyDown
|
||||||
imageView.animates = false
|
imageView.animates = false
|
||||||
imageView.imageAlignment = .alignTop
|
imageView.imageAlignment = .alignCenter
|
||||||
return imageView
|
return imageView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -32,7 +32,13 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
// return imageView
|
// return imageView
|
||||||
// }()
|
// }()
|
||||||
|
|
||||||
var cellAppearance: TimelineCellAppearance!
|
var cellAppearance: TimelineCellAppearance! {
|
||||||
|
didSet {
|
||||||
|
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||||
|
avatarImageView.needsDisplay = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var cellData: TimelineCellData! {
|
var cellData: TimelineCellData! {
|
||||||
didSet {
|
didSet {
|
||||||
updateSubviews()
|
updateSubviews()
|
||||||
@ -186,15 +192,17 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
|
|
||||||
private func updateAvatar() {
|
private func updateAvatar() {
|
||||||
|
|
||||||
// if let image = cellData.avatar {
|
avatarImageView.layer?.cornerRadius = cellAppearance.avatarCornerRadius
|
||||||
// if avatarImageView.image !== image {
|
|
||||||
// avatarImageView.image = image
|
if let image = cellData.avatar {
|
||||||
// }
|
if avatarImageView.image !== image {
|
||||||
// avatarImageView.isHidden = false
|
avatarImageView.image = image
|
||||||
// }
|
}
|
||||||
// else {
|
avatarImageView.isHidden = false
|
||||||
// avatarImageView.isHidden = true
|
}
|
||||||
// }
|
else {
|
||||||
|
avatarImageView.isHidden = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateFavicon() {
|
private func updateFavicon() {
|
||||||
@ -216,7 +224,7 @@ class TimelineTableCellView: NSTableCellView {
|
|||||||
updateFeedNameView()
|
updateFeedNameView()
|
||||||
updateUnreadIndicator()
|
updateUnreadIndicator()
|
||||||
updateAvatar()
|
updateAvatar()
|
||||||
updateFavicon()
|
// updateFavicon()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateAppearance() {
|
private func updateAppearance() {
|
||||||
|
@ -81,6 +81,7 @@ class TimelineViewController: NSViewController, UndoableCommandRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
postTimelineSelectionDidChangeNotification(nil)
|
postTimelineSelectionDidChangeNotification(nil)
|
||||||
|
articles = ArticleArray()
|
||||||
fetchArticles()
|
fetchArticles()
|
||||||
if articles.count > 0 {
|
if articles.count > 0 {
|
||||||
tableView.scrollRowToVisible(0)
|
tableView.scrollRowToVisible(0)
|
||||||
|
@ -104,13 +104,15 @@
|
|||||||
<key>unreadCircleMarginRight</key>
|
<key>unreadCircleMarginRight</key>
|
||||||
<integer>8</integer>
|
<integer>8</integer>
|
||||||
<key>avatarHeight</key>
|
<key>avatarHeight</key>
|
||||||
<integer>42</integer>
|
<integer>48</integer>
|
||||||
<key>avatarWidth</key>
|
<key>avatarWidth</key>
|
||||||
<integer>42</integer>
|
<integer>48</integer>
|
||||||
<key>avatarMarginRight</key>
|
<key>avatarMarginRight</key>
|
||||||
<integer>8</integer>
|
<integer>8</integer>
|
||||||
<key>avatarAdjustmentTop</key>
|
<key>avatarAdjustmentTop</key>
|
||||||
<integer>4</integer>
|
<integer>4</integer>
|
||||||
|
<key>avatarCornerRadius</key>
|
||||||
|
<integer>7</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>Detail</key>
|
<key>Detail</key>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user