Skip to content

Commit

Permalink
Added remaining install types to Briefcast view (get, update, already…
Browse files Browse the repository at this point in the history
… installed). Also cleaned up the loading view, giving it only a single dismiss button. (instead of an optional action button)
  • Loading branch information
capttaco committed Apr 6, 2010
1 parent 3ce393f commit b06dccc
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 86 deletions.
4 changes: 4 additions & 0 deletions Briefs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
D43CEAB11160376500DA07D5 /* BFArrayBriefDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = D43CEAB01160376500DA07D5 /* BFArrayBriefDataSource.m */; };
D43CEB121160468F00DA07D5 /* howto.brieflist in Resources */ = {isa = PBXBuildFile; fileRef = D46414191069AB25001522F6 /* howto.brieflist */; };
D43CEC36116061CD00DA07D5 /* BriefRef.m in Sources */ = {isa = PBXBuildFile; fileRef = D43CEC35116061CD00DA07D5 /* BriefRef.m */; };
D43CEF6F1162E3EC00DA07D5 /* already-button.png in Resources */ = {isa = PBXBuildFile; fileRef = D43CEF6E1162E3EC00DA07D5 /* already-button.png */; };
D463E8FF107310170075CCCE /* BFBriefcastViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D463E8FE107310170075CCCE /* BFBriefcastViewController.m */; };
D464117110606DDE001522F6 /* BFTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D464117010606DDE001522F6 /* BFTableViewController.m */; };
D46411931065CF8C001522F6 /* BFBriefCellController.m in Sources */ = {isa = PBXBuildFile; fileRef = D46411921065CF8C001522F6 /* BFBriefCellController.m */; };
Expand Down Expand Up @@ -216,6 +217,7 @@
D43CEAB01160376500DA07D5 /* BFArrayBriefDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BFArrayBriefDataSource.m; sourceTree = "<group>"; };
D43CEC34116061CD00DA07D5 /* BriefRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BriefRef.h; sourceTree = "<group>"; };
D43CEC35116061CD00DA07D5 /* BriefRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BriefRef.m; sourceTree = "<group>"; };
D43CEF6E1162E3EC00DA07D5 /* already-button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "already-button.png"; path = "images/buttons/already-button.png"; sourceTree = "<group>"; };
D463E8FD107310170075CCCE /* BFBriefcastViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BFBriefcastViewController.h; sourceTree = "<group>"; };
D463E8FE107310170075CCCE /* BFBriefcastViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BFBriefcastViewController.m; sourceTree = "<group>"; wrapsLines = 0; };
D464116F10606DDE001522F6 /* BFTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BFTableViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -565,6 +567,7 @@
D43CE955115FC76E00DA07D5 /* buttons */ = {
isa = PBXGroup;
children = (
D43CEF6E1162E3EC00DA07D5 /* already-button.png */,
D43CE956115FC77E00DA07D5 /* install-button.png */,
D43CE957115FC77E00DA07D5 /* update-button.png */,
);
Expand Down Expand Up @@ -914,6 +917,7 @@
D43CE8B5115F196C00DA07D5 /* remote-play.png in Resources */,
D43CE958115FC77E00DA07D5 /* install-button.png in Resources */,
D43CE959115FC77E00DA07D5 /* update-button.png in Resources */,
D43CEF6F1162E3EC00DA07D5 /* already-button.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion Classes/BFBriefCellController.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ typedef enum {
BFBriefCellInstallTypeNewInstall = -122,

/** Brief is installed with the newest version */
BFBriefCellInstallTypeAlreadyInstalled = -123
BFBriefCellInstallTypeAlreadyInstalled = -133

} BFBriefCellInstallType;

Expand Down
59 changes: 48 additions & 11 deletions Classes/BFBriefCellController.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#import "BFColor.h"


#define kRightAccessoryNormalRect CGRectMake(271.0f, 0.0f, 49.0f, 80.0f)
#define kRightAccessoryExpandedRect CGRectMake(240.0f, 0.0f, 80.0f, 80.0f)
#define kInstallButtonNormalRect CGRectMake(270.0f, 23.0f, 42.0f, 24.0f)
#define kInstallButtonExpandedRect CGRectMake(240.0f, 23.0f, 72.0f, 24.0f)
#define kInstallButtonNormalRect CGRectMake(270.0f, 0.0f, 42.0f, 70.0f)
#define kInstallButtonExpandedRect CGRectMake(240.0f, 0.0f, 72.0f, 70.0f)
#define kInstallButtonBgNormalRect CGRectMake(270.0f, 23.0f, 42.0f, 24.0f)
#define kInstallButtonBgExpandedRect CGRectMake(240.0f, 23.0f, 72.0f, 24.0f)



@interface BFBriefCellController (PrivateMethods)

Expand All @@ -26,7 +28,6 @@ - (void)setInstallButtonExpanded:(BOOL)expand;
@end



@implementation BFBriefCellController
@synthesize brief, delegate;

Expand All @@ -52,7 +53,18 @@ - (id)initWithEnclosure:(FPItem *)item
installType = BFBriefCellInstallTypeAlreadyInstalled;

// style install/update button
UIImage *buttonBG = [[UIImage imageNamed:@"install-button.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:0];
UIImage *buttonBG;
switch (installType) {
case BFBriefCellInstallTypeUpdate:
buttonBG = [[UIImage imageNamed:@"update-button.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:0];
break;
case BFBriefCellInstallTypeAlreadyInstalled:
buttonBG = [[UIImage imageNamed:@"already-button.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:0];
break;
default:
buttonBG = [[UIImage imageNamed:@"install-button.png"] stretchableImageWithLeftCapWidth:4 topCapHeight:0];
}

installButtonBg = [[UIImageView alloc] initWithImage:buttonBG];

}
Expand Down Expand Up @@ -113,14 +125,14 @@ - (void)setInstallButtonExpanded:(BOOL)expand
// expand the button
// rightAccessoryView.frame = kRightAccessoryExpandedRect;
installButton.frame = kInstallButtonExpandedRect;
installButtonBg.frame = kInstallButtonExpandedRect;
installButtonBg.frame = kInstallButtonBgExpandedRect;
}

else {
// unexpand the button
// rightAccessoryView.frame = kRightAccessoryNormalRect;
installButton.frame = kInstallButtonNormalRect;
installButtonBg.frame = kInstallButtonNormalRect;
installButtonBg.frame = kInstallButtonBgNormalRect;
}

[UIView commitAnimations];
Expand All @@ -147,10 +159,35 @@ - (UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexP
[leftAccessoryView addSubview:indexView];

if (installButtonBg != nil) {
installButtonBg.frame = kInstallButtonNormalRect;
installButton.frame = kInstallButtonNormalRect;
[installButton setTitle:@"NEW" forState:UIControlStateNormal];

CGRect theFrame, theFrameBg;
switch (installType) {
case BFBriefCellInstallTypeUpdate:
[installButton setTitle:@"UPDATE" forState:UIControlStateNormal];
theFrame = kInstallButtonExpandedRect;
theFrameBg = kInstallButtonBgExpandedRect;
break;

case BFBriefCellInstallTypeAlreadyInstalled:
[installButton setTitle:@"INSTALLED" forState:UIControlStateNormal];
installButton.enabled = NO;
theFrame = kInstallButtonExpandedRect;
theFrameBg = kInstallButtonBgExpandedRect;
[installButton setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled];
[installButton setTitleShadowColor:[UIColor clearColor] forState:UIControlStateDisabled];

break;

default:
[installButton setTitle:@"NEW" forState:UIControlStateNormal];
theFrame = kInstallButtonNormalRect;
theFrameBg = kInstallButtonBgNormalRect;

}

installButtonBg.frame = theFrameBg;
installButton.frame = theFrame;

[cell addSubview:installButtonBg];
[cell addSubview:installButton];
}
Expand Down
14 changes: 10 additions & 4 deletions Classes/BFBriefcastViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@

#import "BFBriefcastViewController.h"
#import "FeedParser.h"
//#import "BFTitleCellController.h"
//#import "BFLabelCellController.h"
//#import "BFParagraphCellController.h"
//#import "BFHeaderCellController.h"
#import "BFBriefCellController.h"
#import "BFRemoteBriefCellController.h"
#import "BFDataManager.h"
#import "BFColor.h"


@interface BFBriefcastViewController (PrivateMethods)

- (void)dismissLoadingViewAnimation:(UIView *)loadingView;

@end



@implementation BFBriefcastViewController

@synthesize channelTitle, channelLink, channelDescription, locationOfBriefcast, enclosedBriefs, recievedData, briefcast;
Expand Down Expand Up @@ -112,6 +116,8 @@ - (void)dismissLoadingViewAnimation:(UIView *)loadingView
[UIView setAnimationDidStopSelector:@selector(fadeLoadingViewDidStop:finished:context:)];
loadingView.alpha = 0.0f;
[UIView commitAnimations];

[self updateAndReload];
}


Expand Down
1 change: 1 addition & 0 deletions Classes/BFColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

// tint colors
+ (UIColor *)tintColorForNavigationBar;
+ (UIColor *)tintColorForNavigationButton;

// background colors
+ (UIColor *)backgroundForTableView;
Expand Down
6 changes: 6 additions & 0 deletions Classes/BFColor.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
@implementation BFColor

+ (UIColor *)tintColorForNavigationBar
{
return [UIColor colorWithRed:0.5098f green:0.5412f blue:0.6f alpha:1.0f];
// return [UIColor colorWithRed:0.6f green:0.6f blue:0.6f alpha:1.0f];
}

+ (UIColor *)tintColorForNavigationButton
{
return [UIColor colorWithRed:0.5098f green:0.5412f blue:0.6f alpha:1.0f];
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/BFLoadingViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
IBOutlet UISlider *progressSlider;
IBOutlet UIImageView *imageView;
IBOutlet UIButton *cancelButton;
IBOutlet UIButton *actionButton;
// IBOutlet UIButton *actionButton;

id<BFLoadingViewDelegate> delegate;
NSURLConnection *connection;
Expand Down
4 changes: 2 additions & 2 deletions Classes/BFLoadingViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (void)load:(NSString *)location withInitialStatus:(NSString *)status action:(N
[statusLabel setText:status];

if (actionText)
[actionButton setTitle:actionText forState:UIControlStateNormal];
[cancelButton setTitle:actionText forState:UIControlStateNormal];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:location]];
connection = [[[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES] autorelease];
Expand Down Expand Up @@ -107,7 +107,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[statusLabel setText:@"Download Complete"];
[self.delegate loadingView:self didCompleteWithData:self.data];
[actionButton setEnabled:YES];
// [actionButton setEnabled:YES];
safeToClose = YES;
}

Expand Down
Loading

0 comments on commit b06dccc

Please sign in to comment.