layout of audio in FeedView

This commit is contained in:
nixzhu
2015-11-27 11:45:07 +08:00
parent 0eff863809
commit 8522661f02
2 changed files with 18 additions and 2 deletions
+17 -2
View File
@@ -107,7 +107,10 @@ class FeedView: UIView {
@IBOutlet weak var mediaCollectionView: UICollectionView!
@IBOutlet weak var socialWorkContainerView: UIView!
@IBOutlet weak var socialWorkContainerViewHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var socialWorkImageView: UIImageView!
@IBOutlet weak var githubRepoContainerView: UIView!
@IBOutlet weak var githubRepoImageView: UIImageView!
@IBOutlet weak var githubRepoNameLabel: UILabel!
@@ -219,7 +222,11 @@ class FeedView: UIView {
var height: CGFloat = ceil(rect.height) + 10 + 40 + 4 + 15 + 17 + 15
if feed.hasAttachment {
height += 80 + 15
if feed.kind == .Audio {
height += 44 + 15
} else {
height += 80 + 15
}
}
return ceil(height)
@@ -244,7 +251,7 @@ class FeedView: UIView {
calHeightOfMessageTextView()
let hasAttachment = feed.hasAttachment
timeLabelTopConstraint.constant = hasAttachment ? (15 + 80 + 15) : 15
timeLabelTopConstraint.constant = hasAttachment ? (15 + (feed.kind == .Audio ? 44 : 80) + 15) : 15
attachments = feed.attachments.map({
DiscoveredAttachment(kind: AttachmentKind(rawValue: $0.kind)!, metadata: $0.metadata, URLString: $0.URLString)
@@ -289,6 +296,8 @@ class FeedView: UIView {
socialWorkBorderImageView.hidden = false
socialWorkContainerViewHeightConstraint.constant = 80
case .GithubRepo:
mediaCollectionView.hidden = true
@@ -300,6 +309,8 @@ class FeedView: UIView {
socialWorkBorderImageView.hidden = false
socialWorkContainerViewHeightConstraint.constant = 80
githubRepoImageView.tintColor = UIColor.yepIconImageViewTintColor()
githubRepoNameLabel.text = feed.githubRepoName
@@ -318,6 +329,8 @@ class FeedView: UIView {
socialWorkBorderImageView.hidden = false
socialWorkContainerViewHeightConstraint.constant = 80
socialWorkImageView.maskView = socialWorkMaskImageView
socialWorkBorderImageView.hidden = false
@@ -334,6 +347,8 @@ class FeedView: UIView {
socialWorkBorderImageView.hidden = true
socialWorkContainerViewHeightConstraint.constant = 44
voiceBubbleImageVIew.tintColor = UIColor.leftBubbleTintColor()
voicePlayButton.tintColor = UIColor.lightGrayColor()
voicePlayButton.tintAdjustmentMode = .Normal
+1
View File
@@ -255,6 +255,7 @@
<outlet property="nicknameLabelTrailingConstraint" destination="NZM-pG-uou" id="1YN-Da-SWy"/>
<outlet property="socialWorkBorderImageView" destination="4I1-rL-pwe" id="30H-fy-LvG"/>
<outlet property="socialWorkContainerView" destination="PFV-2X-1gy" id="7qZ-BY-U8d"/>
<outlet property="socialWorkContainerViewHeightConstraint" destination="utb-hg-0Rs" id="pVL-2A-XDM"/>
<outlet property="socialWorkImageView" destination="5Md-c8-aoz" id="feO-Z9-PBf"/>
<outlet property="timeLabel" destination="Ix5-dG-THW" id="sGx-zI-RsF"/>
<outlet property="timeLabelTopConstraint" destination="cOy-Y1-cGU" id="F5F-Qd-zep"/>