Merge branch 'charlesmchen/unifyCellAndAvatarSizes'

pull/1/head
Matthew Chen 7 years ago
commit 74358b73f5

@ -44,6 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
[_tableViewController.view autoPinToTopLayoutGuideOfViewController:self withInset:0]; [_tableViewController.view autoPinToTopLayoutGuideOfViewController:self withInset:0];
[_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension; self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
[self updateTableContents]; [self updateTableContents];
} }

@ -44,6 +44,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
self.isExpectingMoreDevices = NO; self.isExpectingMoreDevices = NO;
self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60;
[self.tableView applyScrollViewInsetsFix]; [self.tableView applyScrollViewInsetsFix];

@ -103,6 +103,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
// Auto size cells for dynamic type // Auto size cells for dynamic type
tableView.estimatedRowHeight = 60.0 tableView.estimatedRowHeight = 60.0
tableView.rowHeight = UITableViewAutomaticDimension tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 60
tableView.allowsMultipleSelection = allowsMultipleSelection tableView.allowsMultipleSelection = allowsMultipleSelection

@ -49,6 +49,7 @@ class ConversationSearchViewController: UITableViewController {
blockedPhoneNumberSet = Set(blockingManager.blockedPhoneNumbers()) blockedPhoneNumberSet = Set(blockingManager.blockedPhoneNumbers())
tableView.rowHeight = UITableViewAutomaticDimension tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 60
tableView.register(EmptySearchResultCell.self, forCellReuseIdentifier: EmptySearchResultCell.reuseIdentifier) tableView.register(EmptySearchResultCell.self, forCellReuseIdentifier: EmptySearchResultCell.reuseIdentifier)
tableView.register(HomeViewCell.self, forCellReuseIdentifier: HomeViewCell.cellReuseIdentifier()) tableView.register(HomeViewCell.self, forCellReuseIdentifier: HomeViewCell.cellReuseIdentifier())

@ -59,13 +59,6 @@ NS_ASSUME_NONNULL_BEGIN
{ {
OWSAssert(!self.avatarView); OWSAssert(!self.avatarView);
const CGFloat kMinVMargin = 5;
[self setTranslatesAutoresizingMaskIntoConstraints:NO];
self.layoutMargins = UIEdgeInsetsMake(0, self.cellHMargin, 0, self.cellHMargin);
self.contentView.layoutMargins = UIEdgeInsetsZero;
self.contentView.preservesSuperviewLayoutMargins = YES;
self.backgroundColor = [UIColor whiteColor]; self.backgroundColor = [UIColor whiteColor];
_viewConstraints = [NSMutableArray new]; _viewConstraints = [NSMutableArray new];
@ -79,13 +72,9 @@ NS_ASSUME_NONNULL_BEGIN
[self.avatarView autoVCenterInSuperview]; [self.avatarView autoVCenterInSuperview];
[self.avatarView setContentHuggingHigh]; [self.avatarView setContentHuggingHigh];
[self.avatarView setCompressionResistanceHigh]; [self.avatarView setCompressionResistanceHigh];
const CGFloat kAvatarMinVMargin = 10; // Ensure that the cell's contents never overflow the cell bounds.
[self.avatarView autoPinEdgeToSuperviewEdge:ALEdgeTop [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual];
withInset:kAvatarMinVMargin [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual];
relation:NSLayoutRelationGreaterThanOrEqual];
[self.avatarView autoPinEdgeToSuperviewEdge:ALEdgeBottom
withInset:kAvatarMinVMargin
relation:NSLayoutRelationGreaterThanOrEqual];
self.payloadView = [UIStackView new]; self.payloadView = [UIStackView new];
self.payloadView.axis = UILayoutConstraintAxisVertical; self.payloadView.axis = UILayoutConstraintAxisVertical;
@ -93,14 +82,8 @@ NS_ASSUME_NONNULL_BEGIN
[self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing]; [self.payloadView autoPinLeadingToTrailingEdgeOfView:self.avatarView offset:self.avatarHSpacing];
[self.payloadView autoVCenterInSuperview]; [self.payloadView autoVCenterInSuperview];
// Ensure that the cell's contents never overflow the cell bounds. // Ensure that the cell's contents never overflow the cell bounds.
// We pin to the superview _edge_ and not _margin_ for the purposes [self.payloadView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual];
// of overflow, so that changes to the margins do not trip these safe guards. [self.payloadView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual];
[self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeTop
withInset:kMinVMargin
relation:NSLayoutRelationGreaterThanOrEqual];
[self.payloadView autoPinEdgeToSuperviewEdge:ALEdgeBottom
withInset:kMinVMargin
relation:NSLayoutRelationGreaterThanOrEqual];
// We pin the payloadView traillingEdge later, as part of the "Unread Badge" logic. // We pin the payloadView traillingEdge later, as part of the "Unread Badge" logic.
self.nameLabel = [UILabel new]; self.nameLabel = [UILabel new];
@ -410,11 +393,6 @@ NS_ASSUME_NONNULL_BEGIN
return minValue * alpha; return minValue * alpha;
} }
- (NSUInteger)cellHMargin
{
return 16;
}
- (NSUInteger)avatarSize - (NSUInteger)avatarSize
{ {
return 48.f; return 48.f;

@ -230,6 +230,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self.tableView autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [self.tableView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[self.tableView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:missingContactsPermissionView]; [self.tableView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:missingContactsPermissionView];
self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60;
UILabel *emptyBoxLabel = [UILabel new]; UILabel *emptyBoxLabel = [UILabel new];
self.emptyBoxLabel = emptyBoxLabel; self.emptyBoxLabel = emptyBoxLabel;

@ -125,6 +125,7 @@ NS_ASSUME_NONNULL_BEGIN
[_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinWidthToSuperview];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension; self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
[_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:contactsPermissionReminderView]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:contactsPermissionReminderView];
[self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view]; [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view];

@ -125,6 +125,8 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
[_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinWidthToSuperview];
[_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:firstSection]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:firstSection];
[self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view]; [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
[self updateTableContents]; [self updateTableContents];
} }

@ -63,6 +63,9 @@ NS_ASSUME_NONNULL_BEGIN
{ {
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self]; _contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60;
[self observeNotifications]; [self observeNotifications];
} }

@ -121,6 +121,8 @@ NS_ASSUME_NONNULL_BEGIN
[_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinWidthToSuperview];
[_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:firstSection]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:firstSection];
[self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view]; [self autoPinViewToBottomOfViewControllerOrKeyboard:self.tableViewController.view];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
[self updateTableContents]; [self updateTableContents];
} }

@ -18,7 +18,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
const NSUInteger kContactTableViewCellAvatarSize = 40; const NSUInteger kContactTableViewCellAvatarSize = 48;
const CGFloat kContactTableViewCellAvatarTextMargin = 12; const CGFloat kContactTableViewCellAvatarTextMargin = 12;
@interface ContactTableViewCell () @interface ContactTableViewCell ()
@ -53,11 +53,6 @@ const CGFloat kContactTableViewCellAvatarTextMargin = 12;
{ {
OWSAssert(!self.nameLabel); OWSAssert(!self.nameLabel);
const CGFloat kMinVMargin = 5;
self.preservesSuperviewLayoutMargins = YES;
self.contentView.preservesSuperviewLayoutMargins = YES;
_avatarView = [AvatarImageView new]; _avatarView = [AvatarImageView new];
[self.contentView addSubview:_avatarView]; [self.contentView addSubview:_avatarView];
@ -99,20 +94,10 @@ const CGFloat kContactTableViewCellAvatarTextMargin = 12;
[_nameContainerView autoPinTrailingToSuperviewMargin]; [_nameContainerView autoPinTrailingToSuperviewMargin];
// Ensure that the cell's contents never overflow the cell bounds. // Ensure that the cell's contents never overflow the cell bounds.
// We pin to the superview _edge_ and not _margin_ for the purposes [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual];
// of overflow, so that changes to the margins do not trip these safe guards. [self.avatarView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual];
[_avatarView autoPinEdgeToSuperviewEdge:ALEdgeTop [self.nameContainerView autoPinEdgeToSuperviewMargin:ALEdgeTop relation:NSLayoutRelationGreaterThanOrEqual];
withInset:kMinVMargin [self.nameContainerView autoPinEdgeToSuperviewMargin:ALEdgeBottom relation:NSLayoutRelationGreaterThanOrEqual];
relation:NSLayoutRelationGreaterThanOrEqual];
[_avatarView autoPinEdgeToSuperviewEdge:ALEdgeBottom
withInset:kMinVMargin
relation:NSLayoutRelationGreaterThanOrEqual];
[_nameContainerView autoPinEdgeToSuperviewEdge:ALEdgeTop
withInset:kMinVMargin
relation:NSLayoutRelationGreaterThanOrEqual];
[_nameContainerView autoPinEdgeToSuperviewEdge:ALEdgeBottom
withInset:kMinVMargin
relation:NSLayoutRelationGreaterThanOrEqual];
[self configureFonts]; [self configureFonts];

@ -94,6 +94,8 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
[_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinWidthToSuperview];
[_tableViewController.view autoPinToTopLayoutGuideOfViewController:self withInset:0]; [_tableViewController.view autoPinToTopLayoutGuideOfViewController:self withInset:0];
[_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
[self updateTableContents]; [self updateTableContents];

@ -111,6 +111,8 @@ NS_ASSUME_NONNULL_BEGIN
[_tableViewController.view autoPinWidthToSuperview]; [_tableViewController.view autoPinWidthToSuperview];
[_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:header]; [_tableViewController.view autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:header];
[_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom]; [_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom];
self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableViewController.tableView.estimatedRowHeight = 60;
} }
- (void)yapDatabaseModifiedExternally:(NSNotification *)notification - (void)yapDatabaseModifiedExternally:(NSNotification *)notification

Loading…
Cancel
Save