

#import "TopAddKeysView.h"
#import "DustStripAlphaCell.h"
#import "UIImageView+WebCache.h"

@interface TopAddKeysView ()
@property (nonatomic, strong) UIImageView *andWaxBatteryImageView;
@end

@implementation TopAddKeysView

- (void)inputEscapedLegacyFunLibrariesHailModel:(OperationIllInfo *)model {
[self patientManagedStandardFunMinuteDigitalBlueModel:model];
    NSMutableArray *dense = [NSMutableArray new];
    for (int i = 0; i<model.itsTintBox; i++) {
        DustStripAlphaCell *exec = [[DustStripAlphaCell alloc]init];
        exec.sexTwoNotify = model.carRoleSin;
        exec.channelCount = 1;
        exec.wetIts = 6;
        exec.fullWorkPortal = CGFLOAT_MIN;
        CGRect curlRect = [model.justAwakeArt boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:model.unlearnHindiBrownPersonOnlyTerminate] forKey:NSFontAttributeName] context:nil];
        exec.contactSize = CGSizeMake(curlRect.size.width+8, curlRect.size.height+4);
        exec.model = model;
        [dense addObject:exec];
    }
    [self burstFactEvent:dense];
}

- (void)patientManagedStandardFunMinuteDigitalBlueModel:(OperationIllInfo *)model {
    NSString *url = model.filteredShowersSuchWarnArtworkCrop;

    if (url.length == 0) {
        _andWaxBatteryImageView.hidden = YES;
        _andWaxBatteryImageView.image = nil;
        return;
    }

    UIImageView *sun = self.andWaxBatteryImageView;
    sun.hidden = NO;
    if (sun.superview != self) {
        [self insertSubview:sun atIndex:0];
    } else {
        [self sendSubviewToBack:sun];
    }

    [sun sd_setImageWithURL:[NSURL URLWithString:url] placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        if (image) [self nowMaxToolSeeImageView:sun image:image];
    }];
}

- (void)nowMaxToolSeeImageView:(UIImageView *)sun image:(UIImage *)image {
    CGFloat width = self.bounds.size.width;
    CGFloat height = self.bounds.size.height;
    if (image.size.width > 0) {
        CGFloat thumbWide = image.size.height / image.size.width * width;
        
        CGFloat offsetY = (height - thumbWide) * 0.5;
        sun.frame = CGRectMake(0, offsetY, width, thumbWide);
    } else {
        sun.frame = self.bounds;
    }
}

- (UIImageView *)andWaxBatteryImageView {
    if (!_andWaxBatteryImageView) {
        _andWaxBatteryImageView = [[UIImageView alloc] init];
        _andWaxBatteryImageView.contentMode = UIViewContentModeScaleToFill;
        _andWaxBatteryImageView.userInteractionEnabled = NO;
        _andWaxBatteryImageView.clipsToBounds = NO;
    }
    return _andWaxBatteryImageView;
}

@end
