Skip to content

Commit

Permalink
Finished styling of the briefcast browser view.
Browse files Browse the repository at this point in the history
  • Loading branch information
capttaco committed Apr 12, 2010
1 parent cc72309 commit 506c960
Show file tree
Hide file tree
Showing 16 changed files with 590 additions and 14 deletions.
474 changes: 474 additions & 0 deletions BFBriefcastCell.xib

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions Briefs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@
D4A39833113C6E9D004971E9 /* Briefcast.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A39831113C6E9D004971E9 /* Briefcast.png */; };
D4A39834113C6E9D004971E9 /* Briefs.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A39832113C6E9D004971E9 /* Briefs.png */; };
D4A39836113C6EAA004971E9 /* Icon-small.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A39835113C6EAA004971E9 /* Icon-small.png */; };
D4A4595E1172C2D600D9C1DF /* BFBriefcastCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D4A4595D1172C2D600D9C1DF /* BFBriefcastCell.xib */; };
D4A459621172C3BC00D9C1DF /* Briefcast 32.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A459611172C3BC00D9C1DF /* Briefcast 32.png */; };
D4A4597F1172CE0B00D9C1DF /* cell-middle.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A4597C1172CE0B00D9C1DF /* cell-middle.png */; };
D4A459801172CE0B00D9C1DF /* cell-bottom.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A4597D1172CE0B00D9C1DF /* cell-bottom.png */; };
D4A459811172CE0B00D9C1DF /* cell-top.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A4597E1172CE0B00D9C1DF /* cell-top.png */; };
D4A459CF1172D7AF00D9C1DF /* cell-middle-sel.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A459CE1172D7AF00D9C1DF /* cell-middle-sel.png */; };
D4A459DA1172DCDD00D9C1DF /* cell-bottom-sel.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A459D81172DCDD00D9C1DF /* cell-bottom-sel.png */; };
D4A459DB1172DCDD00D9C1DF /* cell-top-sel.png in Resources */ = {isa = PBXBuildFile; fileRef = D4A459D91172DCDD00D9C1DF /* cell-top-sel.png */; };
D4AF1A341147312400D1B3B5 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4AF1A331147312400D1B3B5 /* CoreData.framework */; };
D4AF1B061147362200D1B3B5 /* Briefs.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = D4AF1B051147362200D1B3B5 /* Briefs.xcdatamodel */; };
D4AF1B32114808A300D1B3B5 /* BFBriefcast+CoreDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D4AF1B31114808A300D1B3B5 /* BFBriefcast+CoreDataAdditions.m */; };
Expand Down Expand Up @@ -312,6 +320,14 @@
D4A39831113C6E9D004971E9 /* Briefcast.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Briefcast.png; path = images/Briefcast.png; sourceTree = "<group>"; };
D4A39832113C6E9D004971E9 /* Briefs.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Briefs.png; path = images/Briefs.png; sourceTree = "<group>"; };
D4A39835113C6EAA004971E9 /* Icon-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon-small.png"; path = "images/Icon-small.png"; sourceTree = "<group>"; };
D4A4595D1172C2D600D9C1DF /* BFBriefcastCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BFBriefcastCell.xib; sourceTree = "<group>"; };
D4A459611172C3BC00D9C1DF /* Briefcast 32.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Briefcast 32.png"; path = "images/icons/Briefcast 32.png"; sourceTree = "<group>"; };
D4A4597C1172CE0B00D9C1DF /* cell-middle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cell-middle.png"; path = "images/bg/cell-middle.png"; sourceTree = "<group>"; };
D4A4597D1172CE0B00D9C1DF /* cell-bottom.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cell-bottom.png"; path = "images/bg/cell-bottom.png"; sourceTree = "<group>"; };
D4A4597E1172CE0B00D9C1DF /* cell-top.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cell-top.png"; path = "images/bg/cell-top.png"; sourceTree = "<group>"; };
D4A459CE1172D7AF00D9C1DF /* cell-middle-sel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cell-middle-sel.png"; path = "images/bg/cell-middle-sel.png"; sourceTree = "<group>"; };
D4A459D81172DCDD00D9C1DF /* cell-bottom-sel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cell-bottom-sel.png"; path = "images/bg/cell-bottom-sel.png"; sourceTree = "<group>"; };
D4A459D91172DCDD00D9C1DF /* cell-top-sel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "cell-top-sel.png"; path = "images/bg/cell-top-sel.png"; sourceTree = "<group>"; };
D4AF1A331147312400D1B3B5 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
D4AF1B051147362200D1B3B5 /* Briefs.xcdatamodel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.xcdatamodel; path = Briefs.xcdatamodel; sourceTree = "<group>"; };
D4AF1B30114808A300D1B3B5 /* BFBriefcast+CoreDataAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BFBriefcast+CoreDataAdditions.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -468,6 +484,7 @@
D4CA29371076F60500AA84FE /* MainWindow.xib */,
D4641312106879AF001522F6 /* BFAddBriefcastViewController.xib */,
D43CE8B1115F134800DA07D5 /* BFBriefCellController.xib */,
D4A4595D1172C2D600D9C1DF /* BFBriefcastCell.xib */,
);
name = nib;
sourceTree = "<group>";
Expand Down Expand Up @@ -547,6 +564,12 @@
D43CE16C114F0DC800DA07D5 /* backgrounds */ = {
isa = PBXGroup;
children = (
D4A459D81172DCDD00D9C1DF /* cell-bottom-sel.png */,
D4A459D91172DCDD00D9C1DF /* cell-top-sel.png */,
D4A459CE1172D7AF00D9C1DF /* cell-middle-sel.png */,
D4A4597C1172CE0B00D9C1DF /* cell-middle.png */,
D4A4597D1172CE0B00D9C1DF /* cell-bottom.png */,
D4A4597E1172CE0B00D9C1DF /* cell-top.png */,
D4D4BC9C11728248009D70D0 /* navigation-bar.png */,
D4D4BC80117278F9009D70D0 /* screens */,
D4D4BC361172552B009D70D0 /* preview-refresh-bg.png */,
Expand Down Expand Up @@ -797,6 +820,7 @@
D4A39830113C6E7F004971E9 /* icons */ = {
isa = PBXGroup;
children = (
D4A459611172C3BC00D9C1DF /* Briefcast 32.png */,
D4A39835113C6EAA004971E9 /* Icon-small.png */,
D4A39831113C6E9D004971E9 /* Briefcast.png */,
D4A39832113C6E9D004971E9 /* Briefs.png */,
Expand Down Expand Up @@ -1000,6 +1024,14 @@
D4D4BC821172790C009D70D0 /* browse-briefcasts.png in Resources */,
D4D4BC8411727A7C009D70D0 /* built-in-button.png in Resources */,
D4D4BC9D11728248009D70D0 /* navigation-bar.png in Resources */,
D4A4595E1172C2D600D9C1DF /* BFBriefcastCell.xib in Resources */,
D4A459621172C3BC00D9C1DF /* Briefcast 32.png in Resources */,
D4A4597F1172CE0B00D9C1DF /* cell-middle.png in Resources */,
D4A459801172CE0B00D9C1DF /* cell-bottom.png in Resources */,
D4A459811172CE0B00D9C1DF /* cell-top.png in Resources */,
D4A459CF1172D7AF00D9C1DF /* cell-middle-sel.png in Resources */,
D4A459DA1172DCDD00D9C1DF /* cell-bottom-sel.png in Resources */,
D4A459DB1172DCDD00D9C1DF /* cell-top-sel.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 3 additions & 0 deletions Classes/BFBriefcastCellController.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

@interface BFBriefcastCellController : NSObject<BFCellController>
{
IBOutlet UILabel *titleLabel;
IBOutlet UILabel *descLabel;

BriefcastRef *briefcast;
}

Expand Down
45 changes: 43 additions & 2 deletions Classes/BFBriefcastCellController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "BFBriefcastCellController.h"
#import "BFBriefcastViewController.h"
#import "BFDataManager.h"
#import "BFConfig.h"


@implementation BFBriefcastCellController
Expand All @@ -34,11 +35,46 @@ - (id)initWithBriefcast:(BriefcastRef *)bcast

- (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:@"BriefcastCell"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"BriefcastCell"] autorelease];
NSArray *nibArray = [[NSBundle mainBundle] loadNibNamed:@"BFBriefcastCell" owner:self options:nil];
cell = (UITableViewCell *) [nibArray objectAtIndex:0];
}

titleLabel.text = [self.briefcast title];

if ([self.briefcast.totalNumberOfBriefcasts intValue] > 0)
descLabel.text = [NSString stringWithFormat:@"%@ Briefs, last opened on %@",
self.briefcast.totalNumberOfBriefcasts, [BFConfig shortDateStringFromDate:self.briefcast.dateLastOpened]];

else descLabel.text = @"No information available.";


// calculate background
UIImage *bgImage, *selectedBgImage;
if (indexPath.row == 0) {
// top
bgImage = [[UIImage imageNamed:@"cell-top.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
selectedBgImage = [[UIImage imageNamed:@"cell-top-sel.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
}

else if (indexPath.row == [tv numberOfRowsInSection:indexPath.section]-1) {
// bottom
bgImage = [[UIImage imageNamed:@"cell-bottom.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
selectedBgImage = [[UIImage imageNamed:@"cell-bottom-sel.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
}
cell.textLabel.text = [self.briefcast title];

else {
// middle
bgImage = [[UIImage imageNamed:@"cell-middle.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
selectedBgImage = [[UIImage imageNamed:@"cell-middle-sel.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0];
}

cell.backgroundView = [[UIImageView alloc] initWithImage:bgImage];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:selectedBgImage];


return cell;
}

Expand All @@ -61,6 +97,11 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
[[BFDataManager sharedBFDataManager] removeBriefcast:self.briefcast];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 49.0f;
}

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

@end
5 changes: 5 additions & 0 deletions Classes/BFBriefcastViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection

[UIView commitAnimations];

// update the briefcast reference
self.briefcast.totalNumberOfBriefcasts = [NSNumber numberWithInt:[[feed items] count]];
self.briefcast.dateLastOpened = [NSDate date];
[[BFDataManager sharedBFDataManager] save];

[super updateAndReload];
[spinner stopAnimating];
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/BFBrowseBriefcastViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="IBUIText">Briefcasts are a way to share briefs. Each contains briefs that you can preview and install on your device.</string>
<string key="IBUIText">Briefcasts are an easy way to share briefs. Each contains briefs that you can preview and install on your device.</string>
<object class="NSFont" key="IBUIFont" id="671686307">
<string key="NSName">Helvetica</string>
<double key="NSSize">13</double>
Expand Down
1 change: 1 addition & 0 deletions Classes/BFBrowseBriefcastsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ - (void)viewDidLoad
self.title = @"Briefcasts";
self.navigationController.navigationBar.tintColor = [BFConfig tintColorForNavigationBar];
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorColor = [BFConfig separatorColorForTableView];
tableFooterView.alpha = 0.0;

// Edit button
Expand Down
7 changes: 6 additions & 1 deletion Classes/BFConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
+ (UIColor *)tintColorForNavigationBar;
+ (UIColor *)tintColorForNavigationButton;

// background colors
// table colors
+ (UIColor *)backgroundForTableView;
+ (UIColor *)separatorColorForTableView;

// dates
+ (NSString *)shortDateStringFromDate:(NSDate *)date;
+ (NSString *)shortTimeStringFromDate:(NSDate *)date;

@end
22 changes: 22 additions & 0 deletions Classes/BFConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,26 @@ + (UIColor *)backgroundForTableView
return [UIColor colorWithRed:0.8667f green:0.8784f blue:0.8902f alpha:1.0f];
}

+ (UIColor *)separatorColorForTableView
{
return [UIColor colorWithHue:0.58333f saturation:0.19f brightness:0.12f alpha:1.0f];
}


+ (NSString *)shortDateStringFromDate:(NSDate *)date;
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
return [dateFormatter stringFromDate:date];
}

+ (NSString *)shortTimeStringFromDate:(NSDate *)date
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
return [[dateFormatter stringFromDate:date] stringByReplacingOccurrencesOfString:@" " withString:@""];
}

@end
13 changes: 3 additions & 10 deletions Classes/BFPreviewBriefViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#import "BFSceneViewController.h"
#import "BFSceneManager.h"
#import "BFPagedBrowseViewController.h"
#import "BFConfig.h"


@interface BFPreviewBriefViewController (PrivateMethods)
Expand Down Expand Up @@ -75,16 +76,8 @@ - (void)prepareInfoView:(BriefRef *)ref
else infoView.fromLabel.text = [[NSURL URLWithString:[ref fromURL]] host];

// format date
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeStyle:NSDateFormatterNoStyle];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
infoView.dateLabel.text = [dateFormatter stringFromDate:[ref dateLastDownloaded]];

[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
infoView.timeLabel.text = [[dateFormatter stringFromDate:[ref dateLastDownloaded]] stringByReplacingOccurrencesOfString:@" " withString:@""];

[dateFormatter release];
infoView.dateLabel.text = [BFConfig shortDateStringFromDate:[ref dateLastDownloaded]];
infoView.timeLabel.text = [BFConfig shortTimeStringFromDate:[ref dateLastDownloaded]];
}

- (void)preparePreview:(BriefRef *)ref
Expand Down
Binary file added images/bg/cell-bottom-sel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg/cell-bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg/cell-middle-sel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg/cell-middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg/cell-top-sel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/bg/cell-top.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 506c960

Please sign in to comment.