forked from zelo72/mastodon-ios
chore: use readableContentGuide
This commit is contained in:
parent
80d76acc27
commit
56d22e9c1c
|
@ -105,24 +105,35 @@ extension NotificationStatusTableViewCell {
|
||||||
func configure() {
|
func configure() {
|
||||||
selectionStyle = .none
|
selectionStyle = .none
|
||||||
|
|
||||||
contentView.addSubview(avatatImageView)
|
let container = UIView()
|
||||||
|
container.backgroundColor = .clear
|
||||||
|
contentView.addSubview(container)
|
||||||
|
container.constrain([
|
||||||
|
container.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
|
container.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||||
|
container.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor),
|
||||||
|
container.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||||
|
])
|
||||||
|
|
||||||
|
container.addSubview(avatatImageView)
|
||||||
avatatImageView.pin(toSize: CGSize(width: 35, height: 35))
|
avatatImageView.pin(toSize: CGSize(width: 35, height: 35))
|
||||||
avatatImageView.pin(top: 12, left: 12, bottom: nil, right: nil)
|
avatatImageView.pin(top: 12, left: 12, bottom: nil, right: nil)
|
||||||
|
|
||||||
contentView.addSubview(actionImageBackground)
|
container.addSubview(actionImageBackground)
|
||||||
actionImageBackground.pin(toSize: CGSize(width: 24 + NotificationStatusTableViewCell.actionImageBorderWidth, height: 24 + NotificationStatusTableViewCell.actionImageBorderWidth))
|
actionImageBackground.pin(toSize: CGSize(width: 24 + NotificationTableViewCell.actionImageBorderWidth, height: 24 + NotificationTableViewCell.actionImageBorderWidth))
|
||||||
actionImageBackground.pin(top: 33, left: 33, bottom: nil, right: nil)
|
actionImageBackground.pin(top: 33, left: 33, bottom: nil, right: nil)
|
||||||
|
|
||||||
actionImageBackground.addSubview(actionImageView)
|
actionImageBackground.addSubview(actionImageView)
|
||||||
actionImageView.constrainToCenter()
|
actionImageView.constrainToCenter()
|
||||||
|
|
||||||
contentView.addSubview(nameLabel)
|
container.addSubview(nameLabel)
|
||||||
nameLabel.constrain([
|
nameLabel.constrain([
|
||||||
nameLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 12),
|
nameLabel.topAnchor.constraint(equalTo: container.topAnchor, constant: 12),
|
||||||
nameLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 61)
|
nameLabel.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 61)
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
contentView.addSubview(actionLabel)
|
container.addSubview(actionLabel)
|
||||||
actionLabel.constrain([
|
actionLabel.constrain([
|
||||||
actionLabel.leadingAnchor.constraint(equalTo: nameLabel.trailingAnchor, constant: 4),
|
actionLabel.leadingAnchor.constraint(equalTo: nameLabel.trailingAnchor, constant: 4),
|
||||||
actionLabel.centerYAnchor.constraint(equalTo: nameLabel.centerYAnchor),
|
actionLabel.centerYAnchor.constraint(equalTo: nameLabel.centerYAnchor),
|
||||||
|
@ -130,20 +141,16 @@ extension NotificationStatusTableViewCell {
|
||||||
])
|
])
|
||||||
|
|
||||||
statusView.contentWarningBlurContentImageView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
statusView.contentWarningBlurContentImageView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
|
||||||
addStatusAndContainer()
|
|
||||||
}
|
|
||||||
|
|
||||||
func addStatusAndContainer() {
|
|
||||||
statusView.isUserInteractionEnabled = false
|
statusView.isUserInteractionEnabled = false
|
||||||
// remove item don't display
|
// remove item don't display
|
||||||
statusView.actionToolbarContainer.removeFromSuperview()
|
statusView.actionToolbarContainer.removeFromSuperview()
|
||||||
statusView.avatarView.removeFromSuperview()
|
statusView.avatarView.removeFromSuperview()
|
||||||
statusView.usernameLabel.removeFromSuperview()
|
statusView.usernameLabel.removeFromSuperview()
|
||||||
|
|
||||||
contentView.addSubview(statusContainer)
|
container.addSubview(statusContainer)
|
||||||
statusContainer.pin(top: 40, left: 63, bottom: 14, right: 14)
|
statusContainer.pin(top: 40, left: 63, bottom: 14, right: 14)
|
||||||
|
|
||||||
contentView.addSubview(statusView)
|
container.addSubview(statusView)
|
||||||
statusView.pin(top: NotificationStatusTableViewCell.statusPadding.top, left: NotificationStatusTableViewCell.statusPadding.left, bottom: NotificationStatusTableViewCell.statusPadding.bottom, right: NotificationStatusTableViewCell.statusPadding.right)
|
statusView.pin(top: NotificationStatusTableViewCell.statusPadding.top, left: NotificationStatusTableViewCell.statusPadding.left, bottom: NotificationStatusTableViewCell.statusPadding.bottom, right: NotificationStatusTableViewCell.statusPadding.right)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,25 +87,35 @@ extension NotificationTableViewCell {
|
||||||
func configure() {
|
func configure() {
|
||||||
selectionStyle = .none
|
selectionStyle = .none
|
||||||
|
|
||||||
contentView.addSubview(avatatImageView)
|
let container = UIView()
|
||||||
|
container.backgroundColor = .clear
|
||||||
|
contentView.addSubview(container)
|
||||||
|
container.constrain([
|
||||||
|
container.topAnchor.constraint(equalTo: contentView.topAnchor),
|
||||||
|
container.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||||
|
container.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor),
|
||||||
|
container.bottomAnchor.constraint(equalTo: contentView.bottomAnchor)
|
||||||
|
])
|
||||||
|
|
||||||
|
container.addSubview(avatatImageView)
|
||||||
avatatImageView.pin(toSize: CGSize(width: 35, height: 35))
|
avatatImageView.pin(toSize: CGSize(width: 35, height: 35))
|
||||||
avatatImageView.pin(top: 12, left: 12, bottom: nil, right: nil)
|
avatatImageView.pin(top: 12, left: 12, bottom: nil, right: nil)
|
||||||
|
|
||||||
contentView.addSubview(actionImageBackground)
|
container.addSubview(actionImageBackground)
|
||||||
actionImageBackground.pin(toSize: CGSize(width: 24 + NotificationTableViewCell.actionImageBorderWidth, height: 24 + NotificationTableViewCell.actionImageBorderWidth))
|
actionImageBackground.pin(toSize: CGSize(width: 24 + NotificationTableViewCell.actionImageBorderWidth, height: 24 + NotificationTableViewCell.actionImageBorderWidth))
|
||||||
actionImageBackground.pin(top: 33, left: 33, bottom: nil, right: nil)
|
actionImageBackground.pin(top: 33, left: 33, bottom: nil, right: nil)
|
||||||
|
|
||||||
actionImageBackground.addSubview(actionImageView)
|
actionImageBackground.addSubview(actionImageView)
|
||||||
actionImageView.constrainToCenter()
|
actionImageView.constrainToCenter()
|
||||||
|
|
||||||
contentView.addSubview(nameLabel)
|
container.addSubview(nameLabel)
|
||||||
nameLabel.constrain([
|
nameLabel.constrain([
|
||||||
nameLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 24),
|
nameLabel.topAnchor.constraint(equalTo: container.topAnchor, constant: 24),
|
||||||
contentView.bottomAnchor.constraint(equalTo: nameLabel.bottomAnchor, constant: 24),
|
contentView.bottomAnchor.constraint(equalTo: nameLabel.bottomAnchor, constant: 24),
|
||||||
nameLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 61)
|
nameLabel.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 61)
|
||||||
])
|
])
|
||||||
|
|
||||||
contentView.addSubview(actionLabel)
|
container.addSubview(actionLabel)
|
||||||
actionLabel.constrain([
|
actionLabel.constrain([
|
||||||
actionLabel.leadingAnchor.constraint(equalTo: nameLabel.trailingAnchor, constant: 4),
|
actionLabel.leadingAnchor.constraint(equalTo: nameLabel.trailingAnchor, constant: 4),
|
||||||
actionLabel.centerYAnchor.constraint(equalTo: nameLabel.centerYAnchor),
|
actionLabel.centerYAnchor.constraint(equalTo: nameLabel.centerYAnchor),
|
||||||
|
|
Loading…
Reference in New Issue