mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
iOS: tweaked #1100 (scroll vertically between stories): story detail toggle
Horizontal story scrolling is now the default. Added a control to the story detail options popover to toggle the orientation.
This commit is contained in:
parent
ab1de65a33
commit
c95351fb10
7 changed files with 94 additions and 35 deletions
|
@ -15,11 +15,13 @@
|
|||
@property (nonatomic) IBOutlet NewsBlurAppDelegate *appDelegate;
|
||||
@property (nonatomic) IBOutlet UISegmentedControl *fontSizeSegment;
|
||||
@property (nonatomic) IBOutlet UISegmentedControl *lineSpacingSegment;
|
||||
@property (nonatomic) IBOutlet UISegmentedControl *scrollOrientationSegment;
|
||||
@property (nonatomic) IBOutlet UISegmentedControl *themeSegment;
|
||||
@property (nonatomic) IBOutlet UITableView *menuTableView;
|
||||
|
||||
- (IBAction)changeFontSize:(id)sender;
|
||||
- (IBAction)changeLineSpacing:(id)sender;
|
||||
- (IBAction)changeScrollOrientation:(id)sender;
|
||||
- (IBAction)changeTheme:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -95,6 +95,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
if([userPreferences objectForKey:@"scroll_stories_horizontally"]){
|
||||
BOOL scrollHorizontally = [userPreferences boolForKey:@"scroll_stories_horizontally"];
|
||||
if (scrollHorizontally) {
|
||||
[self.scrollOrientationSegment setSelectedSegmentIndex:1];
|
||||
} else {
|
||||
[self.scrollOrientationSegment setSelectedSegmentIndex:0];
|
||||
}
|
||||
}
|
||||
|
||||
NSString *theme = [ThemeManager themeManager].theme;
|
||||
if ([theme isEqualToString:@"sepia"]) {
|
||||
self.themeSegment.selectedSegmentIndex = 1;
|
||||
|
@ -195,6 +204,13 @@
|
|||
[userPreferences synchronize];
|
||||
}
|
||||
|
||||
- (IBAction)changeScrollOrientation:(id)sender {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
[userPreferences setBool:[sender selectedSegmentIndex] == 1 forKey:@"scroll_stories_horizontally"];
|
||||
[userPreferences synchronize];
|
||||
[self.appDelegate.storyPageControl changedScrollOrientation];
|
||||
}
|
||||
|
||||
- (IBAction)changeTheme:(id)sender {
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
NSString *theme = ThemeStyleLight;
|
||||
|
@ -223,7 +239,7 @@
|
|||
#pragma mark - Table view data source
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return 9;
|
||||
return 10;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
@ -236,6 +252,8 @@
|
|||
} else if (indexPath.row == 7) {
|
||||
return [self makeLineSpacingTableCell];
|
||||
} else if (indexPath.row == 8) {
|
||||
return [self makeScrollOrientationTableCell];
|
||||
} else if (indexPath.row == 9) {
|
||||
return [self makeThemeTableCell];
|
||||
}
|
||||
|
||||
|
@ -400,6 +418,26 @@
|
|||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)makeScrollOrientationTableCell {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] init];
|
||||
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
cell.separatorInset = UIEdgeInsetsZero;
|
||||
cell.backgroundColor = UIColorFromRGB(0xffffff);
|
||||
|
||||
self.scrollOrientationSegment.frame = CGRectMake(8, 7, cell.frame.size.width - 8*2, kMenuOptionHeight - 7*2);
|
||||
[self.scrollOrientationSegment setTitle:[@"Scroll Up/Down" uppercaseString] forSegmentAtIndex:0];
|
||||
[self.scrollOrientationSegment setTitle:[@"Left/Right" uppercaseString] forSegmentAtIndex:1];
|
||||
self.scrollOrientationSegment.backgroundColor = UIColorFromRGB(0xeeeeee);
|
||||
[self.scrollOrientationSegment setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:11.0f]} forState:UIControlStateNormal];
|
||||
[self.scrollOrientationSegment setContentOffset:CGSizeMake(0, 1) forSegmentAtIndex:0];
|
||||
[self.scrollOrientationSegment setContentOffset:CGSizeMake(0, 1) forSegmentAtIndex:1];
|
||||
|
||||
[cell addSubview:self.scrollOrientationSegment];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)makeThemeTableCell {
|
||||
UITableViewCell *cell = [[UITableViewCell alloc] init];
|
||||
cell.frame = CGRectMake(0, 0, 240, kMenuOptionHeight);
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" colorMatched="YES">
|
||||
<device id="ipad9_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="FontSettingsViewController">
|
||||
|
@ -10,6 +14,7 @@
|
|||
<outlet property="fontSizeSegment" destination="28" id="34"/>
|
||||
<outlet property="lineSpacingSegment" destination="4iD-hO-qU2" id="K0A-P6-riY"/>
|
||||
<outlet property="menuTableView" destination="35" id="38"/>
|
||||
<outlet property="scrollOrientationSegment" destination="muZ-4L-Qll" id="Uie-9I-ECx"/>
|
||||
<outlet property="themeSegment" destination="9Zd-0Z-SQt" id="V1G-LP-kgy"/>
|
||||
<outlet property="view" destination="2" id="3"/>
|
||||
</connections>
|
||||
|
@ -22,7 +27,6 @@
|
|||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="2" id="28">
|
||||
<rect key="frame" x="3" y="81" width="234" height="30"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<segments>
|
||||
<segment title="11pt"/>
|
||||
<segment title="12pt"/>
|
||||
|
@ -37,7 +41,6 @@
|
|||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="2" id="4iD-hO-qU2">
|
||||
<rect key="frame" x="3" y="123" width="234" height="29"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<segments>
|
||||
<segment title="" image="line_spacing_xs.png"/>
|
||||
<segment title="" image="line_spacing_s.png"/>
|
||||
|
@ -49,10 +52,21 @@
|
|||
<action selector="changeLineSpacing:" destination="-1" eventType="valueChanged" id="3hE-hD-2Aq"/>
|
||||
</connections>
|
||||
</segmentedControl>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" id="muZ-4L-Qll">
|
||||
<rect key="frame" x="3" y="96" width="234" height="29"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<segments>
|
||||
<segment title="Scroll Up/Down"/>
|
||||
<segment title="Left/Right"/>
|
||||
</segments>
|
||||
<connections>
|
||||
<action selector="changeLineSpacing:" destination="-1" eventType="valueChanged" id="pWJ-8e-fOX"/>
|
||||
<action selector="changeScrollOrientation:" destination="-1" eventType="valueChanged" id="x5R-7P-7ha"/>
|
||||
</connections>
|
||||
</segmentedControl>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="2" id="9Zd-0Z-SQt">
|
||||
<rect key="frame" x="3" y="97" width="234" height="29"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<segments>
|
||||
<segment title="" image="theme_color_light.png"/>
|
||||
<segment title="" image="theme_color_sepia.png"/>
|
||||
|
@ -66,16 +80,14 @@
|
|||
<tableView clipsSubviews="YES" contentMode="scaleToFill" bounces="NO" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="35">
|
||||
<rect key="frame" x="0.0" y="-1" width="240" height="223"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-1" id="36"/>
|
||||
<outlet property="delegate" destination="-1" id="37"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
</view>
|
||||
|
@ -86,9 +98,9 @@
|
|||
<image name="line_spacing_s.png" width="32" height="32"/>
|
||||
<image name="line_spacing_xl.png" width="32" height="32"/>
|
||||
<image name="line_spacing_xs.png" width="32" height="32"/>
|
||||
<image name="theme_color_dark.png" width="64" height="64"/>
|
||||
<image name="theme_color_light.png" width="64" height="64"/>
|
||||
<image name="theme_color_medium.png" width="64" height="64"/>
|
||||
<image name="theme_color_sepia.png" width="64" height="64"/>
|
||||
<image name="theme_color_dark.png" width="32" height="32"/>
|
||||
<image name="theme_color_light.png" width="32" height="32"/>
|
||||
<image name="theme_color_medium.png" width="32" height="32"/>
|
||||
<image name="theme_color_sepia.png" width="32" height="32"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
- (void)setFontStyle:(NSString *)fontStyle;
|
||||
- (void)changeFontSize:(NSString *)fontSize;
|
||||
- (void)changeLineSpacing:(NSString *)lineSpacing;
|
||||
- (void)changedScrollOrientation;
|
||||
- (void)drawStories;
|
||||
- (void)showShareHUD:(NSString *)msg;
|
||||
- (void)showFetchingTextNotifier;
|
||||
|
|
|
@ -1301,6 +1301,12 @@
|
|||
[self.previousPage changeLineSpacing:lineSpacing];
|
||||
}
|
||||
|
||||
- (void)changedScrollOrientation {
|
||||
[self.scrollView setAlwaysBounceHorizontal:self.isHorizontal];
|
||||
[self.scrollView setAlwaysBounceVertical:!self.isHorizontal];
|
||||
[self reorientPages];
|
||||
}
|
||||
|
||||
- (void)drawStories {
|
||||
[self.currentPage drawStory];
|
||||
[self.nextPage drawStory];
|
||||
|
|
|
@ -624,16 +624,16 @@
|
|||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Scroll horizontally</string>
|
||||
<key>Key</key>
|
||||
<string>scroll_stories_horizontally</string>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Scroll horizontally</string>
|
||||
<key>Key</key>
|
||||
<string>scroll_stories_horizontally</string>
|
||||
<key>DefaultValue</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
|
|
|
@ -644,16 +644,16 @@
|
|||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Scroll horizontally</string>
|
||||
<key>Key</key>
|
||||
<string>scroll_stories_horizontally</string>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<key>Title</key>
|
||||
<string>Scroll horizontally</string>
|
||||
<key>Key</key>
|
||||
<string>scroll_stories_horizontally</string>
|
||||
<key>DefaultValue</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue