From f8abe32ae95d23b4a85e7a37df04cdd44e6d1b79 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 29 Jun 2018 16:16:09 -0600 Subject: [PATCH] more styling to new nav colors --- .../ConversationView/ConversationHeaderView.swift | 4 ++-- .../ConversationView/ConversationViewController.m | 9 +++++---- .../ViewControllers/MediaGalleryViewController.swift | 3 --- .../src/ViewControllers/MediaPageViewController.swift | 5 ++--- SignalMessaging/Views/OWSNavigationBar.swift | 3 ++- .../attachments/AttachmentApprovalViewController.swift | 1 - SignalMessaging/categories/UIViewController+OWS.m | 6 ++++-- SignalMessaging/utils/UIUtil.m | 10 +++++++--- SignalShareExtension/Info.plist | 2 +- 9 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift index 202737872..85e25980b 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationHeaderView.swift @@ -64,13 +64,13 @@ public class ConversationHeaderView: UIStackView { avatarView.layer.borderWidth = 0 titleLabel = UILabel() - titleLabel.textColor = .white + titleLabel.textColor = .ows_navbarForeground titleLabel.lineBreakMode = .byTruncatingTail titleLabel.font = titlePrimaryFont titleLabel.setContentHuggingHigh() subtitleLabel = UILabel() - subtitleLabel.textColor = .white + subtitleLabel.textColor = .ows_navbarForeground subtitleLabel.lineBreakMode = .byTruncatingTail subtitleLabel.font = subtitleFont subtitleLabel.setContentHuggingHigh() diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index d534e8c07..bae004cfa 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -1379,6 +1379,7 @@ typedef enum : NSUInteger { { NSMutableAttributedString *subtitleText = [NSMutableAttributedString new]; + UIColor *subtitleColor = [UIColor.ows_navbarForegroundColor colorWithAlphaComponent:(CGFloat)0.9]; if (self.thread.isMuted) { // Show a "mute" icon before the navigation bar subtitle if this thread is muted. [subtitleText @@ -1386,7 +1387,7 @@ typedef enum : NSUInteger { initWithString:@"\ue067 " attributes:@{ NSFontAttributeName : [UIFont ows_elegantIconsFont:7.f], - NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f], + NSForegroundColorAttributeName : subtitleColor }]]; } @@ -1405,7 +1406,7 @@ typedef enum : NSUInteger { initWithString:@"\uf00c " attributes:@{ NSFontAttributeName : [UIFont ows_fontAwesomeFont:10.f], - NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f], + NSForegroundColorAttributeName : subtitleColor, }]]; } @@ -1415,7 +1416,7 @@ typedef enum : NSUInteger { initWithString:NSLocalizedString(@"GROUP_YOU_LEFT", @"") attributes:@{ NSFontAttributeName : self.headerView.subtitleFont, - NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f], + NSForegroundColorAttributeName : subtitleColor, }]]; } else { [subtitleText appendAttributedString: @@ -1425,7 +1426,7 @@ typedef enum : NSUInteger { @"title can be tapped to access settings for this conversation.") attributes:@{ NSFontAttributeName : self.headerView.subtitleFont, - NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f], + NSForegroundColorAttributeName : subtitleColor, }]]; } diff --git a/Signal/src/ViewControllers/MediaGalleryViewController.swift b/Signal/src/ViewControllers/MediaGalleryViewController.swift index d450bfb35..fd5255920 100644 --- a/Signal/src/ViewControllers/MediaGalleryViewController.swift +++ b/Signal/src/ViewControllers/MediaGalleryViewController.swift @@ -248,9 +248,6 @@ class MediaGalleryViewController: OWSNavigationController, MediaGalleryDataSourc // animate in our view, over the existing context, similar to a cross disolve, but allowing us to have // more fine grained control self.modalPresentationStyle = .custom - self.navigationBar.barTintColor = UIColor.ows_materialBlue - self.navigationBar.isTranslucent = false - self.navigationBar.isOpaque = true // The presentationView is only used during present/dismiss animations. // It's a static image of the media content. diff --git a/Signal/src/ViewControllers/MediaPageViewController.swift b/Signal/src/ViewControllers/MediaPageViewController.swift index d6b842607..43c6021dd 100644 --- a/Signal/src/ViewControllers/MediaPageViewController.swift +++ b/Signal/src/ViewControllers/MediaPageViewController.swift @@ -174,7 +174,6 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou let footerBar = UIToolbar() self.footerBar = footerBar - footerBar.barTintColor = UIColor.ows_signalBrandBlue self.videoPlayBarButton = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(didPressPlayBarButton)) self.videoPauseBarButton = UIBarButtonItem(barButtonSystemItem: .pause, target: self, action: #selector(didPressPauseBarButton)) @@ -588,7 +587,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou lazy private var headerNameLabel: UILabel = { let label = UILabel() - label.textColor = .white + label.textColor = .ows_navbarForeground label.font = UIFont.ows_regularFont(withSize: 17) label.textAlignment = .center label.adjustsFontSizeToFitWidth = true @@ -599,7 +598,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou lazy private var headerDateLabel: UILabel = { let label = UILabel() - label.textColor = .white + label.textColor = .ows_navbarForeground label.font = UIFont.ows_regularFont(withSize: 12) label.textAlignment = .center label.adjustsFontSizeToFitWidth = true diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index 0acd85bf3..4c2837680 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -41,7 +41,8 @@ public class OWSNavigationBar: UINavigationBar { override init(frame: CGRect) { super.init(frame: frame) - self.isTranslucent = false + self.isOpaque = false + self.isTranslucent = true NotificationCenter.default.addObserver(self, selector: #selector(callDidChange), name: .OWSWindowManagerCallDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didChangeStatusBarFrame), name: .UIApplicationDidChangeStatusBarFrame, object: nil) diff --git a/SignalMessaging/attachments/AttachmentApprovalViewController.swift b/SignalMessaging/attachments/AttachmentApprovalViewController.swift index cbe181b98..f9b87c7ed 100644 --- a/SignalMessaging/attachments/AttachmentApprovalViewController.swift +++ b/SignalMessaging/attachments/AttachmentApprovalViewController.swift @@ -70,7 +70,6 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool // Make navigationBar clear navController.navigationBar.backgroundColor = .clear navController.navigationBar.setBackgroundImage(UIImage(), for: .default) - navController.navigationBar.isTranslucent = true navController.navigationBar.shadowImage = UIImage() navController.navigationBar.clipsToBounds = true diff --git a/SignalMessaging/categories/UIViewController+OWS.m b/SignalMessaging/categories/UIViewController+OWS.m index 8d24f7505..8186b9025 100644 --- a/SignalMessaging/categories/UIViewController+OWS.m +++ b/SignalMessaging/categories/UIViewController+OWS.m @@ -2,8 +2,9 @@ // Copyright (c) 2018 Open Whisper Systems. All rights reserved. // -#import "UIView+OWS.h" #import "UIViewController+OWS.h" +#import "UIColor+OWS.h" +#import "UIView+OWS.h" NS_ASSUME_NONNULL_BEGIN @@ -71,9 +72,10 @@ NS_ASSUME_NONNULL_BEGIN // in a UIBarButtonItem. [backButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside]; - UIImage *backImage = [UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")]; + UIImage *backImage = [[UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; OWSAssert(backImage); [backButton setImage:backImage forState:UIControlStateNormal]; + backButton.tintColor = UIColor.ows_navbarForegroundColor; backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; diff --git a/SignalMessaging/utils/UIUtil.m b/SignalMessaging/utils/UIUtil.m index 514f2c226..0dbd93abb 100644 --- a/SignalMessaging/utils/UIUtil.m +++ b/SignalMessaging/utils/UIUtil.m @@ -50,13 +50,17 @@ UINavigationBar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor; // [[UINavigationBar appearance] setBarTintColor:[UIColor ows_materialBlueColor]]; UINavigationBar.appearance.tintColor = UIColor.ows_navbarForegroundColor; + UIToolbar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor; + UIToolbar.appearance.tintColor = UIColor.ows_navbarForegroundColor; -// [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor ows_materialBlueColor]]; + UIBarButtonItem.appearance.tintColor = UIColor.ows_navbarForegroundColor; + + // [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor + // ows_materialBlueColor]]; [[UISwitch appearance] setOnTintColor:[UIColor ows_materialBlueColor]]; [[UIToolbar appearance] setTintColor:[UIColor ows_materialBlueColor]]; -// [[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]]; - + // If we set NSShadowAttributeName, the NSForegroundColorAttributeName value is ignored. UINavigationBar.appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : UIColor.ows_navbarForegroundColor diff --git a/SignalShareExtension/Info.plist b/SignalShareExtension/Info.plist index 2df5fa92c..142034873 100644 --- a/SignalShareExtension/Info.plist +++ b/SignalShareExtension/Info.plist @@ -81,7 +81,7 @@ fontawesome-webfont.ttf UIStatusBarStyle - UIStatusBarStyleLightContent + UIStatusBarStyleDefault UISupportedInterfaceOrientations UIInterfaceOrientationPortrait