NewsBlur/clients/ios/Classes/FeedChooserTitleView.m
David Sinclair 375e3757e2 #1693 (2022 Redesign)
- Laboriously updated the icons (finding the names in the web inspector, updating the code, inspecting the colors, setting those separately, dealing with scaling issues, etc etc).
- Let me know if you spot any icons that I missed, or unscaled icons (they have to be explicitly sized, otherwise appear huge).
- More space between story title and story content.
- More space when reading a folder.
- Added Compact/Comfortable to feed detail menu.
- Changing Compact/Comfortable also adjusts the feed detail list.
- Adjusted the color of the story content etc in the feed detail list.
- Removed top and bottom borders from feed title gradient in story detail.
- More space in story detail header.
- The feed detail is offset when selected.
- Updated the feeds social, search, and saved background colors.
- Unread counts no longer have a shadow, and have more space.
- Folders and feeds remain selected in the feeds list when returning from a story or refreshing.
- Folders in the feeds list no longer have a different background color.
- The folders and feeds highlight is now rounded and unbordered like on web.
2022-07-20 21:35:16 -07:00

101 lines
4.2 KiB
Objective-C

//
// FeedChooserTitleView.m
// NewsBlur
//
// Created by David Sinclair on 2016-01-22.
// Copyright © 2016 NewsBlur. All rights reserved.
//
#import "FeedChooserTitleView.h"
#import "NewsBlurAppDelegate.h"
#import "NewsBlur-Swift.h"
@interface FeedChooserTitleView ()
@property (nonatomic) UIButton *invisibleHeaderButton;
@property (nonatomic, strong) UIFontDescriptor *fontDescriptor;
@end
@implementation FeedChooserTitleView
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
for (UIView *subview in self.subviews) {
[subview removeFromSuperview];
}
// Create the parent view that will hold header Label
UIView *customView = [[UIView alloc] initWithFrame:rect];
// Background
[NewsBlurAppDelegate fillGradient:rect
startColor:UIColorFromLightSepiaMediumDarkRGB(0xEAECE5, 0xffffc6, 0x6A6A6A, 0x444444)
endColor:UIColorFromLightSepiaMediumDarkRGB(0xDCDFD6, 0xffffc0, 0x666666, 0x333333)];
// Borders
UIColor *topColor = UIColorFromLightSepiaMediumDarkRGB(0xFDFDFD, 0xFDFDF6, 0x878B8A, 0x474B4A);
CGContextSetStrokeColor(context, CGColorGetComponents([topColor CGColor]));
CGContextBeginPath(context);
CGContextMoveToPoint(context, 0, 0.25f);
CGContextAddLineToPoint(context, rect.size.width, 0.25f);
CGContextStrokePath(context);
// bottom border
UIColor *bottomColor = UIColorFromLightSepiaMediumDarkRGB(0xB7BBAA, 0xe0e0a6, 0x404040, 0x0D0D0D);
CGContextSetStrokeColor(context, CGColorGetComponents([bottomColor CGColor]));
CGContextBeginPath(context);
CGContextMoveToPoint(context, 0, rect.size.height-0.25f);
CGContextAddLineToPoint(context, rect.size.width, rect.size.height-0.25f);
CGContextStrokePath(context);
// Folder title
UIColor *textColor = UIColorFromRGB(0x4C4D4A);
UIFont *font = [UIFont fontWithDescriptor:self.fontDescriptor size:0.0];
NSInteger titleOffsetY = ((rect.size.height - font.pointSize) / 2) - 1;
UIColor *shadowColor = UIColorFromRGB(0xF0F2E9);
CGContextSetShadowWithColor(context, CGSizeMake(0, 1), 0, [shadowColor CGColor]);
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
paragraphStyle.alignment = NSTextAlignmentLeft;
[self.title drawInRect:CGRectMake(36.0, titleOffsetY, rect.size.width - 36 - 36, font.pointSize)
withAttributes:@{NSFontAttributeName: font,
NSForegroundColorAttributeName: textColor,
NSParagraphStyleAttributeName: paragraphStyle}];
self.invisibleHeaderButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.invisibleHeaderButton.frame = CGRectMake(0, 0, customView.frame.size.width, customView.frame.size.height);
self.invisibleHeaderButton.alpha = 0.1;
self.invisibleHeaderButton.tag = self.section;
self.invisibleHeaderButton.accessibilityLabel = [NSString stringWithFormat:@"%@ folder", self.title];
self.invisibleHeaderButton.accessibilityTraits = UIAccessibilityTraitNone;
[self.invisibleHeaderButton addTarget:self.delegate
action:@selector(didSelectTitleView:)
forControlEvents:UIControlEventTouchUpInside];
[customView addSubview:self.invisibleHeaderButton];
UIImage *folderImage = [UIImage imageNamed:@"folder-open"];
CGFloat folderImageViewX = 10.0;
if ([[UIDevice currentDevice] userInterfaceIdiom] != UIUserInterfaceIdiomPad) {
folderImageViewX = 7.0;
}
[folderImage drawInRect:CGRectMake(folderImageViewX, 8.0, 20.0, 20.0)];
[self addSubview:customView];
}
- (UIFontDescriptor *)fontDescriptor {
if (!_fontDescriptor) {
UIFontDescriptor *captionFontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:UIFontTextStyleCaption1];
UIFontDescriptor *boldFontDescriptor = [captionFontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold];
self.fontDescriptor = [boldFontDescriptor fontDescriptorWithSize:12.0];
}
return _fontDescriptor;
}
@end