|
@@ -28,16 +28,17 @@ import NCCommunication
|
|
|
import RealmSwift
|
|
|
|
|
|
class NCActivity: UIViewController {
|
|
|
-
|
|
|
- @IBOutlet weak var tableView: UITableView!
|
|
|
|
|
|
+ @IBOutlet weak var tableView: UITableView!
|
|
|
|
|
|
@IBOutlet weak var commentView: UIView!
|
|
|
@IBOutlet weak var imageItem: UIImageView!
|
|
|
@IBOutlet weak var labelUser: UILabel!
|
|
|
@IBOutlet weak var newCommentField: UITextField!
|
|
|
+
|
|
|
@IBOutlet weak var viewContainerConstraint: NSLayoutConstraint!
|
|
|
var height: CGFloat = 0
|
|
|
+
|
|
|
var metadata: tableMetadata?
|
|
|
|
|
|
private let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
@@ -152,6 +153,44 @@ class NCActivity: UIViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// MARK: - Table View
|
|
|
+
|
|
|
+extension NCActivity: UITableViewDelegate {
|
|
|
+
|
|
|
+ func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
|
+ return 120
|
|
|
+ }
|
|
|
+
|
|
|
+ func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
|
+ return 60
|
|
|
+ }
|
|
|
+
|
|
|
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
|
|
+ return UITableView.automaticDimension
|
|
|
+ }
|
|
|
+
|
|
|
+ func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
|
|
+
|
|
|
+ let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 60))
|
|
|
+ view.backgroundColor = .clear
|
|
|
+
|
|
|
+ let label = UILabel()
|
|
|
+ label.font = UIFont.boldSystemFont(ofSize: 13)
|
|
|
+ label.textColor = NCBrandColor.shared.label
|
|
|
+ label.text = CCUtility.getTitleSectionDate(sectionDates[section])
|
|
|
+ label.textAlignment = .center
|
|
|
+ label.layer.cornerRadius = 11
|
|
|
+ label.layer.masksToBounds = true
|
|
|
+ label.layer.backgroundColor = UIColor(red: 152.0/255.0, green: 167.0/255.0, blue: 181.0/255.0, alpha: 0.8).cgColor
|
|
|
+ let widthFrame = label.intrinsicContentSize.width + 30
|
|
|
+ let xFrame = tableView.bounds.width / 2 - widthFrame / 2
|
|
|
+ label.frame = CGRect(x: xFrame, y: 10, width: widthFrame, height: 22)
|
|
|
+
|
|
|
+ view.addSubview(label)
|
|
|
+ return view
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
extension NCActivity: UITableViewDataSource {
|
|
|
|
|
|
func numberOfSections(in tableView: UITableView) -> Int {
|