Speeding up scrolling on feed list.

This commit is contained in:
Samuel Clay 2013-10-18 14:17:01 -07:00
parent cb3ab8cb59
commit dc6527da85
3 changed files with 23 additions and 14 deletions

View file

@ -42,7 +42,7 @@
@interface FeedTableCellView : UIView
@property (nonatomic) FeedTableCell *cell;
@property (nonatomic, weak) FeedTableCell *cell;
- (void)redrawUnreadCounts;

View file

@ -934,9 +934,19 @@ static const CGFloat kFolderTitleHeight = 28.0f;
id feedId = [[appDelegate.dictFolders objectForKey:folderName] objectAtIndex:indexPath.row];
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
BOOL isSocial = [appDelegate isSocialFeed:feedIdStr];
NSString *CellIdentifier;
if (indexPath.section == 0 || indexPath.section == 1) {
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
NSString *collapseKey = [NSString stringWithFormat:@"folderCollapsed:%@", folderName];
bool isFolderCollapsed = [userPreferences boolForKey:collapseKey];
NSString *CellIdentifier;
if (isFolderCollapsed || ![self isFeedVisible:feedIdStr]) {
CellIdentifier = @"BlankCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
return cell;
} else if (indexPath.section == 0 || indexPath.section == 1) {
CellIdentifier = @"BlurblogCellIdentifier";
} else {
CellIdentifier = @"FeedCellIdentifier";
@ -950,10 +960,6 @@ static const CGFloat kFolderTitleHeight = 28.0f;
cell.appDelegate = appDelegate;
}
if (![self isFeedVisible:feedId]) {
return cell;
}
NSDictionary *feed = isSocial ?
[appDelegate.dictSocialFeeds objectForKey:feedIdStr] :
[appDelegate.dictFeeds objectForKey:feedIdStr];
@ -1326,10 +1332,12 @@ heightForHeaderInSection:(NSInteger)section {
}
- (BOOL)isFeedVisible:(id)feedId {
NSString *feedIdStr = [NSString stringWithFormat:@"%@",feedId];
NSDictionary *unreadCounts = [appDelegate.dictUnreadCounts objectForKey:feedIdStr];
if (![feedId isKindOfClass:[NSString class]]) {
feedId = [NSString stringWithFormat:@"%@",feedId];
}
NSDictionary *unreadCounts = [appDelegate.dictUnreadCounts objectForKey:feedId];
NSIndexPath *stillVisible = [self.stillVisibleFeeds objectForKey:feedIdStr];
NSIndexPath *stillVisible = [self.stillVisibleFeeds objectForKey:feedId];
if (!stillVisible &&
appDelegate.selectedIntelligence >= 1 &&
[[unreadCounts objectForKey:@"ps"] intValue] <= 0) {
@ -1409,8 +1417,9 @@ heightForHeaderInSection:(NSInteger)section {
[self.feedTitlesTable
reloadRowsAtIndexPaths:[self.feedTitlesTable indexPathsForVisibleRows]
withRowAnimation:direction == 1 ? UITableViewRowAnimationLeft : UITableViewRowAnimationRight];
[self redrawUnreadCounts];
for (UITableViewCell *cell in self.feedTitlesTable.visibleCells) {
[cell setNeedsDisplay];
}
[hud hide:YES afterDelay:0.5];
[self showExplainerOnEmptyFeedlist];
}

View file

@ -56,7 +56,7 @@ static NSMutableDictionary *imageCache;
+ (UIImage *)getImage:(NSString *)filename isSocial:(BOOL)isSocial {
UIImage *image;
if (filename && [[imageCache allKeys] containsObject:filename]) {
if (filename && [imageCache objectForKey:filename]) {
image = [imageCache objectForKey:filename];
}