Rework layout of conversation input toolbar.

This commit is contained in:
Matthew Chen 2019-01-23 10:15:45 -05:00
parent 6ff6ee2e2e
commit 9b7ae86a6d
3 changed files with 24 additions and 19 deletions

View File

@ -10,10 +10,10 @@
#import "Signal-Swift.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
#import "ViewControllerUtils.h"
#import <SignalMessaging/OWSFormat.h>
#import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalMessaging/UIView+OWS.h>
#import <SignalServiceKit/NSTimer+OWS.h>
#import <SignalServiceKit/TSQuotedMessage.h>
@ -199,22 +199,7 @@ const CGFloat kMaxTextViewHeight = 98;
self.hStack.preservesSuperviewLayoutMargins = NO;
self.preservesSuperviewLayoutMargins = NO;
OWSLayerView *contentBorderView = [[OWSLayerView alloc] init];
contentBorderView.userInteractionEnabled = NO;
contentBorderView.backgroundColor = nil;
CAShapeLayer *contentBorderLayer = [CAShapeLayer new];
contentBorderLayer.strokeColor = Theme.secondaryColor.CGColor;
contentBorderLayer.fillColor = nil;
contentBorderLayer.lineWidth = CGHairlineWidth();
[contentBorderView.layer addSublayer:contentBorderLayer];
contentBorderView.layoutCallback = ^(UIView *layerView) {
contentBorderLayer.frame = layerView.bounds;
contentBorderLayer.path = [UIBezierPath bezierPathWithRoundedRect:layerView.bounds cornerRadius:18.f].CGPath;
};
[self.vStack addSubview:contentBorderView];
[contentBorderView autoPinEdgesToSuperviewEdges];
[contentBorderView setCompressionResistanceLow];
[contentBorderView setContentHuggingLow];
[self.vStack addBorderViewWithColor:Theme.secondaryColor strokeWidth:CGHairlineWidth() cornerRadius:18.f];
[self ensureShouldShowVoiceMemoButtonAnimated:NO doLayout:NO];
}

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "OWSMath.h"
@ -150,6 +150,8 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
- (UIView *)addBackgroundViewWithBackgroundColor:(UIColor *)backgroundColor;
- (UIView *)addBorderViewWithColor:(UIColor *)color strokeWidth:(CGFloat)strokeWidth cornerRadius:(CGFloat)cornerRadius;
@end
#pragma mark - Macros

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "UIView+OWS.h"
@ -556,10 +556,28 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
subview.backgroundColor = backgroundColor;
[self addSubview:subview];
[subview autoPinEdgesToSuperviewEdges];
[subview setCompressionResistanceLow];
[subview setContentHuggingLow];
[self sendSubviewToBack:subview];
return subview;
}
- (UIView *)addBorderViewWithColor:(UIColor *)color strokeWidth:(CGFloat)strokeWidth cornerRadius:(CGFloat)cornerRadius
{
UIView *borderView = [UIView new];
borderView.userInteractionEnabled = NO;
borderView.backgroundColor = nil;
borderView.layer.borderColor = color.CGColor;
borderView.layer.borderWidth = strokeWidth;
borderView.layer.cornerRadius = cornerRadius;
[self addSubview:borderView];
[borderView autoPinEdgesToSuperviewEdges];
[borderView setCompressionResistanceLow];
[borderView setContentHuggingLow];
return borderView;
}
@end
CGFloat CGHairlineWidth()