mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing story title height sizing and layout for vertical layout.
This commit is contained in:
parent
e488ae4858
commit
5def8a1bfd
7 changed files with 47 additions and 32 deletions
|
@ -73,9 +73,8 @@
|
|||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
|
||||
self.storiesModule = [FeedDetailViewController new];
|
||||
self.storiesModule.isDashboardModule = YES;
|
||||
// [self.storiesModule view]; // Force load
|
||||
self.storiesModule.storiesCollection = [StoriesCollection new];
|
||||
NSLog(@"Dashboard story module view: %@ (%@)", self.storiesModule, self.storiesModule.storiesCollection);
|
||||
// NSLog(@"Dashboard story module view: %@ (%@)", self.storiesModule, self.storiesModule.storiesCollection);
|
||||
self.storiesModule.view.frame = self.activitiesModule.frame;
|
||||
[self.view insertSubview:self.storiesModule.view belowSubview:self.activitiesModule];
|
||||
[self addChildViewController:self.storiesModule];
|
||||
|
|
|
@ -261,13 +261,17 @@ static UIFont *indicatorFont = nil;
|
|||
storyContentWidth -= leftMargin*2;
|
||||
}
|
||||
CGSize contentSize = [cell.storyContent
|
||||
boundingRectWithSize:CGSizeMake(storyContentWidth, cell.isShort ? font.pointSize*1.5 : font.pointSize*3)
|
||||
boundingRectWithSize:CGSizeMake(storyContentWidth,
|
||||
cell.isShort ? font.pointSize*1.5 : font.pointSize*3)
|
||||
options:NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin
|
||||
attributes:@{NSFontAttributeName: font,
|
||||
NSParagraphStyleAttributeName: paragraphStyle}
|
||||
context:nil].size;
|
||||
|
||||
|
||||
int storyContentY = r.size.height - 18 - 4 - ((font.pointSize*2 + font.lineHeight) + contentSize.height)/2;
|
||||
if (cell.isShort) {
|
||||
storyContentY = r.size.height - 12 - 4 - ((font.pointSize + font.lineHeight) + contentSize.height)/2;
|
||||
}
|
||||
|
||||
if (cell.isRead) {
|
||||
textColor = UIColorFromRGB(0x606060);
|
||||
|
|
|
@ -599,7 +599,7 @@
|
|||
|
||||
- (void)fetchRiverPage:(int)page withCallback:(void(^)())callback {
|
||||
if (self.pageFetching || self.pageFinished) return;
|
||||
NSLog(@"Fetching River in storiesCollection (pg. %ld): %@", (long)page, storiesCollection);
|
||||
// NSLog(@"Fetching River in storiesCollection (pg. %ld): %@", (long)page, storiesCollection);
|
||||
|
||||
self.feedPage = page;
|
||||
self.pageFetching = YES;
|
||||
|
@ -1065,9 +1065,10 @@
|
|||
cell.isRead = ![storiesCollection isStoryUnread:story];
|
||||
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
|
||||
!self.isDashboardModule &&
|
||||
!appDelegate.masterContainerViewController.storyTitlesOnLeft &&
|
||||
UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
cell.isShort = YES;
|
||||
}
|
||||
|
||||
|
@ -1149,9 +1150,9 @@
|
|||
afterDelay:0.1];
|
||||
}
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView
|
||||
heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
|
||||
NSInteger storyCount = storiesCollection.storyLocationsCount;
|
||||
|
||||
|
@ -1161,28 +1162,28 @@ heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|||
storiesCollection.isSocialView ||
|
||||
storiesCollection.isSocialRiverView) {
|
||||
NSInteger height = kTableViewRiverRowHeight;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
if ([self isShortTitles]) {
|
||||
height = height - kTableViewShortRowDifference;
|
||||
}
|
||||
UIFontDescriptor *fontDescriptor = [self fontDescriptorUsingPreferredSize:UIFontTextStyleCaption1];
|
||||
UIFont *font = [UIFont fontWithDescriptor:fontDescriptor size:0.0];
|
||||
if (self.isDashboardModule || self.showContentPreview) {
|
||||
if ([self isShortTitles] && self.showContentPreview) {
|
||||
return height + font.pointSize*3.25;
|
||||
} else if (self.isDashboardModule || self.showContentPreview) {
|
||||
return height + font.pointSize*5;
|
||||
} else {
|
||||
return height + font.pointSize*2;
|
||||
}
|
||||
} else {
|
||||
NSInteger height = kTableViewRowHeight;
|
||||
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad
|
||||
&& !appDelegate.masterContainerViewController.storyTitlesOnLeft
|
||||
&& UIInterfaceOrientationIsPortrait(orientation)) {
|
||||
if ([self isShortTitles]) {
|
||||
height = height - kTableViewShortRowDifference;
|
||||
}
|
||||
UIFontDescriptor *fontDescriptor = [self fontDescriptorUsingPreferredSize:UIFontTextStyleCaption1];
|
||||
UIFont *font = [UIFont fontWithDescriptor:fontDescriptor size:0.0];
|
||||
if (self.isDashboardModule || self.showContentPreview) {
|
||||
if ([self isShortTitles] && self.showContentPreview) {
|
||||
return height + font.pointSize*3.25;
|
||||
} else if (self.isDashboardModule || self.showContentPreview) {
|
||||
return height + font.pointSize*5;
|
||||
} else {
|
||||
return height + font.pointSize*2;
|
||||
|
@ -1217,6 +1218,14 @@ heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|||
return fontDescriptor;
|
||||
}
|
||||
|
||||
- (BOOL)isShortTitles {
|
||||
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||
|
||||
return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
|
||||
!appDelegate.masterContainerViewController.storyTitlesOnLeft &&
|
||||
UIInterfaceOrientationIsPortrait(orientation) &&
|
||||
!self.isDashboardModule;
|
||||
}
|
||||
- (void)checkScroll {
|
||||
NSInteger currentOffset = self.storyTitlesTable.contentOffset.y;
|
||||
NSInteger maximumOffset = self.storyTitlesTable.contentSize.height - self.storyTitlesTable.frame.size.height;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
- (void)syncNextPreviousButtons;
|
||||
|
||||
- (void)adjustDashboardScreen;
|
||||
- (void)adjustFeedDetailScreen;
|
||||
- (void)layoutDashboardScreen;
|
||||
- (void)layoutFeedDetailScreen;
|
||||
- (void)adjustFeedDetailScreenForStoryTitles;
|
||||
|
||||
- (void)transitionToFeedDetail;
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[self adjustDashboardScreen];
|
||||
[self layoutDashboardScreen];
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
|
@ -209,9 +209,9 @@
|
|||
}
|
||||
|
||||
if (!self.feedDetailIsVisible) {
|
||||
[self adjustDashboardScreen];
|
||||
[self layoutDashboardScreen];
|
||||
} else {
|
||||
[self adjustFeedDetailScreen];
|
||||
[self layoutFeedDetailScreen];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,9 +219,9 @@
|
|||
// leftBorder.frame = CGRectMake(0, 0, 1, CGRectGetHeight(self.view.bounds));
|
||||
|
||||
if (!self.feedDetailIsVisible) {
|
||||
[self adjustDashboardScreen];
|
||||
[self layoutDashboardScreen];
|
||||
} else {
|
||||
[self adjustFeedDetailScreen];
|
||||
[self layoutFeedDetailScreen];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -419,14 +419,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)adjustDashboardScreen {
|
||||
- (void)layoutDashboardScreen {
|
||||
CGRect vb = [self.view bounds];
|
||||
self.masterNavigationController.view.frame = CGRectMake(0, 0, self.masterWidth, vb.size.height);
|
||||
self.dashboardViewController.view.frame = CGRectMake(self.masterWidth, 0, vb.size.width - self.masterWidth, vb.size.height);
|
||||
rightBorder.frame = CGRectMake(self.masterWidth-1, 0, 1, CGRectGetHeight(self.view.bounds));
|
||||
}
|
||||
|
||||
- (void)adjustFeedDetailScreen {
|
||||
- (void)layoutFeedDetailScreen {
|
||||
CGRect vb = [self.view bounds];
|
||||
rightBorder.frame = CGRectMake(self.masterWidth-1, 0, 1, CGRectGetHeight(self.view.bounds));
|
||||
|
||||
|
@ -630,6 +630,9 @@
|
|||
vb.size.width - self.masterWidth + 1,
|
||||
vb.size.height);
|
||||
[self interactiveTransitionFromFeedDetail:1];
|
||||
|
||||
UIView *titleLabel = [appDelegate makeFeedTitle:appDelegate.storiesCollection.activeFeed];
|
||||
self.storyPageControl.navigationItem.titleView = titleLabel;
|
||||
}
|
||||
self.leftBorder.hidden = NO;
|
||||
|
||||
|
@ -642,8 +645,6 @@
|
|||
// NSLog(@"Finished hiding dashboard: %d", finished);
|
||||
// [self.dashboardViewController.view removeFromSuperview];
|
||||
}];
|
||||
|
||||
self.storyPageControl.navigationItem.titleView = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +739,7 @@
|
|||
options:UIViewAnimationOptionCurveEaseOut
|
||||
animations:^
|
||||
{
|
||||
[self adjustFeedDetailScreen];
|
||||
[self layoutFeedDetailScreen];
|
||||
} completion:^(BOOL finished) {
|
||||
self.interactiveOriginalTransition = NO;
|
||||
[self.originalNavigationController removeFromParentViewController];
|
||||
|
|
|
@ -220,7 +220,7 @@ static UIFont *userLabelFont;
|
|||
|
||||
[super viewDidAppear:animated];
|
||||
[self performSelector:@selector(fadeSelectedCell) withObject:self afterDelay:0.2];
|
||||
self.navigationController.navigationBar.backItem.title = @"All Sites";
|
||||
// self.navigationController.navigationBar.backItem.title = @"All Sites";
|
||||
|
||||
// // reset all feed detail specific data
|
||||
// appDelegate.activeFeed = nil;
|
||||
|
|
|
@ -262,14 +262,16 @@
|
|||
[appDelegate.storiesCollection.activeFeed objectForKey:@"username"]];
|
||||
self.navigationItem.leftBarButtonItem = self.subscribeButton;
|
||||
// self.subscribeButton.tintColor = UIColorFromRGB(0x0a6720);
|
||||
} else {
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
}
|
||||
appDelegate.isTryFeedView = NO;
|
||||
[self applyNewIndex:previousPage.pageIndex pageController:previousPage];
|
||||
previousPage.view.hidden = NO;
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
previousPage.view.hidden = YES;
|
||||
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
|
||||
|
|
Loading…
Add table
Reference in a new issue