Adjust join button content insets

This commit is contained in:
ismailgulek 2021-04-21 13:58:15 +03:00
parent f23cc01b12
commit c8224d2c2e
No known key found for this signature in database
GPG key ID: E96336D42D9470A9
2 changed files with 18 additions and 13 deletions

View file

@ -1500,13 +1500,13 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05;
else
{
// show Join button
CallTileActionButton *button = [[CallTileActionButton alloc] initWithFrame:CGRectMake(0, 0, 81, 30)];
CallTileActionButton *button = [CallTileActionButton new];
[button setImage:[UIImage imageNamed:@"video_call"] forState:UIControlStateNormal];
[button setTitle:NSLocalizedStringFromTable(@"room_join_group_call", @"Vector", nil) forState:UIControlStateNormal];
[button addTarget:self
action:@selector(onVideoCallPressed:)
forControlEvents:UIControlEventTouchUpInside];
item.image = nil;
button.contentEdgeInsets = UIEdgeInsetsMake(4, 12, 4, 12);
item.customView = button;
item.enabled = YES;
}

View file

@ -48,21 +48,26 @@ class CallTileActionButton: UIButton {
// MARK: Setup
init() {
super.init(frame: .zero)
commonInit()
}
override init(frame: CGRect) {
super.init(frame: frame)
self.commonInit()
commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
self.commonInit()
commonInit()
}
private func commonInit() {
self.contentEdgeInsets = Constants.contentEdgeInsets
self.layer.masksToBounds = true
self.titleLabel?.font = UIFont.systemFont(ofSize: Constants.fontSize)
self.layer.cornerRadius = Constants.cornerRadius
contentEdgeInsets = Constants.contentEdgeInsets
layer.masksToBounds = true
titleLabel?.font = UIFont.systemFont(ofSize: Constants.fontSize)
layer.cornerRadius = Constants.cornerRadius
setImage(image(for: .normal)?.vc_resized(with: Constants.imageSize)?.withRenderingMode(.alwaysTemplate), for: .normal)
updateStyle()
}
@ -70,13 +75,13 @@ class CallTileActionButton: UIButton {
private func updateStyle() {
switch style {
case .positive:
self.vc_setBackgroundColor(theme.tintColor, for: .normal)
self.tintColor = theme.baseTextPrimaryColor
vc_setBackgroundColor(theme.tintColor, for: .normal)
tintColor = theme.baseTextPrimaryColor
case .negative:
self.vc_setBackgroundColor(theme.noticeColor, for: .normal)
self.tintColor = theme.baseTextPrimaryColor
vc_setBackgroundColor(theme.noticeColor, for: .normal)
tintColor = theme.baseTextPrimaryColor
case .custom(let bgColor, let tintColor):
self.vc_setBackgroundColor(bgColor, for: .normal)
vc_setBackgroundColor(bgColor, for: .normal)
self.tintColor = tintColor
}
}