dark theme section headers in tile gallery

pull/1/head
Michael Kirk 6 years ago
parent 8ebe860ff1
commit 31782af2f1

@ -54,6 +54,32 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryDa
notImplemented()
}
// MARK: Subviews
lazy var footerBar: UIToolbar = {
let footerBar = UIToolbar()
let footerItems = [
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
deleteButton,
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
]
footerBar.setItems(footerItems, animated: false)
footerBar.barTintColor = Theme.darkThemeNavbarBackgroundColor
footerBar.tintColor = Theme.darkThemeNavbarIconColor
return footerBar
}()
lazy var deleteButton: UIBarButtonItem = {
let deleteButton = UIBarButtonItem(barButtonSystemItem: .trash,
target: self,
action: #selector(didPressDelete))
deleteButton.tintColor = Theme.darkThemeNavbarIconColor
return deleteButton
}()
// MARK: View Lifecycle Overrides
override public func viewDidLoad() {
@ -77,19 +103,6 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryDa
// feels a bit weird to have content smashed all the way to the bottom edge.
collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 20, right: 0)
let footerBar = UIToolbar()
self.footerBar = footerBar
let deleteButton = UIBarButtonItem(barButtonSystemItem: .trash,
target: self,
action: #selector(didPressDelete))
self.deleteButton = deleteButton
let footerItems = [
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
deleteButton,
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
]
footerBar.setItems(footerItems, animated: false)
self.view.addSubview(self.footerBar)
footerBar.autoPinWidthToSuperview()
footerBar.autoSetDimension(.height, toSize: kFooterBarHeight)
@ -592,8 +605,6 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryDa
present(actionSheet, animated: true)
}
var footerBar: UIToolbar!
var deleteButton: UIBarButtonItem!
var footerBarBottomConstraint: NSLayoutConstraint!
let kFooterBarHeight: CGFloat = 40
@ -812,16 +823,16 @@ private class MediaGallerySectionHeader: UICollectionReusableView {
override init(frame: CGRect) {
label = UILabel()
label.textColor = Theme.primaryColor
label.textColor = Theme.darkThemePrimaryColor
let blurEffect = Theme.barBlurEffect
let blurEffect = Theme.darkThemeBarBlurEffect
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
super.init(frame: frame)
self.backgroundColor = Theme.navbarBackgroundColor.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor)
self.backgroundColor = Theme.darkThemeNavbarBackgroundColor.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor)
self.addSubview(blurEffectView)
self.addSubview(label)
@ -859,7 +870,7 @@ private class MediaGalleryStaticHeader: UICollectionViewCell {
addSubview(label)
label.textColor = Theme.primaryColor
label.textColor = Theme.darkThemePrimaryColor
label.textAlignment = .center
label.numberOfLines = 0
label.autoPinEdgesToSuperviewMargins()

@ -144,20 +144,6 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
pagerScrollView.isScrollEnabled = attachmentItems.count > 1
}
private func makeClearToolbar() -> UIToolbar {
let toolbar = UIToolbar()
toolbar.backgroundColor = UIColor.clear
// Making a toolbar transparent requires setting an empty uiimage
toolbar.setBackgroundImage(UIImage(), forToolbarPosition: .any, barMetrics: .default)
// hide 1px top-border
toolbar.clipsToBounds = true
return toolbar
}
// MARK: UIPageViewControllerDelegate
public func pageViewController(_ pageViewController: UIPageViewController, willTransitionTo pendingViewControllers: [UIViewController]) {

@ -39,8 +39,13 @@ extern NSString *const ThemeDidChangeNotification;
@property (class, readonly, nonatomic) UIColor *cellSelectedColor;
@property (class, readonly, nonatomic) UIColor *cellSeparatorColor;
// In some contexts, e.g. media viewing/sending, we always use "dark theme" UI regardless of the
// users chosen theme.
@property (class, readonly, nonatomic) UIColor *darkThemeNavbarIconColor;
@property (class, readonly, nonatomic) UIColor *darkThemeNavbarBackgroundColor;
@property (class, readonly, nonatomic) UIColor *darkThemeBackgroundColor;
@property (class, readonly, nonatomic) UIColor *darkThemePrimaryColor;
@property (class, readonly, nonatomic) UIBlurEffect *darkThemeBarBlurEffect;
#pragma mark -

@ -90,12 +90,22 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
+ (UIColor *)navbarBackgroundColor
{
return (Theme.isDarkThemeEnabled ? UIColor.ows_blackColor : UIColor.ows_whiteColor);
return (Theme.isDarkThemeEnabled ? self.darkThemeNavbarBackgroundColor : UIColor.ows_whiteColor);
}
+ (UIColor *)darkThemeNavbarBackgroundColor
{
return UIColor.ows_blackColor;
}
+ (UIColor *)navbarIconColor
{
return (Theme.isDarkThemeEnabled ? UIColor.ows_gray25Color : UIColor.ows_gray60Color);
return (Theme.isDarkThemeEnabled ? self.darkThemeNavbarIconColor : UIColor.ows_gray60Color);
}
+ (UIColor *)darkThemeNavbarIconColor;
{
return UIColor.ows_gray25Color;
}
+ (UIColor *)navbarTitleColor
@ -135,10 +145,15 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
+ (UIBlurEffect *)barBlurEffect
{
return Theme.isDarkThemeEnabled ? [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]
return Theme.isDarkThemeEnabled ? self.darkThemeBarBlurEffect
: [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
}
+ (UIBlurEffect *)darkThemeBarBlurEffect
{
return [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
}
+ (UIKeyboardAppearance)keyboardAppearance
{
return Theme.isDarkThemeEnabled ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault;

Loading…
Cancel
Save