2 // BookImageOverlayView.swift
5 // Created by Pawel Dabrowski on 18/06/2018.
6 // Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
11 class BookImageOverlayView: DesignableXibView {
13 @IBOutlet weak var iconsView: UIView!
14 @IBOutlet weak var readImageView: UIImageView!
15 @IBOutlet weak var audiobookImageView: UIImageView!
16 @IBOutlet weak var iconsWidthConstraint: NSLayoutConstraint!
17 @IBOutlet weak var titleLabel: UILabel!
18 @IBOutlet weak var textBgColorView: UIView!
21 override func awakeFromNib() {
23 readImageView.layer.cornerRadius = 9
24 audiobookImageView.layer.cornerRadius = 9
25 readImageView.tintColor = UIColor.white
26 audiobookImageView.tintColor = UIColor.white
28 let color = UIColor(red:0.84, green:0.29, blue:0.19, alpha:0.9)
29 readImageView.backgroundColor = color
30 audiobookImageView.backgroundColor = color
31 textBgColorView.alpha = 0.9
35 func setup(bookModel: BookModel){
36 let titleAttributedText = bookModel.getAttributedAuthorAndTitle(titleFont: UIFont.systemFont(ofSize: 9, weight: .medium), descFont: UIFont.systemFont(ofSize: 11, weight: .bold))
38 readImageView.backgroundColor = bookModel.bgColor
39 audiobookImageView.backgroundColor = bookModel.bgColor
40 textBgColorView.backgroundColor = bookModel.bgColor
41 titleLabel.attributedText = titleAttributedText
43 if bookModel.has_audio{
44 audiobookImageView.isHidden = false
45 iconsWidthConstraint.constant = 39
48 audiobookImageView.isHidden = true
49 iconsWidthConstraint.constant = 18