Add spacing between the Jitsi and Threads toolbar buttons.

This commit is contained in:
Doug 2022-06-21 09:46:28 +01:00 committed by Doug
parent 78bf70febc
commit fcd81ced69
3 changed files with 44 additions and 12 deletions

View file

@ -42,6 +42,16 @@ extension UIView {
subView.bottomAnchor.constraint(equalTo: self.safeAreaLayoutGuide.bottomAnchor).isActive = true
}
/// Add a subview matching parent view with additional insets using autolayout
@objc func vc_addSubViewMatchingParent(_ subView: UIView, withInsets insets: UIEdgeInsets) {
self.addSubview(subView)
subView.translatesAutoresizingMaskIntoConstraints = false
subView.leadingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leadingAnchor, constant: insets.left).isActive = true
subView.topAnchor.constraint(equalTo: self.safeAreaLayoutGuide.topAnchor, constant: insets.top).isActive = true
subView.trailingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.trailingAnchor, constant: insets.right).isActive = true
subView.bottomAnchor.constraint(equalTo: self.safeAreaLayoutGuide.bottomAnchor, constant: insets.bottom).isActive = true
}
@objc func vc_removeAllSubviews() {
for subView in self.subviews {
subView.removeFromSuperview()

View file

@ -1547,6 +1547,38 @@ static CGSize kThreadListBarButtonItemImageSize;
return item;
}
- (UIBarButtonItem *)joinJitsiBarButtonItem
{
CallTileActionButton *button = [CallTileActionButton new];
[button setImage:AssetImages.callVideoIcon.image
forState:UIControlStateNormal];
[button setTitle:[VectorL10n roomJoinGroupCall]
forState:UIControlStateNormal];
[button addTarget:self
action:@selector(onVideoCallPressed:)
forControlEvents:UIControlEventTouchUpInside];
button.contentEdgeInsets = UIEdgeInsetsMake(4, 12, 4, 12);
UIBarButtonItem *item;
if (RiotSettings.shared.enableThreads)
{
// Add some spacing when there is a threads button
UIView *buttonContainer = [[UIView alloc] initWithFrame:CGRectZero];
[buttonContainer vc_addSubViewMatchingParent:button withInsets:UIEdgeInsetsMake(0, 0, 0, -12)];
item = [[UIBarButtonItem alloc] initWithCustomView:buttonContainer];
}
else
{
item = [[UIBarButtonItem alloc] initWithCustomView:button];
}
item.accessibilityLabel = [VectorL10n roomAccessibilityVideoCall];
return item;
}
- (UIBarButtonItem *)threadMoreBarButtonItem
{
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:AssetImages.roomContextMenuMore.image
@ -1751,18 +1783,7 @@ static CGSize kThreadListBarButtonItemImageSize;
}
else
{
// show Join button
CallTileActionButton *button = [CallTileActionButton new];
[button setImage:AssetImages.callVideoIcon.image
forState:UIControlStateNormal];
[button setTitle:[VectorL10n roomJoinGroupCall]
forState:UIControlStateNormal];
[button addTarget:self
action:@selector(onVideoCallPressed:)
forControlEvents:UIControlEventTouchUpInside];
button.contentEdgeInsets = UIEdgeInsetsMake(4, 12, 4, 12);
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:button];
item.accessibilityLabel = [VectorL10n roomAccessibilityVideoCall];
UIBarButtonItem *item = [self joinJitsiBarButtonItem];
[rightBarButtonItems addObject:item];
hasCustomJoinButton = YES;

1
changelog.d/6033.bugfix Normal file
View file

@ -0,0 +1 @@
Room: Add some additional spacing between the Jitsi and Threads buttons.