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"
|
2013-10-09 15:41:17 -07:00
|
|
|
#import "NewsBlurViewController.h"
|
2012-10-02 15:39:18 -07:00
|
|
|
#import "FolderTitleView.h"
|
2012-10-04 10:59:44 -07:00
|
|
|
#import "UnreadCountView.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];
|
|
|
|
}
|
|
|
|
|
2012-10-03 15:46:02 -07:00
|
|
|
NSString *folderName;
|
|
|
|
if (section == 0) {
|
2012-12-07 15:17:22 -08:00
|
|
|
folderName = @"river_global";
|
|
|
|
} else if (section == 1) {
|
2012-10-03 15:46:02 -07:00
|
|
|
folderName = @"river_blurblogs";
|
|
|
|
} else {
|
|
|
|
folderName = [appDelegate.dictFoldersArray objectAtIndex:section];
|
|
|
|
}
|
|
|
|
NSString *collapseKey = [NSString stringWithFormat:@"folderCollapsed:%@", folderName];
|
|
|
|
bool isFolderCollapsed = [userPreferences boolForKey:collapseKey];
|
2012-10-07 15:47:21 -04:00
|
|
|
int countWidth = 0;
|
2015-11-03 22:21:18 -08:00
|
|
|
NSString *accessibilityCount = @"";
|
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)];
|
2014-05-20 13:12:03 -07:00
|
|
|
} else if (isFolderCollapsed) {
|
|
|
|
UnreadCounts *counts = [appDelegate splitUnreadCountForFolder:folderName];
|
2014-03-11 18:20:36 -07:00
|
|
|
unreadCount = [[UnreadCountView alloc] initWithFrame:CGRectInset(rect, 0, 2)];
|
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-11 20:19:26 -04:00
|
|
|
|
|
|
|
// Background
|
2013-02-14 15:36:21 -08:00
|
|
|
[NewsBlurAppDelegate fillGradient:rect
|
2016-02-27 13:20:32 -08:00
|
|
|
startColor:UIColorFromLightSepiaMediumDarkRGB(0xEAECE5, 0xffffc6, 0x6A6A6A, 0x444444)
|
2016-01-27 21:50:44 -08:00
|
|
|
endColor:UIColorFromLightSepiaMediumDarkRGB(0xDCDFD6, 0xffffc0, 0x666666, 0x333333)];
|
2013-02-14 15:36:21 -08:00
|
|
|
// UIColor *backgroundColor = UIColorFromRGB(0xD7DDE6);
|
|
|
|
// [backgroundColor set];
|
|
|
|
// CGContextFillRect(context, rect);
|
2012-10-11 20:19:26 -04:00
|
|
|
|
|
|
|
// Borders
|
2016-02-27 13:20:32 -08:00
|
|
|
UIColor *topColor = UIColorFromLightSepiaMediumDarkRGB(0xFDFDFD, 0xFDFDF6, 0x878B8A, 0x474B4A);
|
2012-10-11 20:19:26 -04:00
|
|
|
CGContextSetStrokeColor(context, CGColorGetComponents([topColor CGColor]));
|
|
|
|
|
|
|
|
CGContextBeginPath(context);
|
2013-10-11 17:46:09 -07:00
|
|
|
CGContextMoveToPoint(context, 0, 0.25f);
|
|
|
|
CGContextAddLineToPoint(context, rect.size.width, 0.25f);
|
2012-10-11 20:19:26 -04:00
|
|
|
CGContextStrokePath(context);
|
2012-10-02 15:39:18 -07:00
|
|
|
|
2012-10-11 20:19:26 -04:00
|
|
|
// bottom border
|
2016-02-27 13:20:32 -08:00
|
|
|
UIColor *bottomColor = UIColorFromLightSepiaMediumDarkRGB(0xB7BBAA, 0xe0e0a6, 0x404040, 0x0D0D0D);
|
2012-10-11 20:19:26 -04:00
|
|
|
CGContextSetStrokeColor(context, CGColorGetComponents([bottomColor CGColor]));
|
|
|
|
CGContextBeginPath(context);
|
2013-10-11 17:46:09 -07:00
|
|
|
CGContextMoveToPoint(context, 0, rect.size.height-0.25f);
|
|
|
|
CGContextAddLineToPoint(context, rect.size.width, rect.size.height-0.25f);
|
2012-10-11 20:19:26 -04:00
|
|
|
CGContextStrokePath(context);
|
2012-10-02 15:39:18 -07:00
|
|
|
|
2012-10-11 20:19:26 -04:00
|
|
|
// Folder title
|
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];
|
2013-10-17 18:56:14 -07:00
|
|
|
UIFont *font = [UIFont fontWithDescriptor: boldFontDescriptor size:0.0];
|
|
|
|
NSInteger titleOffsetY = ((rect.size.height - font.pointSize) / 2) - 1;
|
2012-10-11 20:19:26 -04:00
|
|
|
NSString *folderTitle;
|
2012-10-02 15:39:18 -07:00
|
|
|
if (section == 0) {
|
2012-12-07 15:17:22 -08:00
|
|
|
folderTitle = [@"Global Shared Stories" uppercaseString];
|
2012-10-02 15:39:18 -07:00
|
|
|
} else if (section == 1) {
|
2012-12-07 15:17:22 -08:00
|
|
|
folderTitle = [@"All Shared Stories" uppercaseString];
|
|
|
|
} else if (section == 2) {
|
2012-10-17 15:07:53 -07:00
|
|
|
folderTitle = [@"All Stories" uppercaseString];
|
2014-10-22 16:39:37 -07:00
|
|
|
} else if ([folderName isEqual:@"read_stories"]) {
|
|
|
|
folderTitle = [@"Read Stories" uppercaseString];
|
2013-02-06 15:15:43 -08:00
|
|
|
} else if ([folderName isEqual:@"saved_stories"]) {
|
2012-10-17 15:07:53 -07:00
|
|
|
folderTitle = [@"Saved Stories" uppercaseString];
|
2012-10-02 15:39:18 -07:00
|
|
|
} else {
|
2012-10-11 20:19:26 -04:00
|
|
|
folderTitle = [[appDelegate.dictFoldersArray objectAtIndex:section] uppercaseString];
|
2012-10-02 15:39:18 -07:00
|
|
|
}
|
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
|
2013-10-17 18:56:14 -07:00
|
|
|
drawInRect:CGRectMake(36.0, titleOffsetY, rect.size.width - 36 - 36 - countWidth, font.pointSize)
|
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];
|
2012-10-02 15:39:18 -07:00
|
|
|
invisibleHeaderButton.frame = CGRectMake(0, 0, customView.frame.size.width, customView.frame.size.height);
|
|
|
|
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) {
|
|
|
|
UIButton *disclosureButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
UIImage *disclosureImage = [UIImage imageNamed:@"disclosure.png"];
|
|
|
|
[disclosureButton setImage:disclosureImage forState:UIControlStateNormal];
|
2014-03-11 18:20:36 -07:00
|
|
|
disclosureButton.frame = CGRectMake(customView.frame.size.width - 32, 3, 29, 29);
|
2012-10-14 19:39:24 -04:00
|
|
|
|
|
|
|
// Add collapse button to all folders except Everything
|
2014-10-22 17:03:48 -07:00
|
|
|
if (section != 0 && section != 2 && ![folderName isEqual:@"read_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"];
|
|
|
|
}
|
2014-03-11 18:20:36 -07:00
|
|
|
[disclosureBorder drawInRect:CGRectMake(customView.frame.size.width - 32, 3, 29, 29)];
|
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
|
|
|
|
2013-02-21 12:19:15 -08:00
|
|
|
if (section == 0) {
|
|
|
|
folderImage = [UIImage imageNamed:@"ak-icon-global.png"];
|
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 8;
|
|
|
|
}
|
|
|
|
} else if (section == 1) {
|
|
|
|
folderImage = [UIImage imageNamed:@"ak-icon-blurblogs.png"];
|
2012-10-03 15:46:02 -07:00
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 8;
|
|
|
|
}
|
2012-12-07 15:17:22 -08:00
|
|
|
} else if (section == 2) {
|
2013-02-21 12:19:15 -08:00
|
|
|
folderImage = [UIImage imageNamed:@"ak-icon-allstories.png"];
|
2012-10-03 15:46:02 -07:00
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2015-11-13 21:54:32 -08:00
|
|
|
allowLongPress = YES;
|
2013-02-06 15:15:43 -08:00
|
|
|
} else if ([folderName isEqual:@"saved_stories"]) {
|
2013-03-07 10:55:23 -05:00
|
|
|
folderImage = [UIImage imageNamed:@"clock.png"];
|
2012-10-17 15:07:53 -07:00
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2014-10-22 16:39:37 -07:00
|
|
|
} else if ([folderName isEqual:@"read_stories"]) {
|
2014-10-22 17:03:48 -07:00
|
|
|
folderImage = [UIImage imageNamed:@"g_icn_folder_read.png"];
|
2014-10-22 16:39:37 -07:00
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
folderImageViewX = 10;
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2012-10-03 15:46:02 -07:00
|
|
|
} else {
|
|
|
|
if (isFolderCollapsed) {
|
2013-02-21 12:19:15 -08:00
|
|
|
folderImage = [UIImage imageNamed:@"g_icn_folder_rss"];
|
2012-10-03 15:46:02 -07:00
|
|
|
} else {
|
2013-02-21 12:19:15 -08:00
|
|
|
folderImage = [UIImage imageNamed:@"g_icn_folder"];
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
} else {
|
|
|
|
folderImageViewX = 7;
|
|
|
|
}
|
2013-10-09 16:39:27 -07:00
|
|
|
allowLongPress = YES;
|
2012-10-03 15:46:02 -07:00
|
|
|
}
|
2014-10-22 17:03:48 -07:00
|
|
|
[folderImage drawInRect:CGRectMake(folderImageViewX, 8, 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:10.0f];
|
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"small"]) {
|
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:11.0f];
|
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"medium"]) {
|
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:12.0f];
|
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"large"]) {
|
2015-09-22 13:10:35 -07:00
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:15.0f];
|
2014-09-26 18:35:40 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"xl"]) {
|
2015-09-22 13:10:35 -07:00
|
|
|
fontDescriptorSize = [fontDescriptorSize fontDescriptorWithSize:17.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){
|
|
|
|
[appDelegate.feedsViewController sectionUntappedOutside:invisibleHeaderButton];
|
|
|
|
}];
|
2014-03-04 18:09:43 -08:00
|
|
|
} else if ([longPressTitle isEqualToString:@"mark_read_immediate"]) {
|
|
|
|
[appDelegate.feedsViewController markFeedsRead:feedIds cutoffDays:0];
|
|
|
|
}
|
2012-10-02 15:39:18 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|