From a292aedf7b10eefa6ee3c995a2cd2208623ff340 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 2 Dec 2019 09:52:44 +1100 Subject: [PATCH] Finish home screen redesign --- Signal/src/Loki/HomeVC.swift | 26 ++++++++++++++----- .../Loki/Utilities/Style Guide/Colors.swift | 1 + .../Loki/Utilities/Style Guide/Values.swift | 1 + 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Signal/src/Loki/HomeVC.swift b/Signal/src/Loki/HomeVC.swift index 522d46e8d..fa40cd118 100644 --- a/Signal/src/Loki/HomeVC.swift +++ b/Signal/src/Loki/HomeVC.swift @@ -63,13 +63,25 @@ final class HomeVC : UIViewController, UITableViewDataSource, UITableViewDelegat searchBar.sizeToFit() tableView.contentOffset = CGPoint(x: 0, y: searchBar.frame.height) // Set up new conversation button -// let newConversationButton = UIImageView(image: #imageLiteral(resourceName: "ic_plus_24").asTintedImage(color: UIColor(hex: 0x121212))) -// newConversationButton.backgroundColor = Colors.accent -// newConversationButton.set(.width, to: Values.newConversationButtonSize) -// newConversationButton.set(.height, to: Values.newConversationButtonSize) -// view.addSubview(newConversationButton) -// newConversationButton.center(.horizontal, in: view) -// newConversationButton.center(.vertical, in: view) + let newConversationButton = UIButton() + newConversationButton.setTitle("+", for: UIControl.State.normal) + newConversationButton.titleLabel!.font = .systemFont(ofSize: 35) + newConversationButton.setTitleColor(UIColor(hex: 0x121212), for: UIControl.State.normal) + newConversationButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 1, bottom: 4, right: 0) // Slight adjustment to make the plus exactly centered + newConversationButton.backgroundColor = Colors.accent + let newConversationButtonSize = Values.newConversationButtonSize + newConversationButton.layer.cornerRadius = newConversationButtonSize / 2 + newConversationButton.layer.shadowPath = UIBezierPath(ovalIn: CGRect(origin: CGPoint(x: 0, y: 0), size: CGSize(width: newConversationButtonSize, height: newConversationButtonSize))).cgPath + newConversationButton.layer.shadowColor = Colors.newConversationButtonShadow.cgColor + newConversationButton.layer.shadowOffset = CGSize(width: 0, height: 0.8) + newConversationButton.layer.shadowOpacity = 1 + newConversationButton.layer.shadowRadius = 6 + newConversationButton.layer.masksToBounds = false + newConversationButton.set(.width, to: newConversationButtonSize) + newConversationButton.set(.height, to: newConversationButtonSize) + view.addSubview(newConversationButton) + newConversationButton.center(.horizontal, in: view) + newConversationButton.pin(.bottom, to: .bottom, of: view, withInset: -Values.newConversationButtonBottomOffset) // Negative due to how the constraint is set up // Set up previewing if (traitCollection.forceTouchCapability == .available) { registerForPreviewing(with: self, sourceView: tableView) diff --git a/Signal/src/Loki/Utilities/Style Guide/Colors.swift b/Signal/src/Loki/Utilities/Style Guide/Colors.swift index a92bc1f54..cf5e07247 100644 --- a/Signal/src/Loki/Utilities/Style Guide/Colors.swift +++ b/Signal/src/Loki/Utilities/Style Guide/Colors.swift @@ -21,4 +21,5 @@ final class Colors : NSObject { @objc static let navigationBarBackground = UIColor(hex: 0x161616) @objc static let searchBarPlaceholder = UIColor(hex: 0x8E8E93) // Also used for the icons @objc static let searchBarBackground = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 0.12) + @objc static let newConversationButtonShadow = UIColor(hex: 0x077C44) } diff --git a/Signal/src/Loki/Utilities/Style Guide/Values.swift b/Signal/src/Loki/Utilities/Style Guide/Values.swift index e5dc00cb1..75afec7b7 100644 --- a/Signal/src/Loki/Utilities/Style Guide/Values.swift +++ b/Signal/src/Loki/Utilities/Style Guide/Values.swift @@ -29,4 +29,5 @@ final class Values : NSObject { @objc static let smallSpacing = CGFloat(8) @objc static let mediumSpacing = CGFloat(16) @objc static let largeSpacing = CGFloat(24) + @objc static let newConversationButtonBottomOffset = CGFloat(52) }