#1491 (scroll bounce at story bottom)

- Added the column layout to the Preferences on iPad.
- Two column layout is now the default.
This commit is contained in:
David Sinclair 2021-06-10 19:50:56 -07:00
parent 48beb427a9
commit a83cf508ee
4 changed files with 49 additions and 28 deletions

View file

@ -1258,7 +1258,9 @@ static NSArray<NSString *> *NewsBlurTopSectionNames;
identifier = notification.userInfo.allKeys.firstObject;
}
if ([identifier isEqualToString:@"feed_list_sort_order"]) {
if ([identifier isEqualToString:@"split_behavior"]) {
[self.appDelegate updateSplitBehavior];
} else if ([identifier isEqualToString:@"feed_list_sort_order"]) {
[self.appDelegate reloadFeedsView:YES];
} else if ([identifier isEqual:@"feed_list_font_size"]) {
[self resizeFontSize];

View file

@ -312,6 +312,7 @@ SFSafariViewControllerDelegate> {
- (void)showOrganizeSites;
- (void)showWidgetSites;
- (void)showPremiumDialog;
- (void)updateSplitBehavior;
- (void)addSplitControlToMenuController:(MenuViewController *)menuViewController;
- (void)showPreferences;
- (void)setHiddenPreferencesAnimated:(BOOL)animated;

View file

@ -805,28 +805,33 @@
[self.premiumViewController.view setNeedsLayout];
}
- (void)updateSplitBehavior {
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
NSString *behavior = [preferences stringForKey:@"split_behavior"];
if ([behavior isEqualToString:@"tile"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorTile;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeTwoBesideSecondary;
} else if ([behavior isEqualToString:@"displace"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorDisplace;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeTwoDisplaceSecondary;
} else if ([behavior isEqualToString:@"overlay"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorOverlay;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeTwoOverSecondary;
} else {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorAutomatic;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAutomatic;
}
}
- (void)addSplitControlToMenuController:(MenuViewController *)menuViewController {
NSString *preferenceKey = @"split_behavior";
NSArray *titles = @[@"Auto", @"columns_triple.png", @"columns_double.png", @"Full screen"];
NSArray *values = @[@"auto", @"tile", @"displace", @"overlay"];
[menuViewController addSegmentedControlWithTitles:titles values:values preferenceKey:preferenceKey selectionShouldDismiss:YES handler:^(NSUInteger selectedIndex) {
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
NSString *behavior = [preferences stringForKey:@"split_behavior"];
[UIView animateWithDuration:0.5 animations:^{
if ([behavior isEqualToString:@"tile"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorTile;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeTwoBesideSecondary;
} else if ([behavior isEqualToString:@"displace"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorDisplace;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeTwoDisplaceSecondary;
} else if ([behavior isEqualToString:@"overlay"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorOverlay;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeTwoOverSecondary;
} else {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorAutomatic;
self.splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModeAutomatic;
}
[self updateSplitBehavior];
}];
}];
}
@ -1117,19 +1122,8 @@
return;
}
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
NSString *behavior = [preferences stringForKey:@"split_behavior"];
if ([behavior isEqualToString:@"tile"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorTile;
} else if ([behavior isEqualToString:@"displace"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorDisplace;
} else if ([behavior isEqualToString:@"overlay"]) {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorOverlay;
} else {
self.splitViewController.preferredSplitBehavior = UISplitViewControllerSplitBehaviorAutomatic;
}
self.splitViewController.showsSecondaryOnlyButton = YES;
[self updateSplitBehavior];
self.feedsNavigationController = (UINavigationController *)splitChildren[0];
self.feedsViewController = self.feedsNavigationController.viewControllers.firstObject;

View file

@ -162,6 +162,30 @@
<key>Key</key>
<string>override_scroll_read_filter</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Title</key>
<string>Column layout</string>
<key>Titles</key>
<array>
<string>Automatic</string>
<string>Three columns</string>
<string>Two columns</string>
<string>Full screen</string>
</array>
<key>DefaultValue</key>
<string>displace</string>
<key>Values</key>
<array>
<string>auto</string>
<string>tile</string>
<string>displace</string>
<string>overlay</string>
</array>
<key>Key</key>
<string>split_behavior</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>