Commit 92463f82 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

thumbnail cache: dynamically adapt cluster thumb size to watch size

parent 1c379783
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#import "VLCThumbnailsCache.h" #import "VLCThumbnailsCache.h"
#import <CommonCrypto/CommonDigest.h> #import <CommonCrypto/CommonDigest.h>
#import "UIImage+Blur.h" #import "UIImage+Blur.h"
#import <WatchKit/WatchKit.h>
@interface VLCThumbnailsCache() { @interface VLCThumbnailsCache() {
NSInteger MaxCacheSize; NSInteger MaxCacheSize;
NSCache *_thumbnailCache; NSCache *_thumbnailCache;
...@@ -34,9 +36,7 @@ ...@@ -34,9 +36,7 @@
{ {
self = [super init]; self = [super init];
if (self) { if (self) {
_currentDeviceIdiom = [[UIDevice currentDevice] userInterfaceIdiom]; _currentDeviceIdiom = [[UIDevice currentDevice] userInterfaceIdiom];
MaxCacheSize = 0; MaxCacheSize = 0;
switch (_currentDeviceIdiom) { switch (_currentDeviceIdiom) {
...@@ -56,10 +56,10 @@ ...@@ -56,10 +56,10 @@
_thumbnailCacheMetadata = [[NSCache alloc] init]; _thumbnailCacheMetadata = [[NSCache alloc] init];
[_thumbnailCache setCountLimit: MaxCacheSize]; [_thumbnailCache setCountLimit: MaxCacheSize];
[_thumbnailCacheMetadata setCountLimit: MaxCacheSize]; [_thumbnailCacheMetadata setCountLimit: MaxCacheSize];
} }
return self; return self;
} }
+ (instancetype)sharedThumbnailCache + (instancetype)sharedThumbnailCache
{ {
static dispatch_once_t onceToken; static dispatch_once_t onceToken;
...@@ -256,7 +256,12 @@ ...@@ -256,7 +256,12 @@
imageSize = CGSizeMake(129., 73.); imageSize = CGSizeMake(129., 73.);
} }
} else { } else {
imageSize = CGSizeMake(272., 120.); if (SYSTEM_RUNS_IOS82_OR_LATER) {
if (WKInterfaceDevice.currentDevice != nil) {
CGRect screenRect = WKInterfaceDevice.currentDevice.screenBounds;
imageSize = CGSizeMake(screenRect.size.width * WKInterfaceDevice.currentDevice.screenScale, 120.);
}
}
} }
UIGraphicsBeginImageContext(imageSize); UIGraphicsBeginImageContext(imageSize);
......
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
7D27EC3219DF314F00EF0370 /* wifi@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D27EC2F19DF314F00EF0370 /* wifi@3x.png */; }; 7D27EC3219DF314F00EF0370 /* wifi@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D27EC2F19DF314F00EF0370 /* wifi@3x.png */; };
7D27EC3519DF315E00EF0370 /* browser.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D27EC3319DF315E00EF0370 /* browser.png */; }; 7D27EC3519DF315E00EF0370 /* browser.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D27EC3319DF315E00EF0370 /* browser.png */; };
7D27EC3619DF315E00EF0370 /* browser@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D27EC3419DF315E00EF0370 /* browser@2x.png */; }; 7D27EC3619DF315E00EF0370 /* browser@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D27EC3419DF315E00EF0370 /* browser@2x.png */; };
7D298F441AD5827E00A0BF68 /* WatchKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDF157B31ACB169B00AAFBC6 /* WatchKit.framework */; };
7D2A34A41805CDBA004078AA /* gradient-cell-ios7.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D2A34A21805CDBA004078AA /* gradient-cell-ios7.png */; }; 7D2A34A41805CDBA004078AA /* gradient-cell-ios7.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D2A34A21805CDBA004078AA /* gradient-cell-ios7.png */; };
7D2A34A51805CDBA004078AA /* gradient-cell-ios7@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D2A34A31805CDBA004078AA /* gradient-cell-ios7@2x.png */; }; 7D2A34A51805CDBA004078AA /* gradient-cell-ios7@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7D2A34A31805CDBA004078AA /* gradient-cell-ios7@2x.png */; };
7D2D4ECC1ACFFA42006A8DBD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D2D4ECE1ACFFA42006A8DBD /* Localizable.strings */; }; 7D2D4ECC1ACFFA42006A8DBD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7D2D4ECE1ACFFA42006A8DBD /* Localizable.strings */; };
...@@ -1623,6 +1624,7 @@ ...@@ -1623,6 +1624,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
7D298F441AD5827E00A0BF68 /* WatchKit.framework in Frameworks */,
418FF4B11A0EC1D5005FE808 /* libPods-vlc-ios.a in Frameworks */, 418FF4B11A0EC1D5005FE808 /* libPods-vlc-ios.a in Frameworks */,
8F91EC7F195E1DAB00F5BCBA /* AssetsLibrary.framework in Frameworks */, 8F91EC7F195E1DAB00F5BCBA /* AssetsLibrary.framework in Frameworks */,
7D15168B194773630086FB8C /* MobileCoreServices.framework in Frameworks */, 7D15168B194773630086FB8C /* MobileCoreServices.framework in Frameworks */,
......
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