Commit 76db6a74 authored by Soomin Lee's avatar Soomin Lee

VLCPlaylistCollectionViewCell: Add VLCMLMedia

parent b780db09
......@@ -15,6 +15,7 @@
#import <UIKit/UIKit.h>
#import "VLCLinearProgressIndicator.h"
#import <VLCMediaLibraryKit/VLCMLMedia.h>
@interface VLCPlaylistCollectionViewCell : UICollectionViewCell
......@@ -28,6 +29,7 @@
@property (nonatomic, strong) IBOutlet UILabel *metaDataLabel;
@property (nonatomic, retain) NSManagedObject *mediaObject;
@property (nonatomic, retain) VLCMLMedia *media;
@property (nonatomic, weak) UICollectionView *collectionView;
@property (readonly) BOOL showsMetaData;
......
......@@ -17,6 +17,8 @@
#import "VLCThumbnailsCache.h"
#import "NSString+SupportedMedia.h"
#import <VLCMediaLibraryKit/VLCMLFile.h>
@interface VLCPlaylistCollectionViewCell ()
{
UIImage *_checkboxEmptyImage;
......@@ -198,6 +200,22 @@
[self _updatedDisplayedInformationForKeyPath:nil];
}
- (void)setMedia:(VLCMLMedia *)media
{
if (_media != media) {
_media = media;
}
[self _updateDisplayedInformations];
}
- (void)_updateDisplayedInformations
{
_titleLabel.text = _media.title;
_subtitleLabel.text = [NSString stringWithFormat:@"%@ — %@", [VLCTime timeWithNumber:[NSNumber numberWithLongLong:_media.duration]],
[NSByteCountFormatter stringFromByteCount:[_media.mainFile size] countStyle:NSByteCountFormatterCountStyleFile]];
}
- (void)_updatedDisplayedInformationForKeyPath:(NSString *)keyPath
{
self.thumbnailView.contentMode = UIViewContentModeScaleAspectFill;
......@@ -526,6 +544,7 @@
- (void)prepareForReuse
{
[super prepareForReuse];
self.media = nil;
self.mediaObject = nil;
self.thumbnailView.image = nil;
self.titleLabel.text = @"";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment