Skip to content

Commit

Permalink
Merge from previous pull, add album-art-to-icon transition, view.
Browse files Browse the repository at this point in the history
  • Loading branch information
danhd123 committed Jul 17, 2011
1 parent deb5ecb commit 115a380
Show file tree
Hide file tree
Showing 6 changed files with 327 additions and 4,413 deletions.
5 changes: 5 additions & 0 deletions SGCarouselProtocols.h
Expand Up @@ -13,6 +13,11 @@
@protocol SGCarouselItemViewController <NSObject>
@property (readwrite, retain) id <SGCarouselItem> source;
@property (readonly, retain) UIView *carouselDisplayView;
@optional
-(void)carouselWillBringViewToFront;
-(void)carouselWillSendViewToBack;
-(void)carouselDidSendViewToBack;
-(void)carouselDidBringViewToFront;
@end

@protocol SGCarouselItem <NSObject>
Expand Down
4 changes: 2 additions & 2 deletions SGIPodSource.m
Expand Up @@ -142,8 +142,8 @@ - (void)togglePlay:(id)sender

- (UIView *)carouselDisplayView
{
UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ipod-icon"]];
return [iv autorelease];

return nil;
}


Expand Down
11 changes: 6 additions & 5 deletions SGIPodSourceViewController.h
Expand Up @@ -14,11 +14,12 @@
@interface SGIPodSourceViewController : UIViewController <SGCarouselItemViewController>
{
SGIPodSource *iPodSource;
IBOutlet UIImageView *artworkOrIcon;
IBOutlet UILabel *playlistNameLabel;
IBOutlet UILabel *titleLabel;
IBOutlet UILabel *artistLabel;
IBOutlet UILabel *myPlaylistsLabel;
BOOL iconMode;
}
- (id <SGMediaPlaylist>)previousPlaylist;
- (id <SGMediaPlaylist>)nextPlaylist;
@property (readwrite, retain) NSString *sourceName;
@property (nonatomic, readwrite, retain) id <SGMediaPlaylist> currentPlaylist;
@property (readwrite, retain) NSArray *playlists;

@end
39 changes: 30 additions & 9 deletions SGIPodSourceViewController.m
Expand Up @@ -10,25 +10,17 @@
#import "SGIPodSource.h"

@implementation SGIPodSourceViewController
@synthesize playlists, sourceName, currentPlaylist, source = iPodSource;

@synthesize source = iPodSource;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
iPodSource = [[SGIPodSource alloc] init];
self.sourceName = @"iPod";
// Custom initialization
}
return self;
}

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

- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
Expand All @@ -47,6 +39,16 @@ - (void)viewDidLoad

- (void)viewDidUnload
{
[artworkOrIcon release];
artworkOrIcon = nil;
[playlistNameLabel release];
playlistNameLabel = nil;
[titleLabel release];
titleLabel = nil;
[artistLabel release];
artistLabel = nil;
[myPlaylistsLabel release];
myPlaylistsLabel = nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
Expand Down Expand Up @@ -86,5 +88,24 @@ - (UIView *)carouselDisplayView
return self.view;
}

-(void)carouselWillBringViewToFront
{
artworkOrIcon.image = iPodSource.currentPlaylist.currentItem.thumbnail;
[self.view setNeedsDisplayInRect:artworkOrIcon.bounds];
}
-(void)carouselWillSendViewToBack
{
artworkOrIcon.image = [UIImage imageNamed:@"ipod-icon"];
[self.view setNeedsDisplayInRect:artworkOrIcon.bounds];
}

- (void)dealloc {
[artworkOrIcon release];
[playlistNameLabel release];
[titleLabel release];
[artistLabel release];
[myPlaylistsLabel release];
[iPodSource release];
[super dealloc];
}
@end

0 comments on commit 115a380

Please sign in to comment.