mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00

- It’s alive, ALIVE! - You can now build and run NewsBlur for macOS! - Still lots of issues, including the story CSS not rendering properly, but it works. - Plus of course making things more Mac-like, like modal views as real windows, etc. - Committed to a new branch, since not ready for prime time.
74 lines
2.4 KiB
Objective-C
74 lines
2.4 KiB
Objective-C
//
|
|
// SmallActivityCell.m
|
|
// NewsBlur
|
|
//
|
|
// Created by Roy Yang on 7/21/12.
|
|
// Copyright (c) 2012 NewsBlur. All rights reserved.
|
|
//
|
|
|
|
#import "SmallActivityCell.h"
|
|
#import "UIImageView+AFNetworking.h"
|
|
#import <QuartzCore/QuartzCore.h>
|
|
|
|
@implementation SmallActivityCell
|
|
|
|
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
activityLabel = nil;
|
|
faviconView = nil;
|
|
self.separatorInset = UIEdgeInsetsMake(0, 52, 0, 0);
|
|
self.backgroundColor = UIColorFromRGB(0xFFFFFF);
|
|
UIView *bgView = [[UIView alloc] init];
|
|
bgView.backgroundColor = UIColorFromRGB(0xffffff);
|
|
self.backgroundView = bgView;
|
|
// self.contentView.backgroundColor = [UIColor clearColor];
|
|
|
|
// create favicon and label in view
|
|
UIImageView *favicon = [[UIImageView alloc] initWithFrame:CGRectZero];
|
|
self.faviconView = favicon;
|
|
[self.contentView addSubview:favicon];
|
|
|
|
UILabel *activity = [[UILabel alloc] initWithFrame:CGRectZero];
|
|
activity.backgroundColor = UIColorFromRGB(0xffffff);
|
|
self.activityLabel = activity;
|
|
[self.contentView addSubview:activity];
|
|
|
|
topMargin = 10;
|
|
bottomMargin = 10;
|
|
leftMargin = 10;
|
|
rightMargin = 10;
|
|
avatarSize = 32;
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (void)layoutSubviews {
|
|
[super layoutSubviews];
|
|
|
|
// determine outer bounds
|
|
[self.activityLabel sizeToFit];
|
|
CGRect contentRect = self.frame;
|
|
CGRect labelFrame = self.activityLabel.frame;
|
|
|
|
// position avatar to bounds
|
|
self.faviconView.frame = CGRectMake(leftMargin, topMargin, avatarSize, avatarSize);
|
|
|
|
// position label to bounds
|
|
labelFrame.origin.x = leftMargin*2 + avatarSize;
|
|
labelFrame.origin.y = 0;
|
|
labelFrame.size.width = contentRect.size.width - leftMargin - avatarSize - leftMargin - rightMargin - 20;
|
|
labelFrame.size.height = contentRect.size.height;
|
|
self.activityLabel.frame = labelFrame;
|
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
|
self.activityLabel.backgroundColor = UIColorFromRGB(0xd7dadf);
|
|
} else {
|
|
self.activityLabel.backgroundColor = UIColorFromRGB(0xf6f6f6);
|
|
}
|
|
self.backgroundColor = [UIColor clearColor];
|
|
self.activityLabel.backgroundColor = [UIColor clearColor];
|
|
}
|
|
|
|
@end
|