Skip to content

Commit

Permalink
... And now you can load the most recent briefs right from the main s…
Browse files Browse the repository at this point in the history
…creen. Makes for quick access to the brief while you're working on it. (plus balling animation to start brief)
  • Loading branch information
capttaco committed May 3, 2010
1 parent bd6f0ce commit 7c88e1a
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Briefs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
D4F2138F118E0BD50041F87C /* BFBriefcastCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D4F2138E118E0BD50041F87C /* BFBriefcastCell.xib */; };
D4F21391118E0C2C0041F87C /* BFRefreshBriefCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D4F21390118E0C2C0041F87C /* BFRefreshBriefCell.xib */; };
D4F21399118E0DC70041F87C /* Brief-tablecell.png in Resources */ = {isa = PBXBuildFile; fileRef = D4F21398118E0DC70041F87C /* Brief-tablecell.png */; };
D4F21468118E46AC0041F87C /* refresh-accessory-disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D4F21467118E46AC0041F87C /* refresh-accessory-disabled.png */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -347,6 +348,7 @@
D4F2138E118E0BD50041F87C /* BFBriefcastCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BFBriefcastCell.xib; path = Classes/BFBriefcastCell.xib; sourceTree = "<group>"; };
D4F21390118E0C2C0041F87C /* BFRefreshBriefCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BFRefreshBriefCell.xib; path = Classes/BFRefreshBriefCell.xib; sourceTree = "<group>"; };
D4F21398118E0DC70041F87C /* Brief-tablecell.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Brief-tablecell.png"; path = "images/Brief-tablecell.png"; sourceTree = "<group>"; };
D4F21467118E46AC0041F87C /* refresh-accessory-disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "refresh-accessory-disabled.png"; path = "images/toolbar/refresh-accessory-disabled.png"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -604,6 +606,7 @@
D43CE7D7115DA54100DA07D5 /* toolbar */ = {
isa = PBXGroup;
children = (
D4F21467118E46AC0041F87C /* refresh-accessory-disabled.png */,
D4F212C1118D336F0041F87C /* refresh-accessory.png */,
D43CE8B4115F196C00DA07D5 /* remote-play.png */,
D43CE886115F022D00DA07D5 /* refresh-large.png */,
Expand Down Expand Up @@ -1008,6 +1011,7 @@
D4F2138F118E0BD50041F87C /* BFBriefcastCell.xib in Resources */,
D4F21391118E0C2C0041F87C /* BFRefreshBriefCell.xib in Resources */,
D4F21399118E0DC70041F87C /* Brief-tablecell.png in Resources */,
D4F21468118E46AC0041F87C /* refresh-accessory-disabled.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
11 changes: 8 additions & 3 deletions Classes/BFMainViewDefaultController.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@ - (void)constructTableGroups
// get most recently viewed briefs
id<BFBriefDataSource> recentBriefs = [[BFDataManager sharedBFDataManager] briefsSortedAs:BFDataManagerSortByDateOpened limitTo:2];
if ([recentBriefs numberOfRecords] >= 1) {
[briefControllers addObject:[[[BFRefreshBriefCellController alloc] initWithBrief:[recentBriefs dataForIndex:0]] autorelease]];
BFRefreshBriefCellController *controller1 = [[[BFRefreshBriefCellController alloc] initWithBrief:[recentBriefs dataForIndex:0]] autorelease];
controller1.navigation = navigation;
[briefControllers addObject:controller1];

if ([recentBriefs numberOfRecords] >= 2)
[briefControllers addObject:[[[BFRefreshBriefCellController alloc] initWithBrief:[recentBriefs dataForIndex:1]] autorelease]];
if ([recentBriefs numberOfRecords] >= 2) {
BFRefreshBriefCellController *controller2 = [[[BFRefreshBriefCellController alloc] initWithBrief:[recentBriefs dataForIndex:1]] autorelease];
controller2.navigation = navigation;
[briefControllers addObject:controller2];
}
}


Expand Down
8 changes: 6 additions & 2 deletions Classes/BFRefreshBriefCellController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@

#import "BFCellController.h"
#import "BriefRef.h"
#import "BFLoadingViewController.h"
#import "BFSceneViewController.h"

@interface BFRefreshBriefCellController : NSObject<BFCellController>
@interface BFRefreshBriefCellController : NSObject<BFCellController, BFLoadingViewDelegate, BFSceneViewDelegate>
{
IBOutlet UILabel *name;
IBOutlet UILabel *desc;

BriefRef *brief;
UITableViewCell *cell;
UINavigationController *navigation;
}

@property (nonatomic, retain) BriefRef *brief;
@property (nonatomic, retain) BriefRef *brief;
@property (assign) UINavigationController *navigation;

- (IBAction)updateBriefData;

Expand Down
61 changes: 58 additions & 3 deletions Classes/BFRefreshBriefCellController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
//

#import "BFRefreshBriefCellController.h"
#import "BFLoadingViewController.h"
#import "BFSceneManager.h"
#import "BFPresentationDispatch.h"
#import "BFDataManager.h"
#import "BFConfig.h"

@implementation BFRefreshBriefCellController
@synthesize brief;
@synthesize brief, navigation;

///////////////////////////////////////////////////////////////////////////////
#pragma mark -
Expand Down Expand Up @@ -159,7 +160,33 @@ - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexP

- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// TODO: launch brief
NSString *pathToDictionary = [[[BFDataManager sharedBFDataManager] documentDirectory] stringByAppendingPathComponent:[self.brief filePath]];
BFSceneManager *manager = [[BFSceneManager alloc] initWithPathToDictionary:pathToDictionary];
BFSceneViewController *sceneController = [[BFSceneViewController alloc] initWithSceneManager:manager];

// wire dispatch
if ([[BFPresentationDispatch sharedBFPresentationDispatch] viewController] != nil)
[BFPresentationDispatch sharedBFPresentationDispatch].viewController = nil;

[[BFPresentationDispatch sharedBFPresentationDispatch] setViewController:sceneController];
[BFPresentationDispatch sharedBFPresentationDispatch].viewController.delegate = self;

// get parent View
UIView *parentView = [self.navigation view];

[UIView beginAnimations:@"display brief" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(briefShowDidStop:finished:context:)];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:parentView cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.8f];

// swap loader for brief
[parentView addSubview:[BFPresentationDispatch sharedBFPresentationDispatch].viewController.view];

[UIView commitAnimations];

[manager release];
}


Expand All @@ -168,6 +195,34 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
return 50.0f;
}


///////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark BFSceneViewDelegate Methods

- (void)briefShowDidStop:(NSString *)animationId finished:(NSNumber *)finished context:(void *)context
{
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
}

- (void)sceneView:(BFSceneViewController *)controller shouldDismissView:(BOOL)animated
{
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
[cell setSelected:NO animated:YES];

[UIView beginAnimations:@"remove brief" context:nil];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigation.view cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.8f];

// swap brief for save view
[controller.view removeFromSuperview];

[UIView commitAnimations];
}



///////////////////////////////////////////////////////////////////////////////

@end
Binary file added images/toolbar/refresh-accessory-disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7c88e1a

Please sign in to comment.