~urbanape/ubuntuone-ios-client/2.0-13-prerelease

« back to all changes in this revision

Viewing changes to musicstreaming/controls/SongUITableViewCell.m

  • Committer: Jason Foreman
  • Date: 2011-06-16 18:33:42 UTC
  • mfrom: (191.1.60 master)
  • Revision ID: jason.foreman@canonical.com-20110616183342-vl7a4804xsf0s1b5
Merging branches for v 2.0.

lp:~threeve/ubuntuone-ios-client/master
lp:~urbanape/ubuntuone-ios-client/downloader

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
@implementation SongUITableViewCell
36
36
 
37
 
@synthesize songNameLabel, positionLabel, durationLabel, nowPlaying, evenRow;
 
37
@synthesize cacheButton, spinner, songNameLabel, positionLabel, durationLabel, nowPlaying, evenRow;
38
38
 
39
39
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
40
40
{
44
44
                
45
45
                coloredView = [[UIView alloc] initWithFrame:self.frame];
46
46
                coloredView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
47
 
                
48
47
                [self.contentView addSubview:coloredView];
 
48
 
 
49
        // XXX: This is added first so that it sits behind the cacheButton. This isn't optimal. Something better would be to delegate taps on the spinner to the cacheButton, regardless of its front-to-back ordering in the subviews.
 
50
        spinner = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray] retain];
 
51
        spinner.hidesWhenStopped = YES;
 
52
        [coloredView addSubview:spinner];
49
53
                
50
 
                songNameLabel = [[UILabel alloc] init];
 
54
        cacheButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
 
55
        [cacheButton setImage:[UIImage imageNamed:@"uncached"] forState:UIControlStateNormal];
 
56
        [coloredView addSubview:self.cacheButton];
 
57
        
 
58
        songNameLabel = [[UILabel alloc] init];
51
59
                songNameLabel.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
52
60
                [coloredView addSubview:self.songNameLabel];
53
61
                
64
72
                [coloredView addSubview:durationLabel];
65
73
                
66
74
                nowPlaying = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 13, 12)];
67
 
                nowPlaying.image = [UIImage imageNamed:@"speaker.png"];
 
75
                nowPlaying.image = [UIImage imageNamed:@"speaker"];
68
76
                nowPlaying.backgroundColor = [UIColor clearColor];
69
77
                nowPlaying.contentMode = UIViewContentModeCenter;
70
78
                [coloredView addSubview:nowPlaying];
79
87
{
80
88
    [super layoutSubviews];
81
89
        self.positionLabel.frame = CGRectMake(0, 0, 35, self.frame.size.height);
82
 
        self.songNameLabel.frame = CGRectMake(47, 0, 197, self.frame.size.height);
83
 
        self.nowPlaying.frame = CGRectMake(252, 0, 13, self.frame.size.height);
84
 
        self.durationLabel.frame = CGRectMake(272, 0, 48, self.frame.size.height);
85
 
                
 
90
        self.songNameLabel.frame = CGRectMake(37, 0, 164, self.frame.size.height);
 
91
        self.nowPlaying.frame = CGRectMake(203, 0, 13, self.frame.size.height);
 
92
        self.durationLabel.frame = CGRectMake(218, 0, 48, self.frame.size.height);
 
93
    self.cacheButton.frame = CGRectMake(268, 0, 44, self.frame.size.height);
 
94
    self.spinner.frame = CGRectMake(282, 14, 16, 16);
 
95
    
86
96
        if (self.evenRow)
87
97
        {
88
98
                coloredView.backgroundColor = [UIColor whiteColor];
103
113
 
104
114
- (void)dealloc
105
115
{
 
116
    [cacheButton release];
 
117
    [spinner release];
106
118
        [durationLabel release];
107
119
        [songNameLabel release];
108
120
        [positionLabel release];