mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
#1540 (comfortable/compact feeds)
This commit is contained in:
parent
95efd21426
commit
a44e307c69
3 changed files with 22 additions and 2 deletions
|
@ -1046,6 +1046,14 @@ static NSArray<NSString *> *NewsBlurTopSectionNames;
|
|||
[self.appDelegate resizeFontSize];
|
||||
}];
|
||||
|
||||
preferenceKey = @"feed_list_spacing";
|
||||
titles = @[@"Compact", @"Comfortable"];
|
||||
values = @[@"compact", @"comfortable"];
|
||||
|
||||
[viewController addSegmentedControlWithTitles:titles values:values defaultValue:@"comfortable" preferenceKey:preferenceKey selectionShouldDismiss:YES handler:^(NSUInteger selectedIndex) {
|
||||
[self reloadFeedTitlesTable];
|
||||
}];
|
||||
|
||||
[viewController addThemeSegmentedControl];
|
||||
|
||||
UINavigationController *navController = self.navigationController;
|
||||
|
@ -1587,7 +1595,10 @@ static NSArray<NSString *> *NewsBlurTopSectionNames;
|
|||
|
||||
UIFontDescriptor *fontDescriptor = [self fontDescriptorUsingPreferredSize:UIFontTextStyleCaption1];
|
||||
UIFont *font = [UIFont fontWithName:@"WhitneySSm-Medium" size:fontDescriptor.pointSize];
|
||||
return height + font.pointSize*2;
|
||||
NSString *spacing = [[NSUserDefaults standardUserDefaults] objectForKey:@"feed_list_spacing"];
|
||||
NSInteger offset = [spacing isEqualToString:@"compact"] ? 6 : 0;
|
||||
|
||||
return height + (font.pointSize * 2) - offset;
|
||||
}
|
||||
|
||||
- (void)resetRowHeights {
|
||||
|
|
|
@ -22,6 +22,7 @@ typedef void (^MenuItemSegmentedHandler)(NSUInteger selectedIndex);
|
|||
- (void)addTitle:(NSString *)title iconTemplateName:(NSString *)iconTemplateName selectionShouldDismiss:(BOOL)selectionShouldDismiss handler:(MenuItemHandler)handler;
|
||||
- (void)addSegmentedControlWithTitles:(NSArray *)titles selectIndex:(NSUInteger)selectIndex selectionShouldDismiss:(BOOL)selectionShouldDismiss handler:(MenuItemSegmentedHandler)handler;
|
||||
- (void)addSegmentedControlWithTitles:(NSArray *)titles values:(NSArray *)values preferenceKey:(NSString *)preferenceKey selectionShouldDismiss:(BOOL)selectionShouldDismiss handler:(MenuItemSegmentedHandler)handler;
|
||||
- (void)addSegmentedControlWithTitles:(NSArray *)titles values:(NSArray *)values defaultValue:(NSString *)defaultValue preferenceKey:(NSString *)preferenceKey selectionShouldDismiss:(BOOL)selectionShouldDismiss handler:(MenuItemSegmentedHandler)handler;
|
||||
- (void)addThemeSegmentedControl;
|
||||
|
||||
- (void)showFromNavigationController:(UINavigationController *)navigationController barButtonItem:(UIBarButtonItem *)barButtonItem;
|
||||
|
|
|
@ -106,11 +106,19 @@ NSString * const MenuHandler = @"handler";
|
|||
}
|
||||
|
||||
- (void)addSegmentedControlWithTitles:(NSArray *)titles values:(NSArray *)values preferenceKey:(NSString *)preferenceKey selectionShouldDismiss:(BOOL)selectionShouldDismiss handler:(MenuItemSegmentedHandler)handler {
|
||||
[self addSegmentedControlWithTitles:titles values:values defaultValue:nil preferenceKey:preferenceKey selectionShouldDismiss:selectionShouldDismiss handler:handler];
|
||||
}
|
||||
|
||||
- (void)addSegmentedControlWithTitles:(NSArray *)titles values:(NSArray *)values defaultValue:(NSString *)defaultValue preferenceKey:(NSString *)preferenceKey selectionShouldDismiss:(BOOL)selectionShouldDismiss handler:(MenuItemSegmentedHandler)handler {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
id value = [userPreferences objectForKey:preferenceKey];
|
||||
NSUInteger valueIndex = [values indexOfObject:value];
|
||||
|
||||
if (valueIndex < 0) {
|
||||
if (valueIndex == NSNotFound && defaultValue != nil) {
|
||||
valueIndex = [values indexOfObject:defaultValue];
|
||||
}
|
||||
|
||||
if (valueIndex == NSNotFound) {
|
||||
valueIndex = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue