






#import "OpticalDanceCell.h"
#import "BurstUpload.h"
#import "Masonry.h"
#import "UIImage+MidImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+Anchoring.h"

@interface OpticalDanceCell()


@property (nonatomic,strong) NSString * downQuitSolve;


@property (nonatomic,strong) UIImageView * celsiusCarView;


@property (nonatomic,strong) UILabel * gaspTagTenLabel;


@property (nonatomic,strong) UILabel * howRemoveLabel;

@property (nonatomic, strong) UIButton * sensorButton;

@end

@implementation OpticalDanceCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = BurstUpload.styleOrigins.jobNetEvery;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.celsiusCarView = [UIImageView new];
        self.celsiusCarView.tintColor = [BurstUpload manGlobalColor];
        self.celsiusCarView.layer.cornerRadius = BurstUpload.styleOrigins.rowHumanFlip;
        [self.contentView addSubview:self.celsiusCarView];
        [self.celsiusCarView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(BurstUpload.styleOrigins.rawQuickTip);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(BurstUpload.styleOrigins.partInsetMin);
        }];
        
        self.gaspTagTenLabel = [UILabel new];
        self.gaspTagTenLabel.font = [UIFont boldSystemFontOfSize:BurstUpload.styleOrigins.featOffStand];
        self.gaspTagTenLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.gaspTagTenLabel];
        
        self.howRemoveLabel = [UILabel new];
        self.howRemoveLabel.font = [UIFont boldSystemFontOfSize:BurstUpload.styleOrigins.idiomShuffle];
        self.howRemoveLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.howRemoveLabel];
        
        [self.gaspTagTenLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.celsiusCarView.mas_right).offset(BurstUpload.styleOrigins.areTeluguCap);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.howRemoveLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.gaspTagTenLabel);
            make.top.equalTo(self.gaspTagTenLabel.mas_bottom).offset(BurstUpload.styleOrigins.eraRangeDid);
        }];
        
        self.sensorButton = [[UIButton alloc] init];
        _sensorButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage clearedPrintedSexualObservingHellmanName:BurstUpload.styleOrigins.qualifierRemoveLinearSparseExec] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_sensorButton setBackgroundImage:[UIImage clearedPrintedSexualObservingHellmanName:BurstUpload.styleOrigins.ligaturesStateLocatorJustTop] forState: UIControlStateNormal];
        [_sensorButton setBackgroundImage:image forState: UIControlStateSelected];
        _sensorButton.tintColor = [BurstUpload manGlobalColor];
        [self.contentView addSubview:_sensorButton];
        [_sensorButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-BurstUpload.styleOrigins.areTeluguCap);
            make.size.mas_equalTo(CGSizeMake(BurstUpload.styleOrigins.midLeadPhone, BurstUpload.styleOrigins.midLeadPhone));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _sensorButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [BurstUpload manGlobalColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = BurstUpload.styleOrigins.rawQuickTip;
    frame.size.width -= BurstUpload.styleOrigins.featOffStand;
    frame.origin.y += BurstUpload.styleOrigins.rawQuickTip;
    frame.size.height -= BurstUpload.styleOrigins.rawQuickTip;
    [super setFrame:frame];
}

-(void)setDownQuitSolve:(NSString *)downQuitSolve {
    _downQuitSolve = downQuitSolve;
    [self.celsiusCarView sd_setImageWithURL:[NSURL URLWithString:downQuitSolve] placeholderImage:nil];
}

- (void)setCarTintLaw:(KitCleanupExportDogFullyCollapse *)carTintLaw {
    _carTintLaw= carTintLaw;
    self.downQuitSolve = carTintLaw.millHertz;
    self.gaspTagTenLabel.text = carTintLaw.randomMap;
    NSString *note = carTintLaw.invokeMay?:@"";
    if (note.stoodFairCar) {
        self.howRemoveLabel.hidden = YES;
        [self.gaspTagTenLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.celsiusCarView.mas_right).offset(BurstUpload.styleOrigins.areTeluguCap);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.howRemoveLabel.hidden = NO;
        NSRange appear = [note rangeOfString:BurstUpload.styleOrigins.bitsEarlyFormAuthorSquaresMaltese];
        NSRange capOff = [note rangeOfString:BurstUpload.styleOrigins.renewedLinearMemberActivityCellularNearest];
        
        if (appear.length == 0 && capOff.length == 0) {
            self.howRemoveLabel.text = note;
            self.howRemoveLabel.font = [UIFont systemFontOfSize:BurstUpload.styleOrigins.idiomShuffle];
            self.howRemoveLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange issueBus = NSMakeRange(appear.location+appear.length, capOff.location-(appear.location+appear.length));
            NSString *ageEgg = [note substringWithRange:issueBus];
            NSString *removes = [note stringByReplacingOccurrencesOfString:BurstUpload.styleOrigins.bitsEarlyFormAuthorSquaresMaltese withString:@""];
            removes = [removes stringByReplacingOccurrencesOfString:BurstUpload.styleOrigins.renewedLinearMemberActivityCellularNearest withString:@""];
            
            issueBus = [removes rangeOfString:ageEgg];
            NSMutableAttributedString *disablePlane = [[NSMutableAttributedString alloc] initWithString:removes];
            [disablePlane addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, removes.length)];
            [disablePlane addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, removes.length)];
            [disablePlane addAttribute:NSForegroundColorAttributeName value:[BurstUpload manGlobalColor] range:issueBus];
            [disablePlane addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:issueBus];
            
            self.howRemoveLabel.attributedText = disablePlane;
        }
        
        [self.gaspTagTenLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.celsiusCarView.mas_right).offset(BurstUpload.styleOrigins.areTeluguCap);
            make.top.equalTo(self.celsiusCarView).offset(BurstUpload.styleOrigins.smoothEight);
        }];
    }
}

@end
