Permalink
Browse files

Adding Carousel icons, and animation for generic view; ability to cha…

…nge playlist in iPod Source
  • Loading branch information...
1 parent 9ec291a commit 57e4b96d73c64e82a222fa0a789cc8066d083fdc @snarshad snarshad committed Jul 17, 2011
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -18,6 +18,7 @@
-(void)carouselWillSendViewToBack;
-(void)carouselDidSendViewToBack;
-(void)carouselDidBringViewToFront;
+-(void)popGenericPlayer;
@end
@protocol SGCarouselItem <NSObject>
@@ -56,4 +57,10 @@
@property (readwrite, retain) NSString *title;
@property (readwrite, retain) id <SGMediaItem> currentItem;
+@end
+
+@protocol SGSourceDelegate <NSObject>
+
+- (void)playlistWillChange:(NSString *)newPlaylistName direction:(int)direction;
+
@end
@@ -137,7 +137,7 @@ - (void)showNavigator:(id)sender
{
LOG_CALL;
[OPASpookSoundManager playShortSound:@"nav-Wall.aiff" disposeWhenDone:NO];
- // [[carouselSourceViewControllers objectAtIndex:currentCarouselItemIndex] popGenericController];
+ [[carouselSourceViewControllers objectAtIndex:currentCarouselItemIndex] popGenericPlayer];
}
- (void)showDetail:(id)sender
View
@@ -23,6 +23,7 @@
@property (readwrite, retain) NSString *sourceName;
@property (nonatomic, readwrite, retain) id <SGMediaPlaylist> currentPlaylist;
@property (readwrite, retain) NSArray *playlists;
+@property (readwrite, assign) id<SGSourceDelegate> delegate;
@end
View
@@ -27,7 +27,7 @@ - (id)initWithiPodItem:(MPMediaItem *)item;
@end
@implementation SGIPodSource
-@synthesize playlists, sourceName, currentPlaylist, currentItem, splashColor;
+@synthesize playlists, sourceName, currentPlaylist, currentItem, splashColor, delegate;
- (id)init
{
@@ -96,6 +96,7 @@ - (void)setCurrentPlaylist:(id<SGMediaPlaylist>)playlist
{
if (playlist != nil)
{
+
NSString *pid = [(SGIPodPlaylist *)playlist persistentId];
MPMediaQuery *query = [MPMediaQuery songsQuery];
MPMediaPropertyPredicate *mpp = [MPMediaPropertyPredicate predicateWithValue:pid forProperty:MPMediaPlaylistPropertyPersistentID comparisonType:MPMediaPredicateComparisonEqualTo];
@@ -133,19 +134,26 @@ - (void)playNextPlaylist
if (!next)
return;
+ [delegate playlistWillChange:next.title direction:0];
+ self.currentPlaylist = next;
+ [self play:nil];
}
- (void)playPreviousPlaylist
{
- id <SGMediaPlaylist>prev = [self nextPlaylist];
+ id <SGMediaPlaylist>prev = [self previousPlaylist];
if (!prev)
{
//Go back to "Library"
+ [delegate playlistWillChange:@"Library" direction:0];
}
-
+ [delegate playlistWillChange:prev.title direction:0];
+ self.currentPlaylist = prev;
+
+
return;
}
@@ -11,7 +11,8 @@
@class SGIPodSource, SGGenericPlayerView;
-@interface SGIPodSourceViewController : UIViewController <SGCarouselItemViewController>
+
+@interface SGIPodSourceViewController : UIViewController <SGCarouselItemViewController, SGSourceDelegate>
{
SGIPodSource *iPodSource;
IBOutlet UIImageView *artworkOrIcon;
@@ -15,6 +15,7 @@ @interface SGIPodSourceViewController ()
- (void)updateUIForItem:(id<SGMediaItem>)item;
- (void)animatePlaylistView:(BOOL)upYesDownNo newName:(NSString *)name;
- (void)animatePlaylistViewPart2:(NSString *)animationId finished:(BOOL)finished context:(id)context;
+- (void)hideGenericPlayer:(NSString *)animationID finished:(BOOL)finished context:(id)context;
@end
@@ -25,6 +26,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
iPodSource = [[SGIPodSource alloc] init];
+ iPodSource.delegate = self;
// Custom initialization
}
return self;
@@ -122,15 +124,39 @@ - (void)pushGenericPlayer
pv.source = self.source;
pv.playItem = self.source.currentPlaylist.currentItem;
pv.view.bounds = self.view.bounds;
+ pv.view.alpha = 0.0f;
[self.view.superview addSubview:pv.view];
playerViewController = pv;
+ [UIView beginAnimations:@"pushGenericPlayer" context:nil];
+
+ [UIView setAnimationDidStopSelector:@selector(hideGenericPlayer:finished:context:)];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
+ [UIView setAnimationDuration:.45];
+ playerViewController.view.alpha = 1.0f;
+ [UIView commitAnimations];
}
- (void)popGenericPlayer
{
- [playerViewController.view removeFromSuperview];
- [playerViewController release];
- playerViewController = nil;
+ [UIView beginAnimations:@"popGenericPlayer" context:playerViewController];
+
+ [UIView setAnimationDidStopSelector:@selector(hideGenericPlayer:finished:context:)];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
+ [UIView setAnimationDuration:.15];
+ playerViewController.view.alpha = 0.0f;
+ [UIView commitAnimations];
+}
+
+- (void)hideGenericPlayer:(NSString *)animationID finished:(BOOL)finished context:(id)context
+{
+ SGGenericPlayerView *pvc = (SGGenericPlayerView *)context;
+ if ([animationID isEqualToString:@"popGenericPlayer"])
+ {
+ [pvc.view removeFromSuperview];
+ [pvc release];
+ pvc = nil;
+ }
}
+
- (void)dealloc {
[artworkOrIcon release];
[playlistNameLabel release];
@@ -172,7 +198,7 @@ - (void)animatePlaylistViewPart2:(NSString *)animationId finished:(BOOL)finished
[UIView beginAnimations:NSStringFromSelector(_cmd) context:context];
[UIView setAnimationDidStopSelector:@selector(animatePlaylistViewPart2:finished:context:)];
- [UIView setAnimationCurve:UIViewAnimationCurveLinear];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
[UIView setAnimationDuration:.75];
[UIView setAnimationDelegate:self];
playlistNameLabel.frame = CGRectMake(origPlaylistNameLabelFrame.origin.x, origPlaylistNameLabelFrame.size.height, origPlaylistNameLabelFrame.size.width, origPlaylistNameLabelFrame.size.height);
@@ -8,6 +8,16 @@
/* Begin PBXBuildFile section */
A7462B6E13D36CF300C5CEB5 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B6D13D36CF300C5CEB5 /* icon.png */; };
+ A7462B9F13D3779600C5CEB5 /* mainicons_1.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9513D3779600C5CEB5 /* mainicons_1.png */; };
+ A7462BA013D3779600C5CEB5 /* mainicons_2.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9613D3779600C5CEB5 /* mainicons_2.png */; };
+ A7462BA113D3779600C5CEB5 /* mainicons_3.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9713D3779600C5CEB5 /* mainicons_3.png */; };
+ A7462BA213D3779600C5CEB5 /* mainicons_4.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9813D3779600C5CEB5 /* mainicons_4.png */; };
+ A7462BA313D3779600C5CEB5 /* mainicons_5.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9913D3779600C5CEB5 /* mainicons_5.png */; };
+ A7462BA413D3779600C5CEB5 /* mainicons_r_1.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9A13D3779600C5CEB5 /* mainicons_r_1.png */; };
+ A7462BA513D3779600C5CEB5 /* mainicons_r_2.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9B13D3779600C5CEB5 /* mainicons_r_2.png */; };
+ A7462BA613D3779600C5CEB5 /* mainicons_r_3.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9C13D3779600C5CEB5 /* mainicons_r_3.png */; };
+ A7462BA713D3779600C5CEB5 /* mainicons_r_4.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9D13D3779600C5CEB5 /* mainicons_r_4.png */; };
+ A7462BA813D3779600C5CEB5 /* mainicons_r_5.png in Resources */ = {isa = PBXBuildFile; fileRef = A7462B9E13D3779600C5CEB5 /* mainicons_r_5.png */; };
A763031C13D2754C00F7682D /* SGIPodSource.m in Sources */ = {isa = PBXBuildFile; fileRef = A763031B13D2754C00F7682D /* SGIPodSource.m */; };
A7B38D3113D2616A0067C53D /* nav-LeftRight.aiff in Resources */ = {isa = PBXBuildFile; fileRef = A7B38D2E13D2616A0067C53D /* nav-LeftRight.aiff */; };
A7B38D3213D2616A0067C53D /* nav-UpDown.aiff in Resources */ = {isa = PBXBuildFile; fileRef = A7B38D2F13D2616A0067C53D /* nav-UpDown.aiff */; };
@@ -45,6 +55,16 @@
/* Begin PBXFileReference section */
A7462B6D13D36CF300C5CEB5 /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = Resources/icon.png; sourceTree = SOURCE_ROOT; };
+ A7462B9513D3779600C5CEB5 /* mainicons_1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_1.png; path = "Resources/carousel icons/mainicons_1.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9613D3779600C5CEB5 /* mainicons_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_2.png; path = "Resources/carousel icons/mainicons_2.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9713D3779600C5CEB5 /* mainicons_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_3.png; path = "Resources/carousel icons/mainicons_3.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9813D3779600C5CEB5 /* mainicons_4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_4.png; path = "Resources/carousel icons/mainicons_4.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9913D3779600C5CEB5 /* mainicons_5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_5.png; path = "Resources/carousel icons/mainicons_5.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9A13D3779600C5CEB5 /* mainicons_r_1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_1.png; path = "Resources/carousel icons/mainicons_r_1.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9B13D3779600C5CEB5 /* mainicons_r_2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_2.png; path = "Resources/carousel icons/mainicons_r_2.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9C13D3779600C5CEB5 /* mainicons_r_3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_3.png; path = "Resources/carousel icons/mainicons_r_3.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9D13D3779600C5CEB5 /* mainicons_r_4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_4.png; path = "Resources/carousel icons/mainicons_r_4.png"; sourceTree = SOURCE_ROOT; };
+ A7462B9E13D3779600C5CEB5 /* mainicons_r_5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = mainicons_r_5.png; path = "Resources/carousel icons/mainicons_r_5.png"; sourceTree = SOURCE_ROOT; };
A763031A13D2754C00F7682D /* SGIPodSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGIPodSource.h; sourceTree = SOURCE_ROOT; };
A763031B13D2754C00F7682D /* SGIPodSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGIPodSource.m; sourceTree = SOURCE_ROOT; };
A7B38D2E13D2616A0067C53D /* nav-LeftRight.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; name = "nav-LeftRight.aiff"; path = "Resources/navSounds/nav-LeftRight.aiff"; sourceTree = SOURCE_ROOT; };
@@ -116,6 +136,23 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ A7462B9413D3778000C5CEB5 /* Carousel Icons */ = {
+ isa = PBXGroup;
+ children = (
+ A7462B9513D3779600C5CEB5 /* mainicons_1.png */,
+ A7462B9613D3779600C5CEB5 /* mainicons_2.png */,
+ A7462B9713D3779600C5CEB5 /* mainicons_3.png */,
+ A7462B9813D3779600C5CEB5 /* mainicons_4.png */,
+ A7462B9913D3779600C5CEB5 /* mainicons_5.png */,
+ A7462B9A13D3779600C5CEB5 /* mainicons_r_1.png */,
+ A7462B9B13D3779600C5CEB5 /* mainicons_r_2.png */,
+ A7462B9C13D3779600C5CEB5 /* mainicons_r_3.png */,
+ A7462B9D13D3779600C5CEB5 /* mainicons_r_4.png */,
+ A7462B9E13D3779600C5CEB5 /* mainicons_r_5.png */,
+ );
+ name = "Carousel Icons";
+ sourceTree = "<group>";
+ };
A763031D13D2754F00F7682D /* iPod Source */ = {
isa = PBXGroup;
children = (
@@ -141,6 +178,7 @@
A7B38D2D13D261590067C53D /* Images */ = {
isa = PBXGroup;
children = (
+ A7462B9413D3778000C5CEB5 /* Carousel Icons */,
BC8F929513D3736A00824DB6 /* icon57.png */,
BC8F929613D3736A00824DB6 /* icon114.png */,
A7462B6D13D36CF300C5CEB5 /* icon.png */,
@@ -300,6 +338,16 @@
A7462B6E13D36CF300C5CEB5 /* icon.png in Resources */,
BC8F929713D3736A00824DB6 /* icon57.png in Resources */,
BC8F929813D3736A00824DB6 /* icon114.png in Resources */,
+ A7462B9F13D3779600C5CEB5 /* mainicons_1.png in Resources */,
+ A7462BA013D3779600C5CEB5 /* mainicons_2.png in Resources */,
+ A7462BA113D3779600C5CEB5 /* mainicons_3.png in Resources */,
+ A7462BA213D3779600C5CEB5 /* mainicons_4.png in Resources */,
+ A7462BA313D3779600C5CEB5 /* mainicons_5.png in Resources */,
+ A7462BA413D3779600C5CEB5 /* mainicons_r_1.png in Resources */,
+ A7462BA513D3779600C5CEB5 /* mainicons_r_2.png in Resources */,
+ A7462BA613D3779600C5CEB5 /* mainicons_r_3.png in Resources */,
+ A7462BA713D3779600C5CEB5 /* mainicons_r_4.png in Resources */,
+ A7462BA813D3779600C5CEB5 /* mainicons_r_5.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

0 comments on commit 57e4b96

Please sign in to comment.