mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
adding in hide/expand detail view button and debugging/refacgtoring
This commit is contained in:
parent
09affc6ccf
commit
dcd6c0de46
11 changed files with 91 additions and 38 deletions
|
@ -153,7 +153,7 @@
|
|||
- (void)showDashboard;
|
||||
- (void)loadRiverFeedDetailView;
|
||||
- (void)loadStoryDetailView;
|
||||
- (void)adjustStoryDetailWebView:(BOOL)init shouldCheckLayout:(BOOL)checkLayout;
|
||||
- (void)adjustStoryDetailWebView;
|
||||
- (void)reloadFeedsView:(BOOL)showLoader;
|
||||
- (void)hideNavigationBar:(BOOL)animated;
|
||||
- (void)showNavigationBar:(BOOL)animated;
|
||||
|
|
|
@ -380,10 +380,33 @@
|
|||
[feedDetailViewController fetchRiverPage:1 withCallback:nil];
|
||||
}
|
||||
|
||||
- (void)adjustStoryDetailWebView:(BOOL)init shouldCheckLayout:(BOOL)checkLayout {
|
||||
- (void)adjustStoryDetailWebView {
|
||||
if (!self.inStoryDetail) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIImage *slide;
|
||||
|
||||
if (self.splitStoryController.isShowingMaster) {
|
||||
slide = [[UIImage imageNamed: @"slide_left.png"] retain];
|
||||
|
||||
[self.storyDetailViewController.toggleViewButton setImage:slide];
|
||||
|
||||
self.splitStoryDetailViewController.navigationItem.titleView = nil;
|
||||
} else {
|
||||
slide = [[UIImage imageNamed: @"slide_right.png"] retain];
|
||||
[self.storyDetailViewController.toggleViewButton setImage:slide];
|
||||
|
||||
UIView *titleLabel = [self makeFeedTitle:self.activeFeed];
|
||||
if (splitStoryDetailViewController.navigationItem){
|
||||
splitStoryDetailViewController.navigationItem.titleView = titleLabel;
|
||||
}
|
||||
}
|
||||
|
||||
int contentWidth = splitStoryDetailViewController.view.frame.size.width;
|
||||
// set the styles inside the UIWebView
|
||||
|
||||
[storyDetailViewController changeWebViewWidth:contentWidth];
|
||||
|
||||
if (UIInterfaceOrientationIsPortrait(splitStoryDetailViewController.interfaceOrientation)) {
|
||||
storyDetailViewController.view.frame = CGRectMake(0,
|
||||
|
@ -397,13 +420,14 @@
|
|||
splitStoryDetailViewController.view.frame.size.height);
|
||||
}
|
||||
|
||||
int contentWidth = splitStoryDetailViewController.view.frame.size.width;
|
||||
// set the styles inside the UIWebView
|
||||
|
||||
[storyDetailViewController changeWebViewWidth:contentWidth];
|
||||
[slide release];
|
||||
}
|
||||
|
||||
- (void)animateHidingMasterView {
|
||||
if (!self.splitStoryController.isShowingMaster) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = storyDetailViewController.view.frame.size.width + 291;
|
||||
[UIView animateWithDuration:0.1 animations:^{
|
||||
storyDetailViewController.view.frame = CGRectMake(0,
|
||||
|
@ -411,10 +435,16 @@
|
|||
width,
|
||||
storyDetailViewController.view.frame.size.height);
|
||||
}];
|
||||
[storyDetailViewController changeWebViewWidth:width];
|
||||
|
||||
[self.splitStoryController toggleMasterView:nil];
|
||||
[self performSelector:@selector(adjustStoryDetailWebView) withObject:self afterDelay:0.1 ];
|
||||
}
|
||||
|
||||
- (void)animateShowingMasterView {
|
||||
if (self.splitStoryController.isShowingMaster) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = storyDetailViewController.view.frame.size.width - 291;
|
||||
[UIView animateWithDuration:0.50 animations:^{
|
||||
storyDetailViewController.view.frame = CGRectMake(0,
|
||||
|
@ -422,8 +452,9 @@
|
|||
width,
|
||||
storyDetailViewController.view.frame.size.height);
|
||||
}];
|
||||
[storyDetailViewController changeWebViewWidth:width];
|
||||
|
||||
[self.splitStoryController toggleMasterView:nil];
|
||||
[self performSelector:@selector(adjustStoryDetailWebView) withObject:self afterDelay:.1 ];
|
||||
}
|
||||
|
||||
- (void)dragFeedDetailView:(float)y {
|
||||
|
@ -440,7 +471,7 @@
|
|||
|
||||
[userPreferences setInteger:self.feedDetailPortraitYCoordinate forKey:@"feedDetailPortraitYCoordinate"];
|
||||
[userPreferences synchronize];
|
||||
[self adjustStoryDetailWebView:NO shouldCheckLayout:YES];
|
||||
[self adjustStoryDetailWebView];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,7 +498,7 @@
|
|||
}
|
||||
[subviews release];
|
||||
|
||||
[self adjustStoryDetailWebView:NO shouldCheckLayout:NO];
|
||||
[self adjustStoryDetailWebView];
|
||||
storyDetailViewController.view.tag = STORY_DETAIL_VIEW_TAG;
|
||||
[splitStoryDetailViewController.view addSubview:storyDetailViewController.view];
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
UIBarButtonItem *buttonPrevious;
|
||||
UIBarButtonItem *buttonNext;
|
||||
UIBarButtonItem *activity;
|
||||
UIBarButtonItem *toggleViewButton;
|
||||
UIActivityIndicatorView *loadingIndicator;
|
||||
IBOutlet UIPopoverController *popoverController;
|
||||
}
|
||||
|
@ -34,6 +35,7 @@
|
|||
@property (nonatomic, retain) IBOutlet UIBarButtonItem *buttonPrevious;
|
||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem *buttonNext;
|
||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem *activity;
|
||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem *toggleViewButton;
|
||||
@property (nonatomic, retain) IBOutlet UIBarButtonItem *buttonAction;
|
||||
@property (nonatomic, retain) IBOutlet UIView *feedTitleGradient;
|
||||
@property (retain,nonatomic) UIPopoverController *popoverController;
|
||||
|
@ -41,6 +43,7 @@
|
|||
|
||||
- (void)setNextPreviousButtons;
|
||||
- (void)markStoryAsRead;
|
||||
- (void)toggleView;
|
||||
- (void)showStory;
|
||||
- (void)showOriginalSubview:(id)sender;
|
||||
- (IBAction)doNextUnreadStory;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
@synthesize feedTitleGradient;
|
||||
@synthesize popoverController;
|
||||
@synthesize buttonNextStory;
|
||||
@synthesize toggleViewButton;
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark View boilerplate
|
||||
|
@ -58,6 +59,7 @@
|
|||
[popoverController release];
|
||||
[buttonNextStory release];
|
||||
[buttonNextStory release];
|
||||
[toggleViewButton release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -109,19 +111,43 @@
|
|||
target:self
|
||||
action:@selector(toggleFontSize:)
|
||||
];
|
||||
|
||||
UIImage *slide = [UIImage imageNamed: appDelegate.splitStoryController.isShowingMaster ? @"slide_left.png" : @"slide_right.png"];
|
||||
|
||||
UIBarButtonItem *toggleButton = [[UIBarButtonItem alloc]
|
||||
initWithImage:slide
|
||||
style:UIBarButtonItemStylePlain
|
||||
target:self
|
||||
action:@selector(toggleView)];
|
||||
|
||||
self.toggleViewButton = toggleButton;
|
||||
|
||||
|
||||
|
||||
|
||||
if (UI_USER_INTERFACE_IDIOM()== UIUserInterfaceIdiomPad) {
|
||||
appDelegate.splitStoryDetailViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:originalButton, fontSettingsButton, nil];
|
||||
appDelegate.splitStoryDetailViewController.navigationItem.leftBarButtonItem = self.toggleViewButton;
|
||||
|
||||
} else {
|
||||
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:originalButton, fontSettingsButton, nil];
|
||||
self.navigationItem.rightBarButtonItem = self.toggleViewButton;
|
||||
}
|
||||
|
||||
[toggleButton release];
|
||||
[originalButton release];
|
||||
[fontSettingsButton release];
|
||||
|
||||
[super viewDidAppear:animated];
|
||||
}
|
||||
|
||||
- (void)toggleView {
|
||||
if (appDelegate.splitStoryController.isShowingMaster){
|
||||
[appDelegate animateHidingMasterView];
|
||||
} else {
|
||||
[appDelegate animateShowingMasterView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
Class viewClass = [appDelegate.navigationController.visibleViewController class];
|
||||
if (viewClass == [appDelegate.feedDetailViewController class] ||
|
||||
|
|
|
@ -59,6 +59,10 @@
|
|||
4307BEE41565EDF8007A932A /* warning.png in Resources */ = {isa = PBXBuildFile; fileRef = 4307BE7F1565EDF8007A932A /* warning.png */; };
|
||||
4307BEE61565EDF8007A932A /* world.png in Resources */ = {isa = PBXBuildFile; fileRef = 4307BE801565EDF8007A932A /* world.png */; };
|
||||
4307BEFE1565EEBC007A932A /* Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 4307BEFD1565EEBC007A932A /* Base64.m */; };
|
||||
4315E95C159E910500A117C0 /* slide_left.png in Resources */ = {isa = PBXBuildFile; fileRef = 4315E958159E910500A117C0 /* slide_left.png */; };
|
||||
4315E95D159E910500A117C0 /* slide_left@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4315E959159E910500A117C0 /* slide_left@2x.png */; };
|
||||
4315E95E159E910500A117C0 /* slide_right.png in Resources */ = {isa = PBXBuildFile; fileRef = 4315E95A159E910500A117C0 /* slide_right.png */; };
|
||||
4315E95F159E910500A117C0 /* slide_right@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4315E95B159E910500A117C0 /* slide_right@2x.png */; };
|
||||
433323B015886FA80025064D /* logo_newsblur.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323AF15886FA80025064D /* logo_newsblur.png */; };
|
||||
433323B8158901A40025064D /* fountain_pen.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323B6158901A40025064D /* fountain_pen.png */; };
|
||||
433323B9158901A40025064D /* fountain_pen@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 433323B7158901A40025064D /* fountain_pen@2x.png */; };
|
||||
|
@ -301,6 +305,10 @@
|
|||
4307BE801565EDF8007A932A /* world.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = world.png; sourceTree = "<group>"; };
|
||||
4307BEFC1565EEBC007A932A /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
|
||||
4307BEFD1565EEBC007A932A /* Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Base64.m; sourceTree = "<group>"; };
|
||||
4315E958159E910500A117C0 /* slide_left.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = slide_left.png; sourceTree = "<group>"; };
|
||||
4315E959159E910500A117C0 /* slide_left@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "slide_left@2x.png"; sourceTree = "<group>"; };
|
||||
4315E95A159E910500A117C0 /* slide_right.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = slide_right.png; sourceTree = "<group>"; };
|
||||
4315E95B159E910500A117C0 /* slide_right@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "slide_right@2x.png"; sourceTree = "<group>"; };
|
||||
433323AF15886FA80025064D /* logo_newsblur.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo_newsblur.png; sourceTree = "<group>"; };
|
||||
433323B6158901A40025064D /* fountain_pen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = fountain_pen.png; sourceTree = "<group>"; };
|
||||
433323B7158901A40025064D /* fountain_pen@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "fountain_pen@2x.png"; sourceTree = "<group>"; };
|
||||
|
@ -760,6 +768,10 @@
|
|||
4307BE511565EDF8007A932A /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4315E958159E910500A117C0 /* slide_left.png */,
|
||||
4315E959159E910500A117C0 /* slide_left@2x.png */,
|
||||
4315E95A159E910500A117C0 /* slide_right.png */,
|
||||
4315E95B159E910500A117C0 /* slide_right@2x.png */,
|
||||
43F44B0A159CE98B00F48F8A /* 06-arrow-south.png */,
|
||||
43F44B0B159CE98B00F48F8A /* 06-arrow-south@2x.png */,
|
||||
4389E9E8159B931900BEA604 /* Screen Shot 2012-06-27 at 12.14.10 PM.png */,
|
||||
|
@ -1471,6 +1483,10 @@
|
|||
43F44B15159D42F400F48F8A /* Default-Landscape~ipad.png in Resources */,
|
||||
43F44B18159D454100F48F8A /* logo_72.png in Resources */,
|
||||
43F44B19159D454100F48F8A /* logo_144.png in Resources */,
|
||||
4315E95C159E910500A117C0 /* slide_left.png in Resources */,
|
||||
4315E95D159E910500A117C0 /* slide_left@2x.png in Resources */,
|
||||
4315E95E159E910500A117C0 /* slide_right.png in Resources */,
|
||||
4315E95F159E910500A117C0 /* slide_right@2x.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
BIN
media/iphone/Resources/slide_left.png
Normal file
BIN
media/iphone/Resources/slide_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 B |
BIN
media/iphone/Resources/slide_left@2x.png
Normal file
BIN
media/iphone/Resources/slide_left@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 505 B |
BIN
media/iphone/Resources/slide_right.png
Normal file
BIN
media/iphone/Resources/slide_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 346 B |
BIN
media/iphone/Resources/slide_right@2x.png
Normal file
BIN
media/iphone/Resources/slide_right@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 511 B |
|
@ -21,7 +21,6 @@
|
|||
@property (nonatomic, retain) IBOutlet NewsBlurAppDelegate *appDelegate;
|
||||
@property (nonatomic, retain) UIPopoverController *popoverController;
|
||||
|
||||
- (void)configureView;
|
||||
- (void)onFingerSwipeLeft;
|
||||
- (void)onFingerSwipeRight;
|
||||
|
||||
|
|
|
@ -64,8 +64,9 @@
|
|||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
|
||||
{
|
||||
[appDelegate adjustStoryDetailWebView:NO shouldCheckLayout:YES];
|
||||
[appDelegate adjustStoryDetailWebView];
|
||||
|
||||
// copy the title from the master view to detail view
|
||||
if (appDelegate.splitStoryController.isShowingMaster) {
|
||||
self.navigationItem.titleView = nil;
|
||||
} else {
|
||||
|
@ -79,38 +80,15 @@
|
|||
#pragma mark Gestures
|
||||
|
||||
- (void)onFingerSwipeLeft {
|
||||
if (appDelegate.splitStoryController.isShowingMaster && appDelegate.inStoryDetail){
|
||||
|
||||
UIView *titleLabel = [appDelegate makeFeedTitle:appDelegate.activeFeed];
|
||||
self.navigationItem.titleView = titleLabel;
|
||||
|
||||
[appDelegate.splitStoryController toggleMasterView:nil];
|
||||
[appDelegate adjustStoryDetailWebView:YES shouldCheckLayout:YES];
|
||||
[self configureView];
|
||||
if (appDelegate.inStoryDetail){
|
||||
[appDelegate animateHidingMasterView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onFingerSwipeRight {
|
||||
|
||||
self.navigationItem.titleView = nil;
|
||||
|
||||
if (!appDelegate.splitStoryController.isShowingMaster && appDelegate.inStoryDetail){
|
||||
[appDelegate.splitStoryController toggleMasterView:nil];
|
||||
[appDelegate adjustStoryDetailWebView:YES shouldCheckLayout:YES];
|
||||
[self configureView];
|
||||
if (appDelegate.inStoryDetail){
|
||||
[appDelegate animateShowingMasterView];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)configureView
|
||||
{
|
||||
// // Update the user interface for the detail item.
|
||||
// detailDescriptionLabel.text = [detailItem description];
|
||||
// toggleItem.title = ([splitController isShowingMaster]) ? @"Hide Sites" : @"Show Sites"; // "I... AM... THE MASTER!" Derek Jacobi. Gave me chills.
|
||||
// verticalItem.title = (splitController.vertical) ? @"Horizontal Split" : @"Vertical Split";
|
||||
// dividerStyleItem.title = (splitController.dividerStyle == MGSplitViewDividerStyleThin) ? @"Enable Dragging" : @"Disable Dragging";
|
||||
// masterBeforeDetailItem.title = (splitController.masterBeforeDetail) ? @"Detail First" : @"Master First";
|
||||
}
|
||||
|
||||
@end
|
Loading…
Add table
Reference in a new issue