Skip to content

Commit

Permalink
The main view is starting to look right for the default case. No acti…
Browse files Browse the repository at this point in the history
…ons are working when you tap it, (except for refresh) but it looks pretty, right?
  • Loading branch information
capttaco committed May 2, 2010
1 parent 2f9b14a commit e5401d5
Show file tree
Hide file tree
Showing 10 changed files with 1,271 additions and 56 deletions.
18 changes: 18 additions & 0 deletions Briefs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@
D4F210D5118BD6520041F87C /* top-nav-button.png in Resources */ = {isa = PBXBuildFile; fileRef = D4F210D4118BD6520041F87C /* top-nav-button.png */; };
D4F210F9118C72750041F87C /* BFMainViewDefaultController.m in Sources */ = {isa = PBXBuildFile; fileRef = D4F210F7118C72750041F87C /* BFMainViewDefaultController.m */; };
D4F210FA118C72750041F87C /* BFMainViewDefaultController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D4F210F8118C72750041F87C /* BFMainViewDefaultController.xib */; };
D4F2123D118D222E0041F87C /* BFRefreshBriefCellController.m in Sources */ = {isa = PBXBuildFile; fileRef = D4F2123C118D222E0041F87C /* BFRefreshBriefCellController.m */; };
D4F212C2118D336F0041F87C /* refresh-accessory.png in Resources */ = {isa = PBXBuildFile; fileRef = D4F212C1118D336F0041F87C /* refresh-accessory.png */; };
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 */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -337,7 +341,12 @@
D4F210F6118C72750041F87C /* BFMainViewDefaultController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BFMainViewDefaultController.h; sourceTree = "<group>"; };
D4F210F7118C72750041F87C /* BFMainViewDefaultController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BFMainViewDefaultController.m; sourceTree = "<group>"; };
D4F210F8118C72750041F87C /* BFMainViewDefaultController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = BFMainViewDefaultController.xib; path = Classes/BFMainViewDefaultController.xib; sourceTree = "<group>"; };
D4F2123B118D222E0041F87C /* BFRefreshBriefCellController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BFRefreshBriefCellController.h; sourceTree = "<group>"; };
D4F2123C118D222E0041F87C /* BFRefreshBriefCellController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BFRefreshBriefCellController.m; sourceTree = "<group>"; };
D4F212C1118D336F0041F87C /* refresh-accessory.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "refresh-accessory.png"; path = "images/toolbar/refresh-accessory.png"; sourceTree = "<group>"; };
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>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -595,6 +604,7 @@
D43CE7D7115DA54100DA07D5 /* toolbar */ = {
isa = PBXGroup;
children = (
D4F212C1118D336F0041F87C /* refresh-accessory.png */,
D43CE8B4115F196C00DA07D5 /* remote-play.png */,
D43CE886115F022D00DA07D5 /* refresh-large.png */,
D43CE7D8115DA55600DA07D5 /* return.png */,
Expand Down Expand Up @@ -649,6 +659,8 @@
D46411961065D59D001522F6 /* BFBriefcastCellController.m */,
D464133C10695048001522F6 /* BFTextCellController.h */,
D464133D10695048001522F6 /* BFTextCellController.m */,
D4F2123B118D222E0041F87C /* BFRefreshBriefCellController.h */,
D4F2123C118D222E0041F87C /* BFRefreshBriefCellController.m */,
);
name = cells;
sourceTree = "<group>";
Expand Down Expand Up @@ -682,6 +694,7 @@
D472009510A110FE00601755 /* images */ = {
isa = PBXGroup;
children = (
D4F21398118E0DC70041F87C /* Brief-tablecell.png */,
D43CE955115FC76E00DA07D5 /* buttons */,
D43CE7D7115DA54100DA07D5 /* toolbar */,
D43CE16C114F0DC800DA07D5 /* backgrounds */,
Expand Down Expand Up @@ -857,6 +870,7 @@
D4F211AF118D08EB0041F87C /* table cells */ = {
isa = PBXGroup;
children = (
D4F21390118E0C2C0041F87C /* BFRefreshBriefCell.xib */,
D4F2138E118E0BD50041F87C /* BFBriefcastCell.xib */,
);
name = "table cells";
Expand Down Expand Up @@ -990,7 +1004,10 @@
D4F210FA118C72750041F87C /* BFMainViewDefaultController.xib in Resources */,
D4F210D3118BD5E20041F87C /* root-menu-bg.png in Resources */,
D4F210D5118BD6520041F87C /* top-nav-button.png in Resources */,
D4F212C2118D336F0041F87C /* refresh-accessory.png in Resources */,
D4F2138F118E0BD50041F87C /* BFBriefcastCell.xib in Resources */,
D4F21391118E0C2C0041F87C /* BFRefreshBriefCell.xib in Resources */,
D4F21399118E0DC70041F87C /* Brief-tablecell.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1056,6 +1073,7 @@
D4D4BB2B11710AAA009D70D0 /* BFRemoteBriefSaver.m in Sources */,
D4D4BC9B11728150009D70D0 /* UINavigationBar+CustomBackground.m in Sources */,
D4F210F9118C72750041F87C /* BFMainViewDefaultController.m in Sources */,
D4F2123D118D222E0041F87C /* BFRefreshBriefCellController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 4 additions & 0 deletions Classes/BFMainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "BFMainViewController.h"
#import "BFBrowseBriefcastsViewController.h"
#import "BFMainViewDefaultController.h"
#import "BFBriefcastViewController.h"
#import "BFDataManager.h"
#import "BriefcastRef+BFBriefDataSource.h"
Expand Down Expand Up @@ -111,6 +112,9 @@ - (void)viewDidAppear:(BOOL)animated
[self showMenuWithAnimation];

// TODO: Display recent briefs/briefcasts
BFMainViewDefaultController *defaultController = [[BFMainViewDefaultController alloc] init];
defaultController.view.frame = CGRectOffset(defaultController.view.frame, 0, 0.0f);
[self.view addSubview:defaultController.view];

break;
}
Expand Down
6 changes: 4 additions & 2 deletions Classes/BFMainViewDefaultController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
// Briefs
//
// Created by Rob Rhyne on 5/1/10.
// Copyright 2010 Digital Arch Design. All rights reserved.
// Copyright Digital Arch Design, 2009-2010. See LICENSE file for details.
//

#import "BFTableViewController.h"

@interface BFMainViewDefaultController : BFTableViewController
{

IBOutlet UIView *briefHeaderView;
IBOutlet UIView *briefcastHeaderView;
}


@end
98 changes: 71 additions & 27 deletions Classes/BFMainViewDefaultController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,100 @@
// Briefs
//
// Created by Rob Rhyne on 5/1/10.
// Copyright 2010 Digital Arch Design. All rights reserved.
// Copyright Digital Arch Design, 2009-2010. See LICENSE file for details.
//

#import "BFMainViewDefaultController.h"

#import "BFRefreshBriefCellController.h"
#import "BFBriefcastCellController.h"
#import "BFConfig.h"
#import "BFDataManager.h"
#import "BriefRef.h"

@implementation BFMainViewDefaultController

/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
- (id)init
{
if (self = [super initWithNibName:@"BFMainViewDefaultController" bundle:nil]) {
// initialization?
}

return self;
}
*/

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
- (void)viewDidLoad
{
[super viewDidLoad];

self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorColor = [BFConfig separatorColorForTableView];

}
*/

/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/

- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
- (void)viewWillAppear:(BOOL)animated
{
[self updateAndReload];
}

- (void)viewDidUnload {
- (void)viewDidUnload
{
[super viewDidUnload];

// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}


- (void)dealloc {
- (void)dealloc
{
[super dealloc];
}


///////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark BFTableViewController methods

- (void)constructTableGroups
{
NSMutableArray *briefControllers = [NSMutableArray array];
NSMutableArray *briefcastController = [NSMutableArray array];

// 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]];

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


// get last opened briefcast
NSArray *lastOpenedBriefcast = [[BFDataManager sharedBFDataManager] briefcastsSortedAs:BFDataManagerSortByDateOpened limitTo:1];
if (lastOpenedBriefcast != nil) {
BFBriefcastCellController *controller = [[[BFBriefcastCellController alloc] initWithBriefcast:[lastOpenedBriefcast objectAtIndex:0]] autorelease];
[briefcastController addObject:controller];
}

self.tableGroups = [NSArray arrayWithObjects:briefControllers, briefcastController, nil];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return (section == 0) ? @"RECENT BRIEFS" : @"LAST OPENED BRIEFCAST";
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
return (section == 0) ? briefHeaderView : briefcastHeaderView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return (section == 0) ? briefHeaderView.frame.size.height : briefcastHeaderView.frame.size.height;
}

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

@end
Loading

0 comments on commit e5401d5

Please sign in to comment.