Commit 9d8d311f authored by Felix Paul Kühne's avatar Felix Paul Kühne

Library: improve drawing performance when switching isEditing

parent 314ce3a8
......@@ -34,8 +34,7 @@
{
[super setEditing:editing animated:animated];
self.removeMediaButton.hidden = !editing;
[self _updatedDisplayedInformation];
[self _updatedDisplayedInformationForKeyPath:@"editing"];
}
- (void)prepareForReuse
......@@ -46,7 +45,7 @@
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
[self _updatedDisplayedInformation];
[self _updatedDisplayedInformationForKeyPath:keyPath];
}
- (void)setMediaObject:(MLFile *)mediaObject
......@@ -73,10 +72,10 @@
[_mediaObject willDisplay];
}
[self _updatedDisplayedInformation];
[self _updatedDisplayedInformationForKeyPath:NULL];
}
- (void)_updatedDisplayedInformation
- (void)_updatedDisplayedInformationForKeyPath:(NSString *)keyPath
{
self.titleLabel.text = self.mediaObject.title;
if (self.isEditing)
......@@ -86,7 +85,8 @@
if (self.mediaObject.videoTrack)
self.subtitleLabel.text = [self.subtitleLabel.text stringByAppendingFormat:@" — %@x%@", [[self.mediaObject videoTrack] valueForKey:@"width"], [[self.mediaObject videoTrack] valueForKey:@"height"]];
}
self.thumbnailView.image = self.mediaObject.computedThumbnail;
if ([keyPath isEqualToString:@"computedThumbnail"] || !keyPath)
self.thumbnailView.image = self.mediaObject.computedThumbnail;
self.progressView.progress = self.mediaObject.lastPosition.floatValue;
self.progressView.hidden = (self.progressView.progress < .1f || .95f) ? YES : NO;
......
......@@ -24,7 +24,7 @@
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
[self _updatedDisplayedInformation];
[self _updatedDisplayedInformationForKeyPath:keyPath];
}
- (void)setMediaObject:(MLFile *)mediaObject
......@@ -51,16 +51,16 @@
[_mediaObject willDisplay];
}
[self _updatedDisplayedInformation];
[self _updatedDisplayedInformationForKeyPath:NULL];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
[self _updatedDisplayedInformation];
[self _updatedDisplayedInformationForKeyPath:@"editing"];
}
- (void)_updatedDisplayedInformation
- (void)_updatedDisplayedInformationForKeyPath:(NSString *)keyPath
{
self.titleLabel.text = self.mediaObject.title;
if (self.isEditing)
......@@ -70,7 +70,8 @@
if (self.mediaObject.videoTrack)
self.subtitleLabel.text = [self.subtitleLabel.text stringByAppendingFormat:@" — %@x%@", [[self.mediaObject videoTrack] valueForKey:@"width"], [[self.mediaObject videoTrack] valueForKey:@"height"]];
}
self.thumbnailView.image = self.mediaObject.computedThumbnail;
if ([keyPath isEqualToString:@"computedThumbnail"] || !keyPath)
self.thumbnailView.image = self.mediaObject.computedThumbnail;
self.progressIndicator.progress = self.mediaObject.lastPosition.floatValue;
self.progressIndicator.hidden = ((self.progressIndicator.progress < .1f) || (self.progressIndicator.progress > .95f)) ? YES : NO;
......
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