2012-10-02 15:39:18 -07:00
|
|
|
//
|
|
|
|
// FolderTitleView.m
|
|
|
|
// NewsBlur
|
|
|
|
//
|
|
|
|
// Created by Samuel Clay on 10/2/12.
|
|
|
|
// Copyright (c) 2012 NewsBlur. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2012-10-07 15:47:21 -04:00
|
|
|
#import <QuartzCore/QuartzCore.h>
|
2012-10-02 15:39:18 -07:00
|
|
|
#import "NewsBlurAppDelegate.h"
|
|
|
|
#import "FolderTitleView.h"
|
2012-10-04 10:59:44 -07:00
|
|
|
#import "UnreadCountView.h"
|
2020-08-27 21:26:12 -07:00
|
|
|
#import "NewsBlur-Swift.h"
|
2012-10-02 15:39:18 -07:00
|
|
|
|
|
|
|
@implementation FolderTitleView
|
|
|
|
|
|
|
|
@synthesize appDelegate;
|
2012-10-04 15:44:25 -07:00
|
|
|
@synthesize section;
|
2012-10-12 15:33:40 -04:00
|
|
|
@synthesize unreadCount;
|
2013-10-09 15:41:17 -07:00
|
|
|
@synthesize invisibleHeaderButton;
|
2012-10-12 15:33:40 -04:00
|
|
|
|
|
|
|
- (void)setNeedsDisplay {
|
|
|
|
[unreadCount setNeedsDisplay];
|
|
|
|
|
2014-09-26 18:35:40 -07:00
|
|
|
fontDescriptorSize = nil;
|
|
|
|
|
2012-10-12 15:33:40 -04:00
|
|
|
[super setNeedsDisplay];
|
|
|
|
}
|
2012-10-02 15:39:18 -07:00
|
|
|
|
2012-10-04 15:44:25 -07:00
|
|
|
- (void) drawRect:(CGRect)rect {
|
2012-10-02 15:39:18 -07:00
|
|
|
|
2013-10-09 14:54:49 -07:00
|
|
|
self.appDelegate = [NewsBlurAppDelegate sharedAppDelegate];
|
2012-10-03 15:46:02 -07:00
|
|
|
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
2012-10-04 15:44:25 -07:00
|
|
|
|
2012-10-11 20:19:26 -04:00
|
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
2012-10-14 17:33:07 -04:00
|
|
|
for (UIView *subview in self.subviews) {
|
|
|
|
[subview removeFromSuperview];
|
|
|
|
}
|
|
|
|
|
2022-08-03 21:42:28 -07:00
|
|
|
[UIColorFromRGB(0xF7F8F5) set];
|
|
|
|
CGContextFillRect(context, rect);
|
|
|
|
|
2018-01-28 11:08:38 -05:00
|
|
|
NSString *folderName = appDelegate.dictFoldersArray[section];
|
2012-10-03 15:46:02 -07:00
|
|
|
NSString *collapseKey = [NSString stringWithFormat:@"folderCollapsed:%@", folderName];
|
|
|
|
bool isFolderCollapsed = [userPreferences boolForKey:collapseKey];
|
2017-04-11 16:15:18 -07:00
|
|
|
NSInteger countWidth = 0;
|
2015-11-03 22:21:18 -08:00
|
|
|
NSString *accessibilityCount = @"";
|
2021-05-21 20:57:06 -07:00
|
|
|
NSArray *folderComponents = [folderName componentsSeparatedByString:@" ▸ "];
|
2022-08-02 21:46:26 -07:00
|
|
|
folderName = folderComponents.lastObject;
|
2021-05-21 20:57:06 -07:00
|
|
|
|
|
|
|
CGFloat indentationOffset = (folderComponents.count - 1) * 28;
|
|
|
|
rect.origin.x += indentationOffset;
|
|
|
|
rect.size.width -= indentationOffset;
|
2012-10-12 15:33:40 -04:00
|
|
|
|
2014-05-20 13:12:03 -07:00
|
|
|
if ([folderName isEqual:@"saved_stories"]) {
|
2014-03-11 18:20:36 -07:00
|
|
|
unreadCount = [[UnreadCountView alloc] initWithFrame:CGRectInset(rect, 0, 2)];
|
2012-10-07 15:47:21 -04:00
|
|
|
unreadCount.appDelegate = appDelegate;
|
|
|
|
unreadCount.opaque = NO;
|
2014-05-20 13:12:03 -07:00
|
|
|
unreadCount.psCount = appDelegate.savedStoriesCount;
|
|
|
|
unreadCount.blueCount = appDelegate.savedStoriesCount;
|
2012-10-07 15:47:21 -04:00
|
|
|
|
2014-05-20 13:12:03 -07:00
|
|
|
[unreadCount calculateOffsets:appDelegate.savedStoriesCount nt:0];
|
2012-10-07 15:47:21 -04:00
|
|
|
countWidth = [unreadCount offsetWidth];
|
|
|
|
[self addSubview:unreadCount];
|
2015-11-03 22:21:18 -08:00
|
|
|
|
|
|
|
accessibilityCount = [NSString stringWithFormat:@", %@ stories", @(appDelegate.savedStoriesCount)];
|
2020-05-27 21:26:44 -07:00
|
|
|
} else if ([folderName isEqual:@"saved_searches"]) {
|
|
|
|
NSInteger count = appDelegate.savedSearchesCount;
|
|
|
|
unreadCount = [[UnreadCountView alloc] initWithFrame:CGRectInset(rect, 0, 2)];
|
|
|
|
unreadCount.appDelegate = appDelegate;
|
|
|
|
unreadCount.opaque = NO;
|
|
|
|
unreadCount.psCount = count;
|
|
|
|
unreadCount.blueCount = count;
|
|
|
|
|
|
|
|
[unreadCount calculateOffsets:count nt:0];
|
|
|
|
countWidth = [unreadCount offsetWidth];
|
|
|
|
[self addSubview:unreadCount];
|
|
|
|
|
|
|
|
accessibilityCount = [NSString stringWithFormat:@", %@ searches", @(count)];
|
2014-05-20 13:12:03 -07:00
|
|
|
} else if (isFolderCollapsed) {
|
|
|
|
UnreadCounts *counts = [appDelegate splitUnreadCountForFolder:folderName];
|
2021-05-08 14:00:46 -07:00
|
|
|
unreadCount = [[UnreadCountView alloc] initWithFrame:CGRectMake(rect.origin.x, 0, CGRectGetWidth(rect), CGRectGetHeight(rect))];
|
2012-10-17 15:07:53 -07:00
|
|
|
unreadCount.appDelegate = appDelegate;
|
|
|
|
unreadCount.opaque = NO;
|
2014-05-20 13:12:03 -07:00
|
|
|
unreadCount.psCount = counts.ps;
|
|
|
|
unreadCount.ntCount = counts.nt;
|
2012-10-17 15:07:53 -07:00
|
|
|
|
2014-05-20 13:12:03 -07:00
|
|
|
[unreadCount calculateOffsets:counts.ps nt:counts.nt];
|
2012-10-17 15:07:53 -07:00
|
|
|
countWidth = [unreadCount offsetWidth];
|
|
|
|
[self addSubview:unreadCount];
|
2015-11-03 22:21:18 -08:00
|
|
|
|
|
|
|
accessibilityCount = [NSString stringWithFormat:@", collapsed, %@ unread stories", @(counts.nt)];
|
|
|
|
} else if (UIAccessibilityIsVoiceOverRunning()) {
|
|
|
|
UnreadCounts *counts = [appDelegate splitUnreadCountForFolder:folderName];
|
|
|
|
|
|
|
|
accessibilityCount = [NSString stringWithFormat:@", %@ unread stories", @(counts.nt)];
|
2012-10-07 15:47:21 -04:00
|
|
|
}
|
2015-11-03 22:21:18 -08:00
|
|
|
|
2012-10-02 15:39:18 -07:00
|
|
|
// create the parent view that will hold header Label
|
2012-10-04 15:44:25 -07:00
|
|
|
UIView* customView = [[UIView alloc] initWithFrame:rect];
|
2012-10-02 15:39:18 -07:00
|
|
|
|
2012-10-11 20:19:26 -04:00
|
|
|
// Folder title
|
2022-08-03 21:42:28 -07:00
|
|
|
UIColor *backgroundColor = UIColorFromRGB(0xEAECE6);
|
2016-01-27 21:50:44 -08:00
|
|
|
UIColor *textColor = UIColorFromRGB(0x4C4D4A);
|
2014-09-26 18:35:40 -07:00
|
|
|
UIFontDescriptor *boldFontDescriptor = [self fontDescriptorUsingPreferredSize:UIFontTextStyleCaption1];
|
2021-03-26 21:51:02 -07:00
|
|
|
UIFont *font = [UIFont fontWithName:@"WhitneySSm-Medium" size:boldFontDescriptor.pointSize];
|
2013-10-17 18:56:14 -07:00
|
|
|
NSInteger titleOffsetY = ((rect.size.height - font.pointSize) / 2) - 1;
|
2012-10-11 20:19:26 -04:00
|
|
|
NSString *folderTitle;
|
2022-07-08 21:29:43 -07:00
|
|
|
if (section == NewsBlurTopSectionInfrequentSiteStories) {
|
2021-03-26 21:51:02 -07:00
|
|
|
folderTitle = @"Infrequent Site Stories";
|
2018-01-28 11:08:38 -05:00
|
|
|
} else if (section == NewsBlurTopSectionAllStories) {
|
2022-07-08 21:29:43 -07:00
|
|
|
folderTitle = @"All Site Stories";
|
2022-03-09 19:16:43 -07:00
|
|
|
} else if ([folderName isEqual:@"widget_stories"]) {
|
|
|
|
folderTitle = @"Widget Site Stories";
|
2014-10-22 16:39:37 -07:00
|
|
|
} else if ([folderName isEqual:@"read_stories"]) {
|
2021-03-26 21:51:02 -07:00
|
|
|
folderTitle = @"Read Stories";
|
2022-07-08 21:29:43 -07:00
|
|
|
} else if ([folderName isEqual:@"river_global"]) {
|
|
|
|
folderTitle = @"Global Shared Stories";
|
|
|
|
} else if ([folderName isEqual:@"river_blurblogs"]) {
|
|
|
|
folderTitle = @"All Shared Stories";
|
2013-02-06 15:15:43 -08:00
|
|
|
} else if ([folderName isEqual:@"saved_stories"]) {
|
2021-03-26 21:51:02 -07:00
|
|
|
folderTitle = @"Saved Stories";
|
2020-05-27 21:26:44 -07:00
|
|
|
} else if ([folderName isEqual:@"saved_searches"]) {
|
2021-03-26 21:51:02 -07:00
|
|
|
folderTitle = @"Saved Searches";
|
2012-10-02 15:39:18 -07:00
|
|
|
} else {
|
2022-08-02 21:46:26 -07:00
|
|
|
folderTitle = folderName;
|
2022-08-03 21:42:28 -07:00
|
|
|
backgroundColor = UIColorFromRGB(0xF7F8F5);
|
2012-10-02 15:39:18 -07:00
|
|
|
}
|
2022-08-03 21:42:28 -07:00
|
|
|
|
|
|
|
[backgroundColor set];
|
|
|
|
CGContextFillRect(context, rect);
|
|
|
|
|
2013-02-15 16:41:20 -08:00
|
|
|
UIColor *shadowColor = UIColorFromRGB(0xF0F2E9);
|
2012-10-11 20:19:26 -04:00
|
|
|
CGContextSetShadowWithColor(context, CGSizeMake(0, 1), 0, [shadowColor CGColor]);
|
2013-09-25 17:43:00 -07:00
|
|
|
|
|
|
|
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
|
|
|
|
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
|
|
|
|
paragraphStyle.alignment = NSTextAlignmentLeft;
|
2012-10-11 20:19:26 -04:00
|
|
|
[folderTitle
|
2021-05-08 14:00:46 -07:00
|
|
|
drawInRect:CGRectMake(rect.origin.x + 36.0, titleOffsetY, rect.size.width - 36 - 36 - countWidth, font.pointSize + 5)
|
2013-09-25 17:43:00 -07:00
|
|
|
withAttributes:@{NSFontAttributeName: font,
|
2013-09-26 16:12:09 -07:00
|
|
|
NSForegroundColorAttributeName: textColor,
|
2013-09-25 17:43:00 -07:00
|
|
|
NSParagraphStyleAttributeName: paragraphStyle}];
|
2012-10-11 20:19:26 -04:00
|
|
|
|
2013-10-09 15:41:17 -07:00
|
|
|
invisibleHeaderButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
2021-05-08 14:00:46 -07:00
|
|
|
invisibleHeaderButton.frame = CGRectMake(rect.origin.x, 0, customView.frame.size.width, customView.frame.size.height);
|
#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
|
|
|
invisibleHeaderButton.layer.cornerRadius = 10;
|
|
|
|
invisibleHeaderButton.clipsToBounds = YES;
|
2012-10-02 15:39:18 -07:00
|
|
|
invisibleHeaderButton.alpha = .1;
|
|
|
|
invisibleHeaderButton.tag = section;
|
2015-11-03 22:21:18 -08:00
|
|
|
invisibleHeaderButton.accessibilityLabel = [NSString stringWithFormat:@"%@ folder%@", folderTitle, accessibilityCount];
|
|
|
|
invisibleHeaderButton.accessibilityTraits = UIAccessibilityTraitNone;
|
2014-04-18 14:59:17 -07:00
|
|
|
[invisibleHeaderButton addTarget:appDelegate.feedsViewController
|
|
|
|
action:@selector(didSelectSectionHeader:)
|
|
|
|
forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
[invisibleHeaderButton addTarget:appDelegate.feedsViewController
|
|
|
|
action:@selector(sectionTapped:)
|
|
|
|
forControlEvents:UIControlEventTouchDown];
|
|
|
|
[invisibleHeaderButton addTarget:appDelegate.feedsViewController
|
|
|
|
action:@selector(sectionUntapped:)
|
|
|
|
forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
[invisibleHeaderButton addTarget:appDelegate.feedsViewController
|
|
|
|
action:@selector(sectionUntappedOutside:)
|
|
|
|
forControlEvents:UIControlEventTouchUpOutside];
|
|
|
|
[invisibleHeaderButton addTarget:appDelegate.feedsViewController
|
|
|
|
action:@selector(sectionUntappedOutside:)
|
|
|
|
forControlEvents:UIControlEventTouchCancel];
|
|
|
|
[invisibleHeaderButton addTarget:appDelegate.feedsViewController
|
|
|
|
action:@selector(sectionUntappedOutside:)
|
|
|
|
forControlEvents:UIControlEventTouchDragOutside];
|
2012-10-11 20:19:26 -04:00
|
|
|
[customView addSubview:invisibleHeaderButton];
|
2012-10-02 15:39:18 -07:00
|
|
|
|
|
|
|
if (!appDelegate.hasNoSites) {
|
2017-10-04 16:34:30 -07:00
|
|
|
NSInteger disclosureHeight = 29;
|
2012-10-02 15:39:18 -07:00
|
|
|
UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
UIImage *disclosureImage = [UIImage imageNamed:@"disclosure.png"];
|
|
|
|
[disclosureButton setImage:disclosureImage forState:UIControlStateNormal];
|
2021-05-08 14:00:46 -07:00
|
|
|
disclosureButton.frame = CGRectMake(customView.frame.size.width - 32, CGRectGetMidY(rect)-disclosureHeight/2-1, disclosureHeight, disclosureHeight);
|
2012-10-14 19:39:24 -04:00
|
|
|
|
|
|
|
// Add collapse button to all folders except Everything
|
2022-07-08 21:29:43 -07:00
|
|
|
if (section != NewsBlurTopSectionInfrequentSiteStories && section != NewsBlurTopSectionAllStories && ![folderName isEqual:@"read_stories"] && ![folderName isEqual:@"river_global"] && ![folderName isEqual:@"widget_stories"]) {
|
2012-10-03 15:46:02 -07:00
|
|
|
if (!isFolderCollapsed) {
|
2013-03-03 17:37:54 -08:00
|
|
|
UIImage *disclosureImage = [UIImage imageNamed:@"disclosure_down.png"];
|
|
|
|
[disclosureButton setImage:disclosureImage forState:UIControlStateNormal];
|
|
|
|
// disclosureButton.transform = CGAffineTransformMakeRotation(M_PI_2);
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
disclosureButton.tag = section;
|
|
|
|
[disclosureButton addTarget:appDelegate.feedsViewController action:@selector(didCollapseFolder:) forControlEvents:UIControlEventTouchUpInside];
|
2012-10-14 17:33:07 -04:00
|
|
|
|
2016-02-27 13:20:32 -08:00
|
|
|
UIImage *disclosureBorder = [UIImage imageNamed:@"disclosure_border"];
|
2016-03-09 22:05:51 -08:00
|
|
|
if ([[[ThemeManager themeManager] theme] isEqualToString:ThemeStyleSepia]) {
|
2016-02-27 13:20:32 -08:00
|
|
|
disclosureBorder = [UIImage imageNamed:@"disclosure_border_sepia"];
|
2016-03-09 22:05:51 -08:00
|
|
|
} else if ([[[ThemeManager themeManager] theme] isEqualToString:ThemeStyleMedium]) {
|
2016-02-27 13:20:32 -08:00
|
|
|
disclosureBorder = [UIImage imageNamed:@"disclosure_border_medium"];
|
2016-03-09 22:05:51 -08:00
|
|
|
} else if ([[[ThemeManager themeManager] theme] isEqualToString:ThemeStyleDark]) {
|
2016-02-27 13:20:32 -08:00
|
|
|
disclosureBorder = [UIImage imageNamed:@"disclosure_border_dark"];
|
|
|
|
}
|
2021-05-08 14:00:46 -07:00
|
|
|
[disclosureBorder drawInRect:CGRectMake(rect.origin.x + customView.frame.size.width - 32, CGRectGetMidY(rect)-disclosureHeight/2 - 1, disclosureHeight, disclosureHeight)];
|
2012-10-14 19:39:24 -04:00
|
|
|
} else {
|
2012-10-17 15:07:53 -07:00
|
|
|
// Everything/Saved folder doesn't get a button
|
2012-10-14 19:39:24 -04:00
|
|
|
[disclosureButton setUserInteractionEnabled:NO];
|
2012-10-02 15:39:18 -07:00
|
|
|
}
|
|
|
|
[customView addSubview:disclosureButton];
|
|
|
|
}
|
|
|
|
|
2012-10-03 15:46:02 -07:00
|
|
|
UIImage *folderImage;
|
|
|
|
int folderImageViewX = 10;
|
2013-10-09 16:39:27 -07:00
|
|
|
BOOL allowLongPress = NO;
|
2014-10-22 17:03:48 -07:00
|
|
|
int width = 20;
|
|
|
|
int height = 20;
|
2012-10-03 15:46:02 -07:00
|
|
|
|
2022-07-08 21:29:43 -07:00
|
|
|
if (section == NewsBlurTopSectionInfrequentSiteStories) {
|
|
|
|
folderImage = [UIImage imageNamed:@"ak-icon-infrequent.png"];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2013-02-21 12:19:15 -08:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
folderImageViewX = 7;
|
2013-02-21 12:19:15 -08:00
|
|
|
}
|
2022-07-08 21:29:43 -07:00
|
|
|
allowLongPress = YES;
|
|
|
|
} else if (section == NewsBlurTopSectionAllStories) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"all-stories"];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2012-10-03 15:46:02 -07:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
folderImageViewX = 7;
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
2022-07-08 21:29:43 -07:00
|
|
|
allowLongPress = NO;
|
|
|
|
} else if ([folderName isEqual:@"river_global"]) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"global-shares"];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2012-10-03 15:46:02 -07:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
folderImageViewX = 8;
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
2022-07-08 21:29:43 -07:00
|
|
|
} else if ([folderName isEqual:@"river_blurblogs"]) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"all-shares"];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2017-11-05 22:07:43 -08:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
folderImageViewX = 8;
|
2017-11-05 22:07:43 -08:00
|
|
|
}
|
2020-05-27 21:26:44 -07:00
|
|
|
} else if ([folderName isEqual:@"saved_searches"]) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"search"];
|
2020-09-22 17:28:14 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2020-05-27 21:26:44 -07:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2013-02-06 15:15:43 -08:00
|
|
|
} else if ([folderName isEqual:@"saved_stories"]) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"saved-stories"];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2012-10-17 15:07:53 -07:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2014-10-22 16:39:37 -07:00
|
|
|
} else if ([folderName isEqual:@"read_stories"]) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"indicator-unread"];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2022-03-09 19:16:43 -07:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
|
|
|
} else if ([folderName isEqual:@"widget_stories"]) {
|
|
|
|
folderImage = [UIImage imageNamed:@"g_icn_folder_widget.png"];
|
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2014-10-22 16:39:37 -07:00
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2012-10-03 15:46:02 -07:00
|
|
|
} else {
|
|
|
|
if (isFolderCollapsed) {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"folder-closed"];
|
2012-10-03 15:46:02 -07:00
|
|
|
} else {
|
#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
|
|
|
folderImage = [UIImage imageNamed:@"folder-open"];
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2012-10-03 15:46:02 -07:00
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2013-10-09 16:39:27 -07:00
|
|
|
allowLongPress = YES;
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
2022-08-03 21:42:28 -07:00
|
|
|
|
2022-09-02 21:53:19 -06:00
|
|
|
folderImage = [folderImage imageWithTintColor:UIColorFromLightDarkRGB(0x95968F, 0x95968F)];
|
2022-08-03 21:42:28 -07:00
|
|
|
|
2021-05-08 14:00:46 -07:00
|
|
|
[folderImage drawInRect:CGRectMake(rect.origin.x + folderImageViewX, CGRectGetMidY(rect)-height/2, width, height)];
|
2012-10-03 15:46:02 -07:00
|
|
|
|
2012-10-02 15:39:18 -07:00
|
|
|
[customView setAutoresizingMask:UIViewAutoresizingNone];
|
|
|
|
|
2012-10-04 15:44:25 -07:00
|
|
|
if (isFolderCollapsed) {
|
2012-10-07 15:47:21 -04:00
|
|
|
[self insertSubview:customView belowSubview:unreadCount];
|
|
|
|
} else {
|
|
|
|
[self addSubview:customView];
|
2012-10-04 15:44:25 -07:00
|
|
|
}
|
2013-10-09 15:41:17 -07:00
|
|
|
|
2013-10-09 16:39:27 -07:00
|
|
|
if (allowLongPress) {
|
|
|
|
UILongPressGestureRecognizer *longpress = [[UILongPressGestureRecognizer alloc]
|
|
|
|
initWithTarget:self action:@selector(handleLongPress:)];
|
|
|
|
longpress.minimumPressDuration = 1.0;
|
|
|
|
longpress.delegate = self;
|
|
|
|
[self addGestureRecognizer:longpress];
|
|
|
|
}
|
2013-10-09 15:41:17 -07:00
|
|
|
}
|
|
|
|
|
2014-09-26 18:35:40 -07:00
|
|
|
- (UIFontDescriptor *)fontDescriptorUsingPreferredSize:(NSString *)textStyle {
|
|
|
|
if (fontDescriptorSize) return fontDescriptorSize;
|
|
|
|
|
|
|
|
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
|
|
|
UIFontDescriptor *fontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle: textStyle];
|
|
|
|
fontDescriptorSize = [fontDescriptor fontDescriptorWithSymbolicTraits: UIFontDescriptorTraitBold];
|
|
|
|
|
|
|
|
if (![userPreferences boolForKey:@"use_system_font_size"]) {
|
|
|
|
if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"xs"]) {
|
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:11.0f];
|
2021-03-26 21:51:02 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"small"]) {
|
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:13.0f];
|
2014-09-26 18:35:40 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"medium"]) {
|
2021-03-26 21:51:02 -07:00
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:14.0f];
|
2014-09-26 18:35:40 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"large"]) {
|
2015-09-22 13:10:35 -07:00
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:17.0f];
|
2021-03-26 21:51:02 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"xl"]) {
|
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:19.0f];
|
2014-09-26 18:35:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fontDescriptorSize;
|
|
|
|
}
|
|
|
|
|
2013-10-09 15:41:17 -07:00
|
|
|
- (void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer {
|
|
|
|
if (gestureRecognizer.state != UIGestureRecognizerStateBegan) return;
|
|
|
|
if (section < 2) return;
|
2015-11-13 21:54:32 -08:00
|
|
|
|
2014-03-04 18:09:43 -08:00
|
|
|
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
|
|
|
NSString *longPressTitle = [preferences stringForKey:@"long_press_feed_title"];
|
2013-10-09 15:41:17 -07:00
|
|
|
NSString *folderTitle = [appDelegate.dictFoldersArray objectAtIndex:section];
|
2015-11-13 21:54:32 -08:00
|
|
|
NSArray *feedIds = [self.appDelegate feedIdsForFolderTitle:folderTitle];
|
|
|
|
NSString *collectionTitle = [folderTitle isEqual:@"everything"] ? @"everything" : @"entire folder";
|
|
|
|
|
2014-03-04 18:09:43 -08:00
|
|
|
if ([longPressTitle isEqualToString:@"mark_read_choose_days"]) {
|
2015-11-13 21:54:32 -08:00
|
|
|
[self.appDelegate showMarkReadMenuWithFeedIds:feedIds collectionTitle:collectionTitle sourceView:self sourceRect:self.bounds completionHandler:^(BOOL marked){
|
2020-08-27 15:08:46 -07:00
|
|
|
[self.appDelegate.folderCountCache removeObjectForKey:folderTitle];
|
|
|
|
[self.appDelegate.feedsViewController sectionUntappedOutside:self.invisibleHeaderButton];
|
|
|
|
[self.appDelegate.feedsViewController.feedTitlesTable reloadData];
|
2015-11-13 21:54:32 -08:00
|
|
|
}];
|
2014-03-04 18:09:43 -08:00
|
|
|
} else if ([longPressTitle isEqualToString:@"mark_read_immediate"]) {
|
2020-08-27 15:08:46 -07:00
|
|
|
[self.appDelegate.folderCountCache removeObjectForKey:folderTitle];
|
|
|
|
[self.appDelegate.feedsViewController markFeedsRead:feedIds cutoffDays:0];
|
|
|
|
[self.appDelegate.feedsViewController.feedTitlesTable reloadData];
|
2014-03-04 18:09:43 -08:00
|
|
|
}
|
2012-10-02 15:39:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|