Skip to content

Commit

Permalink
updates controller text after login
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Dec 12, 2011
1 parent 670965d commit d6ca091
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Mixtape/AudioController.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
@property (retain) SPPlaybackManager *playbackManager;
@property () int trackIndex;

- (void)animateControllerIn;

- (void)nextTrack;
- (void)previousTrack;
- (IBAction)playPause:(id)sender;
- (void)playTrackWithIndex:(int)index;
- (void)updateControllerTexts;

@end
20 changes: 16 additions & 4 deletions Mixtape/AudioController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#import <AVFoundation/AVFoundation.h>
#import "SPTrack+Debug.h"

@interface AudioController (private)

- (void)animateControllerIn;

@end

@implementation AudioController

@synthesize trackIndex = _trackIndex, currentPlaylist = _currentSPPlaylist;
Expand Down Expand Up @@ -64,15 +70,22 @@ - (void)playTrackWithIndex:(int)index {
NSLog(@"playback error %@", [error localizedDescription]);
}

_currentPlayingTrackImage.image = track.album.cover.image;
_currentPlayingTrackArtist.text = [track.album.artist name];
_currentPlayingTrackName.text = [track name];
[self updateControllerTexts];

if (_trackIndex < [tracks count] - 1) {
[[SPSession sharedSession] preloadTrackForPlayback:[[tracks objectAtIndex:_trackIndex + 1] item] error:nil];
}
}

- (void)updateControllerTexts {
NSMutableArray *tracks = self.currentPlaylist.items;
SPTrack *track = [[tracks objectAtIndex:_trackIndex] item];

_currentPlayingTrackImage.image = track.album.cover.image;
_currentPlayingTrackArtist.text = [track.album.artist name];
_currentPlayingTrackName.text = [track name];
}

- (void) nextTrack {
[self playTrackWithIndex:_trackIndex + 1];
}
Expand All @@ -88,7 +101,6 @@ - (void) playPause:(id)sender {

}else{
[_playPauseButton setImage:[UIImage imageNamed:@"pause"] forState:UIControlStateNormal];

}
}

Expand Down
3 changes: 2 additions & 1 deletion Mixtape/MixtapeAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ - (void)applicationDidBecomeActive:(UIApplication *)application{
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:ORAppResetKey];
[self startSpotify];
}
#warning refresh information in player

[self.mainViewController.audio updateControllerTexts];

}

Expand Down

0 comments on commit d6ca091

Please sign in to comment.