Merge branch 'charlesmchen/footerAlignment' into release/2.28.0

pull/1/head
Michael Kirk 7 years ago
commit 28f892b3ca

@ -43,6 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
self.layoutMargins = UIEdgeInsetsZero; self.layoutMargins = UIEdgeInsetsZero;
self.contentView.layoutMargins = UIEdgeInsetsZero; self.contentView.layoutMargins = UIEdgeInsetsZero;
self.layoutConstraints = @[];
self.titleLabel = [UILabel new]; self.titleLabel = [UILabel new];
self.titleLabel.textColor = [UIColor ows_light60Color]; self.titleLabel.textColor = [UIColor ows_light60Color];

@ -38,7 +38,6 @@ NS_ASSUME_NONNULL_BEGIN
self.layoutMargins = UIEdgeInsetsZero; self.layoutMargins = UIEdgeInsetsZero;
self.axis = UILayoutConstraintAxisHorizontal; self.axis = UILayoutConstraintAxisHorizontal;
self.spacing = self.hSpacing;
self.alignment = UIStackViewAlignmentCenter; self.alignment = UIStackViewAlignmentCenter;
self.distribution = UIStackViewDistributionEqualSpacing; self.distribution = UIStackViewDistributionEqualSpacing;
@ -47,6 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
leftStackView.spacing = self.hSpacing; leftStackView.spacing = self.hSpacing;
leftStackView.alignment = UIStackViewAlignmentCenter; leftStackView.alignment = UIStackViewAlignmentCenter;
[self addArrangedSubview:leftStackView]; [self addArrangedSubview:leftStackView];
[leftStackView setContentHuggingHigh];
self.timestampLabel = [UILabel new]; self.timestampLabel = [UILabel new];
[leftStackView addArrangedSubview:self.timestampLabel]; [leftStackView addArrangedSubview:self.timestampLabel];
@ -56,7 +56,6 @@ NS_ASSUME_NONNULL_BEGIN
[leftStackView addArrangedSubview:self.messageTimerView]; [leftStackView addArrangedSubview:self.messageTimerView];
self.statusIndicatorImageView = [UIImageView new]; self.statusIndicatorImageView = [UIImageView new];
[self.statusIndicatorImageView setContentHuggingHigh];
[self addArrangedSubview:self.statusIndicatorImageView]; [self addArrangedSubview:self.statusIndicatorImageView];
self.userInteractionEnabled = NO; self.userInteractionEnabled = NO;
@ -143,21 +142,36 @@ NS_ASSUME_NONNULL_BEGIN
} }
if (statusIndicatorImage) { if (statusIndicatorImage) {
OWSAssert(statusIndicatorImage.size.width <= self.maxImageWidth); [self showStatusIndicatorWithIcon:statusIndicatorImage textColor:textColor];
self.statusIndicatorImageView.image =
[statusIndicatorImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
self.statusIndicatorImageView.tintColor = textColor;
self.statusIndicatorImageView.hidden = NO;
} else { } else {
self.statusIndicatorImageView.image = nil; [self hideStatusIndicator];
self.statusIndicatorImageView.hidden = YES;
} }
} else { } else {
self.statusIndicatorImageView.image = nil; [self hideStatusIndicator];
self.statusIndicatorImageView.hidden = YES;
} }
} }
- (void)showStatusIndicatorWithIcon:(UIImage *)icon textColor:(UIColor *)textColor
{
OWSAssert(icon.size.width <= self.maxImageWidth);
self.statusIndicatorImageView.image = [icon imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
self.statusIndicatorImageView.tintColor = textColor;
[self.statusIndicatorImageView setContentHuggingHigh];
self.spacing = self.hSpacing;
}
- (void)hideStatusIndicator
{
// If there's no status indicator, we want the other
// footer contents to "cling to the leading edge".
// Instead of hiding the status indicator view,
// we clear its contents and let it stretch to fill
// the available space.
self.statusIndicatorImageView.image = nil;
[self.statusIndicatorImageView setContentHuggingLow];
self.spacing = 0;
}
- (void)animateSpinningIcon - (void)animateSpinningIcon
{ {
CABasicAnimation *animation; CABasicAnimation *animation;

Loading…
Cancel
Save