mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.0 KiB
Swift
73 lines
2.0 KiB
Swift
7 years ago
|
//
|
||
6 years ago
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||
7 years ago
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
@objc(OWSAvatarTableViewCell)
|
||
|
public class AvatarTableViewCell: UITableViewCell {
|
||
|
|
||
|
private let columns: UIStackView
|
||
|
private let textRows: UIStackView
|
||
5 years ago
|
// private let avatarView: AvatarImageView
|
||
7 years ago
|
|
||
|
private let _textLabel: UILabel
|
||
|
override public var textLabel: UILabel? {
|
||
|
get {
|
||
|
return _textLabel
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private let _detailTextLabel: UILabel
|
||
|
override public var detailTextLabel: UILabel? {
|
||
|
get {
|
||
|
return _detailTextLabel
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@objc
|
||
6 years ago
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||
5 years ago
|
// self.avatarView = AvatarImageView()
|
||
|
// avatarView.autoSetDimensions(to: CGSize(width: CGFloat(kStandardAvatarSize), height: CGFloat(kStandardAvatarSize)))
|
||
7 years ago
|
|
||
|
self._textLabel = UILabel()
|
||
|
self._detailTextLabel = UILabel()
|
||
|
|
||
|
self.textRows = UIStackView(arrangedSubviews: [_textLabel, _detailTextLabel])
|
||
|
textRows.axis = .vertical
|
||
|
|
||
5 years ago
|
self.columns = UIStackView(arrangedSubviews: [ textRows ])
|
||
7 years ago
|
columns.axis = .horizontal
|
||
|
columns.spacing = CGFloat(kContactCellAvatarTextMargin)
|
||
|
|
||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||
|
|
||
|
self.contentView.addSubview(columns)
|
||
|
columns.autoPinEdgesToSuperviewMargins()
|
||
|
|
||
|
OWSTableItem.configureCell(self)
|
||
|
}
|
||
|
|
||
|
required public init?(coder aDecoder: NSCoder) {
|
||
|
fatalError("init(coder:) has not been implemented")
|
||
|
}
|
||
|
|
||
|
@objc
|
||
|
public func configure(image: UIImage?, text: String?, detailText: String?) {
|
||
5 years ago
|
// self.avatarView.image = image
|
||
7 years ago
|
self.textLabel?.text = text
|
||
|
self.detailTextLabel?.text = detailText
|
||
|
|
||
|
OWSTableItem.configureCell(self)
|
||
|
}
|
||
|
|
||
|
@objc
|
||
|
public override func prepareForReuse() {
|
||
|
super.prepareForReuse()
|
||
|
|
||
5 years ago
|
// self.avatarView.image = nil
|
||
7 years ago
|
self.textLabel?.text = nil
|
||
|
self.detailTextLabel?.text = nil
|
||
|
}
|
||
|
}
|