From 09926490a623f5416deba58691d343b589a678d7 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Mon, 27 Nov 2017 13:10:57 -0800 Subject: [PATCH] Add avatarImageView to timeline cell. --- .../Timeline/Cell/TimelineTableCellView.swift | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift index 0fe1f8e92..6bc4a1e99 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -16,6 +16,13 @@ class TimelineTableCellView: NSTableCellView { let dateView = RSSingleLineView(frame: NSZeroRect) let feedNameView = RSSingleLineView(frame: NSZeroRect) + let avatarImageView: NSImageView = { + let imageView = NSImageView(frame: NSRect.zero) + imageView.imageScaling = .scaleProportionallyUpOrDown + imageView.animates = false + return imageView + }() + var cellAppearance: TimelineCellAppearance! var cellData: TimelineCellData! { didSet { @@ -52,22 +59,21 @@ class TimelineTableCellView: NSTableCellView { needsDisplay = true } } - - private func commonInit() { - - addSubview(titleView) - titleView.translatesAutoresizingMaskIntoConstraints = false - - addSubview(unreadIndicatorView) - unreadIndicatorView.translatesAutoresizingMaskIntoConstraints = false - unreadIndicatorView.isHidden = true - - addSubview(dateView) - dateView.translatesAutoresizingMaskIntoConstraints = false - addSubview(feedNameView) - feedNameView.translatesAutoresizingMaskIntoConstraints = false; - feedNameView.isHidden = true + private func addSubviewAtInit(_ view: NSView, hidden: Bool) { + + addSubview(view) + view.translatesAutoresizingMaskIntoConstraints = false + view.isHidden = hidden + } + + private func commonInit() { + + addSubviewAtInit(titleView, hidden: false) + addSubviewAtInit(unreadIndicatorView, hidden: true) + addSubviewAtInit(dateView, hidden: false) + addSubviewAtInit(feedNameView, hidden: true) + addSubviewAtInit(avatarImageView, hidden: true) } override init(frame frameRect: NSRect) {