mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
adding in story titles for portrait
This commit is contained in:
parent
981135e09d
commit
4bbfa05920
4 changed files with 64 additions and 18 deletions
|
@ -23,6 +23,7 @@
|
|||
NSString *siteTitle;
|
||||
UIImage *siteFavicon;
|
||||
BOOL isRead;
|
||||
BOOL isShort;
|
||||
BOOL isRiverOrSocial;
|
||||
BOOL hasAlpha;
|
||||
|
||||
|
@ -43,6 +44,7 @@
|
|||
@property (nonatomic) UIColor *feedColorBarTopBorder;
|
||||
|
||||
@property (readwrite) BOOL isRead;
|
||||
@property (readwrite) BOOL isShort;
|
||||
@property (readwrite) BOOL isRiverOrSocial;
|
||||
@property (readwrite) BOOL hasAlpha;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ static UIFont *indicatorFont = nil;
|
|||
@synthesize siteTitle;
|
||||
@synthesize siteFavicon;
|
||||
@synthesize isRead;
|
||||
@synthesize isShort;
|
||||
@synthesize isRiverOrSocial;
|
||||
@synthesize feedColorBar;
|
||||
@synthesize feedColorBarTopBorder;
|
||||
|
@ -41,7 +42,7 @@ static UIFont *indicatorFont = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) drawContentView:(CGRect)r highlighted:(BOOL)highlighted {
|
||||
- (void)drawContentView:(CGRect)r highlighted:(BOOL)highlighted {
|
||||
int adjustForSocial = 3;
|
||||
if (self.isRiverOrSocial) {
|
||||
adjustForSocial = 20;
|
||||
|
@ -113,12 +114,22 @@ static UIFont *indicatorFont = nil;
|
|||
|
||||
CGSize theSize = [self.storyTitle sizeWithFont:font constrainedToSize:CGSizeMake(rect.size.width - rightMargin, 30.0) lineBreakMode:UILineBreakModeTailTruncation];
|
||||
|
||||
[self.storyTitle
|
||||
drawInRect:CGRectMake(leftMargin, 6 + adjustForSocial + ((30 - theSize.height)/2), rect.size.width - rightMargin, theSize.height)
|
||||
int storyTitleY = 6 + adjustForSocial + ((30 - theSize.height)/2);
|
||||
if (self.isShort){
|
||||
storyTitleY = 6 + adjustForSocial - 2 ;
|
||||
}
|
||||
|
||||
[self.storyTitle
|
||||
drawInRect:CGRectMake(leftMargin, storyTitleY, rect.size.width - rightMargin, theSize.height)
|
||||
withFont:font
|
||||
lineBreakMode:UILineBreakModeTailTruncation
|
||||
alignment:UITextAlignmentLeft];
|
||||
|
||||
int storyAuthorDateY = 42 + adjustForSocial;
|
||||
if (self.isShort){
|
||||
storyAuthorDateY -= 20;
|
||||
}
|
||||
|
||||
// story author style
|
||||
if (self.isRead) {
|
||||
textColor = UIColorFromRGB(0xc0c0c0);
|
||||
|
@ -131,16 +142,15 @@ static UIFont *indicatorFont = nil;
|
|||
textColor = UIColorFromRGB(0x686868);
|
||||
}
|
||||
[textColor set];
|
||||
|
||||
|
||||
[self.storyAuthor
|
||||
drawInRect:CGRectMake(leftMargin, 42 + adjustForSocial, (rect.size.width - rightMargin) / 2 - 10, 15.0)
|
||||
|
||||
[self.storyAuthor
|
||||
drawInRect:CGRectMake(leftMargin, storyAuthorDateY, (rect.size.width - rightMargin) / 2 - 10, 15.0)
|
||||
withFont:font
|
||||
lineBreakMode:UILineBreakModeTailTruncation
|
||||
lineBreakMode:UILineBreakModeTailTruncation
|
||||
alignment:UITextAlignmentLeft];
|
||||
|
||||
|
||||
// story date
|
||||
|
||||
if (self.isRead) {
|
||||
textColor = UIColorFromRGB(0xbabdd1);
|
||||
font = [UIFont fontWithName:@"Helvetica" size:10];
|
||||
|
@ -155,7 +165,7 @@ static UIFont *indicatorFont = nil;
|
|||
[textColor set];
|
||||
|
||||
[self.storyDate
|
||||
drawInRect:CGRectMake(leftMargin + (rect.size.width - rightMargin) / 2 - 10, 42 + adjustForSocial, (rect.size.width - rightMargin) / 2 + 10, 15.0)
|
||||
drawInRect:CGRectMake(leftMargin + (rect.size.width - rightMargin) / 2 - 10, storyAuthorDateY, (rect.size.width - rightMargin) / 2 + 10, 15.0)
|
||||
withFont:font
|
||||
lineBreakMode:UILineBreakModeTailTruncation
|
||||
alignment:UITextAlignmentRight];
|
||||
|
@ -171,7 +181,6 @@ static UIFont *indicatorFont = nil;
|
|||
CGContextAddLineToPoint(context, 5.0f, 81.0f);
|
||||
CGContextStrokePath(context);
|
||||
|
||||
|
||||
// reset for borders
|
||||
CGContextSetAlpha(context, 1.0);
|
||||
CGContextSetLineWidth(context, 1.0f);
|
||||
|
|
|
@ -22,8 +22,9 @@
|
|||
#import "Utilities.h"
|
||||
|
||||
|
||||
#define kTableViewRowHeight 65;
|
||||
#define kTableViewRowHeight 60;
|
||||
#define kTableViewRiverRowHeight 81;
|
||||
#define kTableViewShortRowDifference 20;
|
||||
#define kMarkReadActionSheet 1;
|
||||
#define kSettingsActionSheet 2;
|
||||
|
||||
|
@ -138,6 +139,11 @@
|
|||
appDelegate.inStoryDetail = NO;
|
||||
[appDelegate.storyDetailViewController clearStory];
|
||||
}
|
||||
|
||||
NSString *title = appDelegate.isRiverView ?
|
||||
appDelegate.activeFolder :
|
||||
[appDelegate.activeFeed objectForKey:@"feed_title"];
|
||||
NSLog(@"title %@", title);
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
@ -490,6 +496,13 @@
|
|||
height = kTableViewRowHeight;
|
||||
}
|
||||
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
height = height - kTableViewShortRowDifference;
|
||||
}
|
||||
|
||||
fleuron.frame = CGRectMake(0, 0, self.view.frame.size.width, height);
|
||||
fleuron.contentMode = UIViewContentModeCenter;
|
||||
[cell.contentView addSubview:fleuron];
|
||||
|
@ -634,6 +647,13 @@
|
|||
}
|
||||
|
||||
cell.isRead = [[story objectForKey:@"read_status"] intValue] == 1;
|
||||
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
cell.isShort = YES;
|
||||
}
|
||||
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialView || appDelegate.isSocialRiverView) {
|
||||
cell.isRiverOrSocial = YES;
|
||||
|
@ -676,9 +696,23 @@
|
|||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (appDelegate.isRiverView || appDelegate.isSocialView || appDelegate.isSocialRiverView) {
|
||||
return kTableViewRiverRowHeight;
|
||||
int height = kTableViewRiverRowHeight;
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
height = height - kTableViewShortRowDifference;
|
||||
}
|
||||
return height;
|
||||
} else {
|
||||
return kTableViewRowHeight;
|
||||
int height = kTableViewRowHeight;
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
height = height - kTableViewShortRowDifference;
|
||||
}
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,9 +77,7 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
|
@ -170,6 +168,7 @@
|
|||
if (popoverController.isPopoverVisible) {
|
||||
[popoverController dismissPopoverAnimated:NO];
|
||||
popoverController = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
popoverController = [[UIPopoverController alloc]
|
||||
|
@ -204,6 +203,7 @@
|
|||
if (popoverController.isPopoverVisible) {
|
||||
[popoverController dismissPopoverAnimated:NO];
|
||||
popoverController = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
popoverController = [[UIPopoverController alloc]
|
||||
|
@ -224,6 +224,7 @@
|
|||
if (popoverController.isPopoverVisible) {
|
||||
[popoverController dismissPopoverAnimated:NO];
|
||||
popoverController = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
popoverController = [[UIPopoverController alloc]
|
||||
|
@ -243,8 +244,8 @@
|
|||
- (void)hidePopover {
|
||||
if (popoverController.isPopoverVisible) {
|
||||
[popoverController dismissPopoverAnimated:YES];
|
||||
popoverController = nil;
|
||||
}
|
||||
popoverController = nil;
|
||||
[appDelegate.modalNavigationController dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue