VLCPlaylistGridView.m 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9
//
//  VLCGridViewCell.m
//  AspenProject
//
//  Created by Felix Paul Kühne on 11.04.13.
//  Copyright (c) 2013 VideoLAN. All rights reserved.
//

#import "VLCPlaylistGridView.h"
10
#import "VLCAppDelegate.h"
11 12 13 14 15 16 17

@interface VLCPlaylistGridView (Hack)
@property (nonatomic, retain) NSString * reuseIdentifier;
@end

@implementation VLCPlaylistGridView

18
- (BOOL)editable
19
{
20
    return !self.removeMediaButton.hidden;
21 22
}

23
- (void)setEditable:(BOOL)editable
24
{
25
    self.removeMediaButton.hidden = !editable;
26 27
}

28
- (void)setMediaObject:(MLFile *)mediaObject
29
{
30
    [mediaObject willDisplay];
31

32 33 34 35
    self.titleLabel.text = mediaObject.title;
    self.subtitleLabel.text = [NSString stringWithFormat:@"%@ — %.2f MB", [VLCTime timeWithNumber:[mediaObject duration]], [mediaObject fileSizeInBytes] / 2e6];
    self.thumbnailView.image = mediaObject.computedThumbnail;
    self.progressView.progress = mediaObject.lastPosition.floatValue;
36

37 38 39
    _mediaObject = mediaObject;

    [self setNeedsDisplay];
40 41
}

42
- (IBAction)removeMedia:(id)sender
43
{
44 45
    VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
    [appDelegate.playlistViewController removeMediaObject:self.mediaObject];
46 47 48
}

@end