mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add customize timeline layout setting
This commit is contained in:
@@ -39,7 +39,7 @@ struct MasterTimelineAccessibilityCellLayout: MasterTimelineCellLayout {
|
||||
|
||||
// Icon Image
|
||||
if cellData.showIcon {
|
||||
self.iconImageRect = MasterTimelineAccessibilityCellLayout.rectForIconView(currentPoint)
|
||||
self.iconImageRect = MasterTimelineAccessibilityCellLayout.rectForIconView(currentPoint, iconSize: cellData.iconSize)
|
||||
currentPoint.y = self.iconImageRect.maxY
|
||||
} else {
|
||||
self.iconImageRect = CGRect.zero
|
||||
|
||||
@@ -22,8 +22,9 @@ struct MasterTimelineCellData {
|
||||
let read: Bool
|
||||
let starred: Bool
|
||||
let numberOfLines: Int
|
||||
let iconSize: MasterTimelineIconSize
|
||||
|
||||
init(article: Article, showFeedName: Bool, feedName: String?, iconImage: IconImage?, showIcon: Bool, featuredImage: UIImage?, numberOfLines: Int) {
|
||||
init(article: Article, showFeedName: Bool, feedName: String?, iconImage: IconImage?, showIcon: Bool, featuredImage: UIImage?, numberOfLines: Int, iconSize: MasterTimelineIconSize) {
|
||||
|
||||
self.title = ArticleStringFormatter.truncatedTitle(article)
|
||||
self.summary = ArticleStringFormatter.truncatedSummary(article)
|
||||
@@ -46,6 +47,7 @@ struct MasterTimelineCellData {
|
||||
self.read = article.status.read
|
||||
self.starred = article.status.starred
|
||||
self.numberOfLines = numberOfLines
|
||||
self.iconSize = iconSize
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +63,7 @@ struct MasterTimelineCellData {
|
||||
self.read = true
|
||||
self.starred = false
|
||||
self.numberOfLines = 0
|
||||
self.iconSize = .medium
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ extension MasterTimelineCellLayout {
|
||||
return r
|
||||
}
|
||||
|
||||
static func rectForIconView(_ point: CGPoint) -> CGRect {
|
||||
static func rectForIconView(_ point: CGPoint, iconSize: MasterTimelineIconSize) -> CGRect {
|
||||
var r = CGRect.zero
|
||||
r.size = MasterTimelineDefaultCellLayout.iconImageSize
|
||||
r.size = iconSize.size
|
||||
r.origin.x = point.x
|
||||
r.origin.y = point.y + 4
|
||||
return r
|
||||
|
||||
@@ -21,7 +21,6 @@ struct MasterTimelineDefaultCellLayout: MasterTimelineCellLayout {
|
||||
static let starDimension = CGFloat(integerLiteral: 16)
|
||||
static let starSize = CGSize(width: MasterTimelineDefaultCellLayout.starDimension, height: MasterTimelineDefaultCellLayout.starDimension)
|
||||
|
||||
static let iconImageSize = CGSize(width: 32.0, height: 32.0)
|
||||
static let iconMarginRight = CGFloat(integerLiteral: 8)
|
||||
static let iconCornerRadius = CGFloat(integerLiteral: 4)
|
||||
|
||||
@@ -72,7 +71,7 @@ struct MasterTimelineDefaultCellLayout: MasterTimelineCellLayout {
|
||||
|
||||
// Icon Image
|
||||
if cellData.showIcon {
|
||||
self.iconImageRect = MasterTimelineDefaultCellLayout.rectForIconView(currentPoint)
|
||||
self.iconImageRect = MasterTimelineDefaultCellLayout.rectForIconView(currentPoint, iconSize: cellData.iconSize)
|
||||
currentPoint.x = self.iconImageRect.maxX + MasterTimelineDefaultCellLayout.iconMarginRight
|
||||
} else {
|
||||
self.iconImageRect = CGRect.zero
|
||||
|
||||
Reference in New Issue
Block a user