Merge branch 'martin/IOS-2124'

This commit is contained in:
Martin Böttcher 2022-01-22 12:29:27 +01:00
commit 424f2b5790
3 changed files with 15 additions and 8 deletions

View File

@ -166,11 +166,14 @@ public class HomeViewCell: UITableViewCell {
private func commonInit() {
self.backgroundColor = Theme.backgroundColor
let v = UIView(frame: contentView.bounds)
v.autoresizingMask = [.flexibleWidth, .flexibleHeight]
var v = UIView(frame: contentView.bounds)
v.backgroundColor = Theme.tableCell2MultiSelectedBackgroundColor
multipleSelectionBackgroundView = v
v = UIView(frame: contentView.bounds)
v.backgroundColor = Theme.tableCell2SelectedBackgroundColor
selectedBackgroundView = v
contentView.addSubview(outerHStack)
outerHStack.shouldDeactivateConstraints = false
outerHStack.autoPinEdge(toSuperviewEdge: .leading)
@ -178,7 +181,6 @@ public class HomeViewCell: UITableViewCell {
outerHStack.autoPinHeightToSuperview()
self.selectionStyle = .default
selectedBackgroundView?.backgroundColor = Theme.tableCell2SelectedBackgroundColor
}
// This method can be invoked from any thread.
@ -316,7 +318,7 @@ public class HomeViewCell: UITableViewCell {
func configure(cellContentToken: HVCellContentToken, asyncAvatarLoadingAllowed: Bool = true) {
AssertIsOnMainThread()
OWSTableItem.configureCell(self)
OWSTableItem.configureCellLabels(self)
self.preservesSuperviewLayoutMargins = false
self.contentView.preservesSuperviewLayoutMargins = false

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
#import <SignalUI/OWSViewController.h>
@ -86,6 +86,7 @@ typedef BOOL (^OWSTableSwitchBlock)(void);
+ (UITableViewCell *)newCell;
+ (void)configureCell:(UITableViewCell *)cell;
+ (void)configureCellLabels:(UITableViewCell *)cell;
+ (OWSTableItem *)itemWithTitle:(NSString *)title
actionBlock:(nullable OWSTableActionBlock)actionBlock NS_SWIFT_NAME(init(title:actionBlock:));

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
#import "OWSTableViewController.h"
@ -140,14 +140,18 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
return cell;
}
+ (void)configureCell:(UITableViewCell *)cell
+ (void)configureCellLabels:(UITableViewCell *)cell
{
cell.backgroundColor = Theme.backgroundColor;
cell.textLabel.font = OWSTableItem.primaryLabelFont;
cell.textLabel.textColor = Theme.primaryTextColor;
cell.detailTextLabel.textColor = Theme.secondaryTextAndIconColor;
cell.detailTextLabel.font = OWSTableItem.accessoryLabelFont;
}
+ (void)configureCell:(UITableViewCell *)cell
{
cell.backgroundColor = Theme.backgroundColor;
[self configureCellLabels:cell];
UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor = Theme.cellSelectedColor;
cell.selectedBackgroundView = selectedBackgroundView;