Merge branch 'mkirk/adjust-header-spacing'

pull/1/head
Michael Kirk 7 years ago
commit ba1dc6c24c

@ -151,8 +151,8 @@ NS_ASSUME_NONNULL_BEGIN
[self.contentView addSubview:self.headerView]; [self.contentView addSubview:self.headerView];
[self.viewConstraints addObjectsFromArray:@[ [self.viewConstraints addObjectsFromArray:@[
[self.headerView autoSetDimension:ALDimensionHeight toSize:headerHeight], [self.headerView autoSetDimension:ALDimensionHeight toSize:headerHeight],
[self.headerView autoPinLeadingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterLeading], [self.headerView autoPinEdgeToSuperviewEdge:ALEdgeLeading],
[self.headerView autoPinTrailingToSuperviewMarginWithInset:self.conversationStyle.fullWidthGutterTrailing], [self.headerView autoPinEdgeToSuperviewEdge:ALEdgeTrailing],
[self.headerView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.headerView autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.headerView], [self.messageBubbleView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.headerView],
]]; ]];

@ -93,8 +93,8 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23;
[self.strokeView autoSetDimension:ALDimensionHeight toSize:strokeThickness], [self.strokeView autoSetDimension:ALDimensionHeight toSize:strokeThickness],
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTop],
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:conversationStyle.fullWidthGutterLeading], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:conversationStyle.headerGutterLeading],
[self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:conversationStyle.fullWidthGutterTrailing], [self.stackView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:conversationStyle.headerGutterTrailing]
]; ];
} }
@ -170,7 +170,7 @@ const CGFloat OWSMessageHeaderViewDateHeaderVMargin = 23;
CGFloat strokeThickness = [self strokeThicknessWithViewItem:viewItem]; CGFloat strokeThickness = [self strokeThicknessWithViewItem:viewItem];
result.height += strokeThickness; result.height += strokeThickness;
CGFloat maxTextWidth = conversationStyle.fullWidthContentWidth; CGFloat maxTextWidth = conversationStyle.headerViewContentWidth;
CGSize titleSize = [self.titleLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)]; CGSize titleSize = [self.titleLabel sizeThatFits:CGSizeMake(maxTextWidth, CGFLOAT_MAX)];
result.height += titleSize.height + self.stackView.spacing; result.height += titleSize.height + self.stackView.spacing;

@ -23,17 +23,28 @@ public class ConversationStyle: NSObject {
@objc public var gutterLeading: CGFloat = 0 @objc public var gutterLeading: CGFloat = 0
@objc public var gutterTrailing: CGFloat = 0 @objc public var gutterTrailing: CGFloat = 0
@objc public var headerGutterLeading: CGFloat = 28
@objc public var headerGutterTrailing: CGFloat = 28
// These are the gutters used by "full width" views // These are the gutters used by "full width" views
// like "date headers" and "unread indicator". // like "contact offer" and "info message".
@objc public var fullWidthGutterLeading: CGFloat = 0 @objc public var fullWidthGutterLeading: CGFloat = 0
@objc public var fullWidthGutterTrailing: CGFloat = 0 @objc public var fullWidthGutterTrailing: CGFloat = 0
@objc public var errorGutterTrailing: CGFloat = 0 @objc public var errorGutterTrailing: CGFloat = 0
// viewWidth - (gutterLeading + gutterTrailing) @objc public var contentWidth: CGFloat {
@objc public var contentWidth: CGFloat = 0 return viewWidth - (gutterLeading + gutterTrailing)
}
// viewWidth - (gutterfullWidthGutterLeadingLeading + fullWidthGutterTrailing) @objc public var fullWidthContentWidth: CGFloat {
@objc public var fullWidthContentWidth: CGFloat = 0 return viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing)
}
@objc public var headerViewContentWidth: CGFloat {
return viewWidth - (headerGutterLeading + headerGutterTrailing)
}
@objc public var maxMessageWidth: CGFloat = 0 @objc public var maxMessageWidth: CGFloat = 0
@ -88,12 +99,10 @@ public class ConversationStyle: NSObject {
} }
fullWidthGutterLeading = 16 fullWidthGutterLeading = 16
fullWidthGutterTrailing = 16 fullWidthGutterTrailing = 16
headerGutterLeading = 28
headerGutterTrailing = 28
errorGutterTrailing = 16 errorGutterTrailing = 16
contentWidth = viewWidth - (gutterLeading + gutterTrailing)
fullWidthContentWidth = viewWidth - (fullWidthGutterLeading + fullWidthGutterTrailing)
maxMessageWidth = floor(contentWidth - 32) maxMessageWidth = floor(contentWidth - 32)
let messageTextFont = UIFont.ows_dynamicTypeBody let messageTextFont = UIFont.ows_dynamicTypeBody

Loading…
Cancel
Save