2012-06-29 10:20:06 -07:00
|
|
|
//
|
|
|
|
// FeedTableCell.m
|
|
|
|
// NewsBlur
|
|
|
|
//
|
|
|
|
// Created by Samuel Clay on 7/18/11.
|
|
|
|
// Copyright 2011 NewsBlur. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "NewsBlurAppDelegate.h"
|
|
|
|
#import "FeedTableCell.h"
|
2012-10-03 18:27:21 -07:00
|
|
|
#import "UnreadCountView.h"
|
2012-06-29 10:20:06 -07:00
|
|
|
#import "ABTableViewCell.h"
|
2015-03-03 15:57:08 -05:00
|
|
|
#import "MCSwipeTableViewCell.h"
|
2020-08-27 21:26:12 -07:00
|
|
|
#import "NewsBlur-Swift.h"
|
2012-06-29 10:20:06 -07:00
|
|
|
|
|
|
|
static UIFont *textFont = nil;
|
|
|
|
|
|
|
|
@implementation FeedTableCell
|
|
|
|
|
|
|
|
@synthesize appDelegate;
|
|
|
|
@synthesize feedTitle;
|
|
|
|
@synthesize feedFavicon;
|
|
|
|
@synthesize positiveCount = _positiveCount;
|
|
|
|
@synthesize neutralCount = _neutralCount;
|
|
|
|
@synthesize negativeCount = _negativeCount;
|
|
|
|
@synthesize negativeCountStr;
|
|
|
|
@synthesize isSocial;
|
2014-05-20 12:58:04 -07:00
|
|
|
@synthesize isSaved;
|
2013-10-09 14:54:49 -07:00
|
|
|
@synthesize unreadCount;
|
2012-06-29 10:20:06 -07:00
|
|
|
|
|
|
|
+ (void) initialize{
|
2012-07-01 12:08:30 -07:00
|
|
|
if (self == [FeedTableCell class]) {
|
2012-07-15 15:06:06 -07:00
|
|
|
textFont = [UIFont boldSystemFontOfSize:18];
|
2012-07-01 12:08:30 -07:00
|
|
|
}
|
2012-06-29 10:20:06 -07:00
|
|
|
}
|
|
|
|
|
2013-09-30 12:13:10 -07:00
|
|
|
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
2013-10-09 14:54:49 -07:00
|
|
|
appDelegate = [NewsBlurAppDelegate sharedAppDelegate];
|
|
|
|
|
|
|
|
unreadCount = [UnreadCountView alloc];
|
|
|
|
unreadCount.appDelegate = self.appDelegate;
|
|
|
|
self.unreadCount = unreadCount;
|
2014-09-26 18:35:40 -07:00
|
|
|
|
2013-09-30 12:13:10 -07:00
|
|
|
cellContent = [[FeedTableCellView alloc] initWithFrame:self.frame];
|
|
|
|
cellContent.opaque = YES;
|
2013-10-09 14:54:49 -07:00
|
|
|
|
2016-01-27 21:50:44 -08:00
|
|
|
// Clear out half pixel border on top and bottom that the draw code can't touch
|
|
|
|
UIView *selectedBackground = [[UIView alloc] init];
|
|
|
|
[selectedBackground setBackgroundColor:[UIColor clearColor]];
|
|
|
|
self.selectedBackgroundView = selectedBackground;
|
|
|
|
|
2013-09-30 12:13:10 -07:00
|
|
|
[self.contentView addSubview:cellContent];
|
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)drawRect:(CGRect)rect {
|
|
|
|
((FeedTableCellView *)cellContent).cell = self;
|
2021-05-08 14:00:46 -07:00
|
|
|
|
|
|
|
CGFloat indentationOffset = self.indentationLevel * self.indentationWidth;
|
|
|
|
rect.origin.x += indentationOffset;
|
|
|
|
rect.size.width -= indentationOffset;
|
|
|
|
|
2013-09-30 12:13:10 -07:00
|
|
|
cellContent.frame = rect;
|
|
|
|
[cellContent setNeedsDisplay];
|
|
|
|
}
|
|
|
|
|
2022-02-01 21:27:20 -08:00
|
|
|
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
|
|
|
|
[super setHighlighted:highlighted animated:animated];
|
|
|
|
|
|
|
|
[self setNeedsDisplay];
|
|
|
|
}
|
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
- (void) setPositiveCount:(int)ps {
|
|
|
|
if (ps == _positiveCount) return;
|
2012-06-29 10:20:06 -07:00
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
_positiveCount = ps;
|
2013-10-01 15:38:29 -07:00
|
|
|
// [cellContent setNeedsDisplay];
|
2012-06-29 10:20:06 -07:00
|
|
|
}
|
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
- (void) setNeutralCount:(int)nt {
|
|
|
|
if (nt == _neutralCount) return;
|
2012-06-29 10:20:06 -07:00
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
_neutralCount = nt;
|
2013-10-01 15:38:29 -07:00
|
|
|
// [cellContent setNeedsDisplay];
|
2012-06-29 10:20:06 -07:00
|
|
|
}
|
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
- (void) setNegativeCount:(int)ng {
|
|
|
|
if (ng == _negativeCount) return;
|
2012-06-29 10:20:06 -07:00
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
_negativeCount = ng;
|
2012-07-15 15:06:06 -07:00
|
|
|
_negativeCountStr = [NSString stringWithFormat:@"%d", ng];
|
2013-10-01 15:38:29 -07:00
|
|
|
// [cellContent setNeedsDisplay];
|
2012-06-29 10:20:06 -07:00
|
|
|
}
|
|
|
|
|
2013-09-27 17:54:06 -07:00
|
|
|
- (void)setupGestures {
|
2014-05-20 12:58:04 -07:00
|
|
|
if (self.isSaved) {
|
|
|
|
self.shouldDrag = NO;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-11-24 16:41:41 -05:00
|
|
|
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
2020-01-31 15:50:03 -08:00
|
|
|
NSString *swipe = [preferences stringForKey:@"feed_swipe_left"];
|
|
|
|
NSString *iconName;
|
|
|
|
|
|
|
|
if (self.isSocial) {
|
|
|
|
iconName = @"menu_icn_fetch_subscribers.png";
|
|
|
|
} else if ([swipe isEqualToString:@"notifications"]) {
|
|
|
|
iconName = @"menu_icn_notifications.png";
|
|
|
|
} else if ([swipe isEqualToString:@"statistics"]) {
|
|
|
|
iconName = @"menu_icn_statistics.png";
|
|
|
|
} else {
|
|
|
|
iconName = @"train.png";
|
|
|
|
}
|
|
|
|
|
2020-08-27 21:26:12 -07:00
|
|
|
[self setDelegate:(FeedsViewController <MCSwipeTableViewCellDelegate> *)appDelegate.feedsViewController];
|
2020-01-31 15:50:03 -08:00
|
|
|
[self setFirstStateIconName:(iconName)
|
2013-10-01 15:38:29 -07:00
|
|
|
firstColor:UIColorFromRGB(0xA4D97B)
|
2013-09-27 17:54:06 -07:00
|
|
|
secondStateIconName:nil
|
|
|
|
secondColor:nil
|
#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
|
|
|
thirdIconName:@"indicator-unread"
|
|
|
|
thirdColor:UIColorFromRGB(0x6A6659)
|
2013-09-27 17:54:06 -07:00
|
|
|
fourthIconName:nil
|
|
|
|
fourthColor:nil];
|
|
|
|
|
|
|
|
self.mode = MCSwipeTableViewCellModeSwitch;
|
|
|
|
self.shouldAnimatesIcons = NO;
|
|
|
|
}
|
2012-06-29 10:20:06 -07:00
|
|
|
|
2013-10-17 17:23:52 -07:00
|
|
|
- (void)redrawUnreadCounts {
|
|
|
|
[((FeedTableCellView *)cellContent) redrawUnreadCounts];
|
|
|
|
}
|
|
|
|
|
2014-09-26 18:35:40 -07:00
|
|
|
|
|
|
|
- (UIFontDescriptor *)fontDescriptorUsingPreferredSize:(NSString *)textStyle {
|
2014-10-01 14:23:57 -07:00
|
|
|
UIFontDescriptor *fontDescriptor = appDelegate.fontDescriptorTitleSize;
|
|
|
|
if (fontDescriptor) return fontDescriptor;
|
2014-09-26 18:35:40 -07:00
|
|
|
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
2014-10-01 14:23:57 -07:00
|
|
|
fontDescriptor = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
|
2014-09-26 18:35:40 -07:00
|
|
|
if (![userPreferences boolForKey:@"use_system_font_size"]) {
|
|
|
|
if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"xs"]) {
|
2021-04-07 23:12:47 -04:00
|
|
|
fontDescriptor = [fontDescriptor fontDescriptorWithSize:10.0f];
|
2021-03-26 21:51:02 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"small"]) {
|
2021-04-07 23:12:47 -04:00
|
|
|
fontDescriptor = [fontDescriptor fontDescriptorWithSize:12.0f];
|
2014-09-26 18:35:40 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"medium"]) {
|
2021-04-07 23:12:47 -04:00
|
|
|
fontDescriptor = [fontDescriptor fontDescriptorWithSize:13.0f];
|
2021-03-26 21:51:02 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"large"]) {
|
2021-04-07 23:12:47 -04:00
|
|
|
fontDescriptor = [fontDescriptor fontDescriptorWithSize:16.0f];
|
2021-03-26 21:51:02 -07:00
|
|
|
} else if ([[userPreferences stringForKey:@"feed_list_font_size"] isEqualToString:@"xl"]) {
|
2021-04-07 23:12:47 -04:00
|
|
|
fontDescriptor = [fontDescriptor fontDescriptorWithSize:18.0f];
|
2014-09-26 18:35:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-01 14:23:57 -07:00
|
|
|
return fontDescriptor;
|
2014-09-26 18:35:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-09-27 17:54:06 -07:00
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation FeedTableCellView
|
|
|
|
|
|
|
|
@synthesize cell;
|
|
|
|
|
|
|
|
- (void)drawRect:(CGRect)r {
|
2019-10-23 20:32:07 -07:00
|
|
|
if (!cell) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-07-01 12:08:30 -07:00
|
|
|
CGContextRef context = UIGraphicsGetCurrentContext();
|
|
|
|
|
#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
|
|
|
BOOL isHighlighted = cell.highlighted || cell.selected;
|
2012-07-01 12:08:30 -07:00
|
|
|
UIColor *backgroundColor;
|
2012-06-29 10:20:06 -07:00
|
|
|
|
#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
|
|
|
backgroundColor = cell.isSocial ? UIColorFromRGB(0xD8E3DB) :
|
|
|
|
cell.isSearch ? UIColorFromRGB(0xDBDFE6) :
|
|
|
|
cell.isSaved ? UIColorFromRGB(0xDFDCD6) :
|
2013-02-14 15:36:21 -08:00
|
|
|
UIColorFromRGB(0xF7F8F5);
|
2012-07-20 19:55:38 -07:00
|
|
|
|
2017-09-27 12:19:58 -07:00
|
|
|
// [backgroundColor set];
|
|
|
|
self.backgroundColor = backgroundColor;
|
|
|
|
cell.backgroundColor = backgroundColor;
|
2018-08-29 14:55:37 -07:00
|
|
|
|
#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
|
|
|
if (isHighlighted) {
|
|
|
|
UIColor *highlightColor = UIColorFromLightSepiaMediumDarkRGB(0xFFFFD2, 0xFFFFD2, 0x304050, 0x000022);
|
2013-02-14 15:36:21 -08:00
|
|
|
|
#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
|
|
|
CGContextSetFillColorWithColor(context, highlightColor.CGColor);
|
|
|
|
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:r cornerRadius:8];
|
|
|
|
CGContextAddPath(context, path.CGPath);
|
|
|
|
CGContextFillPath(context);
|
2012-07-30 16:19:06 -07:00
|
|
|
}
|
2016-03-26 21:27:25 -07:00
|
|
|
|
2020-06-15 19:57:06 -07:00
|
|
|
if (cell.isInactive) {
|
|
|
|
CGRect imageRect = CGRectMake(CGRectGetMaxX(r) - 25, CGRectGetMidY(r) - 8, 16, 16);
|
|
|
|
[[UIImage imageNamed:@"mute_gray.png"] drawInRect:imageRect];
|
|
|
|
} else if (cell.savedStoriesCount > 0) {
|
2016-03-26 21:27:25 -07:00
|
|
|
[cell.unreadCount drawInRect:r ps:cell.savedStoriesCount nt:0 listType:NBFeedListSaved];
|
|
|
|
} else {
|
|
|
|
[cell.unreadCount drawInRect:r ps:cell.positiveCount nt:cell.neutralCount
|
2014-05-20 12:58:04 -07:00
|
|
|
listType:(cell.isSocial ? NBFeedListSocial : cell.isSaved ? NBFeedListSaved : NBFeedListFeed)];
|
2016-03-26 21:27:25 -07:00
|
|
|
}
|
2012-06-29 10:20:06 -07:00
|
|
|
|
#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
|
|
|
UIColor *textColor = isHighlighted ?
|
2015-12-07 16:09:49 -08:00
|
|
|
UIColorFromRGB(NEWSBLUR_BLACK_COLOR):
|
2016-01-27 21:50:44 -08:00
|
|
|
UIColorFromRGB(0x3A3A3A);
|
2012-06-29 10:20:06 -07:00
|
|
|
UIFont *font;
|
2014-09-26 18:35:40 -07:00
|
|
|
UIFontDescriptor *fontDescriptor = [cell fontDescriptorUsingPreferredSize:UIFontTextStyleFootnote];
|
2013-09-27 17:54:06 -07:00
|
|
|
if (cell.negativeCount || cell.neutralCount || cell.positiveCount) {
|
2013-11-23 13:03:14 -08:00
|
|
|
UIFontDescriptor *boldFontDescriptor = [fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold];
|
2021-03-26 21:51:02 -07:00
|
|
|
font = [UIFont fontWithName:@"WhitneySSm-Medium" size:boldFontDescriptor.pointSize];
|
2012-06-29 10:20:06 -07:00
|
|
|
} else {
|
2021-03-26 21:51:02 -07:00
|
|
|
font = [UIFont fontWithName:@"WhitneySSm-Book" size:fontDescriptor.pointSize];
|
2012-06-29 10:20:06 -07:00
|
|
|
}
|
2017-10-04 16:34:30 -07:00
|
|
|
NSInteger titleOffsetY = ((r.size.height - font.pointSize) / 2) - 1;
|
2013-09-24 17:18:20 -07:00
|
|
|
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
|
|
|
|
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
|
|
|
|
paragraphStyle.alignment = NSTextAlignmentLeft;
|
2022-07-08 21:29:43 -07:00
|
|
|
CGSize faviconSize;
|
2013-09-27 17:54:06 -07:00
|
|
|
if (cell.isSocial) {
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2022-07-08 21:29:43 -07:00
|
|
|
faviconSize = CGSizeMake(28, 28);
|
|
|
|
UIImage *feedIcon = [Utilities roundCorneredImage:cell.feedFavicon radius:4 convertToSize:faviconSize];
|
|
|
|
[feedIcon drawInRect:CGRectMake(9.0, CGRectGetMidY(r)-faviconSize.height/2, faviconSize.width, faviconSize.height)];
|
2013-10-17 18:56:14 -07:00
|
|
|
[cell.feedTitle drawInRect:CGRectMake(46, titleOffsetY, r.size.width - ([cell.unreadCount offsetWidth] + 36) - 10 - 16, font.pointSize*1.4)
|
2013-09-24 17:18:20 -07:00
|
|
|
withAttributes:@{NSFontAttributeName: font,
|
2013-09-25 17:43:00 -07:00
|
|
|
NSForegroundColorAttributeName: textColor,
|
2013-09-24 17:18:20 -07:00
|
|
|
NSParagraphStyleAttributeName: paragraphStyle}];
|
2012-08-02 12:01:42 -07:00
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
faviconSize = CGSizeMake(26, 26);
|
|
|
|
UIImage *feedIcon = [Utilities roundCorneredImage:cell.feedFavicon radius:4 convertToSize:faviconSize];
|
|
|
|
[feedIcon drawInRect:CGRectMake(9.0, CGRectGetMidY(r)-faviconSize.height/2, faviconSize.width, faviconSize.height)];
|
2013-10-17 18:56:14 -07:00
|
|
|
[cell.feedTitle drawInRect:CGRectMake(42, titleOffsetY, r.size.width - ([cell.unreadCount offsetWidth] + 36) - 10 - 12, font.pointSize*1.4)
|
2013-09-24 17:18:20 -07:00
|
|
|
withAttributes:@{NSFontAttributeName: font,
|
2013-09-25 17:43:00 -07:00
|
|
|
NSForegroundColorAttributeName: textColor,
|
2013-09-24 17:18:20 -07:00
|
|
|
NSParagraphStyleAttributeName: paragraphStyle}];
|
2012-08-02 12:01:42 -07:00
|
|
|
}
|
2012-06-29 10:20:06 -07:00
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
faviconSize = CGSizeMake(16, 16);
|
|
|
|
UIImage *feedIcon = [Utilities roundCorneredImage:cell.feedFavicon radius:4 convertToSize:faviconSize];
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
2022-07-08 21:29:43 -07:00
|
|
|
[feedIcon drawInRect:CGRectMake(12.0, CGRectGetMidY(r)-faviconSize.height/2, faviconSize.width, faviconSize.height)];
|
2013-10-17 18:56:14 -07:00
|
|
|
[cell.feedTitle drawInRect:CGRectMake(36.0, titleOffsetY, r.size.width - ([cell.unreadCount offsetWidth] + 36) - 10, font.pointSize*1.4)
|
2013-09-24 17:18:20 -07:00
|
|
|
withAttributes:@{NSFontAttributeName: font,
|
2013-09-25 17:43:00 -07:00
|
|
|
NSForegroundColorAttributeName: textColor,
|
2013-09-24 17:18:20 -07:00
|
|
|
NSParagraphStyleAttributeName: paragraphStyle}];
|
2012-08-02 18:33:55 -07:00
|
|
|
} else {
|
2022-07-08 21:29:43 -07:00
|
|
|
[feedIcon drawInRect:CGRectMake(9.0, CGRectGetMidY(r)-faviconSize.height/2, faviconSize.width, faviconSize.height)];
|
2013-10-17 18:56:14 -07:00
|
|
|
[cell.feedTitle drawInRect:CGRectMake(34.0, titleOffsetY, r.size.width - ([cell.unreadCount offsetWidth] + 36) - 10, font.pointSize*1.4)
|
2013-09-24 17:18:20 -07:00
|
|
|
withAttributes:@{NSFontAttributeName: font,
|
2013-09-25 17:43:00 -07:00
|
|
|
NSForegroundColorAttributeName: textColor,
|
2013-09-24 17:18:20 -07:00
|
|
|
NSParagraphStyleAttributeName: paragraphStyle}];
|
2012-08-02 18:33:55 -07:00
|
|
|
}
|
2012-06-29 10:20:06 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-17 17:23:52 -07:00
|
|
|
- (void)redrawUnreadCounts {
|
2016-03-26 21:27:25 -07:00
|
|
|
if (cell.savedStoriesCount) {
|
|
|
|
cell.unreadCount.blueCount = cell.savedStoriesCount;
|
|
|
|
} else if (cell.isSaved) {
|
2014-05-20 13:12:03 -07:00
|
|
|
cell.unreadCount.blueCount = cell.positiveCount;
|
|
|
|
} else {
|
|
|
|
cell.unreadCount.psCount = cell.positiveCount;
|
|
|
|
cell.unreadCount.ntCount = cell.neutralCount;
|
|
|
|
}
|
2013-10-17 17:23:52 -07:00
|
|
|
[cell.unreadCount setNeedsLayout];
|
|
|
|
}
|
2012-06-29 10:20:06 -07:00
|
|
|
|
2016-09-13 16:28:19 -07:00
|
|
|
@end
|