Adapt conversation settings view to RTL.

// FREEBIE
pull/1/head
Matthew Chen 7 years ago
parent 656cc47de5
commit 693e74e868

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "NavBarBackWhiteRTL@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "NavBarBackWhiteRTL@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "NavBarBackWhiteRTL@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -1079,6 +1079,7 @@ typedef enum : NSUInteger {
// This method gets called multiple times, so it's important we re-layout the unread badge // This method gets called multiple times, so it's important we re-layout the unread badge
// with respect to the new backItem. // with respect to the new backItem.
[backItem.customView addSubview:_backButtonUnreadCountView]; [backItem.customView addSubview:_backButtonUnreadCountView];
// TODO:
[_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6]; [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:-6];
[_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:1]; [_backButtonUnreadCountView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:1];
[_backButtonUnreadCountView autoSetDimension:ALDimensionHeight toSize:unreadCountViewDiameter]; [_backButtonUnreadCountView autoSetDimension:ALDimensionHeight toSize:unreadCountViewDiameter];
@ -1097,7 +1098,7 @@ typedef enum : NSUInteger {
const CGFloat kTitleVSpacing = 0.f; const CGFloat kTitleVSpacing = 0.f;
if (!self.navigationBarTitleView) { if (!self.navigationBarTitleView) {
self.navigationBarTitleView = [UIView new]; self.navigationBarTitleView = [UIView containerView];
[self.navigationBarTitleView [self.navigationBarTitleView
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(navigationTitleTapped:)]]; action:@selector(navigationTitleTapped:)]];
@ -1161,7 +1162,9 @@ typedef enum : NSUInteger {
+ kTitleVSpacing); + kTitleVSpacing);
self.navigationBarTitleLabel.frame self.navigationBarTitleLabel.frame
= CGRectMake(0, 0, titleViewWidth, self.navigationBarTitleLabel.frame.size.height); = CGRectMake(0, 0, titleViewWidth, self.navigationBarTitleLabel.frame.size.height);
self.navigationBarSubtitleLabel.frame = CGRectMake(0, self.navigationBarSubtitleLabel.frame = CGRectMake((self.view.isRTL ? self.navigationBarTitleView.frame.size.width
- self.navigationBarSubtitleLabel.frame.size.width
: 0),
self.navigationBarTitleView.frame.size.height - self.navigationBarSubtitleLabel.frame.size.height, self.navigationBarTitleView.frame.size.height - self.navigationBarSubtitleLabel.frame.size.height,
titleViewWidth, titleViewWidth,
self.navigationBarSubtitleLabel.frame.size.height); self.navigationBarSubtitleLabel.frame.size.height);

@ -293,18 +293,20 @@ NS_ASSUME_NONNULL_BEGIN
[mainSection [mainSection
addItem:[OWSTableItem itemWithCustomCellBlock:^{ addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
UIView *topView = [UIView new]; UIView *topView = [UIView containerView];
[cell.contentView addSubview:topView]; [cell.contentView addSubview:topView];
[topView autoPinWidthToSuperview]; [topView autoPinLeadingAndTrailingToSuperview];
[topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight];
UIImageView *iconView = [self viewForIconWithName:@"table_ic_hourglass"]; UIImageView *iconView = [self viewForIconWithName:@"table_ic_hourglass"];
[topView addSubview:iconView]; [topView addSubview:iconView];
[iconView autoVCenterInSuperview]; [iconView autoVCenterInSuperview];
[iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; [iconView autoPinLeadingToSuperView];
UILabel *rowLabel = [UILabel new]; UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString(@"DISAPPEARING_MESSAGES", @"table cell label in conversation settings"); rowLabel.text = NSLocalizedString(@"DISAPPEARING_MESSAGES", @"table cell label in conversation settings");
@ -313,7 +315,7 @@ NS_ASSUME_NONNULL_BEGIN
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[topView addSubview:rowLabel]; [topView addSubview:rowLabel];
[rowLabel autoVCenterInSuperview]; [rowLabel autoVCenterInSuperview];
[rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing];
UISwitch *switchView = [UISwitch new]; UISwitch *switchView = [UISwitch new];
switchView.on = self.disappearingMessagesConfiguration.isEnabled; switchView.on = self.disappearingMessagesConfiguration.isEnabled;
@ -322,7 +324,8 @@ NS_ASSUME_NONNULL_BEGIN
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
[topView addSubview:switchView]; [topView addSubview:switchView];
[switchView autoVCenterInSuperview]; [switchView autoVCenterInSuperview];
[switchView autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:16.f]; [switchView autoPinLeadingToTrailingOfView:rowLabel margin:weakSelf.iconSpacing];
[switchView autoPinTrailingToSuperView];
UILabel *subtitleLabel = [UILabel new]; UILabel *subtitleLabel = [UILabel new];
subtitleLabel.text subtitleLabel.text
@ -333,8 +336,8 @@ NS_ASSUME_NONNULL_BEGIN
subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping; subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
[cell.contentView addSubview:subtitleLabel]; [cell.contentView addSubview:subtitleLabel];
[subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; [subtitleLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView];
[subtitleLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:rowLabel]; [subtitleLabel autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel];
[subtitleLabel autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:16.f]; [subtitleLabel autoPinTrailingToSuperView];
return cell; return cell;
} }
@ -347,18 +350,20 @@ NS_ASSUME_NONNULL_BEGIN
addItem:[OWSTableItem addItem:[OWSTableItem
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
UIView *topView = [UIView new]; UIView *topView = [UIView containerView];
[cell.contentView addSubview:topView]; [cell.contentView addSubview:topView];
[topView autoPinWidthToSuperview]; [topView autoPinLeadingAndTrailingToSuperview];
[topView autoPinEdgeToSuperviewEdge:ALEdgeTop]; [topView autoPinEdgeToSuperviewEdge:ALEdgeTop];
[topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight]; [topView autoSetDimension:ALDimensionHeight toSize:kOWSTable_DefaultCellHeight];
UIImageView *iconView = [self viewForIconWithName:@"table_ic_hourglass"]; UIImageView *iconView = [self viewForIconWithName:@"table_ic_hourglass"];
[topView addSubview:iconView]; [topView addSubview:iconView];
[iconView autoVCenterInSuperview]; [iconView autoVCenterInSuperview];
[iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; [iconView autoPinLeadingToSuperView];
UILabel *rowLabel = self.disappearingMessagesDurationLabel; UILabel *rowLabel = self.disappearingMessagesDurationLabel;
[self updateDisappearingMessagesDurationLabel]; [self updateDisappearingMessagesDurationLabel];
@ -367,7 +372,7 @@ NS_ASSUME_NONNULL_BEGIN
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[topView addSubview:rowLabel]; [topView addSubview:rowLabel];
[rowLabel autoVCenterInSuperview]; [rowLabel autoVCenterInSuperview];
[rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing];
UISlider *slider = [UISlider new]; UISlider *slider = [UISlider new];
slider.maximumValue = (float)(self.disappearingMessagesDurations.count - 1); slider.maximumValue = (float)(self.disappearingMessagesDurations.count - 1);
@ -379,8 +384,8 @@ NS_ASSUME_NONNULL_BEGIN
forControlEvents:UIControlEventValueChanged]; forControlEvents:UIControlEventValueChanged];
[cell.contentView addSubview:slider]; [cell.contentView addSubview:slider];
[slider autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView]; [slider autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:topView];
[slider autoPinEdge:ALEdgeLeft toEdge:ALEdgeLeft ofView:rowLabel]; [slider autoPinEdge:ALEdgeLeading toEdge:ALEdgeLeading ofView:rowLabel];
[slider autoPinEdgeToSuperviewEdge:ALEdgeRight withInset:16.f]; [slider autoPinTrailingToSuperView];
return cell; return cell;
} }
@ -431,12 +436,14 @@ NS_ASSUME_NONNULL_BEGIN
OWSTableSection *muteSection = [OWSTableSection new]; OWSTableSection *muteSection = [OWSTableSection new];
[muteSection addItem:[OWSTableItem itemWithCustomCellBlock:^{ [muteSection addItem:[OWSTableItem itemWithCustomCellBlock:^{
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIImageView *iconView = [self viewForIconWithName:@"table_ic_mute_thread"]; UIImageView *iconView = [self viewForIconWithName:@"table_ic_mute_thread"];
[cell.contentView addSubview:iconView]; [cell.contentView addSubview:iconView];
[iconView autoVCenterInSuperview]; [iconView autoVCenterInSuperview];
[iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; [iconView autoPinLeadingToSuperView];
UILabel *rowLabel = [UILabel new]; UILabel *rowLabel = [UILabel new];
rowLabel.text = NSLocalizedString( rowLabel.text = NSLocalizedString(
@ -446,7 +453,7 @@ NS_ASSUME_NONNULL_BEGIN
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[cell.contentView addSubview:rowLabel]; [cell.contentView addSubview:rowLabel];
[rowLabel autoVCenterInSuperview]; [rowLabel autoVCenterInSuperview];
[rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; [rowLabel autoPinLeadingToTrailingOfView:iconView margin:weakSelf.iconSpacing];
NSString *muteStatus = NSLocalizedString( NSString *muteStatus = NSLocalizedString(
@"CONVERSATION_SETTINGS_MUTE_NOT_MUTED", @"Indicates that the current thread is not muted."); @"CONVERSATION_SETTINGS_MUTE_NOT_MUTED", @"Indicates that the current thread is not muted.");
@ -481,7 +488,8 @@ NS_ASSUME_NONNULL_BEGIN
statusLabel.text = muteStatus; statusLabel.text = muteStatus;
[cell.contentView addSubview:statusLabel]; [cell.contentView addSubview:statusLabel];
[statusLabel autoVCenterInSuperview]; [statusLabel autoVCenterInSuperview];
[statusLabel autoPinEdgeToSuperviewEdge:ALEdgeRight]; // [statusLabel autoPinLeadingToTrailingOfView:rowLabel margin:weakSelf.iconSpacing];
[statusLabel autoPinTrailingToSuperView];
return cell; return cell;
} }
customRowHeight:45.f customRowHeight:45.f
@ -523,18 +531,25 @@ NS_ASSUME_NONNULL_BEGIN
[self.tableView reloadData]; [self.tableView reloadData];
} }
- (CGFloat)iconSpacing
{
return 12.f;
}
- (UITableViewCell *)disclosureCellWithName:(NSString *)name iconName:(NSString *)iconName - (UITableViewCell *)disclosureCellWithName:(NSString *)name iconName:(NSString *)iconName
{ {
OWSAssert(name.length > 0); OWSAssert(name.length > 0);
OWSAssert(iconName.length > 0); OWSAssert(iconName.length > 0);
UITableViewCell *cell = [UITableViewCell new]; UITableViewCell *cell = [UITableViewCell new];
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIImageView *iconView = [self viewForIconWithName:iconName]; UIImageView *iconView = [self viewForIconWithName:iconName];
[cell.contentView addSubview:iconView]; [cell.contentView addSubview:iconView];
[iconView autoVCenterInSuperview]; [iconView autoVCenterInSuperview];
[iconView autoPinEdgeToSuperviewEdge:ALEdgeLeft withInset:16.f]; [iconView autoPinLeadingToSuperView];
UILabel *rowLabel = [UILabel new]; UILabel *rowLabel = [UILabel new];
rowLabel.text = name; rowLabel.text = name;
@ -543,7 +558,8 @@ NS_ASSUME_NONNULL_BEGIN
rowLabel.lineBreakMode = NSLineBreakByTruncatingTail; rowLabel.lineBreakMode = NSLineBreakByTruncatingTail;
[cell.contentView addSubview:rowLabel]; [cell.contentView addSubview:rowLabel];
[rowLabel autoVCenterInSuperview]; [rowLabel autoVCenterInSuperview];
[rowLabel autoPinEdge:ALEdgeLeft toEdge:ALEdgeRight ofView:iconView withOffset:12.f]; [rowLabel autoPinLeadingToTrailingOfView:iconView margin:self.iconSpacing];
[rowLabel autoPinTrailingToSuperView];
return cell; return cell;
} }

@ -7,7 +7,6 @@
#import "ContactTableViewCell.h" #import "ContactTableViewCell.h"
#import "ContactsViewHelper.h" #import "ContactsViewHelper.h"
#import "Environment.h" #import "Environment.h"
#import "InboxTableViewCell.h"
#import "OWSContactsManager.h" #import "OWSContactsManager.h"
#import "OWSContactsSearcher.h" #import "OWSContactsSearcher.h"
#import "OWSTableViewController.h" #import "OWSTableViewController.h"

@ -3,9 +3,8 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "InboxTableViewCell.h"
#import "Contact.h" @class TSThread;
#import "TSGroupModel.h"
@interface SignalsViewController : UIViewController @interface SignalsViewController : UIViewController

@ -2,6 +2,7 @@
// Copyright (c) 2017 Open Whisper Systems. All rights reserved. // Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// //
#import "UIView+OWS.h"
#import "UIViewController+OWS.h" #import "UIViewController+OWS.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -18,13 +19,16 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(target); OWSAssert(target);
OWSAssert(selector); OWSAssert(selector);
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
BOOL isRTL = [backButton isRTL];
// Nudge closer to the left edge to match default back button item. // Nudge closer to the left edge to match default back button item.
const CGFloat kExtraLeftPadding = -8; const CGFloat kExtraLeftPadding = isRTL ? +0 : -8;
// Give some extra hit area to the back button. This is a little smaller // Give some extra hit area to the back button. This is a little smaller
// than the default back button, but makes sense for our left aligned title // than the default back button, but makes sense for our left aligned title
// view in the MessagesViewController // view in the MessagesViewController
const CGFloat kExtraRightPadding = 10; const CGFloat kExtraRightPadding = isRTL ? -0 : +10;
// Extra hit area above/below // Extra hit area above/below
const CGFloat kExtraHeightPadding = 4; const CGFloat kExtraHeightPadding = 4;
@ -33,10 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
// We can't just adjust the imageEdgeInsets on a UIBarButtonItem directly, // We can't just adjust the imageEdgeInsets on a UIBarButtonItem directly,
// so we adjust the imageEdgeInsets on a UIButton, then wrap that // so we adjust the imageEdgeInsets on a UIButton, then wrap that
// in a UIBarButtonItem. // in a UIBarButtonItem.
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[backButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside]; [backButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
UIImage *backImage = [UIImage imageNamed:@"NavBarBack"]; UIImage *backImage = [UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")];
OWSAssert(backImage); OWSAssert(backImage);
[backButton setImage:backImage forState:UIControlStateNormal]; [backButton setImage:backImage forState:UIControlStateNormal];

Loading…
Cancel
Save