2012-07-21 18:25:56 -07:00
|
|
|
//
|
|
|
|
// SmallActivityCell.m
|
|
|
|
// NewsBlur
|
|
|
|
//
|
|
|
|
// Created by Roy Yang on 7/21/12.
|
|
|
|
// Copyright (c) 2012 NewsBlur. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "SmallActivityCell.h"
|
2012-07-22 14:23:50 -07:00
|
|
|
#import "NSAttributedString+Attributes.h"
|
|
|
|
#import "UIImageView+AFNetworking.h"
|
|
|
|
#import <QuartzCore/QuartzCore.h>
|
|
|
|
|
|
|
|
#define topMargin 10
|
|
|
|
#define bottomMargin 10
|
|
|
|
#define leftMargin 10
|
|
|
|
#define rightMargin 10
|
|
|
|
#define avatarSize 32
|
2012-07-21 18:25:56 -07:00
|
|
|
|
|
|
|
@implementation SmallActivityCell
|
|
|
|
|
|
|
|
- (id)initWithFrame:(CGRect)frame
|
|
|
|
{
|
|
|
|
self = [super initWithFrame:frame];
|
|
|
|
if (self) {
|
|
|
|
// Initialization code
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)layoutSubviews {
|
|
|
|
[super layoutSubviews];
|
|
|
|
|
|
|
|
// determine outer bounds
|
|
|
|
CGRect contentRect = self.contentView.bounds;
|
|
|
|
|
|
|
|
// position avatar to bounds
|
|
|
|
self.faviconView.frame = CGRectMake(leftMargin, topMargin, avatarSize, avatarSize);
|
|
|
|
|
|
|
|
// position label to bounds
|
|
|
|
CGRect labelRect = contentRect;
|
|
|
|
labelRect.origin.x = labelRect.origin.x + leftMargin + avatarSize + leftMargin;
|
|
|
|
labelRect.origin.y = labelRect.origin.y + topMargin - 1;
|
|
|
|
labelRect.size.width = contentRect.size.width - leftMargin - avatarSize - leftMargin - rightMargin;
|
|
|
|
labelRect.size.height = contentRect.size.height - topMargin - bottomMargin;
|
|
|
|
self.activityLabel.frame = labelRect;
|
2012-07-22 14:23:50 -07:00
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
|
|
|
self.activityLabel.backgroundColor = UIColorFromRGB(0xd7dadf);
|
|
|
|
} else {
|
|
|
|
self.activityLabel.backgroundColor = UIColorFromRGB(0xf6f6f6);
|
|
|
|
}
|
|
|
|
self.activityLabel.backgroundColor = [UIColor clearColor];
|
|
|
|
}
|
|
|
|
|
2012-07-21 18:25:56 -07:00
|
|
|
@end
|