Refine views.

pull/1/head
Matthew Chen 7 years ago
parent fcbf8d4dc2
commit 8862f9a531

@ -316,7 +316,7 @@
NSString *_Nullable localProfileName = [OWSProfileManager.sharedManager localProfileName];
if (localProfileName.length > 0) {
titleLabel.text = localProfileName;
titleLabel.textColor = [UIColor ows_themeForegroundColor];
titleLabel.textColor = [UIColor ows_themePrimaryColor];
titleLabel.font = [UIFont ows_dynamicTypeTitle2Font];
} else {
titleLabel.text = NSLocalizedString(

@ -228,7 +228,7 @@ NS_ASSUME_NONNULL_BEGIN
UIColor *textColor = [UIColor ows_themeSecondaryColor];
if (hasUnreadMessages && overrideSnippet == nil) {
textColor = [UIColor ows_themeForegroundColor];
textColor = [UIColor ows_themePrimaryColor];
self.dateTimeLabel.font = self.dateTimeFont.ows_mediumWeight;
} else {
self.dateTimeLabel.font = self.dateTimeFont;
@ -366,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN
@"A label for conversations with blocked users.")
attributes:@{
NSFontAttributeName : self.snippetFont.ows_mediumWeight,
NSForegroundColorAttributeName : [UIColor ows_themeForegroundColor],
NSForegroundColorAttributeName : [UIColor ows_themePrimaryColor],
}]];
} else {
if ([thread isMuted]) {
@ -375,7 +375,7 @@ NS_ASSUME_NONNULL_BEGIN
attributes:@{
NSFontAttributeName : [UIFont ows_elegantIconsFont:9.f],
NSForegroundColorAttributeName :
(hasUnreadMessages ? [UIColor ows_themeForegroundColor]
(hasUnreadMessages ? [UIColor ows_themePrimaryColor]
: [UIColor ows_themeSecondaryColor]),
}]];
}
@ -388,7 +388,7 @@ NS_ASSUME_NONNULL_BEGIN
(hasUnreadMessages ? self.snippetFont.ows_mediumWeight
: self.snippetFont),
NSForegroundColorAttributeName :
(hasUnreadMessages ? [UIColor ows_themeForegroundColor]
(hasUnreadMessages ? [UIColor ows_themePrimaryColor]
: [UIColor ows_themeSecondaryColor]),
}]];
}
@ -491,7 +491,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertIsOnMainThread();
self.nameLabel.font = self.nameFont;
self.nameLabel.textColor = [UIColor ows_themeForegroundColor];
self.nameLabel.textColor = [UIColor ows_themePrimaryColor];
ThreadViewModel *thread = self.thread;
if (thread == nil) {

@ -822,7 +822,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
label.text = NSLocalizedString(@"HOME_VIEW_ARCHIVED_CONVERSATIONS", @"Label for 'archived conversations' button.");
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont ows_dynamicTypeBodyFont];
label.textColor = UIColor.ows_themeForegroundColor;
label.textColor = UIColor.ows_themePrimaryColor;
UIStackView *stackView = [UIStackView new];
stackView.axis = UILayoutConstraintAxisHorizontal;
@ -1449,7 +1449,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
value:[UIFont ows_regularFontWithSize:14.f]
range:NSMakeRange(firstLine.length + 1, secondLine.length)];
[fullLabelString addAttribute:NSForegroundColorAttributeName
value:UIColor.ows_themeForegroundColor
value:UIColor.ows_themePrimaryColor
range:NSMakeRange(0, firstLine.length)];
// TODO: Theme, Review with design.
[fullLabelString addAttribute:NSForegroundColorAttributeName

@ -75,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
{
[super loadView];
self.view.backgroundColor = UIColor.whiteColor;
self.view.backgroundColor = UIColor.ows_themeBackgroundColor;
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
_conversationSearcher = [ConversationSearcher shared];
_nonContactAccountSet = [NSMutableSet set];
@ -102,7 +102,12 @@ NS_ASSUME_NONNULL_BEGIN
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = [UIColor whiteColor];
searchBar.backgroundColor = [UIColor ows_themeBackgroundColor];
if (UIColor.isThemeEnabled) {
searchBar.barStyle = UIBarStyleBlack;
} else {
searchBar.barStyle = UIBarStyleDefault;
}
[searchBar sizeToFit];
_tableViewController = [OWSTableViewController new];
@ -139,6 +144,18 @@ NS_ASSUME_NONNULL_BEGIN
[self.tableViewController.tableView insertSubview:pullToRefreshView atIndex:0];
[self updateTableContents];
[self applyTheme];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(themeDidChange:)
name:NSNotificationNameThemeDidChange
object:nil];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)pullToRefreshPerformed:(UIRefreshControl *)refreshControl
@ -166,7 +183,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UIView *)createNoSignalContactsView
{
UIView *view = [UIView new];
view.backgroundColor = [UIColor whiteColor];
view.backgroundColor = [UIColor ows_themeBackgroundColor];
UIView *contents = [UIView new];
[view addSubview:contents];
@ -188,7 +205,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(
@"EMPTY_CONTACTS_LABEL_LINE1", "Full width label displayed when attempting to compose message");
titleLabel.textColor = [UIColor blackColor];
titleLabel.textColor = [UIColor ows_themePrimaryColor];
titleLabel.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(17.f, 20.f)];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -201,7 +218,7 @@ NS_ASSUME_NONNULL_BEGIN
UILabel *subtitleLabel = [UILabel new];
subtitleLabel.text = NSLocalizedString(
@"EMPTY_CONTACTS_LABEL_LINE2", "Full width label displayed when attempting to compose message");
subtitleLabel.textColor = [UIColor colorWithWhite:0.32f alpha:1.f];
subtitleLabel.textColor = [UIColor ows_themeSecondaryColor];
subtitleLabel.font = [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(12.f, 14.f)];
subtitleLabel.textAlignment = NSTextAlignmentCenter;
subtitleLabel.lineBreakMode = NSLineBreakByWordWrapping;
@ -993,6 +1010,22 @@ NS_ASSUME_NONNULL_BEGIN
}
}
#pragma mark - Theme
- (void)themeDidChange:(id)notification
{
OWSAssertIsOnMainThread();
[self applyTheme];
}
- (void)applyTheme
{
OWSAssertIsOnMainThread();
self.view.backgroundColor = UIColor.ows_themeBackgroundColor;
}
@end
NS_ASSUME_NONNULL_END

@ -137,7 +137,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
firstSectionHeader.userInteractionEnabled = YES;
[firstSectionHeader
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(headerWasTapped:)]];
firstSectionHeader.backgroundColor = [UIColor whiteColor];
firstSectionHeader.backgroundColor = [UIColor ows_themeBackgroundColor];
UIView *threadInfoView = [UIView new];
[firstSectionHeader addSubview:threadInfoView];
[threadInfoView autoPinWidthToSuperviewWithMargin:16.f];
@ -155,7 +155,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
UITextField *groupNameTextField = [UITextField new];
_groupNameTextField = groupNameTextField;
groupNameTextField.textColor = [UIColor blackColor];
groupNameTextField.textColor = [UIColor ows_themePrimaryColor];
groupNameTextField.font = [UIFont ows_dynamicTypeTitle2Font];
groupNameTextField.placeholder
= NSLocalizedString(@"NEW_GROUP_NAMEGROUP_REQUEST_DEFAULT", @"Placeholder text for group name field");

@ -99,7 +99,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UILabel *)createLabelWithText:(NSString *)text
{
UILabel *label = [UILabel new];
label.textColor = [UIColor ows_themeForegroundColor];
label.textColor = [UIColor ows_themePrimaryColor];
label.text = text;
label.font = [UIFont ows_regularFontWithSize:ScaleFromIPhone5To7Plus(14.f, 16.f)];
label.numberOfLines = 0;
@ -112,7 +112,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)createPinTextfield
{
self.pinTextfield = [UITextField new];
self.pinTextfield.textColor = [UIColor ows_themeForegroundColor];
self.pinTextfield.textColor = [UIColor ows_themePrimaryColor];
self.pinTextfield.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(30.f, 36.f)];
self.pinTextfield.textAlignment = NSTextAlignmentCenter;
self.pinTextfield.keyboardType = UIKeyboardTypeNumberPad;

@ -514,11 +514,11 @@ const CGFloat kIconViewLength = 24;
itemWithCustomCellBlock:^{
UITableViewCell *cell =
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
[OWSTableItem configureCell:cell];
OWSConversationSettingsViewController *strongSelf = weakSelf;
OWSCAssert(strongSelf);
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.backgroundColor = [UIColor ows_themeBackgroundColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_notification_sound"];
@ -553,11 +553,11 @@ const CGFloat kIconViewLength = 24;
itemWithCustomCellBlock:^{
UITableViewCell *cell =
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
[OWSTableItem configureCell:cell];
OWSConversationSettingsViewController *strongSelf = weakSelf;
OWSCAssert(strongSelf);
cell.preservesSuperviewLayoutMargins = YES;
cell.contentView.preservesSuperviewLayoutMargins = YES;
cell.backgroundColor = [UIColor ows_themeBackgroundColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
UIImageView *iconView = [strongSelf viewForIconWithName:@"table_ic_mute_thread"];

@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
- (UILabel *)createLabelWithText:(nullable NSString *)text
{
UILabel *label = [UILabel new];
label.textColor = [UIColor ows_themeForegroundColor];
label.textColor = [UIColor ows_themePrimaryColor];
label.text = text;
label.font = self.labelFont;
label.numberOfLines = 0;
@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
self.pinTextfield = [UITextField new];
}
self.pinTextfield.textColor = [UIColor ows_themeForegroundColor];
self.pinTextfield.textColor = [UIColor ows_themePrimaryColor];
self.pinTextfield.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(30.f, 36.f)];
self.pinTextfield.textAlignment = NSTextAlignmentCenter;
self.pinTextfield.keyboardType = UIKeyboardTypeNumberPad;

@ -88,7 +88,7 @@ class ReminderView: UIView {
// Label
label.font = UIFont.ows_dynamicTypeSubheadline
container.addArrangedSubview(label)
label.textColor = UIColor.ows_themeForeground()
label.textColor = UIColor.ows_themePrimary
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
@ -102,7 +102,7 @@ class ReminderView: UIView {
}
let iconView = UIImageView(image: iconImage.withRenderingMode(.alwaysTemplate))
iconView.contentMode = .scaleAspectFit
iconView.tintColor = UIColor.ows_themeSecondary()
iconView.tintColor = UIColor.ows_themeSecondary
iconView.autoSetDimension(.width, toSize: 13)
container.addArrangedSubview(iconView)
}

@ -53,6 +53,7 @@ typedef UITableViewCell *_Nonnull (^OWSTableCustomCellBlock)(void);
@property (nonatomic, weak) UIViewController *tableViewController;
+ (UITableViewCell *)newCell;
+ (void)configureCell:(UITableViewCell *)cell;
+ (OWSTableItem *)itemWithTitle:(NSString *)title actionBlock:(nullable OWSTableActionBlock)actionBlock;

@ -101,16 +101,20 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (UITableViewCell *)newCell
{
UITableViewCell *cell = [UITableViewCell new];
[self configureCell:cell];
return cell;
}
+ (void)configureCell:(UITableViewCell *)cell
{
cell.backgroundColor = [UIColor ows_themeBackgroundColor];
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [UIColor ows_themeForegroundColor];
cell.textLabel.textColor = [UIColor ows_themePrimaryColor];
UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor =
[(UIColor.isThemeEnabled ? [UIColor ows_whiteColor] : [UIColor ows_blackColor]) colorWithAlphaComponent:0.08];
cell.selectedBackgroundView = selectedBackgroundView;
return cell;
}
+ (OWSTableItem *)itemWithTitle:(NSString *)title actionBlock:(nullable OWSTableActionBlock)actionBlock
@ -210,10 +214,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
item.customCellBlock = ^{
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:@"UITableViewCellStyleValue1"];
cell.backgroundColor = [UIColor ows_themeBackgroundColor];
[OWSTableItem configureCell:cell];
cell.textLabel.text = text;
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [UIColor ows_themeForegroundColor];
cell.detailTextLabel.text = detailText;
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
return cell;

@ -58,18 +58,14 @@ const CGFloat kContactCellAvatarTextMargin = 12;
self.nameLabel = [UILabel new];
self.nameLabel.lineBreakMode = NSLineBreakByTruncatingTail;
self.nameLabel.textColor = [UIColor blackColor];
self.profileNameLabel = [UILabel new];
self.profileNameLabel.lineBreakMode = NSLineBreakByTruncatingTail;
self.profileNameLabel.textColor = [UIColor grayColor];
self.subtitleLabel = [UILabel new];
self.subtitleLabel.textColor = [UIColor ows_darkGrayColor];
self.accessoryLabel = [[UILabel alloc] init];
self.accessoryLabel.textAlignment = NSTextAlignmentRight;
self.accessoryLabel.textColor = [UIColor colorWithWhite:0.5f alpha:1.f];
self.accessoryViewContainer = [UIView containerView];
@ -91,15 +87,20 @@ const CGFloat kContactCellAvatarTextMargin = 12;
[self addArrangedSubview:self.nameContainerView];
[self addArrangedSubview:self.accessoryViewContainer];
[self configureFonts];
[self configureFontsAndColors];
}
- (void)configureFonts
- (void)configureFontsAndColors
{
self.nameLabel.font = [UIFont ows_dynamicTypeBodyFont];
self.profileNameLabel.font = [UIFont ows_regularFontWithSize:11.f];
self.subtitleLabel.font = [UIFont ows_regularFontWithSize:11.f];
self.accessoryLabel.font = [UIFont ows_mediumFontWithSize:13.f];
self.nameLabel.textColor = [UIColor ows_themePrimaryColor];
self.profileNameLabel.textColor = [UIColor ows_themeSecondaryColor];
self.subtitleLabel.textColor = [UIColor ows_themeSecondaryColor];
self.accessoryLabel.textColor = [UIColor colorWithWhite:0.5f alpha:1.f];
}
- (void)configureWithSignalAccount:(SignalAccount *)signalAccount contactsManager:(OWSContactsManager *)contactsManager
@ -113,7 +114,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
OWSAssert(contactsManager);
// Update fonts to reflect changes to dynamic type.
[self configureFonts];
[self configureFontsAndColors];
self.recipientId = recipientId;
self.contactsManager = contactsManager;
@ -143,7 +144,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
self.thread = thread;
// Update fonts to reflect changes to dynamic type.
[self configureFonts];
[self configureFontsAndColors];
self.contactsManager = contactsManager;
@ -155,7 +156,7 @@ const CGFloat kContactCellAvatarTextMargin = 12;
NSAttributedString *attributedText =
[[NSAttributedString alloc] initWithString:threadName
attributes:@{
NSForegroundColorAttributeName : [UIColor blackColor],
NSForegroundColorAttributeName : [UIColor ows_themePrimaryColor],
}];
self.nameLabel.attributedText = attributedText;

@ -4,6 +4,8 @@
#import "ContactTableViewCell.h"
#import "ContactCellView.h"
#import "OWSTableViewController.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
#import <SignalServiceKit/SignalAccount.h>
@ -44,6 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
self.preservesSuperviewLayoutMargins = YES;
self.contentView.preservesSuperviewLayoutMargins = YES;
[OWSTableItem configureCell:self];
self.cellView = [ContactCellView new];
[self.contentView addSubview:self.cellView];

@ -90,9 +90,10 @@ extern NSString *const NSNotificationNameThemeDidChange;
+ (void)setIsThemeEnabled:(BOOL)value;
#endif
+ (UIColor *)ows_themeBackgroundColor;
+ (UIColor *)ows_themeForegroundColor;
+ (UIColor *)ows_themeSecondaryColor;
@property (class, readonly, nonatomic) UIColor *ows_themeBackgroundColor;
@property (class, readonly, nonatomic) UIColor *ows_themePrimaryColor;
@property (class, readonly, nonatomic) UIColor *ows_themeSecondaryColor;
@property (class, readonly, nonatomic) UIColor *ows_themeBoldColor;
@end

@ -384,7 +384,7 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
return (UIColor.isThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor);
}
+ (UIColor *)ows_themeForegroundColor
+ (UIColor *)ows_themePrimaryColor
{
// TODO: Theme, Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_light90Color);
@ -396,6 +396,12 @@ NSString *const UIColorKeyThemeEnabled = @"UIColorKeyThemeEnabled";
return (UIColor.isThemeEnabled ? UIColor.ows_dark60Color : UIColor.ows_light60Color);
}
+ (UIColor *)ows_themeBoldColor
{
// TODO: Review with design.
return (UIColor.isThemeEnabled ? UIColor.ows_whiteColor : UIColor.blackColor);
}
@end
NS_ASSUME_NONNULL_END

@ -762,9 +762,9 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan
UIFont *boldFont = [UIFont ows_mediumFontWithSize:font.pointSize];
NSDictionary<NSString *, id> *boldFontAttributes =
@{ NSFontAttributeName : boldFont, NSForegroundColorAttributeName : [UIColor blackColor] };
@{ NSFontAttributeName : boldFont, NSForegroundColorAttributeName : [UIColor ows_themeBoldColor] };
NSDictionary<NSString *, id> *normalFontAttributes =
@{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColor ows_darkGrayColor] };
@{ NSFontAttributeName : font, NSForegroundColorAttributeName : [UIColor ows_themePrimaryColor] };
NSDictionary<NSString *, id> *firstNameAttributes
= (self.shouldSortByGivenName ? boldFontAttributes : normalFontAttributes);
NSDictionary<NSString *, id> *lastNameAttributes

@ -108,7 +108,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{
UILabel *countryCodeLabel = [UILabel new];
countryCodeLabel.font = [UIFont ows_mediumFontWithSize:18.f];
countryCodeLabel.textColor = [UIColor ows_themeForegroundColor];
countryCodeLabel.textColor = [UIColor ows_themePrimaryColor];
countryCodeLabel.text
= NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"Label for the country code field");
return countryCodeLabel;
@ -133,7 +133,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{
UILabel *phoneNumberLabel = [UILabel new];
phoneNumberLabel.font = [UIFont ows_mediumFontWithSize:18.f];
phoneNumberLabel.textColor = [UIColor ows_themeForegroundColor];
phoneNumberLabel.textColor = [UIColor ows_themePrimaryColor];
phoneNumberLabel.text
= NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"Label for the phone number textfield");
return phoneNumberLabel;

Loading…
Cancel
Save