2019-10-01 03:01:02 +02:00
|
|
|
//
|
2024-02-26 17:37:15 +01:00
|
|
|
// TimelineUnreadCountView.swift
|
2019-10-01 03:01:02 +02:00
|
|
|
// NetNewsWire-iOS
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 9/30/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
2024-05-07 07:21:37 +02:00
|
|
|
final class TimelineUnreadCountView: FeedUnreadCountView {
|
2019-10-01 03:01:02 +02:00
|
|
|
|
2019-11-20 01:58:18 +01:00
|
|
|
override var padding: UIEdgeInsets {
|
|
|
|
return UIEdgeInsets(top: 2.0, left: 9.0, bottom: 2.0, right: 9.0)
|
|
|
|
}
|
|
|
|
|
2019-10-01 03:01:02 +02:00
|
|
|
override var textColor: UIColor {
|
|
|
|
return UIColor.systemBackground
|
|
|
|
}
|
|
|
|
|
|
|
|
override var intrinsicContentSize: CGSize {
|
|
|
|
return contentSize
|
|
|
|
}
|
|
|
|
|
|
|
|
override func draw(_ dirtyRect: CGRect) {
|
|
|
|
|
|
|
|
let cornerRadii = CGSize(width: cornerRadius, height: cornerRadius)
|
|
|
|
let rect = CGRect(x: 1, y: 1, width: bounds.width - 2, height: bounds.height - 2)
|
|
|
|
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: .allCorners, cornerRadii: cornerRadii)
|
|
|
|
AppAssets.primaryAccentColor.setFill()
|
|
|
|
path.fill()
|
|
|
|
|
|
|
|
if unreadCount > 0 {
|
|
|
|
unreadCountString.draw(at: textRect().origin, withAttributes: textAttributes)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|