partially fixing ipad layout issues.

This commit is contained in:
Samuel Clay 2017-09-27 12:19:58 -07:00
parent ef51152bcd
commit 2cafd785f2
8 changed files with 64 additions and 61 deletions

View file

@ -154,9 +154,10 @@ static UIFont *textFont = nil;
cell.isSaved ? UIColorFromRGB(0xE9EBEE) :
UIColorFromRGB(0xF7F8F5);
[backgroundColor set];
CGContextFillRect(context, self.frame);
// [backgroundColor set];
self.backgroundColor = backgroundColor;
cell.backgroundColor = backgroundColor;
if (cell.highlighted || cell.selected) {
// [NewsBlurAppDelegate fillGradient:CGRectMake(r.origin.x, r.origin.y + 1, r.size.width, r.size.height - 1) startColor:UIColorFromRGB(0xFFFFD2) endColor:UIColorFromRGB(0xFDED8D)];

View file

@ -85,7 +85,7 @@
UIView* customView = [[UIView alloc] initWithFrame:rect];
// Background
[NewsBlurAppDelegate fillGradient:rect
[NewsBlurAppDelegate fillGradient:self.bounds
startColor:UIColorFromLightSepiaMediumDarkRGB(0xEAECE5, 0xffffc6, 0x6A6A6A, 0x444444)
endColor:UIColorFromLightSepiaMediumDarkRGB(0xDCDFD6, 0xffffc0, 0x666666, 0x333333)];
// UIColor *backgroundColor = UIColorFromRGB(0xD7DDE6);

View file

@ -287,7 +287,7 @@
- (IBAction)forgotPassword:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://www.newsblur.com/folder_rss/forgot_password"];
SFSafariViewController *safariViewController = [[SFSafariViewController alloc] initWithURL:url entersReaderIfAvailable:NO];
SFSafariViewController *safariViewController = [[SFSafariViewController alloc] initWithURL:url];
[self presentViewController:safariViewController animated:YES completion:nil];
}

View file

@ -1715,8 +1715,7 @@
NSString *firefoxURL = [NSString stringWithFormat:@"%@%@", @"firefox://open-url?url=", encodedURL];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:firefoxURL] options:@{} completionHandler:nil];
} else if ([storyBrowser isEqualToString:@"inappsafari"]) {
self.safariViewController = [[SFSafariViewController alloc] initWithURL:url
entersReaderIfAvailable:NO];
self.safariViewController = [[SFSafariViewController alloc] initWithURL:url];
self.safariViewController.delegate = self;
[navigationController presentViewController:self.safariViewController animated:YES completion:nil];
} else {

View file

@ -35,7 +35,6 @@ UIGestureRecognizerDelegate> {
NSDate *lastUpdate;
NSCache *imageCache;
UIView *innerView;
UITableView * feedTitlesTable;
UIToolbar * feedViewToolbar;
UISlider * feedScoreSlider;

View file

@ -54,7 +54,6 @@ static UIFont *userLabelFont;
@implementation NewsBlurViewController
@synthesize appDelegate;
@synthesize innerView;
@synthesize feedTitlesTable;
@synthesize feedViewToolbar;
@synthesize feedScoreSlider;
@ -98,7 +97,7 @@ static UIFont *userLabelFont;
- (void)viewDidLoad {
[super viewDidLoad];
self.refreshControl = [UIRefreshControl new];
self.refreshControl.tintColor = UIColorFromLightDarkRGB(0x0, 0xffffff);
self.refreshControl.backgroundColor = UIColorFromRGB(0xE3E6E0);
@ -155,7 +154,7 @@ static UIFont *userLabelFont;
withOffset:CGPointMake(0, self.feedViewToolbar.frame.size.height)];
[self.view insertSubview:self.notifier belowSubview:self.feedViewToolbar];
self.feedTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
// self.feedTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
self.feedTitlesTable.separatorColor = [UIColor clearColor];
userAvatarButton.customView.hidden = YES;
@ -340,15 +339,15 @@ static UIFont *userLabelFont;
}
- (void)layoutForInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
CGSize toolbarSize = [self.feedViewToolbar sizeThatFits:self.view.frame.size];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
self.feedViewToolbar.frame = CGRectMake(-10.0f,
CGRectGetHeight(self.view.frame) - toolbarSize.height,
toolbarSize.width + 20, toolbarSize.height);
} else {
self.feedViewToolbar.frame = (CGRect){CGPointMake(0.f, CGRectGetHeight(self.view.frame) - toolbarSize.height), toolbarSize};
}
self.innerView.frame = (CGRect){CGPointZero, CGSizeMake(CGRectGetWidth(self.view.frame), CGRectGetMinY(self.feedViewToolbar.frame))};
// CGSize toolbarSize = [self.feedViewToolbar sizeThatFits:self.view.frame.size];
// if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
// self.feedViewToolbar.frame = CGRectMake(-10.0f,
// CGRectGetHeight(self.view.frame) - toolbarSize.height,
// toolbarSize.width + 20, toolbarSize.height);
// } else {
// self.feedViewToolbar.frame = (CGRect){CGPointMake(0.f, CGRectGetHeight(self.view.frame) - toolbarSize.height), toolbarSize};
// }
// self.innerView.frame = (CGRect){CGPointZero, CGSizeMake(CGRectGetWidth(self.view.frame), CGRectGetMinY(self.feedViewToolbar.frame))};
self.notifier.offset = CGPointMake(0, self.feedViewToolbar.frame.size.height);
[self updateIntelligenceControlForOrientation:interfaceOrientation];
@ -383,15 +382,15 @@ static UIFont *userLabelFont;
[self.intelligenceControl sizeToFit];
NSInteger height = 16;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsLandscape(orientation)) {
height = 8;
}
CGRect intelFrame = self.intelligenceControl.frame;
intelFrame.origin.x = (self.feedViewToolbar.frame.size.width / 2) - (intelFrame.size.width / 2) + 20;
intelFrame.size.height = self.feedViewToolbar.frame.size.height - height;
self.intelligenceControl.frame = intelFrame;
// NSInteger height = 16;
// if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsLandscape(orientation)) {
// height = 8;
// }
//
// CGRect intelFrame = self.intelligenceControl.frame;
// intelFrame.origin.x = (self.feedViewToolbar.frame.size.width / 2) - (intelFrame.size.width / 2) + 20;
// intelFrame.size.height = self.feedViewToolbar.frame.size.height - height;
// self.intelligenceControl.frame = intelFrame;
}
// allow keyboard comands
@ -540,37 +539,38 @@ static UIFont *userLabelFont;
}
// Bottom toolbar
UIImage *addImage = [UIImage imageNamed:@"nav_icn_add.png"];
UIImage *settingsImage = [UIImage imageNamed:@"nav_icn_settings.png"];
addBarButton.enabled = YES;
// UIImage *addImage = [UIImage imageNamed:@"nav_icn_add.png"];
// UIImage *settingsImage = [UIImage imageNamed:@"nav_icn_settings.png"];
// addBarButton.enabled = YES;
addBarButton.accessibilityLabel = @"Add site";
settingsBarButton.enabled = YES;
// settingsBarButton.enabled = YES;
settingsBarButton.accessibilityLabel = @"Settings";
NBBarButtonItem *addButton = [NBBarButtonItem buttonWithType:UIButtonTypeCustom];
[addButton setImage:[[ThemeManager themeManager] themedImage:addImage] forState:UIControlStateNormal];
[addButton sizeToFit];
[addButton addTarget:self action:@selector(tapAddSite:)
forControlEvents:UIControlEventTouchUpInside];
addButton.accessibilityLabel = @"Add feed";
[addBarButton setCustomView:addButton];
// NBBarButtonItem *addButton = [NBBarButtonItem buttonWithType:UIButtonTypeCustom];
// [addButton setImage:[[ThemeManager themeManager] themedImage:addImage] forState:UIControlStateNormal];
// [addButton sizeToFit];
// [addButton addTarget:self action:@selector(tapAddSite:)
// forControlEvents:UIControlEventTouchUpInside];
// addButton.accessibilityLabel = @"Add feed";
// [addBarButton setCustomView:addButton];
NBBarButtonItem *settingsButton = [NBBarButtonItem buttonWithType:UIButtonTypeCustom];
settingsButton.onRightSide = YES;
[settingsButton setImage:[[ThemeManager themeManager] themedImage:settingsImage] forState:UIControlStateNormal];
[settingsButton sizeToFit];
[settingsButton addTarget:self action:@selector(showSettingsPopover:)
forControlEvents:UIControlEventTouchUpInside];
settingsButton.accessibilityLabel = @"Settings";
[settingsBarButton setCustomView:settingsButton];
// NBBarButtonItem *settingsButton = [NBBarButtonItem buttonWithType:UIButtonTypeCustom];
// settingsButton.onRightSide = YES;
// [settingsButton setImage:[[ThemeManager themeManager] themedImage:settingsImage] forState:UIControlStateNormal];
// [settingsButton sizeToFit];
// [settingsButton addTarget:self action:@selector(showSettingsPopover:)
// forControlEvents:UIControlEventTouchUpInside];
// settingsButton.accessibilityLabel = @"Settings";
// [settingsBarButton setCustomView:settingsButton];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
UIImage *activityImage = [UIImage imageNamed:@"nav_icn_activity_hover.png"];
NBBarButtonItem *activityButton = [NBBarButtonItem buttonWithType:UIButtonTypeCustom];
activityButton.accessibilityLabel = @"Activities";
[activityButton setImage:activityImage forState:UIControlStateNormal];
[activityButton sizeToFit];
[activityButton setContentEdgeInsets:UIEdgeInsetsMake(0, -6, -0, -6)];
[activityButton setFrame:CGRectInset(activityButton.frame, 0, -6)];
[activityButton setImageEdgeInsets:UIEdgeInsetsMake(12, 12, 12, 12)];
// [activityButton sizeToFit];
// [activityButton setContentEdgeInsets:UIEdgeInsetsMake(0, -6, -0, -6)];
// [activityButton setFrame:CGRectInset(activityButton.frame, 0, -6)];
[activityButton setImageEdgeInsets:UIEdgeInsetsMake(4, 4, 4, 4)];
[activityButton addTarget:self
action:@selector(showInteractionsPopover:)
forControlEvents:UIControlEventTouchUpInside];
@ -807,7 +807,8 @@ static UIFont *userLabelFont;
[self.appDelegate.addSiteNavigationController popToRootViewControllerAnimated:NO];
// if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.appDelegate showPopoverWithViewController:self.appDelegate.addSiteNavigationController contentSize:CGSizeMake(320, 96) sourceView:self.addBarButton.customView sourceRect:CGRectMake(35.0, 0.0, 0.0, 0.0) permittedArrowDirections:UIPopoverArrowDirectionDown];
[self.appDelegate showPopoverWithViewController:self.appDelegate.addSiteNavigationController contentSize:CGSizeMake(320, 96) barButtonItem:self.addBarButton];
// [self.appDelegate showPopoverWithViewController:self.appDelegate.addSiteNavigationController contentSize:CGSizeMake(320, 96) sourceView:self.addBarButton sourceRect:CGRectMake(35.0, 0.0, 0.0, 0.0) permittedArrowDirections:UIPopoverArrowDirectionDown];
// } else {
// [self.appDelegate showPopoverWithViewController:self.appDelegate.addSiteNavigationController contentSize:CGSizeMake(320, 96) barButtonItem:self.addBarButton];
// }
@ -963,7 +964,7 @@ static UIFont *userLabelFont;
[self layoutHeaderCounts:0];
[self refreshHeaderCounts];
self.feedTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
// self.feedTitlesTable.backgroundColor = UIColorFromRGB(0xf4f4f4);
[self.feedTitlesTable reloadData];
[self resetupGestures];
@ -1504,7 +1505,7 @@ heightForHeaderInSection:(NSInteger)section {
if (!firstFeedInFolderVisible) {
CGRect headerRect = [self.feedTitlesTable rectForHeaderInSection:button.tag];
CGPoint headerPoint = CGPointMake(headerRect.origin.x, headerRect.origin.y);
[self.feedTitlesTable setContentOffset:headerPoint animated:YES];
// [self.feedTitlesTable setContentOffset:headerPoint animated:YES];
}
}
@ -1556,7 +1557,7 @@ heightForHeaderInSection:(NSInteger)section {
- (IBAction)selectIntelligence {
[MBProgressHUD hideHUDForView:self.feedTitlesTable animated:NO];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.innerView animated:YES];
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.removeFromSuperViewOnHide = YES;
@ -1935,7 +1936,12 @@ heightForHeaderInSection:(NSInteger)section {
userAvatarButton = [UIBarButtonItem barItemWithImage:[UIImage alloc]
target:self
action:@selector(showUserProfile)];
userAvatarButton.customView.frame = CGRectMake(0, yOffset + 1, isShort ? 28 : 32, isShort ? 28 : 32);
userAvatarButton.customView.frame = CGRectMake(0, yOffset + 1, 32, 32);
if (@available(iOS 11.0, *)) {
userAvatarButton.customView.insetsLayoutMarginsFromSafeArea = NO;
} else {
// Fallback on earlier versions
}
userAvatarButton.accessibilityLabel = @"User info";
userAvatarButton.accessibilityHint = @"Double-tap for information about your account.";

View file

@ -173,10 +173,7 @@ CGRect IASKCGRectSwap(CGRect rect);
- (void)viewDidLoad {
[super viewDidLoad];
if ([self isPad]) {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) // don't use etched style on iOS 7
#endif
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLineEtched;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
}
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapToEndEdit:)];
tapGesture.cancelsTouchesInView = NO;

View file

@ -1,3 +1,4 @@
//
// main.m
// NewsBlur